Does multi search request accept any custom params and return the same in response

Hi,

Want to know, Is there any way we can pass a custom parameter in multi search request payload and get that parameter in response?

e.g.,

GET twitter/_msearch
{"query" : {"match_all" : {}}, "from" : 0, "size" : 10, "PARAMETER_TO_INCLUDE_IN_RESPONSE" => CUSTOM_QUERY_NAME1}
{"query" : {"match_all" : {}}, "from" : 0, "size" : 20, "PARAMETER_TO_INCLUDE_IN_RESPONSE" => CUSTOM_QUERY_NAME1}

Response:
Way to access/filter the response by PARAMETER_TO_INCLUDE_IN_RESPONSE

Thanks

This? https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-named-queries-and-filters.html

Thanks a lot,
Looks like "matched_queries" holds the value, and present inside the "hits " key. Is there a way to get the same outside of hits. Because most of my query(histogram) ignores hits/sources by setting size as 0.

e.g.,
Sample Request:

{
    "size": 0,
    "query" : {
        "term" : { "device_country" : { "value": "us", "_name": "Us historgram" } }
    },
    "aggs": {
		"dateHistogram": {
			"date_histogram": {
				"field": "device_reg_date",
				"interval": "day"
			}
		}
    }
}

Expected Response:

{
    "took": 6,
    "timed_out": false,
    "_shards": {
        ...
    },
    "hits": {
        ...
        "hits": [],
        "matched_queries": "Us historgram"
    },
    "aggregations": {
        "dateHistogram": {
            ...
        }
    }
}

So, that i can filter the query based on the "matched_queries" value.

I see. I don't think so.

Might be a candidate for a feature request?
Wanna open one and link to this discussion ?

Sure, Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.