In the following documentation, the phrase “other kwargs listed below” refers to the kwargs documented in a subsequent Parameters section. However, it also implicitly includes any kwargs the caller might care to make up and have passed to ES as query string parameters. These kwargs must start with es_ for forward compatibility and will be unprefixed and converted to strings as discussed in Features.
Unless otherwise indicated, methods return the JSON-decoded response sent by elasticsearch. This way, you don’t lose any part of the return value, no matter how esoteric. But fear not: if there was an error, an exception will be raised, so it’ll be hard to miss.
An object which manages connections to elasticsearch and acts as a go-between for API calls to it
This object is thread-safe. You can create one instance and share it among all threads.
Parameters: |
|
---|
Put a typed JSON document into a specific index to make it searchable.
Parameters: |
|
---|
See ES’s index API for more detail.
Index a list of documents as efficiently as possible.
Parameters: |
|
---|
See ES’s bulk API for more detail.
Delete a typed JSON document from a specific index based on its ID.
Parameters: |
|
---|
See ES’s delete API for more detail.
Delete all documents of the given doctype from an index.
Parameters: |
|
---|
See ES’s delete API for more detail.
Delete typed JSON documents from a specific index based on query.
Parameters: |
|
---|
See ES’s delete-by-query API for more detail.
Get a typed JSON document from an index by ID.
Parameters: |
|
---|
See ES’s get API for more detail.
Execute a search query against one or more indices and get back search hits.
Parameters: |
|
---|
See ES’s search API for more detail.
Update a document by means of a script.
Parameters: |
|
---|
Execute a query against one or more indices and get hit count.
Parameters: |
|
---|
See ES’s count API for more detail.
Fetch the mapping definition for a specific index and type.
Parameters: |
|
---|
Omit both arguments to get mappings for all types and indexes.
See ES’s get-mapping API for more detail.
Register specific mapping definition for a specific type against one or more indices.
Parameters: |
|
---|
See ES’s put-mapping API for more detail.
Execute a “more like this” search query against one or more fields and get back search hits.
Parameters: |
|
---|
See ES’s more-like-this API for more detail.
Retrieve the status of one or more indices
Parameters: |
|
---|
See ES’s index-status API for more detail.
Create an index with optional settings.
Parameters: |
|
---|
See ES’s create-index API for more detail.
Delete an index.
Parameters: | index – An index or iterable thereof to delete |
---|
See ES’s delete-index API for more detail.
Delete all indexes.
Close an index.
Parameters: | index – The index to close |
---|
See ES’s close-index API for more detail.
Open an index.
Parameters: | index – The index to open |
---|
See ES’s open-index API for more detail.
Change the settings of one or more indexes.
Parameters: |
|
---|
See ES’s update-settings API for more detail.
Update the settings of all indexes.
Parameters: | settings – A dictionary of settings |
---|
See ES’s update-settings API for more detail.
Flush one or more indices (clear memory).
Parameters: |
|
---|
See ES’s flush API for more detail.
Refresh one or more indices.
Parameters: | index – An index or iterable of indexes |
---|
See ES’s refresh API for more detail.
Gateway snapshot one or more indices.
Parameters: | index – An index or iterable of indexes |
---|
See ES’s gateway-snapshot API for more detail.
Optimize one or more indices.
Parameters: |
|
---|
See ES’s optimize API for more detail.
Report on the health of the cluster or certain indices.
Parameters: |
|
---|
See ES’s cluster-health API for more detail.
Send an HTTP request to ES, and return the JSON-decoded response.
This is mostly an internal method, but it also comes in handy if you need to use a brand new ES API that isn’t yet explicitly supported by pyelasticsearch, while still taking advantage of our connection pooling and retrying.
Retry the request on different servers if the first one is down and self.max_retries > 0.
Parameters: |
|
---|
Any method representing an ES API call can raise one of the following exceptions:
Exception raised there is a connection error and we are out of retries. (See the max_retries argument to ElasticSearch.)
Exception raised when an HTTP request times out and we are out of retries. (See the max_retries argument to ElasticSearch.)
Exception raised when ES returns a non-OK (>=400) HTTP status code