|
| 1 | +module Elasticsearch |
| 2 | + module API |
| 3 | + module Actions |
| 4 | + |
| 5 | + # Return whether documents exists for a particular query |
| 6 | + # |
| 7 | + # @option arguments [List] :index A comma-separated list of indices to restrict the results |
| 8 | + # @option arguments [List] :type A comma-separated list of types to restrict the results |
| 9 | + # @option arguments [Hash] :body A query to restrict the results specified with the Query DSL (optional) |
| 10 | + # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when |
| 11 | + # unavailable (missing or closed) |
| 12 | + # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves |
| 13 | + # into no concrete indices. |
| 14 | + # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices |
| 15 | + # that are open, closed or both. |
| 16 | + # (options: open, closed, none, all) |
| 17 | + # @option arguments [Number] :min_score Include only documents with a specific `_score` value in the result |
| 18 | + # @option arguments [String] :preference Specify the node or shard the operation should be performed on |
| 19 | + # (default: random) |
| 20 | + # @option arguments [String] :routing Specific routing value |
| 21 | + # @option arguments [String] :q Query in the Lucene query string syntax |
| 22 | + # @option arguments [String] :analyzer The analyzer to use for the query string |
| 23 | + # @option arguments [Boolean] :analyze_wildcard Specify whether wildcard and prefix queries should be |
| 24 | + # analyzed (default: false) |
| 25 | + # @option arguments [String] :default_operator The default operator for query string query (AND or OR) |
| 26 | + # (options: AND, OR) |
| 27 | + # @option arguments [String] :df The field to use as default where no field prefix is given |
| 28 | + # in the query string |
| 29 | + # @option arguments [Boolean] :lenient Specify whether format-based query failures |
| 30 | + # (such as providing text to a numeric field) should be ignored |
| 31 | + # @option arguments [Boolean] :lowercase_expanded_terms Specify whether query terms should be lowercased |
| 32 | + # |
| 33 | + # @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-exists.html |
| 34 | + # |
| 35 | + def search_exists(arguments={}) |
| 36 | + method = 'POST' |
| 37 | + path = "_search/exists" |
| 38 | + params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) |
| 39 | + body = arguments[:body] |
| 40 | + |
| 41 | + perform_request(method, path, params, body).body |
| 42 | + end |
| 43 | + |
| 44 | + # Register this action with its valid params when the module is loaded. |
| 45 | + # |
| 46 | + # @since 6.2.0 |
| 47 | + ParamsRegistry.register(:search_exists, [ |
| 48 | + :ignore_unavailable, |
| 49 | + :allow_no_indices, |
| 50 | + :expand_wildcards, |
| 51 | + :min_score, |
| 52 | + :preference, |
| 53 | + :routing, |
| 54 | + :q, |
| 55 | + :analyzer, |
| 56 | + :analyze_wildcard, |
| 57 | + :default_operator, |
| 58 | + :df, |
| 59 | + :lenient, |
| 60 | + :lowercase_expanded_terms ].freeze) |
| 61 | + end |
| 62 | + end |
| 63 | +end |
0 commit comments