Multisearch request with aggregations

(Aguilar Perez) #1


When I perform a single search request with aggregations it works fine. But when I try to perform a multisearch request, aggregations don't seem to work. Isn't it supposed to?

Below is my code, am I doing something wrong (the output is list of hits and no aggregations)? or is msearch not support aggs?

var body = {
	"query": {
		"filtered" : {
			"filter" : {
				"and" : filterObj.filters

var bodyArray = [];
for (var aggItem in multiaggregations){

	bodyArray.push({ "index" : "myindex", "size" : 0});
	bodyArray.push({ "query": body.query, "aggregations":  aggItem});


		body: bodyArray

(Luca Cavanna) #2

I can confirm that aggregations are supported by multi search too, same way as they are supported by the search api. I assume something goes wrong when providing the array of of search requests to msearch. What do you get back instead? an array of search results, but no aggs section, or something else? Maybe you can print out a json representation of the query that you are sending so we can figure out what goes wrong there?

(system) #3