A first-party Python client for Elastic Workplace 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_workplace_search
You can also download and install the project source:
$ python setup.py install
Usage
Creating a new Client
from elastic_workplace_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/ws/v1")
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/workplace-search-python',
'title': 'Elastic Workplace 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...
- Before opening a pull request, please create an issue to discuss the scope of your proposal.
- Please write simple code and concise documentation, when appropriate.
License 📗
Thank you to all the contributors!
Metadata
Release files for elastic-workplace-search 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| elastic_workplace_search-0.3.0.tar.gz | 10.9 kB | Without provenance | Details for elastic_workplace_search-0.3.0.tar.gz |
Release files / elastic_workplace_search-0.3.0.tar.gz
| Download URL | elastic_workplace_search-0.3.0.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2311e38ec53ff1f40d8cd94d0da3b2b47f41c6df1422dbd1cda8a8dbb06dfe81
|
|
BLAKE2b-256 checksum How to use checksums |
86c714ede006c42a27d03f62c1e35d756f186043356e2d37dd174d4638b117e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for elastic-workplace-search 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.