elasticsearch-api 6.2.0 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -1
- data/lib/elasticsearch/api/actions/benchmark.rb +1 -1
- data/lib/elasticsearch/api/actions/bulk.rb +4 -6
- data/lib/elasticsearch/api/actions/cat/aliases.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/allocation.rb +11 -11
- data/lib/elasticsearch/api/actions/cat/count.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +9 -7
- data/lib/elasticsearch/api/actions/cat/health.rb +11 -11
- data/lib/elasticsearch/api/actions/cat/help.rb +4 -2
- data/lib/elasticsearch/api/actions/cat/indices.rb +14 -15
- data/lib/elasticsearch/api/actions/cat/master.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +6 -4
- data/lib/elasticsearch/api/actions/cat/nodes.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +10 -10
- data/lib/elasticsearch/api/actions/cat/plugins.rb +7 -6
- data/lib/elasticsearch/api/actions/cat/recovery.rb +10 -12
- data/lib/elasticsearch/api/actions/cat/repositories.rb +7 -3
- data/lib/elasticsearch/api/actions/cat/segments.rb +9 -7
- data/lib/elasticsearch/api/actions/cat/shards.rb +12 -12
- data/lib/elasticsearch/api/actions/cat/snapshots.rb +8 -4
- data/lib/elasticsearch/api/actions/cat/tasks.rb +4 -6
- data/lib/elasticsearch/api/actions/cat/templates.rb +6 -6
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +13 -17
- data/lib/elasticsearch/api/actions/clear_scroll.rb +7 -0
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +2 -3
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +5 -2
- data/lib/elasticsearch/api/actions/cluster/health.rb +11 -20
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +2 -3
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +8 -3
- data/lib/elasticsearch/api/actions/cluster/remote_info.rb +7 -1
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +7 -7
- data/lib/elasticsearch/api/actions/cluster/state.rb +18 -15
- data/lib/elasticsearch/api/actions/cluster/stats.rb +12 -5
- data/lib/elasticsearch/api/actions/count.rb +12 -23
- data/lib/elasticsearch/api/actions/count_percolate.rb +1 -1
- data/lib/elasticsearch/api/actions/delete.rb +16 -8
- data/lib/elasticsearch/api/actions/delete_by_query.rb +7 -9
- data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +29 -0
- data/lib/elasticsearch/api/actions/delete_script.rb +5 -6
- data/lib/elasticsearch/api/actions/exists.rb +3 -4
- data/lib/elasticsearch/api/actions/exists_source.rb +51 -0
- data/lib/elasticsearch/api/actions/explain.rb +11 -25
- data/lib/elasticsearch/api/actions/field_caps.rb +2 -2
- data/lib/elasticsearch/api/actions/get.rb +13 -19
- data/lib/elasticsearch/api/actions/get_script.rb +9 -2
- data/lib/elasticsearch/api/actions/get_source.rb +10 -14
- data/lib/elasticsearch/api/actions/index.rb +10 -16
- data/lib/elasticsearch/api/actions/indices/analyze.rb +3 -27
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +2 -4
- data/lib/elasticsearch/api/actions/indices/close.rb +9 -15
- data/lib/elasticsearch/api/actions/indices/create.rb +7 -7
- data/lib/elasticsearch/api/actions/indices/delete.rb +3 -4
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +7 -4
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +5 -2
- data/lib/elasticsearch/api/actions/indices/exists.rb +11 -17
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +6 -14
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +8 -4
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +6 -15
- data/lib/elasticsearch/api/actions/indices/flush.rb +5 -9
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +1 -1
- data/lib/elasticsearch/api/actions/indices/forcemerge.rb +13 -11
- data/lib/elasticsearch/api/actions/indices/freeze.rb +0 -1
- data/lib/elasticsearch/api/actions/indices/get.rb +9 -15
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +6 -14
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +11 -15
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +12 -16
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +12 -21
- data/lib/elasticsearch/api/actions/indices/get_template.rb +8 -5
- data/lib/elasticsearch/api/actions/indices/open.rb +9 -15
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +6 -3
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +11 -23
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +10 -20
- data/lib/elasticsearch/api/actions/indices/put_template.rb +10 -5
- data/lib/elasticsearch/api/actions/indices/recovery.rb +2 -4
- data/lib/elasticsearch/api/actions/indices/refresh.rb +6 -14
- data/lib/elasticsearch/api/actions/indices/rollover.rb +6 -5
- data/lib/elasticsearch/api/actions/indices/segments.rb +6 -14
- data/lib/elasticsearch/api/actions/indices/shard_stores.rb +2 -4
- data/lib/elasticsearch/api/actions/indices/shrink.rb +6 -7
- data/lib/elasticsearch/api/actions/indices/split.rb +2 -1
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +7 -4
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +10 -13
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +14 -25
- data/lib/elasticsearch/api/actions/info.rb +6 -0
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +1 -1
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +4 -3
- data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +29 -0
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +1 -1
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +5 -5
- data/lib/elasticsearch/api/actions/mget.rb +8 -17
- data/lib/elasticsearch/api/actions/msearch.rb +7 -2
- data/lib/elasticsearch/api/actions/msearch_template.rb +8 -1
- data/lib/elasticsearch/api/actions/mtermvectors.rb +21 -22
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +4 -6
- data/lib/elasticsearch/api/actions/nodes/info.rb +6 -26
- data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +10 -4
- data/lib/elasticsearch/api/actions/nodes/stats.rb +11 -30
- data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -0
- data/lib/elasticsearch/api/actions/ping.rb +6 -0
- data/lib/elasticsearch/api/actions/put_script.rb +10 -9
- data/lib/elasticsearch/api/actions/rank_eval.rb +36 -0
- data/lib/elasticsearch/api/actions/reindex.rb +9 -14
- data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +29 -0
- data/lib/elasticsearch/api/actions/render_search_template.rb +1 -1
- data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +27 -0
- data/lib/elasticsearch/api/actions/scroll.rb +3 -2
- data/lib/elasticsearch/api/actions/search.rb +36 -53
- data/lib/elasticsearch/api/actions/search_shards.rb +7 -14
- data/lib/elasticsearch/api/actions/search_template.rb +20 -19
- data/lib/elasticsearch/api/actions/snapshot/create.rb +2 -3
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +4 -3
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +3 -3
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +1 -2
- data/lib/elasticsearch/api/actions/snapshot/get.rb +3 -3
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +3 -6
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +1 -1
- data/lib/elasticsearch/api/actions/snapshot/status.rb +4 -5
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +1 -2
- data/lib/elasticsearch/api/actions/tasks/cancel.rb +7 -13
- data/lib/elasticsearch/api/actions/tasks/get.rb +6 -3
- data/lib/elasticsearch/api/actions/tasks/list.rb +10 -16
- data/lib/elasticsearch/api/actions/termvectors.rb +22 -21
- data/lib/elasticsearch/api/actions/update.rb +19 -33
- data/lib/elasticsearch/api/actions/update_by_query.rb +13 -33
- data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +29 -0
- data/lib/elasticsearch/api/version.rb +1 -1
- data/spec/elasticsearch/api/actions/cluster/state_spec.rb +0 -17
- data/spec/elasticsearch/api/actions/cluster/stats_spec.rb +17 -0
- data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -37
- data/spec/elasticsearch/api/actions/indices/put_settings_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/indices/refresh_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/indices/segments_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/mget_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/mlt_spec.rb +127 -114
- data/spec/elasticsearch/api/actions/search_exists_spec.rb +58 -12
- data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
- data/test/integration/yaml_test_runner.rb +2 -4
- data/utils/thor/generate_source.rb +1 -0
- data/utils/thor/templates/ruby/method.erb +7 -5
- metadata +12 -10
- data/spec/elasticsearch/api/actions/indices/freeze_spec.rb +0 -68
- data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -108
- data/spec/elasticsearch/api/actions/indices/unfreeze_spec.rb +0 -68
|
@@ -1,117 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
1
|
+
module Elasticsearch
|
|
2
|
+
module API
|
|
3
|
+
module Actions
|
|
4
|
+
|
|
5
|
+
# Return documents similar to the specified one.
|
|
6
|
+
#
|
|
7
|
+
# Performs a `more_like_this` query with the specified document as the input.
|
|
8
|
+
#
|
|
9
|
+
# @example Search for similar documents using the `title` property of document `myindex/mytype/1`
|
|
10
|
+
#
|
|
11
|
+
# # First, let's setup a synonym-aware analyzer ("quick" <=> "fast")
|
|
12
|
+
# client.indices.create index: 'myindex', body: {
|
|
13
|
+
# settings: {
|
|
14
|
+
# analysis: {
|
|
15
|
+
# filter: {
|
|
16
|
+
# synonyms: {
|
|
17
|
+
# type: 'synonym',
|
|
18
|
+
# synonyms: [ "quick,fast" ]
|
|
19
|
+
# }
|
|
20
|
+
# },
|
|
21
|
+
# analyzer: {
|
|
22
|
+
# title_synonym: {
|
|
23
|
+
# type: 'custom',
|
|
24
|
+
# tokenizer: 'whitespace',
|
|
25
|
+
# filter: ['lowercase', 'stop', 'snowball', 'synonyms']
|
|
26
|
+
# }
|
|
27
|
+
# }
|
|
28
|
+
# }
|
|
29
|
+
# },
|
|
30
|
+
# mappings: {
|
|
31
|
+
# mytype: {
|
|
32
|
+
# properties: {
|
|
33
|
+
# title: {
|
|
34
|
+
# type: 'string',
|
|
35
|
+
# analyzer: 'title_synonym'
|
|
36
|
+
# }
|
|
37
|
+
# }
|
|
38
|
+
# }
|
|
39
|
+
# }
|
|
40
|
+
# }
|
|
41
|
+
#
|
|
42
|
+
# # Index three documents
|
|
43
|
+
# client.index index: 'myindex', type: 'mytype', id: 1, body: { title: 'Quick Brown Fox' }
|
|
44
|
+
# client.index index: 'myindex', type: 'mytype', id: 2, body: { title: 'Slow Black Dog' }
|
|
45
|
+
# client.index index: 'myindex', type: 'mytype', id: 3, body: { title: 'Fast White Rabbit' }
|
|
46
|
+
# client.indices.refresh index: 'myindex'
|
|
47
|
+
#
|
|
48
|
+
# client.mlt index: 'myindex', type: 'mytype', id: 1, mlt_fields: 'title', min_doc_freq: 1, min_term_freq: 1
|
|
49
|
+
# # => { ... {"title"=>"Fast White Rabbit"}}]}}
|
|
50
|
+
#
|
|
51
|
+
# @option arguments [String] :id The document ID (*Required*)
|
|
52
|
+
# @option arguments [String] :index The name of the index (*Required*)
|
|
53
|
+
# @option arguments [String] :type The type of the document (use `_all` to fetch
|
|
54
|
+
# the first document matching the ID across all types) (*Required*)
|
|
55
|
+
# @option arguments [Hash] :body A specific search request definition
|
|
56
|
+
# @option arguments [Number] :boost_terms The boost factor
|
|
57
|
+
# @option arguments [Number] :max_doc_freq The word occurrence frequency as count: words with higher occurrence
|
|
58
|
+
# in the corpus will be ignored
|
|
59
|
+
# @option arguments [Number] :max_query_terms The maximum query terms to be included in the generated query
|
|
60
|
+
# @option arguments [Number] :max_word_len The minimum length of the word: longer words will be ignored
|
|
61
|
+
# @option arguments [Number] :min_doc_freq The word occurrence frequency as count: words with lower occurrence
|
|
62
|
+
# in the corpus will be ignored
|
|
63
|
+
# @option arguments [Number] :min_term_freq The term frequency as percent: terms with lower occurence
|
|
64
|
+
# in the source document will be ignored
|
|
65
|
+
# @option arguments [Number] :min_word_len The minimum length of the word: shorter words will be ignored
|
|
66
|
+
# @option arguments [List] :mlt_fields Specific fields to perform the query against
|
|
67
|
+
# @option arguments [Number] :percent_terms_to_match How many terms have to match in order to consider
|
|
68
|
+
# the document a match (default: 0.3)
|
|
69
|
+
# @option arguments [String] :routing Specific routing value
|
|
70
|
+
# @option arguments [Number] :search_from The offset from which to return results
|
|
71
|
+
# @option arguments [List] :search_indices A comma-separated list of indices to perform the query against
|
|
72
|
+
# (default: the index containing the document)
|
|
73
|
+
# @option arguments [String] :search_query_hint The search query hint
|
|
74
|
+
# @option arguments [String] :search_scroll A scroll search request definition
|
|
75
|
+
# @option arguments [Number] :search_size The number of documents to return (default: 10)
|
|
76
|
+
# @option arguments [String] :search_source A specific search request definition (instead of using the request body)
|
|
77
|
+
# @option arguments [String] :search_type Specific search type (eg. `dfs_then_fetch`, `count`, etc)
|
|
78
|
+
# @option arguments [List] :search_types A comma-separated list of types to perform the query against
|
|
79
|
+
# (default: the same type as the document)
|
|
80
|
+
# @option arguments [List] :stop_words A list of stop words to be ignored
|
|
81
|
+
#
|
|
82
|
+
# @see http://elasticsearch.org/guide/reference/api/more-like-this/
|
|
83
|
+
#
|
|
84
|
+
def mlt(arguments={})
|
|
85
|
+
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
|
86
|
+
raise ArgumentError, "Required argument 'type' missing" unless arguments[:type]
|
|
87
|
+
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
|
|
88
|
+
method = HTTP_GET
|
|
89
|
+
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
|
90
|
+
Utils.__escape(arguments[:type]),
|
|
91
|
+
Utils.__escape(arguments[:id]),
|
|
92
|
+
'_mlt'
|
|
93
|
+
|
|
94
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
95
|
+
|
|
96
|
+
[:mlt_fields, :search_indices, :search_types, :stop_words].each do |name|
|
|
97
|
+
params[name] = Utils.__listify(params[name]) if params[name]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
body = arguments[:body]
|
|
101
|
+
|
|
102
|
+
perform_request(method, path, params, body).body
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Register this action with its valid params when the module is loaded.
|
|
106
|
+
#
|
|
107
|
+
# @since 6.2.0
|
|
108
|
+
ParamsRegistry.register(:mlt, [
|
|
109
|
+
:boost_terms,
|
|
110
|
+
:max_doc_freq,
|
|
111
|
+
:max_query_terms,
|
|
112
|
+
:max_word_len,
|
|
113
|
+
:min_doc_freq,
|
|
114
|
+
:min_term_freq,
|
|
115
|
+
:min_word_len,
|
|
116
|
+
:mlt_fields,
|
|
117
|
+
:percent_terms_to_match,
|
|
118
|
+
:routing,
|
|
119
|
+
:search_from,
|
|
120
|
+
:search_indices,
|
|
121
|
+
:search_query_hint,
|
|
122
|
+
:search_scroll,
|
|
123
|
+
:search_size,
|
|
124
|
+
:search_source,
|
|
125
|
+
:search_type,
|
|
126
|
+
:search_types,
|
|
127
|
+
:stop_words ].freeze)
|
|
115
128
|
end
|
|
116
129
|
end
|
|
117
130
|
end
|
|
@@ -1,17 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
module Elasticsearch
|
|
2
|
+
module API
|
|
3
|
+
module Actions
|
|
2
4
|
|
|
3
|
-
|
|
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]
|
|
4
40
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
'POST',
|
|
8
|
-
'_search/exists',
|
|
9
|
-
{ q: 'foo' },
|
|
10
|
-
nil
|
|
11
|
-
]
|
|
12
|
-
end
|
|
41
|
+
perform_request(method, path, params, body).body
|
|
42
|
+
end
|
|
13
43
|
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
16
62
|
end
|
|
17
63
|
end
|
|
@@ -113,19 +113,4 @@ describe 'client#search' do
|
|
|
113
113
|
}.to raise_exception(ArgumentError)
|
|
114
114
|
end
|
|
115
115
|
end
|
|
116
|
-
|
|
117
|
-
context 'when the request field params are not URL-encoded' do
|
|
118
|
-
|
|
119
|
-
let(:params) do
|
|
120
|
-
{ fields: 'foo^bar'}
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
let(:url) do
|
|
124
|
-
'foo/bar/_search'
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
it 'does not encode the field params' do
|
|
128
|
-
expect(client_double.search(index: 'foo', type: 'bar', fields: 'foo^bar'))
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
116
|
end
|
|
@@ -143,7 +143,7 @@ module Elasticsearch
|
|
|
143
143
|
|
|
144
144
|
def symbolize_keys(object)
|
|
145
145
|
if object.is_a? Hash
|
|
146
|
-
object.reduce({}) { |memo,(k,v)| memo[k.to_sym] = symbolize_keys(v); memo }
|
|
146
|
+
object.reduce({}) { |memo,(k,v)| memo[k.to_s.to_sym] = symbolize_keys(v); memo }
|
|
147
147
|
else
|
|
148
148
|
object
|
|
149
149
|
end
|
|
@@ -297,9 +297,7 @@ suites.each do |suite|
|
|
|
297
297
|
#
|
|
298
298
|
setup do
|
|
299
299
|
$helper_client.indices.delete index: '_all', ignore: 404
|
|
300
|
-
$helper_client.indices.delete_template name: '
|
|
301
|
-
$helper_client.indices.delete_template name: 'test', ignore: 404
|
|
302
|
-
$helper_client.indices.delete_template name: 'index_template', ignore: 404
|
|
300
|
+
$helper_client.indices.delete_template name: '*', ignore: 404
|
|
303
301
|
$helper_client.snapshot.delete repository: 'test_repo_create_1', snapshot: 'test_snapshot', ignore: 404
|
|
304
302
|
$helper_client.snapshot.delete repository: 'test_repo_restore_1', snapshot: 'test_snapshot', ignore: 404
|
|
305
303
|
$helper_client.snapshot.delete repository: 'test_cat_snapshots_1', snapshot: 'snap1', ignore: 404
|
|
@@ -47,6 +47,7 @@ module Elasticsearch
|
|
|
47
47
|
copy_file "templates/ruby/test_helper.rb", @output.join('test').join('test_helper.rb') if options[:language] == 'ruby'
|
|
48
48
|
|
|
49
49
|
Dir[@input].each do |file|
|
|
50
|
+
next if File.basename(file)[0] == '_'
|
|
50
51
|
@path = Pathname(file)
|
|
51
52
|
@json = MultiJson.load( File.read(@path) )
|
|
52
53
|
@spec = @json.values.first
|
|
@@ -35,14 +35,10 @@ module Elasticsearch
|
|
|
35
35
|
<%= ' '*(@namespace_depth+1) + "raise ArgumentError, \"Required argument 'body' missing\" unless arguments[:body]" + "\n" -%>
|
|
36
36
|
<%- end -%>
|
|
37
37
|
<%# Method, path, params, body -%>
|
|
38
|
-
<%- unless @spec['url']['params'].empty? -%>
|
|
39
|
-
<%= ' '*@namespace_depth %> valid_params = [
|
|
40
|
-
<%= ' '*(@namespace_depth+2) %><%= @spec['url']['params'].keys.map { |k| ":#{k}" }.join(",\n#{' '*(@namespace_depth+5)}") %> ]
|
|
41
|
-
<%- end -%>
|
|
42
38
|
<%= ' '*@namespace_depth %> method = <%= @http_method %>
|
|
43
39
|
<%= ' '*@namespace_depth %> path = "<%= @http_path %>"
|
|
44
40
|
<%- unless @spec['url']['params'].empty? -%>
|
|
45
|
-
<%= ' '*@namespace_depth %> params = Elasticsearch::API::Utils.__validate_and_extract_params arguments,
|
|
41
|
+
<%= ' '*@namespace_depth %> params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
|
46
42
|
<%- else -%>
|
|
47
43
|
<%= ' '*@namespace_depth %> params = {}
|
|
48
44
|
<%- end -%>
|
|
@@ -53,6 +49,12 @@ module Elasticsearch
|
|
|
53
49
|
<%- @namespace_depth.downto(1) do |i| -%>
|
|
54
50
|
<%= ' '*(i-1) %>end
|
|
55
51
|
<%- end if @namespace_depth > 0 -%>
|
|
52
|
+
|
|
53
|
+
<%= ' '*@namespace_depth -%># Register this action with its valid params when the module is loaded.
|
|
54
|
+
<%= ' '*@namespace_depth -%>#
|
|
55
|
+
<%= ' '*@namespace_depth -%># @since 6.2.0
|
|
56
|
+
<%= ' '*@namespace_depth -%>ParamsRegistry.register(:<%= @method_name -%>, [
|
|
57
|
+
<%= ' '*(@namespace_depth +2) + @spec['url']['params'].keys.map { |k| ":#{k}" }.join(",\n#{' '*(@namespace_depth+5)}") %> ].freeze)
|
|
56
58
|
end
|
|
57
59
|
end
|
|
58
60
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: elasticsearch-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Karel Minarik
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-05-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: multi_json
|
|
@@ -334,7 +334,7 @@ dependencies:
|
|
|
334
334
|
version: '2'
|
|
335
335
|
description: 'Ruby API for Elasticsearch. See the `elasticsearch` gem for full integration.
|
|
336
336
|
|
|
337
|
-
'
|
|
337
|
+
'
|
|
338
338
|
email:
|
|
339
339
|
- karel.minarik@elasticsearch.org
|
|
340
340
|
executables: []
|
|
@@ -391,9 +391,11 @@ files:
|
|
|
391
391
|
- lib/elasticsearch/api/actions/create.rb
|
|
392
392
|
- lib/elasticsearch/api/actions/delete.rb
|
|
393
393
|
- lib/elasticsearch/api/actions/delete_by_query.rb
|
|
394
|
+
- lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb
|
|
394
395
|
- lib/elasticsearch/api/actions/delete_script.rb
|
|
395
396
|
- lib/elasticsearch/api/actions/delete_template.rb
|
|
396
397
|
- lib/elasticsearch/api/actions/exists.rb
|
|
398
|
+
- lib/elasticsearch/api/actions/exists_source.rb
|
|
397
399
|
- lib/elasticsearch/api/actions/explain.rb
|
|
398
400
|
- lib/elasticsearch/api/actions/field_caps.rb
|
|
399
401
|
- lib/elasticsearch/api/actions/field_stats.rb
|
|
@@ -454,6 +456,7 @@ files:
|
|
|
454
456
|
- lib/elasticsearch/api/actions/ingest/delete_pipeline.rb
|
|
455
457
|
- lib/elasticsearch/api/actions/ingest/get_pipeline.rb
|
|
456
458
|
- lib/elasticsearch/api/actions/ingest/params_registry.rb
|
|
459
|
+
- lib/elasticsearch/api/actions/ingest/processor_grok.rb
|
|
457
460
|
- lib/elasticsearch/api/actions/ingest/put_pipeline.rb
|
|
458
461
|
- lib/elasticsearch/api/actions/ingest/simulate.rb
|
|
459
462
|
- lib/elasticsearch/api/actions/list_benchmarks.rb
|
|
@@ -469,14 +472,18 @@ files:
|
|
|
469
472
|
- lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb
|
|
470
473
|
- lib/elasticsearch/api/actions/nodes/shutdown.rb
|
|
471
474
|
- lib/elasticsearch/api/actions/nodes/stats.rb
|
|
475
|
+
- lib/elasticsearch/api/actions/nodes/usage.rb
|
|
472
476
|
- lib/elasticsearch/api/actions/params_registry.rb
|
|
473
477
|
- lib/elasticsearch/api/actions/percolate.rb
|
|
474
478
|
- lib/elasticsearch/api/actions/ping.rb
|
|
475
479
|
- lib/elasticsearch/api/actions/put_script.rb
|
|
476
480
|
- lib/elasticsearch/api/actions/put_template.rb
|
|
481
|
+
- lib/elasticsearch/api/actions/rank_eval.rb
|
|
477
482
|
- lib/elasticsearch/api/actions/reindex.rb
|
|
483
|
+
- lib/elasticsearch/api/actions/reindex_rethrottle.rb
|
|
478
484
|
- lib/elasticsearch/api/actions/remote/info.rb
|
|
479
485
|
- lib/elasticsearch/api/actions/render_search_template.rb
|
|
486
|
+
- lib/elasticsearch/api/actions/scripts_painless_execute.rb
|
|
480
487
|
- lib/elasticsearch/api/actions/scroll.rb
|
|
481
488
|
- lib/elasticsearch/api/actions/search.rb
|
|
482
489
|
- lib/elasticsearch/api/actions/search_exists.rb
|
|
@@ -500,6 +507,7 @@ files:
|
|
|
500
507
|
- lib/elasticsearch/api/actions/termvectors.rb
|
|
501
508
|
- lib/elasticsearch/api/actions/update.rb
|
|
502
509
|
- lib/elasticsearch/api/actions/update_by_query.rb
|
|
510
|
+
- lib/elasticsearch/api/actions/update_by_query_rethrottle.rb
|
|
503
511
|
- lib/elasticsearch/api/namespace/cat.rb
|
|
504
512
|
- lib/elasticsearch/api/namespace/cluster.rb
|
|
505
513
|
- lib/elasticsearch/api/namespace/common.rb
|
|
@@ -577,7 +585,6 @@ files:
|
|
|
577
585
|
- spec/elasticsearch/api/actions/indices/flush_spec.rb
|
|
578
586
|
- spec/elasticsearch/api/actions/indices/flush_synced_spec.rb
|
|
579
587
|
- spec/elasticsearch/api/actions/indices/forcemerge_spec.rb
|
|
580
|
-
- spec/elasticsearch/api/actions/indices/freeze_spec.rb
|
|
581
588
|
- spec/elasticsearch/api/actions/indices/get_alias_spec.rb
|
|
582
589
|
- spec/elasticsearch/api/actions/indices/get_aliases_spec.rb
|
|
583
590
|
- spec/elasticsearch/api/actions/indices/get_field_mapping_spec.rb
|
|
@@ -602,9 +609,7 @@ files:
|
|
|
602
609
|
- spec/elasticsearch/api/actions/indices/shrink_spec.rb
|
|
603
610
|
- spec/elasticsearch/api/actions/indices/snapshot_index_spec.rb
|
|
604
611
|
- spec/elasticsearch/api/actions/indices/split_spec.rb
|
|
605
|
-
- spec/elasticsearch/api/actions/indices/stats_spec.rb
|
|
606
612
|
- spec/elasticsearch/api/actions/indices/status_spec.rb
|
|
607
|
-
- spec/elasticsearch/api/actions/indices/unfreeze_spec.rb
|
|
608
613
|
- spec/elasticsearch/api/actions/indices/update_aliases_spec.rb
|
|
609
614
|
- spec/elasticsearch/api/actions/indices/upgrade_spec.rb
|
|
610
615
|
- spec/elasticsearch/api/actions/indices/validate_query_spec.rb
|
|
@@ -688,7 +693,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
688
693
|
- !ruby/object:Gem::Version
|
|
689
694
|
version: '0'
|
|
690
695
|
requirements: []
|
|
691
|
-
rubygems_version: 3.0.
|
|
696
|
+
rubygems_version: 3.0.3
|
|
692
697
|
signing_key:
|
|
693
698
|
specification_version: 4
|
|
694
699
|
summary: Ruby API for Elasticsearch.
|
|
@@ -759,7 +764,6 @@ test_files:
|
|
|
759
764
|
- spec/elasticsearch/api/actions/indices/flush_spec.rb
|
|
760
765
|
- spec/elasticsearch/api/actions/indices/flush_synced_spec.rb
|
|
761
766
|
- spec/elasticsearch/api/actions/indices/forcemerge_spec.rb
|
|
762
|
-
- spec/elasticsearch/api/actions/indices/freeze_spec.rb
|
|
763
767
|
- spec/elasticsearch/api/actions/indices/get_alias_spec.rb
|
|
764
768
|
- spec/elasticsearch/api/actions/indices/get_aliases_spec.rb
|
|
765
769
|
- spec/elasticsearch/api/actions/indices/get_field_mapping_spec.rb
|
|
@@ -784,9 +788,7 @@ test_files:
|
|
|
784
788
|
- spec/elasticsearch/api/actions/indices/shrink_spec.rb
|
|
785
789
|
- spec/elasticsearch/api/actions/indices/snapshot_index_spec.rb
|
|
786
790
|
- spec/elasticsearch/api/actions/indices/split_spec.rb
|
|
787
|
-
- spec/elasticsearch/api/actions/indices/stats_spec.rb
|
|
788
791
|
- spec/elasticsearch/api/actions/indices/status_spec.rb
|
|
789
|
-
- spec/elasticsearch/api/actions/indices/unfreeze_spec.rb
|
|
790
792
|
- spec/elasticsearch/api/actions/indices/update_aliases_spec.rb
|
|
791
793
|
- spec/elasticsearch/api/actions/indices/upgrade_spec.rb
|
|
792
794
|
- spec/elasticsearch/api/actions/indices/validate_query_spec.rb
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe 'client.indices#freeze' do
|
|
4
|
-
|
|
5
|
-
let(:expected_args) do
|
|
6
|
-
[
|
|
7
|
-
'POST',
|
|
8
|
-
url,
|
|
9
|
-
params,
|
|
10
|
-
nil,
|
|
11
|
-
nil
|
|
12
|
-
]
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
let(:params) do
|
|
16
|
-
{}
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
context 'when there is no index specified' do
|
|
20
|
-
|
|
21
|
-
let(:client) do
|
|
22
|
-
Class.new { include Elasticsearch::API }.new
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'raises an exception' do
|
|
26
|
-
expect {
|
|
27
|
-
client.indices.freeze
|
|
28
|
-
}.to raise_exception(ArgumentError)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
context 'when an index is specified' do
|
|
33
|
-
|
|
34
|
-
let(:url) do
|
|
35
|
-
'foo/_freeze'
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it 'performs the request' do
|
|
39
|
-
expect(client_double.indices.freeze(index: 'foo')).to eq({})
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context 'when params are specified' do
|
|
44
|
-
|
|
45
|
-
let(:params) do
|
|
46
|
-
{ timeout: '1s' }
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
let(:url) do
|
|
50
|
-
'foo/_freeze'
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'performs the request' do
|
|
54
|
-
expect(client_double.indices.freeze(index: 'foo', timeout: '1s')).to eq({})
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
context 'when the path must be URL-escaped' do
|
|
59
|
-
|
|
60
|
-
let(:url) do
|
|
61
|
-
'foo%5Ebar/_freeze'
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it 'performs the request' do
|
|
65
|
-
expect(client_double.indices.freeze(index: 'foo^bar')).to eq({})
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|