lib/elasticsearch/api/actions/search.rb in elasticsearch-api-6.1.0 vs lib/elasticsearch/api/actions/search.rb in elasticsearch-api-6.2.0
- old
+ new
@@ -124,12 +124,30 @@
# @see http://www.elasticsearch.org/guide/reference/api/search/
# @see http://www.elasticsearch.org/guide/reference/api/search/request-body/
#
def search(arguments={})
arguments[:index] = UNDERSCORE_ALL if ! arguments[:index] && arguments[:type]
+ method = HTTP_GET
+ path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), UNDERSCORE_SEARCH )
- valid_params = [
+ params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
+
+ body = arguments[:body]
+
+ params[:fields] = Utils.__listify(params[:fields], :escape => false) if params[:fields]
+ params[:fielddata_fields] = Utils.__listify(params[:fielddata_fields], :escape => false) if params[:fielddata_fields]
+
+ # FIX: Unescape the `filter_path` parameter due to __listify default behavior. Investigate.
+ params[:filter_path] = defined?(EscapeUtils) ? EscapeUtils.unescape_url(params[:filter_path]) : CGI.unescape(params[:filter_path]) if params[:filter_path]
+
+ perform_request(method, path, params, body).body
+ end
+
+ # Register this action with its valid params when the module is loaded.
+ #
+ # @since 6.2.0
+ ParamsRegistry.register(:search, [
:analyzer,
:analyze_wildcard,
:default_operator,
:df,
:explain,
@@ -154,11 +172,13 @@
:size,
:sort,
:source,
:_source,
:_source_include,
+ :_source_includes,
:_source_exclude,
+ :_source_excludes,
:stored_fields,
:stats,
:suggest_field,
:suggest_mode,
:suggest_size,
@@ -167,25 +187,11 @@
:timeout,
:typed_keys,
:version,
:batched_reduce_size,
:max_concurrent_shard_requests,
- :pre_filter_shard_size ]
-
- method = HTTP_GET
- path = Utils.__pathify( Utils.__listify(arguments[:index]), Utils.__listify(arguments[:type]), UNDERSCORE_SEARCH )
-
- params = Utils.__validate_and_extract_params arguments, valid_params
-
- body = arguments[:body]
-
- params[:fields] = Utils.__listify(params[:fields], :escape => false) if params[:fields]
- params[:fielddata_fields] = Utils.__listify(params[:fielddata_fields], :escape => false) if params[:fielddata_fields]
-
- # FIX: Unescape the `filter_path` parameter due to __listify default behavior. Investigate.
- params[:filter_path] = defined?(EscapeUtils) ? EscapeUtils.unescape_url(params[:filter_path]) : CGI.unescape(params[:filter_path]) if params[:filter_path]
-
- perform_request(method, path, params, body).body
- end
+ :pre_filter_shard_size,
+ :rest_total_hits_as_int,
+ :ignore_throttled ].freeze)
end
end
end