elasticsearch - Elastic Search pipeline search queries -
i looking way pipeline multiple queries elastic search. main problem when receive results want able know query generated result. in pseudo-code following
query1="james bond" query2="sean connery" query3="charlie chaplin" pipeline=new elasticsearchpipeline() pipeline.add(query1);pipeline.add(query2);pipeline.add(query3) pipeline.execute() jamesbondresults=pipeline.getresultsforquery(query1) seanconneryresults=pipeline.getresultsforquery(query2) charlechaplinresults=pipeline.getresultsforquery(query3)
the key feature want send avoid overhead of sending multiple requests on es server, still able treat results if had sent queries 1 one.
the multi search api you're looking for.
you can send many queries , response contain array responses each query in same order:
curl -xpost localhost:9200/_msearch -d ' {"index" : "test1"} {"query" : {"match_all" : {}}, "from" : 0, "size" : 10} {"index" : "test2",} {"query" : {"match_all" : {}}} '
the response array of above multi search queries contain 2 es responses documents first , second queries.
Comments
Post a Comment