Distinct multi search result

(gpong) #1

Hi Guys,

I use Elasticsearch 2.2 and when using Multi Search API, it's possible to distinct the result between the first search and the second search??
I have multi search query dsl like this

{"query": {"filtered": {"filter": {"bool": {"must": [{"terms": {"mtart": ["roh"]}},{"terms": {"werks": ["f230","f232"]}}]}},"query": {"query_string": {"query": "roh"}}}}}

The result for the first search is 12 hits and the second is 39 hits. But there is duplicate value between first search and second search. And I want to distinct all the hits and get the unique documents. It is possible to do it??

Thanks a lot

(Mark Walkom) #2

Not using the APIs, no.
You'd need to do that external to ES, in your own code.

(gpong) #3

Thanks Mark.

It there any possibility to use multisearch query string on JAVA API?? like setExtraSource function?
I just need to input query string to the function and I can get the result.
If I use for loop to create SearchBuilder, how to add to esClient.prepareMultiSearch().add(searchBuilder) function?

Thanks a lot

(Gavin Song123) #4

I have the same problem. But the version of elasticsearch which I used is 5.2.2.

(system) #5