Python's official low-level client for Elasticsearch
Questions tagged [elasticsearch-py]
194 questions
1
vote
1 answer
Is there a way to get one, unified, mapping from all indices under one alias?
For example if I have 10 indices with similar names and they all alias to test-index, how would I get test-index-1 test-index-2 test-index-3 test-index-4, test-index-5, test-index-6, test-index-7, test-index-8, test-index-9, and test-index-10 to all…

Justin Reddick
- 441
- 1
- 5
- 20
1
vote
1 answer
ES dense_vector field: 'dims' must be specified
I have an ElasticSearch (v7.5.1) index with a dense_vector field called lda, with 150 dimensions. The mapping, as shown on http://localhost:9200/documents/_mapping, looks like this:
"documents": {
"mappings": {
[...]
"lda": {
…

Carsten
- 1,912
- 1
- 28
- 55
1
vote
0 answers
Remote ElasticSearch cluster connection using Python Client using http
I am trying to index data to a node in a remote cluster using the ElasticSearch python client. I have the details of the cluster. I have tried the following:
client= Elasticsearch(
['http://user:secretkey@clustername:port']
)
if not…

Abhilash Challa
- 21
- 3
1
vote
1 answer
Filtering by priority based on a document's key in Elasticsearch
I have a large ES index which I intend to populate using various sources. The sources sometimes have the same documents, meaning that I will have duplicate docs differing only by 'source' param.
To perform de-duplication when serving searches, I see…

Mark Ang
- 149
- 1
- 11
1
vote
1 answer
Elasticsearch-python - bulk helper API with refresh
I need to index multiple documents in bulk with making them available to search as soon as possible. So, I want to use refresh in order to suffice this requirement.
I am currently using the code like this below. Taking example from official site
def…

Parth Pandya
- 39
- 1
- 12
1
vote
1 answer
Elasticsearch Common of two Aggregations
I want to find the common doc counts of aggregation on top authors and top co-authors which are fields inside biblio data field of source in an index.
What I am currently doing is:
1.Calculating Aggregation on top 10…

DARK_C0D3R
- 2,075
- 16
- 21
1
vote
1 answer
Closing connections to an elasticsearch cluster using elasticsearch-py
I'm trying to close a connection to my elasticsearch cluster in my application code using elasticsearch-py.
Currently, I'm using:
es = Elasticsearch()
es.close()
But, I'm getting the error:
Traceback (most recent call last):
File "tmp.py", line…

Ronak Vora
- 185
- 3
- 16
1
vote
1 answer
Elasticsearch-py Bulk Update Script With Query?
I'd like to use the bulk update api with a script, but i would like to apply the update via a query- and not an id.
A standard bulk-update payload looks something like this-
{
"_index": "users",
"_type": "user",
"_op_type": "update",
"_id":…

micah
- 7,596
- 10
- 49
- 90
1
vote
1 answer
Average bucket aggregation including 0 values
I am using ES to get statistics per day in a case where I do not have input data for everyday, but where missing data is also an information as such (in my case I am measuring an activity). To achieve such task I use the average bucket aggregation…

SantiStSupery
- 202
- 3
- 14
1
vote
3 answers
How to calculate total for each token in Elasticsearch
I have a request into Elastic
{
"query":{
"bool":{
"must":[
{
"query_string":{
"query":"something1 OR something2 OR something3",
"default_operator":"OR"
…

Саша Коровій
- 304
- 4
- 12
1
vote
2 answers
How to return only a single field in a response ElasticSearch - Python?
I am connecting to an AWS elasticsearch server and trying to fetch only one field in the response. In addition, I am not aware of the format but I am sure it works with the normal curl / postman requests.
The code :
import collections
from…

Viv
- 1,474
- 5
- 28
- 47
1
vote
1 answer
Add a field in ElasticSearch using python with boolean datatype?
How do add a new field of a particular datatype(boolean) in Elasticsearch using python.
Is this query correct?
es.update(index='my_index', doc_type='my_doctype', id='id_of_doc', body={"doc": {"new_field":"boolean_value"},"type":"boolean"})

arun_munagala
- 65
- 8
1
vote
2 answers
Increase speed on elasticsearch-py scans
I'm looking for a way to increase the speed of the scroll-scan over my elasticsearch data.
The following python code scans over multiple indices and spews out the findings to console and to a file located somewhere.
My tests concluded that this…

xenoid
- 13
- 7
1
vote
1 answer
sum calculation using elasticsearch-dsl python client
I have an Eleaticsearch index named 'demoadmin' with type named 'billing'.
I have executed this following query body using POST successfully .
{"query": { "filtered":{ "query" : {"match_all": {}}, "filter": { "bool": { "must":[{ "term": { "Month":…

Soumen
- 121
- 1
- 3
- 14
1
vote
1 answer
Elasticsearch Python API results in "search() missing 1 required positional argument" on a simple query
I am desperately trying to perform a simple search operation on elasticsearch, but fail since hours. This is my code:
res = es.search(index="people", doc_type="test", body={"query":{"match":{"name": "john"}}})
I saw this many times on the internet,…

Mugen
- 13
- 1
- 6