I need result documents based on geo_distance query for points A(lat=3,long=101) and B(lat=5,long=102) separately. one result docs I need corresponding to filter A(lat=3,long=101) and other result set I need corresponding to filter B(lat=5,long=102). I am not able to find the correct query for this. I found the query which provides union of results is like this:
Hi.
Either use the multi-search api to issue two searches in one request or use a single request with a filters aggregation to include the two geo distance filters and use a top_hits aggregation under that to group the results
Hi Maulik,
I don’t have access to your data so can’t test but if the geo distance clauses work as a query they should also work as a filter. Do these clauses match anything?
As for the top_hits expression - aggregations can be nested so simply place another “aggs” expression inside your “messages” section and add the “top_hits” clause inside that.
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.