When I am passing the timeout value 1ms in the request, still the result is coming with took value being more than 1ms.
How does this timeout value work?
Request -
Elasticsearch only checks for a timed-out request at certain points during execution of the query, and only covers certain aspects of the execution. It also doesn't account for network delays etc. If you need a hard timeout in your application, you need to do it on the client side.
I don't know the technical details of how the timeout is implemented, but if it's anything else like the rest of the design of Elasticsearch I would be very surprised if it worked and you would be better off using a more realistic timeout period.
Regardless of the timeout period, there are some things that Elasticsearch itself doesn't count. That might be by design (e.g. some aspects of the search execution are deliberately excluded) or because there is no way it can measure them (e.g. network delays on the way to the client are invisible to Elasticsearch). They need client-side timeouts.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.