The package can be installed from PyPI:
$ python -m pip install elastic-enterprise-search
The version follows the Elastic Stack version so 7.10
is compatible
with Enterprise Search released in Elastic Stack 7.10.
NOTE: The package
elastic-enterprise-search
was previously used as a client for only 'Elastic Workplace Search' before the product was renamed. When installing make sure you receive a version greater than 7.10.0.
Here's how you can get started:
>>> from elastic_enterprise_search import EnterpriseSearch
# Connecting to an instance on Elastic Cloud w/ username and password
>>> ent_search = EnterpriseSearch(
"https://<...>.ent-search.us-central1.gcp.cloud.es.io",
http_auth=("elastic", "<password>"),
)
>>> ent_search.get_version()
{'number': '7.10.0', 'build_hash': '9d6eb9f067b7d7090c541890c21f6a1e15f29c48', 'build_date': '2020-10-05T16:19:16Z'}
# If you're only planning on using App Search you
# can instantiate App Search namespaced client by itself:
>>> from elastic_enterprise_search import AppSearch
# Connecting to an instance on Elastic Cloud w/ an App Search private key
>>> app_search = AppSearch(
"https://<...>.ent-search.us-central1.gcp.cloud.es.io",
http_auth="private-<private key>",
)
>>> app_search.index_documents(
engine_name="national-parks",
body=[{
"id": "yellowstone",
"title": "Yellowstone National Park"
}]
)
enterprise-search-python
is available under the Apache-2.0 license.
For more details see LICENSE.