4

I am working on getting datas from an API with ElasticSearch and have some issues with fetching all the results.

I tried to use the from parameter without success, it even has a strange behaviour.

For example I have one request rendering me 15 results, here are the different number of results depending on the value of the parameter from :

from=9 - gives me 1 result
from=10 - gives me 7 results
from=11 - gives me 2 results
from=12 - gives me 5 results
from=13 - gives me 9 results

Thanks for helping !

Diane Duquesne
  • 516
  • 2
  • 11
  • I think this is what you're looking for http://stackoverflow.com/questions/8829468/elasticsearch-query-to-return-all-records – Ryan Huynh. Sep 11 '15 at 22:14

1 Answers1

2

It's quite simple from https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html:

{ "from" : 0, "size" : 10, "query" : { "term" : { "user" : "kimchy" } } }

from is from where to start the result ie. offset (This is applied after all your filters etc. in query). And size is max number of document to be return.

You should post your query also if issue persists.

jitendra
  • 195
  • 1
  • 2
  • 10