Can REST API _msearch support new feature response filter?


(Joshua Ze) #1

I used the new feature (JSON response body filtering) under elasticsearch1.6.0, but failed with API _msearch.
I tried _search api, it works (the URL filter_path is the same as _msearch URL).
But when i use _msearch, it only returns "{}".
the msearch URL shows below:
http://10.249.68.154:9200/seasonal_yr5
*/kw/_msearch?pretty&filter_path=aggregations.timeseries.buckets.key_as_string,aggregations.timeseries.buckets.sum_quantity.value


(Colin Goodheart-Smithe) #2

According to the _msearch documentation, the response will have an array called responses which will contain the response for each of your searches. Your filterpath does not include that array, it assumes that there will be a field in the root of the JSON called aggregations. try setting you filter_path to include responses:

responses.aggregations.timeseries.buckets.key_as_string,aggregations.timeseries.buckets.sum_quantity.value

If that doesn't work, run your _msearch request without any filter_path and check the structure of the response to see what you are missing.


(Joshua Ze) #3

it works.
thank you very much.


(system) #4