Home Ask Login Register

Developers Planet

Your answer is one click away!

AbtPst February 2016

How to specify meta parameters in search query

I am using Elasticsearch 2.2 and the corresponding python api. I can query like

res = es.search(index="test-index", body={"query": {"match_all": {}}})

that is good. Now there are also some meta parameters that we can specify with the query, as shown on


so basically, i want to execute a query like

url = 'http://localhost:9200/tesIndex/test/_search?from=%d&q=FieldA=ABC or FieldA=PQR'%start

result =  requests.get(url).json()

how would i specify this query using the elasticsearch python api?


Chemi February 2016

You just pass them as keyword parameters:

res = es.search(index="test-index", body={"query": {"match_all": {}}},  from_=20, size=100, _source=False)

Reference: http://elasticsearch-py.readthedocs.org/en/2.2.0/api.html#elasticsearch.Elasticsearch.search

Post Status

Asked in February 2016
Viewed 1,079 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life