@@ -21,6 +21,7 @@ module Actions
2121 # Allows to execute several search operations in one request.
2222 #
2323 # @option arguments [List] :index A comma-separated list of index names to use as default
24+ # @option arguments [List] :type A comma-separated list of document types to use as default
2425 # @option arguments [String] :search_type Search operation type (options: query_then_fetch, query_and_fetch, dfs_query_then_fetch, dfs_query_and_fetch)
2526 # @option arguments [Number] :max_concurrent_searches Controls the maximum number of concurrent searches the multi search api will execute
2627 # @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
@@ -31,6 +32,11 @@ module Actions
3132 # @option arguments [Hash] :headers Custom HTTP headers
3233 # @option arguments [Hash] :body The request definitions (metadata-search request definition pairs), separated by newlines (*Required*)
3334 #
35+ # *Deprecation notice*:
36+ # Specifying types in urls has been deprecated
37+ # Deprecated since version 7.0.0
38+ #
39+ #
3440 # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-multi-search.html
3541 #
3642 def msearch ( arguments = { } )
@@ -42,8 +48,12 @@ def msearch(arguments = {})
4248
4349 _index = arguments . delete ( :index )
4450
51+ _type = arguments . delete ( :type )
52+
4553 method = Elasticsearch ::API ::HTTP_POST
46- path = if _index
54+ path = if _index && _type
55+ "#{ Utils . __listify ( _index ) } /#{ Utils . __listify ( _type ) } /_msearch"
56+ elsif _index
4757 "#{ Utils . __listify ( _index ) } /_msearch"
4858 else
4959 "_msearch"
0 commit comments