elasticsearch-api 7.4.0 → 7.5.0.pre.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +16 -23
- data/lib/elasticsearch/api/actions/abort_benchmark.rb +1 -2
- data/lib/elasticsearch/api/actions/benchmark.rb +2 -3
- data/lib/elasticsearch/api/actions/bulk.rb +35 -68
- data/lib/elasticsearch/api/actions/cat/aliases.rb +30 -52
- data/lib/elasticsearch/api/actions/cat/allocation.rb +36 -50
- data/lib/elasticsearch/api/actions/cat/count.rb +25 -46
- data/lib/elasticsearch/api/actions/cat/fielddata.rb +31 -33
- data/lib/elasticsearch/api/actions/cat/health.rb +27 -37
- data/lib/elasticsearch/api/actions/cat/help.rb +14 -10
- data/lib/elasticsearch/api/actions/cat/indices.rb +45 -62
- data/lib/elasticsearch/api/actions/cat/master.rb +24 -34
- data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +20 -16
- data/lib/elasticsearch/api/actions/cat/nodes.rb +34 -46
- data/lib/elasticsearch/api/actions/cat/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +29 -35
- data/lib/elasticsearch/api/actions/cat/plugins.rb +21 -18
- data/lib/elasticsearch/api/actions/cat/recovery.rb +40 -56
- data/lib/elasticsearch/api/actions/cat/repositories.rb +21 -24
- data/lib/elasticsearch/api/actions/cat/segments.rb +29 -22
- data/lib/elasticsearch/api/actions/cat/shards.rb +38 -59
- data/lib/elasticsearch/api/actions/cat/snapshots.rb +32 -27
- data/lib/elasticsearch/api/actions/cat/tasks.rb +25 -19
- data/lib/elasticsearch/api/actions/cat/templates.rb +26 -18
- data/lib/elasticsearch/api/actions/cat/thread_pool.rb +36 -46
- data/lib/elasticsearch/api/actions/clear_scroll.rb +21 -8
- data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +15 -13
- data/lib/elasticsearch/api/actions/cluster/get_settings.rb +18 -18
- data/lib/elasticsearch/api/actions/cluster/health.rb +42 -44
- data/lib/elasticsearch/api/actions/cluster/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +15 -17
- data/lib/elasticsearch/api/actions/cluster/put_settings.rb +20 -17
- data/lib/elasticsearch/api/actions/cluster/remote_info.rb +8 -6
- data/lib/elasticsearch/api/actions/cluster/reroute.rb +25 -37
- data/lib/elasticsearch/api/actions/cluster/state.rb +37 -41
- data/lib/elasticsearch/api/actions/cluster/stats.rb +20 -12
- data/lib/elasticsearch/api/actions/count.rb +52 -39
- data/lib/elasticsearch/api/actions/create.rb +25 -26
- data/lib/elasticsearch/api/actions/delete.rb +43 -36
- data/lib/elasticsearch/api/actions/delete_by_query.rb +74 -62
- data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +39 -0
- data/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +4 -3
- data/lib/elasticsearch/api/actions/delete_script.rb +19 -13
- data/lib/elasticsearch/api/actions/exists.rb +44 -34
- data/lib/elasticsearch/api/actions/exists_source.rb +43 -25
- data/lib/elasticsearch/api/actions/explain.rb +46 -51
- data/lib/elasticsearch/api/actions/field_caps.rb +27 -20
- data/lib/elasticsearch/api/actions/get.rb +42 -41
- data/lib/elasticsearch/api/actions/get_script.rb +19 -14
- data/lib/elasticsearch/api/actions/get_source.rb +38 -44
- data/lib/elasticsearch/api/actions/index.rb +60 -89
- data/lib/elasticsearch/api/actions/indices/analyze.rb +19 -48
- data/lib/elasticsearch/api/actions/indices/clear_cache.rb +29 -41
- data/lib/elasticsearch/api/actions/indices/clone.rb +21 -21
- data/lib/elasticsearch/api/actions/indices/close.rb +28 -32
- data/lib/elasticsearch/api/actions/indices/create.rb +22 -70
- data/lib/elasticsearch/api/actions/indices/delete.rb +23 -35
- data/lib/elasticsearch/api/actions/indices/delete_alias.rb +24 -20
- data/lib/elasticsearch/api/actions/indices/delete_template.rb +18 -20
- data/lib/elasticsearch/api/actions/indices/exists.rb +32 -34
- data/lib/elasticsearch/api/actions/indices/exists_alias.rb +33 -29
- data/lib/elasticsearch/api/actions/indices/exists_template.rb +21 -16
- data/lib/elasticsearch/api/actions/indices/exists_type.rb +29 -29
- data/lib/elasticsearch/api/actions/indices/flush.rb +28 -28
- data/lib/elasticsearch/api/actions/indices/flush_synced.rb +23 -12
- data/lib/elasticsearch/api/actions/indices/forcemerge.rb +26 -41
- data/lib/elasticsearch/api/actions/indices/freeze.rb +7 -8
- data/lib/elasticsearch/api/actions/indices/get.rb +25 -19
- data/lib/elasticsearch/api/actions/indices/get_alias.rb +31 -23
- data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +42 -38
- data/lib/elasticsearch/api/actions/indices/get_mapping.rb +39 -31
- data/lib/elasticsearch/api/actions/indices/get_settings.rb +34 -37
- data/lib/elasticsearch/api/actions/indices/get_template.rb +21 -23
- data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +48 -0
- data/lib/elasticsearch/api/actions/indices/open.rb +24 -21
- data/lib/elasticsearch/api/actions/indices/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/indices/put_alias.rb +25 -27
- data/lib/elasticsearch/api/actions/indices/put_mapping.rb +40 -39
- data/lib/elasticsearch/api/actions/indices/put_settings.rb +30 -37
- data/lib/elasticsearch/api/actions/indices/put_template.rb +23 -23
- data/lib/elasticsearch/api/actions/indices/recovery.rb +20 -23
- data/lib/elasticsearch/api/actions/indices/refresh.rb +22 -26
- data/lib/elasticsearch/api/actions/indices/rollover.rb +28 -19
- data/lib/elasticsearch/api/actions/indices/segments.rb +24 -17
- data/lib/elasticsearch/api/actions/indices/shard_stores.rb +27 -15
- data/lib/elasticsearch/api/actions/indices/shrink.rb +23 -17
- data/lib/elasticsearch/api/actions/indices/split.rb +23 -17
- data/lib/elasticsearch/api/actions/indices/stats.rb +53 -104
- data/lib/elasticsearch/api/actions/indices/unfreeze.rb +7 -7
- data/lib/elasticsearch/api/actions/indices/update_aliases.rb +15 -32
- data/lib/elasticsearch/api/actions/indices/upgrade.rb +26 -16
- data/lib/elasticsearch/api/actions/indices/validate_query.rb +46 -59
- data/lib/elasticsearch/api/actions/info.rb +9 -6
- data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +18 -12
- data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +21 -11
- data/lib/elasticsearch/api/actions/ingest/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +12 -13
- data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +19 -14
- data/lib/elasticsearch/api/actions/ingest/simulate.rb +23 -13
- data/lib/elasticsearch/api/actions/mget.rb +37 -44
- data/lib/elasticsearch/api/actions/msearch.rb +54 -54
- data/lib/elasticsearch/api/actions/msearch_template.rb +46 -35
- data/lib/elasticsearch/api/actions/mtermvectors.rb +39 -35
- data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +30 -25
- data/lib/elasticsearch/api/actions/nodes/info.rb +29 -63
- data/lib/elasticsearch/api/actions/nodes/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +24 -22
- data/lib/elasticsearch/api/actions/nodes/shutdown.rb +4 -4
- data/lib/elasticsearch/api/actions/nodes/stats.rb +43 -36
- data/lib/elasticsearch/api/actions/nodes/usage.rb +31 -10
- data/lib/elasticsearch/api/actions/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/ping.rb +12 -13
- data/lib/elasticsearch/api/actions/put_script.rb +26 -30
- data/lib/elasticsearch/api/actions/rank_eval.rb +24 -15
- data/lib/elasticsearch/api/actions/reindex.rb +25 -48
- data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +18 -12
- data/lib/elasticsearch/api/actions/remote/info.rb +1 -2
- data/lib/elasticsearch/api/actions/render_search_template.rb +17 -15
- data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +8 -6
- data/lib/elasticsearch/api/actions/scroll.rb +28 -51
- data/lib/elasticsearch/api/actions/search.rb +104 -165
- data/lib/elasticsearch/api/actions/search_shards.rb +31 -28
- data/lib/elasticsearch/api/actions/search_template.rb +48 -40
- data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +44 -0
- data/lib/elasticsearch/api/actions/snapshot/create.rb +22 -29
- data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +19 -24
- data/lib/elasticsearch/api/actions/snapshot/delete.rb +20 -22
- data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +16 -18
- data/lib/elasticsearch/api/actions/snapshot/get.rb +22 -31
- data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +21 -25
- data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/snapshot/restore.rb +21 -32
- data/lib/elasticsearch/api/actions/snapshot/status.rb +23 -24
- data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +18 -13
- data/lib/elasticsearch/api/actions/tasks/cancel.rb +19 -13
- data/lib/elasticsearch/api/actions/tasks/get.rb +16 -13
- data/lib/elasticsearch/api/actions/tasks/list.rb +20 -18
- data/lib/elasticsearch/api/actions/tasks/params_registry.rb +0 -1
- data/lib/elasticsearch/api/actions/termvectors.rb +52 -70
- data/lib/elasticsearch/api/actions/update.rb +53 -98
- data/lib/elasticsearch/api/actions/update_by_query.rb +77 -66
- data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +17 -11
- data/lib/elasticsearch/api/version.rb +1 -1
- data/spec/elasticsearch/api/actions/cat/segments_spec.rb +9 -11
- data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/count_spec.rb +8 -8
- data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +12 -7
- data/spec/elasticsearch/api/actions/delete_script_spec.rb +0 -14
- data/spec/elasticsearch/api/actions/exists_document_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/get_document_source_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/index_document_spec.rb +6 -15
- data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +0 -4
- data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +1 -5
- data/spec/elasticsearch/api/actions/indices/clone_spec.rb +1 -1
- data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +2 -2
- data/spec/elasticsearch/api/actions/indices/get_spec.rb +0 -11
- data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/indices/stats_spec.rb +0 -1
- data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +3 -3
- data/spec/elasticsearch/api/actions/put_script_spec.rb +20 -15
- data/spec/elasticsearch/api/actions/render_search_template_spec.rb +23 -7
- data/spec/elasticsearch/api/actions/scroll_spec.rb +37 -0
- data/spec/elasticsearch/api/actions/search_spec.rb +0 -15
- data/spec/elasticsearch/api/actions/tasks/list_spec.rb +0 -11
- data/spec/elasticsearch/api/actions/update_document_spec.rb +3 -7
- data/spec/rest_yaml_tests_helper.rb +12 -0
- data/utils/Gemfile +1 -0
- data/utils/Thorfile +0 -1
- data/utils/thor/generate_source.rb +192 -85
- data/utils/thor/generator/endpoint_specifics.rb +157 -0
- data/utils/thor/generator/files_helper.rb +37 -0
- data/utils/thor/lister.rb +3 -4
- data/utils/thor/templates/_documentation_top.erb +27 -0
- data/utils/thor/templates/_method_setup.erb +35 -0
- data/utils/thor/templates/_params_registry.erb +12 -0
- data/utils/thor/templates/_perform_request.erb +37 -0
- data/utils/thor/templates/method.erb +59 -0
- data/utils/thor/templates/{ruby/test.erb → test.erb} +0 -0
- data/utils/thor/templates/{ruby/test_helper.rb → test_helper.rb} +0 -0
- metadata +19 -11
- data/spec/elasticsearch/api/actions/scoll_spec.rb +0 -21
- data/utils/thor/generate_api.rb +0 -193
- data/utils/thor/templates/ruby/method.erb +0 -62
@@ -5,109 +5,80 @@
|
|
5
5
|
module Elasticsearch
|
6
6
|
module API
|
7
7
|
module Actions
|
8
|
+
# Creates or updates a document in an index.
|
9
|
+
#
|
10
|
+
# @option arguments [String] :id Document ID
|
11
|
+
# @option arguments [String] :index The name of the index
|
12
|
+
# @option arguments [String] :type The type of the document *Deprecated*
|
13
|
+
# @option arguments [String] :wait_for_active_shards Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|
14
|
+
# @option arguments [String] :op_type Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID
|
15
|
+
# (options: index,create)
|
16
|
+
|
17
|
+
# @option arguments [String] :refresh If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|
18
|
+
# (options: true,false,wait_for)
|
8
19
|
|
9
|
-
# Create or update a document.
|
10
|
-
#
|
11
|
-
# The `index` API will either _create_ a new document, or _update_ an existing one, when a document `:id`
|
12
|
-
# is passed. When creating a document, an ID will be auto-generated, when it's not passed as an argument.
|
13
|
-
#
|
14
|
-
# You can specifically enforce the _create_ operation by setting the `op_type` argument to `create`, or
|
15
|
-
# by using the {Actions#create} method.
|
16
|
-
#
|
17
|
-
# Optimistic concurrency control is performed, when the `version` argument is specified. By default,
|
18
|
-
# no version checks are performed.
|
19
|
-
#
|
20
|
-
# By default, the document will be available for {Actions#get} immediately, for {Actions#search} only
|
21
|
-
# after an index refresh operation has been performed (either automatically or manually).
|
22
|
-
#
|
23
|
-
# @example Create or update a document `myindex/mytype/1`
|
24
|
-
#
|
25
|
-
# client.index index: 'myindex',
|
26
|
-
# type: 'mytype',
|
27
|
-
# id: '1',
|
28
|
-
# body: {
|
29
|
-
# title: 'Test 1',
|
30
|
-
# tags: ['y', 'z'],
|
31
|
-
# published: true,
|
32
|
-
# published_at: Time.now.utc.iso8601,
|
33
|
-
# counter: 1
|
34
|
-
# }
|
35
|
-
#
|
36
|
-
# @example Refresh the index after the operation (useful e.g. in integration tests)
|
37
|
-
#
|
38
|
-
# client.index index: 'myindex', type: 'mytype', id: '1', body: { title: 'TEST' }, refresh: true
|
39
|
-
# client.search index: 'myindex', q: 'title:test'
|
40
|
-
#
|
41
|
-
# @example Create a document with a specific expiration time (TTL)
|
42
|
-
#
|
43
|
-
# # Decrease the default housekeeping interval first:
|
44
|
-
# client.cluster.put_settings body: { transient: { 'indices.ttl.interval' => '1s' } }
|
45
|
-
#
|
46
|
-
# # Enable the `_ttl` property for all types within the index
|
47
|
-
# client.indices.create index: 'myindex', body: { mappings: { properties: { _ttl: { enabled: true } } } }
|
48
|
-
#
|
49
|
-
# client.index index: 'myindex', type: 'mytype', id: '1', body: { title: 'TEST' }, ttl: '5s'
|
50
|
-
#
|
51
|
-
# sleep 3 and client.get index: 'myindex', type: 'mytype', id: '1'
|
52
|
-
# # => {"_index"=>"myindex" ... "_source"=>{"title"=>"TEST"}}
|
53
|
-
#
|
54
|
-
# sleep 3 and client.get index: 'myindex', type: 'mytype', id: '1'
|
55
|
-
# # => Elasticsearch::Transport::Transport::Errors::NotFound: [404] ...
|
56
|
-
#
|
57
|
-
# @option arguments [String] :id Document ID (optional, will be auto-generated if missing)
|
58
|
-
# @option arguments [String] :index The name of the index (*Required*)
|
59
|
-
# @option arguments [String] :type The type of the document (*Required*)
|
60
|
-
# @option arguments [Hash] :body The document
|
61
|
-
# @option arguments [String] :consistency Explicit write consistency setting for the operation
|
62
|
-
# (options: one, quorum, all)
|
63
|
-
# @option arguments [Boolean] :include_type_name Whether a type should be expected in the body of the mappings.
|
64
|
-
# @option arguments [String] :op_type Explicit operation type (options: index, create)
|
65
|
-
# @option arguments [String] :parent ID of the parent document
|
66
|
-
# @option arguments [String] :percolate Percolator queries to execute while indexing the document
|
67
|
-
# @option arguments [Boolean] :refresh Refresh the index after performing the operation
|
68
|
-
# @option arguments [String] :replication Specific replication type (options: sync, async)
|
69
20
|
# @option arguments [String] :routing Specific routing value
|
70
21
|
# @option arguments [Time] :timeout Explicit operation timeout
|
71
|
-
# @option arguments [Time] :timestamp Explicit timestamp for the document
|
72
|
-
# @option arguments [Duration] :ttl Expiration time for the document
|
73
22
|
# @option arguments [Number] :version Explicit version number for concurrency control
|
74
|
-
# @option arguments [String] :version_type Specific version type
|
23
|
+
# @option arguments [String] :version_type Specific version type
|
24
|
+
# (options: internal,external,external_gte)
|
25
|
+
|
26
|
+
# @option arguments [Number] :if_seq_no only perform the index operation if the last operation that has changed the document has the specified sequence number
|
27
|
+
# @option arguments [Number] :if_primary_term only perform the index operation if the last operation that has changed the document has the specified primary term
|
28
|
+
# @option arguments [String] :pipeline The pipeline id to preprocess incoming documents with
|
29
|
+
|
30
|
+
# @option arguments [Hash] :body The document (*Required*)
|
75
31
|
#
|
76
|
-
#
|
32
|
+
# *Deprecation notice*:
|
33
|
+
# Specifying types in urls has been deprecated
|
34
|
+
# Deprecated since version 7.0.0
|
77
35
|
#
|
78
|
-
|
36
|
+
#
|
37
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-index_.html
|
38
|
+
#
|
39
|
+
def index(arguments = {})
|
40
|
+
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
|
79
41
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
80
|
-
arguments[:type] ||= DEFAULT_DOC
|
81
|
-
method = arguments[:id] ? HTTP_PUT : HTTP_POST
|
82
|
-
path = Utils.__pathify Utils.__escape(arguments[:index]),
|
83
|
-
Utils.__escape(arguments[:type]),
|
84
|
-
Utils.__escape(arguments[:id])
|
85
42
|
|
43
|
+
arguments = arguments.clone
|
44
|
+
|
45
|
+
_id = arguments.delete(:id)
|
46
|
+
|
47
|
+
_index = arguments.delete(:index)
|
48
|
+
|
49
|
+
_type = arguments.delete(:type)
|
50
|
+
|
51
|
+
method = _id ? Elasticsearch::API::HTTP_PUT : Elasticsearch::API::HTTP_POST
|
52
|
+
path = if _index && _type && _id
|
53
|
+
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/#{Utils.__listify(_id)}"
|
54
|
+
elsif _index && _id
|
55
|
+
"#{Utils.__listify(_index)}/_doc/#{Utils.__listify(_id)}"
|
56
|
+
elsif _index && _type
|
57
|
+
"#{Utils.__listify(_index)}/#{Utils.__listify(_type)}"
|
58
|
+
else
|
59
|
+
"#{Utils.__listify(_index)}/_doc"
|
60
|
+
end
|
86
61
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
87
|
-
|
62
|
+
|
63
|
+
body = arguments[:body]
|
88
64
|
perform_request(method, path, params, body).body
|
89
65
|
end
|
90
66
|
|
91
67
|
# Register this action with its valid params when the module is loaded.
|
92
68
|
#
|
93
|
-
# @since 6.
|
69
|
+
# @since 6.2.0
|
94
70
|
ParamsRegistry.register(:index, [
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
:version,
|
108
|
-
:version_type,
|
109
|
-
:if_seq_no,
|
110
|
-
:if_primary_term ].freeze)
|
71
|
+
:wait_for_active_shards,
|
72
|
+
:op_type,
|
73
|
+
:refresh,
|
74
|
+
:routing,
|
75
|
+
:timeout,
|
76
|
+
:version,
|
77
|
+
:version_type,
|
78
|
+
:if_seq_no,
|
79
|
+
:if_primary_term,
|
80
|
+
:pipeline
|
81
|
+
].freeze)
|
82
|
+
end
|
111
83
|
end
|
112
|
-
end
|
113
84
|
end
|
@@ -6,68 +6,39 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Return the result of the analysis process (tokens)
|
11
|
-
#
|
12
|
-
# Allows to "test-drive" the Elasticsearch analysis process by performing the analysis on the
|
13
|
-
# same text with different analyzers. An ad-hoc analysis chain can be built from specific
|
14
|
-
# _tokenizer_ and _filters_.
|
15
|
-
#
|
16
|
-
# @example Analyze text "Quick Brown Jumping Fox" with the _snowball_ analyzer
|
17
|
-
#
|
18
|
-
# client.indices.analyze text: 'The Quick Brown Jumping Fox', analyzer: 'snowball'
|
19
|
-
#
|
20
|
-
# @example Analyze text "Quick Brown Jumping Fox" with a custom tokenizer and filter chain
|
21
|
-
#
|
22
|
-
# client.indices.analyze body: { text: 'The Quick Brown Jumping Fox',
|
23
|
-
# tokenizer: 'whitespace',
|
24
|
-
# filter: ['lowercase','stop'] }
|
25
|
-
#
|
26
|
-
# @note If your text for analysis is longer than 4096 bytes then you should use the :body argument, rather than :text, to avoid HTTP transport errors
|
27
|
-
#
|
28
|
-
# @example Analyze text "Quick <b>Brown</b> Jumping Fox" with custom tokenizer, token and character filters
|
29
|
-
#
|
30
|
-
# client.indices.analyze body: { text: 'The Quick <b>Brown</b> Jumping Fox',
|
31
|
-
# tokenizer: 'standard',
|
32
|
-
# char_filter: ['html_strip'] }
|
9
|
+
# Performs the analysis process on a text and return the tokens breakdown of the text.
|
33
10
|
#
|
34
11
|
# @option arguments [String] :index The name of the index to scope the operation
|
35
|
-
# @option arguments [String] :body The text on which the analysis should be performed
|
36
|
-
# @option arguments [String] :analyzer The name of the analyzer to use
|
37
|
-
# @option arguments [String] :field Use the analyzer configured for this field
|
38
|
-
# (instead of passing the analyzer name)
|
39
|
-
# @option arguments [List] :filters A comma-separated list of token filters to use for the analysis.
|
40
|
-
# (Also available as the `:token_filters` option)
|
41
|
-
# @option arguments [List] :char_filters A comma-separated list of char filters to use for the analysis
|
42
|
-
# @option arguments [Boolean] :explain Whether to output further details (default: false)
|
43
|
-
# @option arguments [List] :attributes A comma-separated list of token attributes to output (use with `:explain`)
|
44
12
|
# @option arguments [String] :index The name of the index to scope the operation
|
45
|
-
|
46
|
-
#
|
47
|
-
# @option arguments [String] :text The text on which the analysis should be performed
|
48
|
-
# (when request body is not used)
|
49
|
-
# @option arguments [String] :tokenizer The name of the tokenizer to use for the analysis
|
13
|
+
|
14
|
+
# @option arguments [Hash] :body Define analyzer/tokenizer parameters and the text on which the analysis should be performed
|
50
15
|
#
|
51
|
-
# @see https://www.elastic.co/guide/reference/
|
16
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-analyze.html
|
52
17
|
#
|
53
|
-
def analyze(arguments={})
|
54
|
-
|
55
|
-
path = Utils.__pathify Utils.__listify(arguments[:index]), '_analyze'
|
18
|
+
def analyze(arguments = {})
|
19
|
+
arguments = arguments.clone
|
56
20
|
|
57
|
-
|
58
|
-
params[:filters] = Utils.__listify(params[:filters]) if params[:filters]
|
21
|
+
_index = arguments.delete(:index)
|
59
22
|
|
60
|
-
|
23
|
+
method = Elasticsearch::API::HTTP_GET
|
24
|
+
path = if _index
|
25
|
+
"#{Utils.__listify(_index)}/_analyze"
|
26
|
+
else
|
27
|
+
"_analyze"
|
28
|
+
end
|
29
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
61
30
|
|
31
|
+
body = arguments[:body]
|
62
32
|
perform_request(method, path, params, body).body
|
63
33
|
end
|
64
34
|
|
65
35
|
# Register this action with its valid params when the module is loaded.
|
66
36
|
#
|
67
|
-
# @since 6.
|
37
|
+
# @since 6.2.0
|
68
38
|
ParamsRegistry.register(:analyze, [
|
69
|
-
|
39
|
+
:index
|
40
|
+
].freeze)
|
41
|
+
end
|
70
42
|
end
|
71
|
-
end
|
72
43
|
end
|
73
44
|
end
|
@@ -6,66 +6,54 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Clear caches and other auxiliary data structures.
|
11
|
-
#
|
12
|
-
# Can be performed against a specific index, or against all indices.
|
13
|
-
#
|
14
|
-
# By default, all caches and data structures will be cleared.
|
15
|
-
# Pass a specific cache or structure name to clear just a single one.
|
16
|
-
#
|
17
|
-
# @example Clear all caches and data structures
|
18
|
-
#
|
19
|
-
# client.indices.clear_cache
|
20
|
-
#
|
21
|
-
# @example Clear the field data structure only
|
22
|
-
#
|
23
|
-
# client.indices.clear_cache field_data: true
|
24
|
-
#
|
25
|
-
# @example Clear only specific field in the field data structure
|
26
|
-
#
|
27
|
-
# client.indices.clear_cache field_data: true, fields: 'created_at', filter_cache: false, id_cache: false
|
9
|
+
# Clears all or specific caches for one or more indices.
|
28
10
|
#
|
29
11
|
# @option arguments [List] :index A comma-separated list of index name to limit the operation
|
30
|
-
# @option arguments [Boolean] :field_data Clear field data
|
31
12
|
# @option arguments [Boolean] :fielddata Clear field data
|
32
|
-
# @option arguments [List] :fields A comma-separated list of fields to clear when using the `
|
13
|
+
# @option arguments [List] :fields A comma-separated list of fields to clear when using the `fielddata` parameter (default: all)
|
33
14
|
# @option arguments [Boolean] :query Clear query caches
|
34
15
|
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
35
16
|
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
36
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
17
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
18
|
+
# (options: open,closed,none,all)
|
19
|
+
|
37
20
|
# @option arguments [List] :index A comma-separated list of index name to limit the operation
|
38
|
-
# @option arguments [Boolean] :recycler Clear the recycler cache
|
39
|
-
# @option arguments [Boolean] :request_cache Clear request cache
|
40
21
|
# @option arguments [Boolean] :request Clear request cache
|
22
|
+
|
41
23
|
#
|
42
|
-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/
|
24
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-clearcache.html
|
43
25
|
#
|
44
|
-
def clear_cache(arguments={})
|
45
|
-
|
46
|
-
path = Utils.__pathify Utils.__listify(arguments[:index]), '_cache/clear'
|
26
|
+
def clear_cache(arguments = {})
|
27
|
+
arguments = arguments.clone
|
47
28
|
|
48
|
-
|
49
|
-
body = nil
|
29
|
+
_index = arguments.delete(:index)
|
50
30
|
|
51
|
-
|
31
|
+
method = Elasticsearch::API::HTTP_POST
|
32
|
+
path = if _index
|
33
|
+
"#{Utils.__listify(_index)}/_cache/clear"
|
34
|
+
else
|
35
|
+
"_cache/clear"
|
36
|
+
end
|
37
|
+
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
52
38
|
|
39
|
+
body = nil
|
53
40
|
perform_request(method, path, params, body).body
|
54
41
|
end
|
55
42
|
|
56
43
|
# Register this action with its valid params when the module is loaded.
|
57
44
|
#
|
58
|
-
# @since 6.
|
45
|
+
# @since 6.2.0
|
59
46
|
ParamsRegistry.register(:clear_cache, [
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
47
|
+
:fielddata,
|
48
|
+
:fields,
|
49
|
+
:query,
|
50
|
+
:ignore_unavailable,
|
51
|
+
:allow_no_indices,
|
52
|
+
:expand_wildcards,
|
53
|
+
:index,
|
54
|
+
:request
|
55
|
+
].freeze)
|
56
|
+
end
|
68
57
|
end
|
69
|
-
end
|
70
58
|
end
|
71
59
|
end
|
@@ -6,45 +6,45 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Clone an existing index into a new index, where each original primary shard is cloned into a
|
11
|
-
# new primary shard in the new index.
|
12
|
-
#
|
13
|
-
# @example Clone index named _myindex_
|
9
|
+
# Clones an index
|
14
10
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# @option arguments [String] :index The name of the source index to clone (*Required*)
|
18
|
-
# @option arguments [String] :target The name of the target index to clone into (*Required*)
|
11
|
+
# @option arguments [String] :index The name of the source index to clone
|
12
|
+
# @option arguments [String] :target The name of the target index to clone into
|
19
13
|
# @option arguments [Time] :timeout Explicit operation timeout
|
20
14
|
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
21
|
-
# @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on
|
22
|
-
|
15
|
+
# @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the cloned index before the operation returns.
|
16
|
+
|
23
17
|
# @option arguments [Hash] :body The configuration for the target index (`settings` and `aliases`)
|
24
18
|
#
|
25
|
-
# @see
|
19
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-clone-index.html
|
26
20
|
#
|
27
|
-
def clone(arguments={})
|
21
|
+
def clone(arguments = {})
|
28
22
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
29
23
|
raise ArgumentError, "Required argument 'target' missing" unless arguments[:target]
|
30
|
-
|
24
|
+
|
31
25
|
arguments = arguments.clone
|
32
26
|
|
33
|
-
|
34
|
-
|
27
|
+
_index = arguments.delete(:index)
|
28
|
+
|
29
|
+
_target = arguments.delete(:target)
|
30
|
+
|
31
|
+
method = Elasticsearch::API::HTTP_PUT
|
32
|
+
path = "#{Utils.__listify(_index)}/_clone/#{Utils.__listify(_target)}"
|
35
33
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
36
34
|
|
35
|
+
body = arguments[:body]
|
37
36
|
perform_request(method, path, params, body).body
|
38
37
|
end
|
39
38
|
|
40
39
|
# Register this action with its valid params when the module is loaded.
|
41
40
|
#
|
42
|
-
# @since
|
41
|
+
# @since 6.2.0
|
43
42
|
ParamsRegistry.register(:clone, [
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
:timeout,
|
44
|
+
:master_timeout,
|
45
|
+
:wait_for_active_shards
|
46
|
+
].freeze)
|
47
|
+
end
|
47
48
|
end
|
48
|
-
end
|
49
49
|
end
|
50
50
|
end
|
@@ -6,52 +6,48 @@ module Elasticsearch
|
|
6
6
|
module API
|
7
7
|
module Indices
|
8
8
|
module Actions
|
9
|
-
|
10
|
-
# Close an index (keep the data on disk, but deny operations with the index).
|
11
|
-
#
|
12
|
-
# A closed index can be opened again with the {Indices::Actions#close} API.
|
13
|
-
#
|
14
|
-
# @example Close index named _myindex_
|
9
|
+
# Closes an index.
|
15
10
|
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# @option arguments [List] :index A comma separated list of indices to perform the operation on
|
19
|
-
# (*Required*)
|
20
|
-
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into
|
21
|
-
# no concrete indices. (This includes `_all` string or when no
|
22
|
-
# indices have been specified)
|
23
|
-
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that
|
24
|
-
# are open, closed or both. (options: open, closed)
|
25
|
-
# @option arguments [String] :ignore_indices When performed on multiple indices, allows to ignore
|
26
|
-
# `missing` ones (options: none, missing) @until 1.0
|
27
|
-
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
|
28
|
-
# unavailable (missing, closed, etc)
|
11
|
+
# @option arguments [List] :index A comma separated list of indices to close
|
29
12
|
# @option arguments [Time] :timeout Explicit operation timeout
|
13
|
+
# @option arguments [Time] :master_timeout Specify timeout for connection to master
|
14
|
+
# @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
15
|
+
# @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
16
|
+
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
17
|
+
# (options: open,closed,none,all)
|
18
|
+
|
19
|
+
# @option arguments [String] :wait_for_active_shards Sets the number of active shards to wait for before the operation returns.
|
20
|
+
|
30
21
|
#
|
31
|
-
# @see https://www.elastic.co/guide/reference/
|
22
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-open-close.html
|
32
23
|
#
|
33
|
-
def close(arguments={})
|
24
|
+
def close(arguments = {})
|
34
25
|
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
|
35
|
-
method = HTTP_POST
|
36
|
-
path = Utils.__pathify Utils.__listify(arguments[:index]), '_close'
|
37
26
|
|
27
|
+
arguments = arguments.clone
|
28
|
+
|
29
|
+
_index = arguments.delete(:index)
|
30
|
+
|
31
|
+
method = Elasticsearch::API::HTTP_POST
|
32
|
+
path = "#{Utils.__listify(_index)}/_close"
|
38
33
|
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
|
39
|
-
body = nil
|
40
34
|
|
35
|
+
body = nil
|
41
36
|
perform_request(method, path, params, body).body
|
42
37
|
end
|
43
38
|
|
44
39
|
# Register this action with its valid params when the module is loaded.
|
45
40
|
#
|
46
|
-
# @since 6.
|
41
|
+
# @since 6.2.0
|
47
42
|
ParamsRegistry.register(:close, [
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
43
|
+
:timeout,
|
44
|
+
:master_timeout,
|
45
|
+
:ignore_unavailable,
|
46
|
+
:allow_no_indices,
|
47
|
+
:expand_wildcards,
|
48
|
+
:wait_for_active_shards
|
49
|
+
].freeze)
|
50
|
+
end
|
54
51
|
end
|
55
|
-
end
|
56
52
|
end
|
57
53
|
end
|