I am doing some performance testing on Elasticsearch. So I am comparing Oracle db with Elasticsearch.
The Oracle query is able to stop it's search once it finds the first 10matches by using the code
select * from mtd_sec_data
WHERE current_sighting_status= 'ACT'
fetch first 10 rows only;
I want to do similar action in Elasticsearch too. Any help is appreciable.
See the terminate_after parameter.
i have tried this query
GET /mtd_sec_data/_search?pretty&terminate_after=10
{ "query":{
"match" : {
"CURRENT_SIGHTING_STATUS": "ACT"
}
}
}
Even after testing the script it is having a similar throughput as in without using terminate_after. Does this really stops searching once it finds the first 10hits or is it searching the entire index?
How many total docs does the non-constrained search match?
It's also worth noting that queries now have optimisations for short-cutting non-competitive matches
It has around 536 hits and the index contains 1000docs.
It has around 536 hits and the index contains 1000docs.
Probably not a great benchmark on that sort of volume. Most of the time spent will be in JSON parsing/rendering, returning those 10 docs source. The matching part which is searching for a single search term with only ~500 uses will be a small part of the overall cost.
can we observe a clear difference by benchmarking on 1million data and above?
can we observe a clear difference by benchmarking on 1million data and above?
Perhaps clearer.
Benchmarking is a notoriously tricky thing what with things like caches playing a part (caches built into elasticsearch and file system caches).
We have a whole benchmarking framework and related forum topic
Thank you for giving an idea. It really gives some useful thoughts 