I\'ve setup Elasticsearch with 1 cluster á 4 nodes. Number of shards per index: 1; Number of replicas per index: 3
When I call a simple query like the following one
This is because you don't have specified sort
order and size
. So every time you query you get random first 10 records as default size
for result set by elasticsearch server is 10
.
You can add sorting in following way with curl,
curl -XPOST 'localhost:9200/_search' -d '{
"query" : {
...
},
"sort" : [
{"price" : {"order" : "asc", "mode" : "avg"}}
]
}'
Check here for for more info specially from
and size
with sort which is most mostly used for pagination.
update:
Though default sort is score DESC
sometime it not works when records don't have relevant _score, as per http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_sorting.html#_sorting