Skip to main content

A Deprecated API client for Elastic Workplace Search. Use elastic_workplace_search instead.

Reason this release was yanked:

Users should migrate to v7.10.0+

Project description

Elastic Enterprise Search Logo

CircleCI build

A first-party Python client for Elastic Enterprise Search.

Contents


Getting started 🐣

Supports Python 2.7 and Python 3.3+.

Depends on futures and requests.

Installed with pip <http://pypi.python.org/pypi/pip>:

$ python -m pip install elastic_enterprise_search

You can also download and install the project source:

$ python setup.py install

Usage

Creating a new Client

  from elastic_enterprise_search import Client
  authorization_token = 'authorization token'
  client = Client(authorization_token)

Retrieve your access token and a content source key after creating your content source.

Change API endpoint

client = Client(authorization_token, "https://your-server.example.com/api/v1/ent")

Custom Source Documents

Document API features are found in the client.documents module.

Indexing Documents

Indexing a document into a custom content source:

  content_source_key = 'content source key'
  documents = [
    {
      'id': '1234',
      'url': 'https://github.com/elastic/enterprise-search-python',
      'title': 'Elastic Enterprise Search Official Python Client',
      'body': 'A descriptive body, with document contents and metadata'
    }
  ]

  client.documents.index_documents(content_source_key, documents)

Deleting Documents

Deleting a document from a custom content source:

  content_source_key = 'content source key'
  ids = ['1234']

  client.documents.delete_documents(content_source_key, ids)

Permissions

Permissions API features are found in the client.permissions module.

Listing all permissions

content_source_key = 'content source key'

client.permissions.list_all_permissions(content_source_key)

Listing all permissions with paging

content_source_key = 'content source key'

client.permissions.list_all_permissions(content_source_key, size=20, current=2)

Retrieve a User's permissions

content_source_key = 'content source key'
user = 'enterprise_search'

client.permissions.get_user_permissions(content_source_key, user)

Add permissions to a User

content_source_key = 'content source key'
user = 'enterprise_search'
permissions = ['permission1']

client.permissions.add_user_permissions(content_source_key, 'enterprise_search', { 'permissions': permissions })

Update a User's permissions

content_source_key = 'content source key'
user = 'enterprise_search'
permissions = ['permission2']

client.permissions.update_user_permissions(content_source_key, 'enterprise_search', { 'permissions': permissions })

Remove permissions from a User

content_source_key = 'content source key'
user = 'enterprise_search'
permissions = ['permission2']

client.permissions.remove_user_permissions(content_source_key, 'enterprise_search', { 'permissions': permissions })

FAQ 🔮

Where do I report issues with the client?

If something is not working as expected, please open an issue.

Contribute 🚀

We welcome contributors to the project. Before you begin, a couple notes...

License 📗

Apache 2.0 © Elastic

Thank you to all the contributors!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elastic_enterprise_search-0.2.1.tar.gz (11.1 kB view details)

Uploaded Source

File details

Details for the file elastic_enterprise_search-0.2.1.tar.gz.

File metadata

  • Download URL: elastic_enterprise_search-0.2.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.6

File hashes

Hashes for elastic_enterprise_search-0.2.1.tar.gz
Algorithm Hash digest
SHA256 aa6decc2accfcc42336a8009ebf58542e66b12b9c1fb6e5cb378b67372f09764
MD5 91408ec496ed73b87a445b2f3009c787
BLAKE2b-256 813df0eab1f9ab23826c66fd6f779bcda775f98a4c19dd8e1949331729421710

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page