logstash-input-elasticsearch 4.22.0 → 5.0.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/CHANGELOG.md +7 -12
- data/docs/index.asciidoc +19 -233
- data/lib/logstash/inputs/elasticsearch/aggregation.rb +8 -11
- data/lib/logstash/inputs/elasticsearch/paginated_search.rb +2 -12
- data/lib/logstash/inputs/elasticsearch.rb +21 -137
- data/logstash-input-elasticsearch.gemspec +3 -3
- data/spec/fixtures/test_certs/ca.crt +18 -17
- data/spec/fixtures/test_certs/ca.der.sha256 +1 -1
- data/spec/fixtures/test_certs/es.crt +18 -17
- data/spec/inputs/elasticsearch_spec.rb +22 -126
- data/spec/inputs/integration/elasticsearch_spec.rb +2 -10
- metadata +3 -18
- data/lib/logstash/inputs/elasticsearch/cursor_tracker.rb +0 -58
- data/spec/fixtures/test_certs/GENERATED_AT +0 -1
- data/spec/fixtures/test_certs/es.chain.crt +0 -38
- data/spec/fixtures/test_certs/renew.sh +0 -15
- data/spec/inputs/cursor_tracker_spec.rb +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b34b6c6d814152e88f320525ea0bb80bbf1e63ff962e022aaac0a2385dd087b6
|
4
|
+
data.tar.gz: d142df9148ad69bf838d62badeec71382118741938db61e6aad0676bdb918a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19b2b1325ded83b5b93966365f855f104ba1881f2c991ffdbe92216e08d12d18a7b3ddd4a14d755f6d55c85c98e00d12ca566188c63706d6db1f0aa5b085048b
|
7
|
+
data.tar.gz: ff5de17e75281d8ddd0be70167f2c4dee0a90eef328c7e486b704e79fe10db7b7108b733f77438386a7abb18d504efbef5aaf7b0f34a6c8edd62791640514b7b
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
##
|
2
|
-
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
- Fix: prevent plugin crash when hits contain illegal structure [#183](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/183)
|
9
|
-
- When a hit cannot be converted to an event, the input now emits an event tagged with `_elasticsearch_input_failure` with an `[event][original]` containing a JSON-encoded string representation of the entire hit.
|
10
|
-
|
11
|
-
## 4.21.0
|
12
|
-
- Add support for custom headers [#217](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/217)
|
1
|
+
## 5.0.0
|
2
|
+
- SSL settings that were marked deprecated in version `4.17.0` are now marked obsolete, and will prevent the plugin from starting.
|
3
|
+
- These settings are:
|
4
|
+
- `ssl`, which should bre replaced by `ssl_enabled`
|
5
|
+
- `ca_file`, which should bre replaced by `ssl_certificate_authorities`
|
6
|
+
- `ssl_certificate_verification`, which should bre replaced by `ssl_verification_mode`
|
7
|
+
- [#213](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/213)
|
13
8
|
|
14
9
|
## 4.20.5
|
15
10
|
- Add `x-elastic-product-origin` header to Elasticsearch requests [#211](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/211)
|
data/docs/index.asciidoc
CHANGED
@@ -48,7 +48,7 @@ This would create an Elasticsearch query with the following format:
|
|
48
48
|
"sort": [ "_doc" ]
|
49
49
|
}'
|
50
50
|
|
51
|
-
|
51
|
+
|
52
52
|
==== Scheduling
|
53
53
|
|
54
54
|
Input from this plugin can be scheduled to run periodically according to a specific
|
@@ -93,147 +93,16 @@ The plugin logs a warning when ECS is enabled and `target` isn't set.
|
|
93
93
|
|
94
94
|
TIP: Set the `target` option to avoid potential schema conflicts.
|
95
95
|
|
96
|
-
[id="plugins-{type}s-{plugin}-failure-handling"]
|
97
|
-
==== Failure handling
|
98
|
-
|
99
|
-
When this input plugin cannot create a structured `Event` from a hit result, it will instead create an `Event` that is tagged with `_elasticsearch_input_failure` whose `[event][original]` is a JSON-encoded string representation of the entire hit.
|
100
|
-
|
101
|
-
Common causes are:
|
102
|
-
|
103
|
-
- When the hit result contains top-level fields that are {logstash-ref}/processing.html#reserved-fields[reserved in Logstash] but do not have the expected shape. Use the <<plugins-{type}s-{plugin}-target>> directive to avoid conflicts with the top-level namespace.
|
104
|
-
- When <<plugins-{type}s-{plugin}-docinfo>> is enabled and the docinfo fields cannot be merged into the hit result. Combine <<plugins-{type}s-{plugin}-target>> and <<plugins-{type}s-{plugin}-docinfo_target>> to avoid conflict.
|
105
|
-
|
106
|
-
[id="plugins-{type}s-{plugin}-cursor"]
|
107
|
-
==== Tracking a field's value across runs
|
108
|
-
|
109
|
-
.Technical Preview: Tracking a field's value
|
110
|
-
****
|
111
|
-
The feature that allows tracking a field's value across runs is in _Technical Preview_.
|
112
|
-
Configuration options and implementation details are subject to change in minor releases without being preceded by deprecation warnings.
|
113
|
-
****
|
114
|
-
|
115
|
-
Some uses cases require tracking the value of a particular field between two jobs.
|
116
|
-
Examples include:
|
117
|
-
|
118
|
-
* avoiding the need to re-process the entire result set of a long query after an unplanned restart
|
119
|
-
* grabbing only new data from an index instead of processing the entire set on each job.
|
120
|
-
|
121
|
-
The Elasticsearch input plugin provides the <<plugins-{type}s-{plugin}-tracking_field>> and <<plugins-{type}s-{plugin}-tracking_field_seed>> options.
|
122
|
-
When <<plugins-{type}s-{plugin}-tracking_field>> is set, the plugin records the value of that field for the last document retrieved in a run into
|
123
|
-
a file.
|
124
|
-
(The file location defaults to <<plugins-{type}s-{plugin}-last_run_metadata_path>>.)
|
125
|
-
|
126
|
-
You can then inject this value in the query using the placeholder `:last_value`.
|
127
|
-
The value will be injected into the query before execution, and then updated after the query completes if new data was found.
|
128
|
-
|
129
|
-
This feature works best when:
|
130
|
-
|
131
|
-
* the query sorts by the tracking field,
|
132
|
-
* the timestamp field is added by {es}, and
|
133
|
-
* the field type has enough resolution so that two events are unlikely to have the same value.
|
134
|
-
|
135
|
-
Consider using a tracking field whose type is https://www.elastic.co/guide/en/elasticsearch/reference/current/date_nanos.html[date nanoseconds].
|
136
|
-
If the tracking field is of this data type, you can use an extra placeholder called `:present` to inject the nano-second based value of "now-30s".
|
137
|
-
This placeholder is useful as the right-hand side of a range filter, allowing the collection of
|
138
|
-
new data but leaving partially-searchable bulk request data to the next scheduled job.
|
139
|
-
|
140
|
-
[id="plugins-{type}s-{plugin}-tracking-sample"]
|
141
|
-
===== Sample configuration: Track field value across runs
|
142
|
-
|
143
|
-
This section contains a series of steps to help you set up the "tailing" of data being written to a set of indices, using a date nanosecond field added by an Elasticsearch ingest pipeline and the `tracking_field` capability of this plugin.
|
144
|
-
|
145
|
-
. Create ingest pipeline that adds Elasticsearch's `_ingest.timestamp` field to the documents as `event.ingested`:
|
146
|
-
+
|
147
|
-
[source, json]
|
148
|
-
PUT _ingest/pipeline/my-pipeline
|
149
|
-
{
|
150
|
-
"processors": [
|
151
|
-
{
|
152
|
-
"script": {
|
153
|
-
"lang": "painless",
|
154
|
-
"source": "ctx.putIfAbsent(\"event\", [:]); ctx.event.ingested = metadata().now.format(DateTimeFormatter.ISO_INSTANT);"
|
155
|
-
}
|
156
|
-
}
|
157
|
-
]
|
158
|
-
}
|
159
|
-
|
160
|
-
[start=2]
|
161
|
-
. Create an index mapping where the tracking field is of date nanosecond type and invokes the defined pipeline:
|
162
|
-
+
|
163
|
-
[source, json]
|
164
|
-
PUT /_template/my_template
|
165
|
-
{
|
166
|
-
"index_patterns": ["test-*"],
|
167
|
-
"settings": {
|
168
|
-
"index.default_pipeline": "my-pipeline",
|
169
|
-
},
|
170
|
-
"mappings": {
|
171
|
-
"properties": {
|
172
|
-
"event": {
|
173
|
-
"properties": {
|
174
|
-
"ingested": {
|
175
|
-
"type": "date_nanos",
|
176
|
-
"format": "strict_date_optional_time_nanos"
|
177
|
-
}
|
178
|
-
}
|
179
|
-
}
|
180
|
-
}
|
181
|
-
}
|
182
|
-
}
|
183
|
-
|
184
|
-
[start=3]
|
185
|
-
. Define a query that looks at all data of the indices, sorted by the tracking field, and with a range filter since the last value seen until present:
|
186
|
-
+
|
187
|
-
[source,json]
|
188
|
-
{
|
189
|
-
"query": {
|
190
|
-
"range": {
|
191
|
-
"event.ingested": {
|
192
|
-
"gt": ":last_value",
|
193
|
-
"lt": ":present"
|
194
|
-
}
|
195
|
-
}
|
196
|
-
},
|
197
|
-
"sort": [
|
198
|
-
{
|
199
|
-
"event.ingested": {
|
200
|
-
"order": "asc",
|
201
|
-
"format": "strict_date_optional_time_nanos",
|
202
|
-
"numeric_type": "date_nanos"
|
203
|
-
}
|
204
|
-
}
|
205
|
-
]
|
206
|
-
}
|
207
|
-
|
208
|
-
[start=4]
|
209
|
-
. Configure the Elasticsearch input to query the indices with the query defined above, every minute, and track the `event.ingested` field:
|
210
|
-
+
|
211
|
-
[source, ruby]
|
212
|
-
input {
|
213
|
-
elasticsearch {
|
214
|
-
id => tail_test_index
|
215
|
-
hosts => [ 'https://..']
|
216
|
-
api_key => '....'
|
217
|
-
index => 'test-*'
|
218
|
-
query => '{ "query": { "range": { "event.ingested": { "gt": ":last_value", "lt": ":present"}}}, "sort": [ { "event.ingested": {"order": "asc", "format": "strict_date_optional_time_nanos", "numeric_type" : "date_nanos" } } ] }'
|
219
|
-
tracking_field => "[event][ingested]"
|
220
|
-
slices => 5 # optional use of slices to speed data processing, should be equal to or less than number of primary shards
|
221
|
-
schedule => '* * * * *' # every minute
|
222
|
-
schedule_overlap => false # don't accumulate jobs if one takes longer than 1 minute
|
223
|
-
}
|
224
|
-
}
|
225
|
-
|
226
|
-
With this sample setup, new documents are indexed into a `test-*` index.
|
227
|
-
The next scheduled run:
|
228
|
-
|
229
|
-
* selects all new documents since the last observed value of the tracking field,
|
230
|
-
* uses {ref}/point-in-time-api.html#point-in-time-api[Point in time (PIT)] + {ref}/paginate-search-results.html#search-after[Search after] to paginate through all the data, and
|
231
|
-
* updates the value of the field at the end of the pagination.
|
232
|
-
|
233
96
|
[id="plugins-{type}s-{plugin}-options"]
|
234
97
|
==== Elasticsearch Input configuration options
|
235
98
|
|
236
|
-
This plugin supports
|
99
|
+
This plugin supports these configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
|
100
|
+
|
101
|
+
NOTE: As of version `5.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed.
|
102
|
+
Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.
|
103
|
+
|
104
|
+
NOTE: As of version `5.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed.
|
105
|
+
Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.
|
237
106
|
|
238
107
|
[cols="<,<,<",options="header",]
|
239
108
|
|=======================================================================
|
@@ -250,14 +119,12 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
250
119
|
| <<plugins-{type}s-{plugin}-ecs_compatibility>> |<<string,string>>|No
|
251
120
|
| <<plugins-{type}s-{plugin}-hosts>> |<<array,array>>|No
|
252
121
|
| <<plugins-{type}s-{plugin}-index>> |<<string,string>>|No
|
253
|
-
| <<plugins-{type}s-{plugin}-last_run_metadata_path>> |<<string,string>>|No
|
254
122
|
| <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
|
255
123
|
| <<plugins-{type}s-{plugin}-proxy>> |<<uri,uri>>|No
|
256
124
|
| <<plugins-{type}s-{plugin}-query>> |<<string,string>>|No
|
257
125
|
| <<plugins-{type}s-{plugin}-response_type>> |<<string,string>>, one of `["hits","aggregations"]`|No
|
258
126
|
| <<plugins-{type}s-{plugin}-request_timeout_seconds>> | <<number,number>>|No
|
259
127
|
| <<plugins-{type}s-{plugin}-schedule>> |<<string,string>>|No
|
260
|
-
| <<plugins-{type}s-{plugin}-schedule_overlap>> |<<boolean,boolean>>|No
|
261
128
|
| <<plugins-{type}s-{plugin}-scroll>> |<<string,string>>|No
|
262
129
|
| <<plugins-{type}s-{plugin}-search_api>> |<<string,string>>, one of `["auto", "search_after", "scroll"]`|No
|
263
130
|
| <<plugins-{type}s-{plugin}-size>> |<<number,number>>|No
|
@@ -277,8 +144,6 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
277
144
|
| <<plugins-{type}s-{plugin}-ssl_verification_mode>> |<<string,string>>, one of `["full", "none"]`|No
|
278
145
|
| <<plugins-{type}s-{plugin}-socket_timeout_seconds>> | <<number,number>>|No
|
279
146
|
| <<plugins-{type}s-{plugin}-target>> | {logstash-ref}/field-references-deepdive.html[field reference] | No
|
280
|
-
| <<plugins-{type}s-{plugin}-tracking_field>> |<<string,string>>|No
|
281
|
-
| <<plugins-{type}s-{plugin}-tracking_field_seed>> |<<string,string>>|No
|
282
147
|
| <<plugins-{type}s-{plugin}-retries>> | <<number,number>>|No
|
283
148
|
| <<plugins-{type}s-{plugin}-user>> |<<string,string>>|No
|
284
149
|
|=======================================================================
|
@@ -458,17 +323,6 @@ Check out {ref}/api-conventions.html#api-multi-index[Multi Indices
|
|
458
323
|
documentation] in the Elasticsearch documentation for info on
|
459
324
|
referencing multiple indices.
|
460
325
|
|
461
|
-
[id="plugins-{type}s-{plugin}-last_run_metadata_path"]
|
462
|
-
===== `last_run_metadata_path`
|
463
|
-
|
464
|
-
* Value type is <<string,string>>
|
465
|
-
* There is no default value for this setting.
|
466
|
-
|
467
|
-
The path to store the last observed value of the tracking field, when used.
|
468
|
-
By default this file is stored as `<path.data>/plugins/inputs/elasticsearch/<pipeline_id>/last_run_value`.
|
469
|
-
|
470
|
-
This setting should point to file, not a directory, and Logstash must have read+write access to this file.
|
471
|
-
|
472
326
|
[id="plugins-{type}s-{plugin}-password"]
|
473
327
|
===== `password`
|
474
328
|
|
@@ -549,19 +403,6 @@ for example: "* * * * *" (execute query every minute, on the minute)
|
|
549
403
|
There is no schedule by default. If no schedule is given, then the statement is run
|
550
404
|
exactly once.
|
551
405
|
|
552
|
-
[id="plugins-{type}s-{plugin}-schedule_overlap"]
|
553
|
-
===== `schedule_overlap`
|
554
|
-
|
555
|
-
* Value type is <<boolean,boolean>>
|
556
|
-
* Default value is `true`
|
557
|
-
|
558
|
-
Whether to allow queuing of a scheduled run if a run is occurring.
|
559
|
-
While this is ideal for ensuring a new run happens immediately after the previous on finishes if there
|
560
|
-
is a lot of work to do, but given the queue is unbounded it may lead to an out of memory over long periods of time
|
561
|
-
if the queue grows continuously.
|
562
|
-
|
563
|
-
When in doubt, set `schedule_overlap` to false (it may become the default value in the future).
|
564
|
-
|
565
406
|
[id="plugins-{type}s-{plugin}-scroll"]
|
566
407
|
===== `scroll`
|
567
408
|
|
@@ -654,6 +495,8 @@ Enable SSL/TLS secured communication to Elasticsearch cluster.
|
|
654
495
|
Leaving this unspecified will use whatever scheme is specified in the URLs listed in <<plugins-{type}s-{plugin}-hosts>> or extracted from the <<plugins-{type}s-{plugin}-cloud_id>>.
|
655
496
|
If no explicit protocol is specified plain HTTP will be used.
|
656
497
|
|
498
|
+
When not explicitly set, SSL will be automatically enabled if any of the specified hosts use HTTPS.
|
499
|
+
|
657
500
|
[id="plugins-{type}s-{plugin}-ssl_key"]
|
658
501
|
===== `ssl_key`
|
659
502
|
* Value type is <<path,path>>
|
@@ -772,28 +615,6 @@ When the `target` is set to a field reference, the `_source` of the hit is place
|
|
772
615
|
This option can be useful to avoid populating unknown fields when a downstream schema such as ECS is enforced.
|
773
616
|
It is also possible to target an entry in the event's metadata, which will be available during event processing but not exported to your outputs (e.g., `target \=> "[@metadata][_source]"`).
|
774
617
|
|
775
|
-
[id="plugins-{type}s-{plugin}-tracking_field"]
|
776
|
-
===== `tracking_field`
|
777
|
-
|
778
|
-
* Value type is <<string,string>>
|
779
|
-
* There is no default value for this setting.
|
780
|
-
|
781
|
-
Which field from the last event of a previous run will be used a cursor value for the following run.
|
782
|
-
The value of this field is injected into each query if the query uses the placeholder `:last_value`.
|
783
|
-
For the first query after a pipeline is started, the value used is either read from <<plugins-{type}s-{plugin}-last_run_metadata_path>> file,
|
784
|
-
or taken from <<plugins-{type}s-{plugin}-tracking_field_seed>> setting.
|
785
|
-
|
786
|
-
Note: The tracking value is updated after each page is read and at the end of each Point in Time. In case of a crash the last saved value will be used so some duplication of data can occur. For this reason the use of unique document IDs for each event is recommended in the downstream destination.
|
787
|
-
|
788
|
-
[id="plugins-{type}s-{plugin}-tracking_field_seed"]
|
789
|
-
===== `tracking_field_seed`
|
790
|
-
|
791
|
-
* Value type is <<string,string>>
|
792
|
-
* Default value is `"1970-01-01T00:00:00.000000000Z"`
|
793
|
-
|
794
|
-
The starting value for the <<plugins-{type}s-{plugin}-tracking_field>> if there is no <<plugins-{type}s-{plugin}-last_run_metadata_path>> already.
|
795
|
-
This field defaults to the nanosecond precision ISO8601 representation of `epoch`, or "1970-01-01T00:00:00.000000000Z", given nano-second precision timestamps are the
|
796
|
-
most reliable data format to use for this feature.
|
797
618
|
|
798
619
|
[id="plugins-{type}s-{plugin}-user"]
|
799
620
|
===== `user`
|
@@ -806,56 +627,21 @@ option when authenticating to the Elasticsearch server. If set to an
|
|
806
627
|
empty string authentication will be disabled.
|
807
628
|
|
808
629
|
|
809
|
-
[id="plugins-{type}s-{plugin}-
|
810
|
-
==== Elasticsearch Input
|
630
|
+
[id="plugins-{type}s-{plugin}-obsolete-options"]
|
631
|
+
==== Elasticsearch Input Obsolete Configuration Options
|
811
632
|
|
812
|
-
|
633
|
+
WARNING: As of version `5.0.0` of this plugin, some configuration options have been replaced.
|
634
|
+
The plugin will fail to start if it contains any of these obsolete options.
|
813
635
|
|
814
|
-
WARNING: Deprecated options are subject to removal in future releases.
|
815
636
|
|
816
|
-
[cols="
|
637
|
+
[cols="<,<",options="header",]
|
817
638
|
|=======================================================================
|
818
|
-
|Setting|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
639
|
+
|Setting|Replaced by
|
640
|
+
| ca_file | <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
|
641
|
+
| ssl | <<plugins-{type}s-{plugin}-ssl_enabled>>
|
642
|
+
| ssl_certificate_verification | <<plugins-{type}s-{plugin}-ssl_verification_mode>>
|
822
643
|
|=======================================================================
|
823
644
|
|
824
|
-
[id="plugins-{type}s-{plugin}-ca_file"]
|
825
|
-
===== `ca_file`
|
826
|
-
deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>]
|
827
|
-
|
828
|
-
* Value type is <<path,path>>
|
829
|
-
* There is no default value for this setting.
|
830
|
-
|
831
|
-
SSL Certificate Authority file in PEM encoded format, must also include any chain certificates as necessary.
|
832
|
-
|
833
|
-
[id="plugins-{type}s-{plugin}-ssl"]
|
834
|
-
===== `ssl`
|
835
|
-
deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
|
836
|
-
|
837
|
-
* Value type is <<boolean,boolean>>
|
838
|
-
* Default value is `false`
|
839
|
-
|
840
|
-
If enabled, SSL will be used when communicating with the Elasticsearch
|
841
|
-
server (i.e. HTTPS will be used instead of plain HTTP).
|
842
|
-
|
843
|
-
|
844
|
-
[id="plugins-{type}s-{plugin}-ssl_certificate_verification"]
|
845
|
-
===== `ssl_certificate_verification`
|
846
|
-
deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_verification_mode>>]
|
847
|
-
|
848
|
-
* Value type is <<boolean,boolean>>
|
849
|
-
* Default value is `true`
|
850
|
-
|
851
|
-
Option to validate the server's certificate. Disabling this severely compromises security.
|
852
|
-
When certificate validation is disabled, this plugin implicitly trusts the machine
|
853
|
-
resolved at the given address without validating its proof-of-identity.
|
854
|
-
In this scenario, the plugin can transmit credentials to or process data from an untrustworthy
|
855
|
-
man-in-the-middle or other compromised infrastructure.
|
856
|
-
More information on the importance of certificate verification:
|
857
|
-
**https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf**.
|
858
|
-
|
859
645
|
[id="plugins-{type}s-{plugin}-common-options"]
|
860
646
|
include::{include_path}/{type}.asciidoc[]
|
861
647
|
|
@@ -12,9 +12,14 @@ module LogStash
|
|
12
12
|
@client = client
|
13
13
|
@plugin_params = plugin.params
|
14
14
|
|
15
|
-
@index = @plugin_params["index"]
|
16
15
|
@size = @plugin_params["size"]
|
16
|
+
@query = @plugin_params["query"]
|
17
17
|
@retries = @plugin_params["retries"]
|
18
|
+
@agg_options = {
|
19
|
+
:index => @plugin_params["index"],
|
20
|
+
:size => 0
|
21
|
+
}.merge(:body => @query)
|
22
|
+
|
18
23
|
@plugin = plugin
|
19
24
|
end
|
20
25
|
|
@@ -28,18 +33,10 @@ module LogStash
|
|
28
33
|
false
|
29
34
|
end
|
30
35
|
|
31
|
-
def
|
32
|
-
{
|
33
|
-
:index => @index,
|
34
|
-
:size => 0,
|
35
|
-
:body => query_object
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
def do_run(output_queue, query_object)
|
36
|
+
def do_run(output_queue)
|
40
37
|
logger.info("Aggregation starting")
|
41
38
|
r = retryable(AGGREGATION_JOB) do
|
42
|
-
@client.search(
|
39
|
+
@client.search(@agg_options)
|
43
40
|
end
|
44
41
|
@plugin.push_hit(r, output_queue, 'aggregations') if r
|
45
42
|
end
|
@@ -21,10 +21,9 @@ module LogStash
|
|
21
21
|
@pipeline_id = plugin.pipeline_id
|
22
22
|
end
|
23
23
|
|
24
|
-
def do_run(output_queue
|
25
|
-
@query = query
|
26
|
-
|
24
|
+
def do_run(output_queue)
|
27
25
|
return retryable_search(output_queue) if @slices.nil? || @slices <= 1
|
26
|
+
|
28
27
|
retryable_slice_search(output_queue)
|
29
28
|
end
|
30
29
|
|
@@ -123,13 +122,6 @@ module LogStash
|
|
123
122
|
PIT_JOB = "create point in time (PIT)"
|
124
123
|
SEARCH_AFTER_JOB = "search_after paginated search"
|
125
124
|
|
126
|
-
attr_accessor :cursor_tracker
|
127
|
-
|
128
|
-
def do_run(output_queue, query)
|
129
|
-
super(output_queue, query)
|
130
|
-
@cursor_tracker.checkpoint_cursor(intermediate: false) if @cursor_tracker
|
131
|
-
end
|
132
|
-
|
133
125
|
def pit?(id)
|
134
126
|
!!id&.is_a?(String)
|
135
127
|
end
|
@@ -200,8 +192,6 @@ module LogStash
|
|
200
192
|
end
|
201
193
|
end
|
202
194
|
|
203
|
-
@cursor_tracker.checkpoint_cursor(intermediate: true) if @cursor_tracker
|
204
|
-
|
205
195
|
logger.info("Query completed", log_details)
|
206
196
|
end
|
207
197
|
|