Commit Graph

2479 Commits

Author SHA1 Message Date
Nik Everett ce01e480e7
Fix a leftover skip (#60932)
Looks like I never updated a test skip many many months ago.
2020-08-10 16:24:57 -04:00
István Zoltán Szabó 7b71a686eb
[DOCS] Fixes broken links in rest API spec. (#60582) 2020-08-03 15:29:51 +02:00
Julie Tibshirani 74b56f3b67
Avoid using string 'y' in fields REST tests. (#60471)
Some yaml parsers interpret 'y' and 'yes' as the boolean 'true'.
2020-07-31 09:09:17 -07:00
James Rodewig aec26b1a23
[DOCS] Move search pagination content to one page (#60515) 2020-07-31 11:43:06 -04:00
Dan Hermann 90062d5c0d
Fix failing test for resolve index API (#60306) 2020-07-31 07:52:44 -05:00
Tim Brooks 50c56233ff
Reenable BWC after memory limit api backport (#60415)
This commit reenables BWC and updates version constants after the
bacport of #60342.
2020-07-29 13:30:59 -06:00
Nik Everett 944a6c243c
Allows nanosecond resolution in search_after (#60328)
This fixes `search_after` to properly parse string formatted dates that
have nanosecond resolution.

Closes #52424
2020-07-29 14:29:10 -04:00
Tim Brooks b1a6271ec8
Add configured indexing memory limit to node stats (#60342)
This commit adds the configured memory limit to the node stats API.
2020-07-29 11:20:59 -06:00
David Turner 48981b4042
Fix up BWC following backport of #60297 (#60313)
Co-authored-by: Igor Motov <igor@motovs.org>
2020-07-28 20:12:58 +01:00
Igor Motov a23f1a00f5
Prepare for backport of aggregations in node info (#60309)
This commit temporary disables all bwc tests until #60256 is merged.
2020-07-28 14:05:39 -04:00
Julie Tibshirani a1f7ff7f07 Adjust the BWC version for the 'fields' param.
We can lower it to 7.10.0 now that it's been backported.
2020-07-28 10:58:33 -07:00
David Turner 940d618186
Log and track open/close of transport connections (#60297)
Transport connections between nodes remain in place until one or other
node shuts down or the connection is disrupted by a flaky network.
Today it is very difficult to demonstrate that transient failures and
cluster instability are caused by the network even though this is often
the case. In particular, transport connections open and close without
logging anything, even at `DEBUG` level, making it very hard to quantify
the scale of the problem or to correlate the networking problems with
external events.

This commit adds the missing `DEBUG`-level logging when transport
connections open and close, and also tracks the total number of
transport connections a node has opened as a measure of the stability of
the underlying network.
2020-07-28 16:58:00 +01:00
Julie Tibshirani 8a89d95372
Add search `fields` parameter to support high-level field retrieval. (#60100)
This feature adds a new `fields` parameter to the search request, which
consults both the document `_source` and the mappings to fetch fields in a
consistent way. The PR merges the `field-retrieval` feature branch.

Addresses #49028 and #55363.
2020-07-27 13:25:55 -07:00
Igor Motov 20c5f7edff
Add aggregation list to node info (#60074)
Adds a full list of supported aggregations to the node info API. This list
will be used in transform tests and telemetry mapping tests that will be added
as follow-up PRs.

Fixes #59774
2020-07-27 14:45:02 -04:00
Tim Brooks 5c227dac88
Implement human readable indexing pressure stats (#60022)
The indexing pressure stats do not currently have human readable
variants. This commit add human readable variants and updates the
documentation.
2020-07-22 09:54:51 -06:00
Nik Everett ad3a3f07d4
Fix bug in deep pipeline agg serialization (forward port of tests in #59984) (#60018)
In #54716 I removed pipeline aggregators from the aggregation result
tree and caused us to read them from the request. This saves a bunch of
round trip bytes, which is neat. But there was a bug in the backwards
compatibility logic. You see, we still have to give the pipeline
aggregations to nodes older than 7.8 over the wire because that is how
they know what pipelines to run. They have the pipelines in the request
but they don't read them. They use the ones in the response tree.

Anyway, we had a bug where we were never sending pipelines defined two
levels down. So while you are upgrading the pipeline wouldn't run.
Sometimes. If the data node of the "first" result was post-7.8 and the
coordinating node was pre-7.8.

This fixes the bug.
2020-07-21 16:49:26 -04:00
Lee Hinman 15e674fa77 Fix skip version for 14_alias_to_multiple_indices.yml
The message was slightly changed but only in 7.9+

Relates to #59806
2020-07-17 16:56:13 -06:00
Lee Hinman ebcf5d525d
Fix retrieving data stream stats for a DS with multiple backing indices (#59806)
* Fix retrieving data stream stats for a DS with multiple backing indices

This API incorrectly had `allowAliasesToMultipleIndices` set to false in the default options for the
request. This changes it from `false` to `true` and enhances a test to exercise the functionality.

Resolves #59802

* Fix test for wording change
2020-07-17 13:52:44 -06:00
Benjamin Trent 1c7e16319d
[ML] adjusting bwc tests and serialization for require_alias (#59780) 2020-07-17 12:27:52 -04:00
Lee Hinman 19a380ac63
Allow simulating existing composable index template (#59733)
This change allows simulating replacing a composable template with a different version, for example:

```
POST /_index_template/_simulate/my-template
{
  "index_patterns": ["idx*"],
  "composed_of": ["ct1"],
  "priority": 10,
  "template": {
    "settings": {
      "index.lifecycle.name": "policy"
    }
  }
}
```

Should simulate as if `my-template` were replaced with the template specified in the body.

Resolves #59152
2020-07-17 10:12:30 -06:00
Benjamin Trent f72b893fd3
Adding new `require_alias` option to indexing requests (#58917)
This commit adds the `require_alias` flag to requests that create new documents.

This flag, when `true` prevents the request from automatically creating an index. Instead, the destination of the request MUST be an alias.

When the flag is not set, or `false`, the behavior defaults to the `action.auto_create_index` settings.

This is useful when an alias is required instead of a concrete index.

closes https://github.com/elastic/elasticsearch/issues/55267
2020-07-17 08:45:46 -04:00
Igor Motov 5d1d397e48
Prepare for backport of hard bounds in Histograms (#59720)
Histograms are used in many tests, so it is not practical to hunt them all down
and disable one by one. This commit temporary disables all bwc tests until
#59656 is merged.
2020-07-16 14:41:50 -04:00
Dan Hermann 902c1fa80a
Move REST specs for data streams (#59634) 2020-07-16 08:56:58 -05:00
James Baiera 1fb4a5ed31
Remove unneeded rest params from Data Stream Stats (#59575)
This PR removes the expand_wildcards and forbid_closed_indices parameters from the Data 
Streams Stats REST endpoint. These options are required for broadcast requests, but are not 
needed for anything in terms of resolving data streams. Instead, we just set a default set of 
IndicesOptions on the transport request.
2020-07-15 14:24:15 -04:00
James Baiera 589bb1f26c
Data Stream Stats API (#58707)
This API reports on statistics important for data streams, including the number of data 
streams, the number of backing indices for those streams, the disk usage for each data 
stream, and the maximum timestamp for each data stream
2020-07-14 14:51:32 -04:00
Tim Brooks aa14860597
Separate coordinating and primary bytes in stats (#59487)
Currently we combine coordinating and primary bytes into a single bucket
for indexing pressure stats. This makes sense for rejection logic.
However, for metrics it would be useful to separate them.
2020-07-14 12:22:42 -06:00
Mayya Sharipova b130a1bfbb
Fix the test version in highlighters test (#59515)
This was supposed to be done after the backport but was missed.

Related to #53408
2020-07-14 11:24:34 -04:00
Dan Hermann 1d3a723f68
Adds write_index_only option to put mapping API (#59396) 2020-07-14 08:25:10 -05:00
Andrei Dan 5609353c5d
Default to @timestamp in composable template datastream definition (#59317)
This makes the data_stream timestamp field specification optional when
defining a composable template.
When there isn't one specified it will default to `@timestamp`.
2020-07-14 11:45:48 +01:00
Andrei Dan 4e72f43d62
Composable templates: add a default mapping for @timestamp (#59244)
This adds a low precendece mapping for the `@timestamp` field with
type `date`.
This will aid with the bootstrapping of data streams as a timestamp
mapping can be omitted when nanos precision is not needed.
2020-07-14 09:19:00 +01:00
Tim Brooks 9f22634bcd
Update versions for indexing pressure backport (#59472)
This commit updates the node stats version constants to reflect the fact
that index pressure stats were backported to 7.9. It also reenables BWC
tests.
2020-07-13 18:29:32 -06:00
Igor Motov 12c61e0d80
Change 7.9.99 -> 7.99.99 in tests (#59469)
Since we most likely going to have 7.10 we should update version
in tests skips to 7.99.99.
2020-07-13 17:26:15 -04:00
Igor Motov 0af410ad0b
Adds hard_bounds to histogram aggregations (#59175)
* Adds hard_bounds to histogram aggregations

Adds a hard_bounds parameter to explicitly limit the buckets that a histogram
can generate. This is especially useful in case of open ended ranges that can
produce a very large number of buckets.

Co-authored-by: Mark Tozzi <mark.tozzi@gmail.com>
2020-07-13 16:43:11 -04:00
Nik Everett e6e906d0e7 Update skip after backport of #42035 2020-07-13 16:39:30 -04:00
Tim Brooks b87bb86d88
Adding indexing pressure stats to node stats API (#59247)
We have recently added internal metrics to monitor the amount of
indexing occurring on a node. These metrics introduce back pressure to
indexing when memory utilization is too high. This commit exposes these
stats through the node stats API.
2020-07-13 10:37:46 -06:00
Martijn van Groningen 40b9fd49e0
Make data streams a basic licensed feature. (#59293)
* Create new data-stream xpack module.
* Move TimestampFieldMapper to the new module,
  this results in storing a composable index template
  with data stream definition only to work with default
  distribution. This way data streams can only be used
  with default distribution, since a data stream can
  currently only be created if a matching composable index
  template exists with a data stream definition.
* Renamed `_timestamp` meta field mapper 
   to `_data_stream_timestamp` meta field mapper.
* Add logic to put composable index template api
  to fail if `_data_stream_timestamp` meta field mapper
  isn't registered. So that a more understandable
  error is returned when attempting to store a template
  with data stream definition via the oss distribution.

In a follow up the data stream transport and
rest actions can be moved to the xpack data-stream module.
2020-07-13 11:43:42 +02:00
Dan Hermann 198b4253d9
Data stream admin actions are now index-level actions (#59095) 2020-07-10 12:25:07 -05:00
Martijn van Groningen cb6b05d12b
Fix the timestamp field of a data stream to @timestamp (#59076)
The commit makes the following changes:
* The timestamp field of a data stream definition in a composable
  index template can only be set to '@timestamp'.
* Removed custom data stream timestamp field validation and reuse the validation from `TimestampFieldMapper` and
  instead only check that the _timestamp field mapping has been defined on a backing index of a data stream.
* Moved code that injects _timestamp meta field mapping from `MetadataCreateIndexService#applyCreateIndexRequestWithV2Template58956(...)` method
  to `MetadataIndexTemplateService#collectMappings(...)` method.
* Fixed a bug (#58956) that cases timestamp field validation to be performed
  for each template and instead of the final mappings that is created.
* only apply _timestamp meta field if index is created as part of a data stream or data stream rollover,
this fixes a docs test, where a regular index creation matches (logs-*) with a template with a data stream definition.

Relates to #58642
Relates to #53100
Closes #58956
Closes #58583
2020-07-08 09:41:47 +02:00
James Rodewig 2be9db01c8
[DOCS] Replace `datatype` with `data type` (#58972) 2020-07-07 13:52:10 -04:00
Andrei Dan 0d9c98a823
GET data stream API returns additional information (#59128)
This adds the data stream's index template, the configured ILM policy
(if any) and the health status of the data stream to the GET _data_stream
response.

Restoring a data stream from a snapshot could install a data stream that
doesn't match any composable templates. This also makes the `template` 
field in the `GET _data_stream` response optional.
2020-07-07 17:52:40 +01:00
Nik Everett 38667b8fe5
Update skip after backport (#59153)
Update a skip after backporting #59099.
2020-07-07 11:33:01 -04:00
Jake Landis bd49766fde
Add build plugin to rest-api-spec to properly generate pom (#59142)
The build plugin is still necessary to generate the POM file.
This commit adds the build plugin plugin back to the rest-api-spec
project. It was recently removed as it was thought to be
unnecessary.
2020-07-07 09:58:07 -05:00
Nik Everett 3b3ed4b4a7
Fix lookup support in adjacency matrix (#59099)
This request:
```
POST /_search
{
  "aggs": {
    "a": {
      "adjacency_matrix": {
        "filters": {
          "1": {
            "terms": { "t": { "index": "lookup", "id": "1", "path": "t" } }
          }
        }
      }
    }
  }
}
```

Would fail with a 500 error and a message like:
```
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_state_exception",
        "reason":"async actions are left after rewrite"
      }
    ]
  }
}
```

This fixes that by moving the query rewrite phase from a synchronous
call on the data nodes into the standard aggregation rewrite phase which
can properly handle the asynchronous actions.
2020-07-06 18:53:19 -04:00
Jake Landis 333a5d8cdf
Create plugin for yamlTest task (#56841)
This commit creates a new Gradle plugin to provide a separate task name
and source set for running YAML based REST tests. The only project
converted to use the new plugin in this PR is distribution/archives/integ-test-zip.
For which the testing has been moved to :rest-api-spec since it makes the most
sense and it avoids a small but awkward change to the distribution plugin.

The remaining cases in modules, plugins, and x-pack will be handled in followups.

This plugin is distinctly different from the plugin introduced in #55896 since
the YAML REST tests are intended to be black box tests over HTTP. As such they
should not (by default) have access to the classpath for that which they are testing.

The YAML based REST tests will be moved to separate source sets (yamlRestTest).
The which source is the target for the test resources is dependent on if this
new plugin is applied. If it is not applied, it will default to the test source
set.

Further, this introduces a breaking change for plugin developers that
use the YAML testing framework. They will now need to either use the new source set
and matching task, or configure the rest resources to use the old "test" source set that
matches the old integTest task. (The former should be preferred).

As part of this change (which is also breaking for plugin developers) the
rest resources plugin has been removed from the build plugin and now requires
either explicit application or application via the new YAML REST test plugin.

Plugin developers should be able to fix the breaking changes to the YAML tests
by adding apply plugin: 'elasticsearch.yaml-rest-test' and moving the YAML tests
under a yamlRestTest folder (instead of test)
2020-07-06 12:13:01 -05:00
Dan Hermann be45d016e4
Delete data stream API accepts multiple names (#58833) 2020-07-06 06:45:58 -05:00
Dan Hermann 100e7a6651
Data stream support for indices shard stores API (#58591) 2020-07-06 06:44:31 -05:00
Dan Hermann c3aaf33d73
Ignore matching data streams if include_data_streams is false (#57900) 2020-07-03 08:46:01 -05:00
Dan Hermann e592a9a5e7
Add include_data_streams flag for authorization (#58154) 2020-07-02 23:53:31 -05:00
Dan Hermann 50ed781c9f
Mirror privileges over data streams to their backing indices (#58381) 2020-07-02 21:56:16 -05:00
Martijn van Groningen 001b3fb440
Add data stream timestamp validation via metadata field mapper (#58582)
This commit adds a new metadata field mapper that validates,
that a document has exactly a single timestamp value in the data stream timestamp field and
that the timestamp field mapping only has `type`, `meta` or `format` attributes configured.
Other attributes can affect the guarantee that an index with this meta field mapper has a 
useable timestamp field.

The MetadataCreateIndexService inserts a data stream timestamp field mapper whenever
a new backing index of a data stream is created.

Relates to #53100
2020-07-02 10:58:18 +02:00
David Turner acf031cdb5
Forbid read-only-allow-delete block in blocks API (#58727)
* Forbid read-only-allow-delete block in blocks API

The read-only-allow-delete block is not really under the user's control
since Elasticsearch adds/removes it automatically. This commit removes
support for it from the new API for adding blocks to indices that was
introduced in #58094.

* Missing xref

* Reword paragraph on read-only-allow-delete block
2020-07-01 12:57:34 +01:00
David Turner 83d6589b2a
Account for remaining recovery in disk allocator (#58029)
Today the disk-based shard allocator accounts for incoming shards by
subtracting the estimated size of the incoming shard from the free space on the
node. This is an overly conservative estimate if the incoming shard has almost
finished its recovery since in that case it is already consuming most of the
disk space it needs.

This change adds to the shard stats a measure of how much larger each store is
expected to grow, computed from the ongoing recovery, and uses this to account
for the disk usage of incoming shards more accurately.
2020-07-01 08:04:45 +01:00
Lee Hinman 29c05544ec
Fix template name in mapping composition yml test (#58788)
The warning was copied from elsewhere and just needed to use the correct template and index name.
2020-06-30 17:03:47 -06:00
Julie Tibshirani 416cb6b31e Adjust the skip version for template mapping merging REST test. 2020-06-30 13:22:16 -07:00
Martijn van Groningen 906aed4a88
Add data stream support to put mapping and update index settings APIs. (#58231)
Change update index setting and put mapping api
to execute on all backing indices if data stream is targeted.

Relates #53100
2020-06-30 17:23:27 +02:00
Lee Hinman 3b68df2355
Add default composable templates for new indexing strategy (#57629)
This commit adds the component and composable templates, as well as ILM policies, for the new
default indexing strategy. It installs:

- logs-default-mappings (component)
- logs-default-settings (component)
- logs-default-policy (ilm policy)
- logs-default-template (composable template)
- metrics-default-mappings (component)
- metrics-default-settings (component)
- metrics-default-policy (ilm policy)
- metrics-default-template (composable template)

These templates and policies are managed by a new x-pack module, `stack`, and can be disabled by
setting `stack.templates.enabled` to `false`.

These ensure that patterns for the `logs-*-*` and `metrics-*-*` indices are set up to create data
streams with the proper mappings and settings.

This also makes changes to the `IndexTemplateRegistry` to support installing component and
composable templates (previously it supported only legacy templates).

Resolves #56709
2020-06-30 09:19:37 -06:00
Yannick Welsch e4df92815e Adapt BWC after backport of (#58094) 2020-06-30 14:09:03 +02:00
Yannick Welsch 5e345e115b
Add index block api (#58094)
Adds an API for putting an index block in place, which also ensures for write blocks that, once successfully returning to
the user, all shards of the index are properly accounting for the block, for example that all in-flight writes to an index have
been completed after adding the write block.

This API allows coordinating more complex workflows, where it is crucial that an index is no longer receiving writes after
the API completes, useful for example when marking an index as read-only during an upgrade in order to reindex its
documents.
2020-06-30 09:33:15 +02:00
Julie Tibshirani 676893a263
Merge mappings for composable index templates (#58521)
This PR implements recursive mapping merging for composable index templates.

When creating an index, we perform the following:
* Add each component template mapping in order, merging each one in after the
last.
* Merge in the index template mappings (if present).
* Merge in the mappings on the index request itself (if present).

Some principles:
* All 'structural' changes are disallowed (but everything else is fine). An
object mapper can never be changed between `type: object` and `type: nested`. A
field mapper can never be changed to an object mapper, and vice versa.
* Generally, each section is merged recursively. This includes `object`
mappings, as well as root options like `dynamic_templates` and `meta`. Once we
reach 'leaf components' like field definitions, they always overwrite an
existing one instead of being merged.

Relates to #53101.
2020-06-29 15:00:40 -07:00
Enrico Zimuel 9a7a28958a
Added PERL reserved words in REST keywords (#58535) 2020-06-26 12:11:22 +02:00
Dan Hermann edc15d7c90
Add data stream support to open index API (#58487) 2020-06-25 09:13:53 -05:00
Dan Hermann 603c5f7a48
Data stream support for get field mappings API (#58488)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-06-25 08:08:51 -05:00
Dan Hermann 991f635c7f
Data stream support for search shards API (#58486) 2020-06-25 07:57:56 -05:00
Rory Hunter 48c9a0776b Update rest-api-spec keyword list
Follow-up to 35aecf4c9a. Somehow I missed the fact that there's an ILM
API named `retry`, which is a keyword in Ruby. I've removed it from the
keywords list.
2020-06-25 09:53:16 +01:00
Rory Hunter 35aecf4c9a
Validate that REST API names do not contain keywords (#58452)
If an API name (or components of a name) overlaps with a reserved word in
the programming language for an ES client, then it's possible that the code
that is generated from the API will not compile. This PR adds validation to
check for such overlaps.
2020-06-25 09:47:05 +01:00
Martijn van Groningen 0166e0e5a3
Re-enable data streams yaml tests in bwc mode (#58403) 2020-06-24 14:55:57 +02:00
James Dorfman e99d287fbb
Add Variable Width Histogram Aggregation (#42035)
Implements a new histogram aggregation called `variable_width_histogram` which
dynamically determines bucket intervals based on document groupings. These
groups are determined by running a one-pass clustering algorithm on each shard
and then reducing each shard's clusters using an agglomerative
clustering algorithm.

This PR addresses #9572.

The shard-level clustering is done in one pass to minimize memory overhead. The
algorithm was lightly inspired by
[this paper](https://ieeexplore.ieee.org/abstract/document/1198387). It fetches
a small number of documents to sample the data and determine initial clusters.
Subsequent documents are then placed into one of these clusters, or a new one
if they are an outlier. This algorithm is described in more details in the
aggregation's docs.

At reduce time, a
[hierarchical agglomerative clustering](https://en.wikipedia.org/wiki/Hierarchical_clustering)
algorithm inspired by [this paper](https://arxiv.org/abs/1802.00304)
continually merges the closest buckets from all shards (based on their
centroids) until the target number of buckets is reached.

The final values produced by this aggregation are approximate. Each bucket's
min value is used as its key in the histogram. Furthermore, buckets are merged
based on their centroids and not their bounds. So it is possible that adjacent
buckets will overlap after reduction. Because each bucket's key is its min,
this overlap is not shown in the final histogram. However, when such overlap
occurs, we set the key of the bucket with the larger centroid to the midpoint
between its minimum and the smaller bucket’s maximum:
`min[large] = (min[large] + max[small]) / 2`. This heuristic is expected to
increases the accuracy of the clustering.

Nodes are unable to share centroids during the shard-level clustering phase. In
the future, resolving https://github.com/elastic/elasticsearch/issues/50863
would let us solve this issue. 

It doesn’t make sense for this aggregation to support the `min_doc_count`
parameter, since clusters are determined dynamically. The `order` parameter is
not supported here to keep this large PR from becoming too complex.
2020-06-23 09:26:54 -04:00
Martijn van Groningen 085ba99fba
Keep track of timestamp_field mapping as part of a data stream (#58096)
Relates to #53100

* use mapping source direcly instead of using mapper service to extract the relevant mapping details
* moved assertion to TimestampField class and added helper method for tests
* Improved logic that inserts timestamp field mapping into an mapping.
If the timestamp field path consisted out of object fields and
if the final mapping did not contain the parent field then an error
occurred, because the prior logic assumed that the object field existed.
2020-06-22 12:01:01 +02:00
Jim Ferenczi b0f4024879
Adapt bwc version after backport of #58299 (#58300)
This commit adapts the bwc version in preparation of the backport
to 7.x. The bwc tests are disabled in order to allow the merge of
#58299.

Relates #58299
2020-06-18 10:22:54 +02:00
Rory Hunter 1f6c953194
Rename dangling index APIs (#58266)
The dangling_indices.import API name could cause issues in the client
libs because import is a reserved word in many languages. Rename the
API to avoid this, and rename the other APIs for consistency.

Related to #48366.
2020-06-18 08:57:39 +01:00
Jim Ferenczi 90c9b95ca0
Allow index filtering in field capabilities API (#57276)
* Add index filtering in field capabilities API

This change allows to use an `index_filter` in the
field capabilities API. Indices are filtered from
the response if the provided query rewrites to `match_none`
on every shard:

````
GET metrics-*
{
  "index_filter": {
    "bool": {
      "must": [
        "range": {
          "@timestamp": {
            "gt": "2019"
          }
        }
      }
  }
}
````

The filtering is done on a best-effort basis, it uses the can match phase
to rewrite queries to `match_none` instead of fully executing the request.
The first shard that can match the filter is used to create the field
capabilities response for the entire index.

Closes #56195
2020-06-17 22:53:53 +02:00
Rory Hunter ebe8951879
Implement dangling indices API (#50920)
Part of #48366. Implement an API for listing, importing and deleting dangling
indices.

Co-authored-by: David Turner <david.turner@elastic.co>
2020-06-16 15:19:17 +01:00
Dan Hermann cce279bbb3
Prohibit clone, shrink, and split on a data stream's write index (#58104) 2020-06-16 08:37:48 -05:00
Nik Everett 7c7fe0152d
Save memory when auto_date_histogram is not on top (#57304)
This builds an `auto_date_histogram` aggregator that natively aggregates
from many buckets and uses it when the `auto_date_histogram` used to use
`asMultiBucketAggregator` which should save a significant amount of
memory in those cases. In particular, this happens when
`auto_date_histogram` is a sub-aggregator of a multi-bucketing aggregator
like `terms` or `histogram` or `filters`. For the most part we preserve
the original implementation when `auto_date_histogram` only collects from
a single bucket.

It isn't possible to "just port the aggregator" without taking a pretty
significant performance hit because we used to rewrite all of the
buckets every time we switched to a coarser and coarser rounding
configuration. Without some major surgery to how to delay sub-aggs
we'd end up rewriting the delay list zillions of time if there are many
buckets.

The multi-bucket version of the aggregator has a "budget" of "wasted"
buckets and only rewrites all of the buckets when we exceed that budget.
Now that we don't rebucket every time we increase the rounding we can no
longer get an accurate count of the number of buckets! So instead the
aggregator uses an estimate of the number of buckets to trigger switching
to a coarser rounding. This estimate is likely to be *terrible* when
buckets are far apart compared to the rounding. So it also uses the
difference between the first and last bucket to trigger switching to a
coarser rounding. Which covers for the shortcomings of the bucket
estimation technique pretty well. It also causes the aggregator to emit
fewer buckets in cases where they'd be reduced together on the
coordinating node. This is wonderful! But probably fairly rare.

All of that does buy us some speed improvements when the aggregator is
a child of multi-bucket aggregator:
Without metrics or time zone: 25% faster
With metrics: 15% faster
With time zone: 22% faster

Relates to #56487
2020-06-15 14:33:31 -04:00
Dan Hermann e515adb07e
Fix REST test for resolve index API (#58043) 2020-06-12 13:14:58 -05:00
Dan Hermann f9f39d75fa
Mute failing REST tests with correct syntax (#58048) 2020-06-12 09:28:00 -05:00
Dan Hermann 780603d9f7
Mute failing REST tests 2020-06-12 08:54:12 -05:00
Dan Hermann 9724fa9dc8
Resolve index API (#57626) 2020-06-12 06:25:16 -05:00
Martijn van Groningen eb6f46a342
Enforce valid field mapping exists for timestamp_field in templates. (#57741)
Relates to #53100
2020-06-12 13:22:20 +02:00
Martijn van Groningen 01b70b4068
Prohibit append-only writes targeting backing indices directly. (#57788)
Append-only writes can only target the corresponding data stream.

Relates to #53100
2020-06-11 11:29:27 +02:00
Russ Cam a85f2bede8
Mark Component and Index template APIs as experimental (#57910)
This commit marks the Component Template and
Index Template APIs as experimental.
2020-06-10 14:06:32 +10:00
Lee Hinman c688eb69c7
Disallow merging existing mapping field definitions in templates (#57701)
* Disallow merging existing mapping field definitions in templates

This commit changes the merge strategy introduced in #55607 and #55982. Instead of overwriting these
fields, we now prevent them from being merged with an exception when a user attempts to
overwrite a field.

As part of this, a more robust validation has been added. The existing validation checked whether
templates (composable and component) were valid on their own, this new validation now checks that
the composite template (mappings/settings/aliases) is valid. This means that when a composable
template is added or updated, we confirm that it is valid with its component pieces. When a
component template is updated we ensure that all composable templates that make use of the component
template continue to be valid before allowing the component template to be updated.

This change also necessitated changes in the tests, however, I have left tests that exercise mapping
merging with nested object fields as `@AwaitsFix`, as we intend to change the behavior soon to allow
merging in a recursive-with-replacement fashion (see: #57393). I have added tests that check the new
disallowing behavior in the meantime.

* Use functional instead of imperative prefix collection

* Use IndexService.withTempIndexService

* Rename tests

* Fix tests

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-06-08 08:57:13 -06:00
Dan Hermann 904bdae9ff
Change default backing index naming scheme (#57721) 2020-06-08 08:39:55 -05:00
Dan Hermann c4334ee074
Prohibit closing the write index for a data stream (#57692) 2020-06-05 10:00:13 -05:00
Nik Everett 1c7bd29f4c
update skip after backport of #57397 (#57694) 2020-06-04 15:37:53 -04:00
Nik Everett 4b9e378d4a Bump skip before backport 2020-06-04 12:16:20 -04:00
Nik Everett 69cd4435b2
Merge remaining sig_terms into terms (#57397)
Merges the remaining implementation of `significant_terms` into `terms`
so that we can more easilly make them work properly without
`asMultiBucketAggregator` which *should* save memory and speed them up.

Relates #56487
2020-06-04 11:22:03 -04:00
Russ Cam f77005a0e2
Update snapshot.delete.json to make snapshot a list (#57326)
Relates: elastic/elasticsearch#55474

This commit updates the snapshot.delete.json REST API spec
to make snapshot a list type, now that it can accept a
list of comma-separated snapshot names
2020-06-03 09:48:51 +10:00
Nik Everett 474a3fc49f
Update skip after backport of #57438 (#57550) 2020-06-02 16:22:03 -04:00
Nik Everett b072f5f002
Fix an optimization in terms agg (#57438)
When the `terms` agg runs against strings and uses global ordinals it
has an optimization when it collects segments that only ever have a
single value for the particular string. This is *very* common. But I
broke it in #57241. This fixes that optimization and adds `debug`
information that you can use to see how often we collect segments of
each type. And adds a test to make sure that I don't break the
optimization again.

We also had a specialiation for when there isn't a filter on the terms
to aggregate. I had removed that specialization in #57241 which resulted
in some slow down as well. This adds it back but in a more clear way.
And, hopefully, a way that is marginally faster when there *is* a
filter.

Closes #57407
2020-06-02 13:57:27 -04:00
Nik Everett 27bff25cf8
Update skip after backport of #57277 (#57379) 2020-05-29 16:20:07 -04:00
Nik Everett 460b204f8e
Save memory when histogram agg is not on top (#57277)
This saves some memory when the `histogram` aggregation is not a top
level aggregation by dropping `asMultiBucketAggregator` in favor of
natively implementing multi-bucket storage in the aggregator. For the
most part this just uses the `LongKeyedBucketOrds` that we built the
first time we did this.
2020-05-29 09:54:47 -04:00
Nik Everett d0a253db5b
Update skip after backport of #57241 (#57316) 2020-05-29 08:03:34 -04:00
Martijn van Groningen 9d07229879
Change cluster info actions to be able to resolve data streams. (#56878)
With this change the following APIs will be able to resolve data streams:
get index, get mappings and ilm explain APIs.

Relates to #53100
2020-05-29 11:04:55 +02:00
Russ Cam 0b041cccd8
Deprecate local param in get_mapping.json (#57265)
Relates: elastic/elasticsearch#55014

This commit deprecates the local param in get_mapping.json.
This parameter is a no-op and field mappings are always retrieved locally.
2020-05-29 12:24:44 +10:00
Nik Everett 29e9e79656 Update skip before backport
I accidentally didn't put the customary "skip the last version" on
 #57241 and the PR tests didn't catch it. This adds it.
2020-05-28 16:01:37 -04:00
Martijn van Groningen 9f6bc6856b
Re-able data stream bwc tests (#57293)
after merging #57275
2020-05-28 21:36:03 +02:00
Nik Everett 974d236fbc
Make global ords terms simpler to understand (#57241)
When the `terms` enum operates on non-numeric data it can collect it via
global ordinals. It actually has two separate collection strategies for,
one "dense" and one "remapping". Each of *those* strategies has two
"iteration" strategies that it uses to build buckets, depending on
whether or not we need buckets with `0` docs in them. Previously this
was done with several `null` checks and never really explained. This
change replaces those checks with two `CollectionStrategy` classes which
have good stuff like documentation.
2020-05-28 15:29:31 -04:00
Christoph Büscher 3d4f9fedaf
Check for negative "from" values in search request body (#54953)
Today we already disallow negative values for the "from" parameter in the search
API when it is set as a request parameter and setting it on the
SearchSourceBuilder, but it is still parsed without complaint from a search
body, leading to differing exceptions later. This PR changes this behavior to be
the same regardless of setting the value directly, as url parameter or in the
search body. While we silently accepted "-1" as meaning "unset" and used the
default value of 0 so far, any negative from-value is now disallowed.

Closes #54897
2020-05-28 16:25:19 +02:00
Martijn van Groningen f8b090b641
Ensure template exists when creating data stream (#56888)
Limit the creation of data streams only for namespaces that have a composable template with a data stream definition.

This way we ensure that mappings/settings have been specified and will be used at data stream creation and data stream rollover.

Also remove `timestamp_field` parameter from create data stream request and
let the create data stream api resolve the timestamp field
from the data stream definition snippet inside a composable template.

Relates to #53100
2020-05-28 13:11:15 +02:00
Dan Hermann 7a67395807
Limit _cat/indices test to versions with fix (#57244) 2020-05-27 16:06:33 -05:00
Nik Everett 69661252fc
Update skip after backport of #56789 (#57238) 2020-05-27 16:30:31 -04:00
Lee Hinman 4dc32611fc
Rename template V2 classes to ComposableTemplate (#57183)
This PR changes the name of the Index Template V2 classes to "Composable Templates", it also ensures there are no mentions of "V2" in the documentation or error/warning messages. V1 templates are referred to as "legacy" templates.

Resolves #56609
2020-05-27 09:32:10 -06:00
Nik Everett 9aaab6efdd
Save memory on numeric sig terms when not top (#56789)
This saves memory when running numeric significant terms which are not
at the top level by merging its collection into numeric terms and relying
on the optimization that we made in #55873.
2020-05-27 10:53:09 -04:00
Russ Cam 38a17f299f
Update track_total_hits to union type (#51846)
* Update track_total_hits to union type

This commit updates track_total_hits parameter type to a union
of boolean and number, to reflect the possible values that can
be passed.

* Update rest-api-spec/src/main/resources/rest-api-spec/api/search.json

Co-Authored-By: Karel Minarik <karel.minarik@gmail.com>

* Update rest-api-spec/src/main/resources/rest-api-spec/api/search.json

Co-authored-by: Karel Minarik <karel.minarik@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-05-27 12:25:45 +10:00
James Rodewig eae4a1c953
[DOCS] Add delete snapshot repo API docs (#57043)
Changes:

* Adds API reference docs for the delete snapshot repo API.

* Corrects an error in the delete snapshot repo API spec. Comma-separated
repository names are not supported.

* Relocates the existing delete snapshot repo API example docs.
2020-05-21 13:59:48 -04:00
Nik Everett 7790e815fe
Update skip after backport of #56921 (#56974) 2020-05-20 11:20:20 -04:00
Dan Hermann 4eb9d18b72
Handle exceptions when building _cat/indices response (#56993) 2020-05-20 09:44:40 -05:00
Nik Everett bea2341c9e
Save memory when date_histogram is not on top (#56921)
When `date_histogram` is a sub-aggregator it used to allocate a bunch of
objects for every one of it's parent's buckets. This uses the data
structures that we built in #55873 rework the `date_histogram`
aggregator instead of all of the allocation.

Part of #56487
2020-05-19 13:48:25 -04:00
Ioannis Kakavas 127646c496
Adjust version mute for reload secure settings (#56938)
We can safely run the reload_secure_settings tests
after 7.7.0 , the relevant changes have long been
backported there
2020-05-19 18:13:44 +03:00
Tomas Della Vedova f5360fc984
[DOCS] Fix component template API link in JSON specs (#56884) 2020-05-19 09:59:06 -04:00
Ioannis Kakavas 9ae9bdc9a3
Adjust reload keystore test to pass in FIPS (#56889)
In KeystoreWrapper class we determine if the error to decrypt a
given keystore is caused by a wrong password based on the exception
that the SunJCE implementation of AES is
throwing(AEADBadTagException). Other implementations from other
Security Providers fail with a different exception and as such we
cannot differentiate between a corrupted file and a wrong password
in a foolproof way.
As in other tests such as in
KeyStoreWrapperTests#testDecryptKeyStoreWithWrongPassword
we handle this by matching both possible exception messages.
2020-05-19 15:25:45 +03:00
Lee Hinman d3ccada06f
Add template simulation API for simulating template composition (#56842)
This adds an API for simulating template composition with or without an index template.

It looks like:

```
POST /_index_template/_simulate/my-template
```

To simulate a template named `my-template` that already exists, or, to simulate a template that does
not already exist:

```
POST /_index_template/_simulate
{
  "index_patterns": ["my-index"]
  "composed_of": ["ct1", "ct2"],
}
```

This is related to #55686, which adds an API to simulate composition based on an index name (hence
the `_simulate_index` vs `_simulate`).

This commit also adds reference documentation for both simulation APIs.

Relates to #53101
Resolves #56390
Resolves #56255
2020-05-18 15:11:42 -06:00
Dan Hermann a62483f7b5
Rename endpoint from plural "_data_streams" to singular "_data_stream" (#56762) 2020-05-15 08:23:43 -05:00
Ryan Ernst c0ee68b0a0
Move publishing configuration to a separate plugin (#56727)
This is another part of the breakup of the massive BuildPlugin. This PR
moves the code for configuring publications to a separate plugin. Most
of the time these publications are jar files, but this also supports the
zip publication we have for integ tests.
2020-05-14 18:56:59 -07:00
Lee Hinman cad030d8d7
Don't allow invalid template combinations (#56397)
This commit removes the ability to put V2 index templates that reference missing component templates.
It also prevents removing component templates that are being referenced by an existing V2 index
template.

Relates to #53101
Resolves #56314
2020-05-14 15:33:35 -06:00
Nik Everett f433fd472c
Update skip after backport of #56208 (#56719) 2020-05-13 17:36:31 -04:00
Nik Everett 4a8d93f55b
Add list of defered aggregations to the profiler (#56208)
This adds a few things to the `breakdown` of the profiler:
* `histogram` aggregations now contain `total_buckets` which is the
  count of buckets that they collected. This could be useful when
  debugging a histogram inside of another bucketing agg that is fairly
  selective.
* All bucketing aggs that can delay their sub-aggregations will now add
  a list of delayed sub-aggregations. This is useful because we
  sometimes have fairly involved logic around which sub-aggregations get
  delayed and this will save you from having to guess.
* Aggregtations wrapped in the `MultiBucketAggregatorWrapper` can't
  accurately add anything to the breakdown. Instead they the wrapper
  adds a marker entry `"multi_bucket_aggregator_wrapper": true` so we
  can be quickly pick out such aggregations when debugging.

It also fixes a bug where `_count` breakdown entries were contributing
to the overall `time_in_nanos`. They didn't add a large amount of time
so it is unlikely that this caused a big problem, but I was there.

To support the arbitrary breakdown data this reworks the profiler so
that the `breakdown` can contain any data that is supported by
`StreamOutput#writeGenericValue(Object)` and
`XContentBuilder#value(Object)`.
2020-05-13 08:30:38 -04:00
Martijn van Groningen e9cc3de173
Fix allowed warning in data stream rest test. (#56630) 2020-05-12 21:02:37 +02:00
Jake Landis 525522e187
json spec: allow null for documentation url (#55749)
This commit allows the JSON schema's documentation.url property to have a null value.
This can useful for cases where a feature is under development, and does not have
documentation published yet.

This commit also adds a documentation.url for two ml resources.
2020-05-12 12:51:24 -05:00
Martijn van Groningen c4082384db
Enable bwc tests after backporting index templates v2 data stream integration (#56615)
Relates to #55377
2020-05-12 18:10:20 +02:00
James Rodewig 3ebbf895f2
[DOCS] Add clean up snapshot repository API docs (#56519) 2020-05-12 08:56:29 -04:00
Martijn van Groningen 74e2c01138
Auto create data streams using index templates v2 (#55377)
This commit adds the ability to auto create data streams using index templates v2.
Index templates (v2) now have a data_steam field that includes a timestamp field,
if provided and index name matches with that template then a data stream
(plus first backing index) is auto created. 

Relates to #53100
2020-05-12 13:42:59 +02:00
Lee Hinman fc708ccca4
Remove prefer_v2_templates query string parameter (#56546)
This commit removes the `prefer_v2_templates` flag and setting. This was a brief setting that
allowed specifying whether V1 or V2 template should be used when an index is created. It has been
removed in favor of V2 templates always having priority.

Relates to #53101
Resolves #56528

This is not a breaking change because this flag was never in a released version.
2020-05-11 14:56:48 -06:00
Nik Everett 7c367de13b
Update skip after backport of #56252 (#56379) 2020-05-07 15:41:45 -04:00
Nik Everett 923fc988ad
Fix auto_date_histogram interval (#56252)
`auto_date_histogram` was returning the incorrect `interval` because
of a combination of two things:
1. When pipeline aggregations rewrote `auto_date_histogram` we reset the
   interval to 1. Oops. Fixed that.
2. *Every* bucket aggregation was rewriting its buckets as though there
   was a pipeline aggregation even if there aren't any. This is a bit
   silly so we skip that too.

Closes #56116
2020-05-07 08:19:53 -04:00
Przemko Robakowski 7ca47f52e8
Add prefer_v2_templates parameter to Reindex (#56253)
* prefer_v2_templates for reindex
2020-05-06 22:01:13 +02:00
Jake Landis 32269f1a6d
_cat/threadpool remove "size" and add "time" params (#55736)
The rest spec and documentation for _cat/threadpool supports a "size" parameter.
However, the "size" parameter will have no impact since there are no values
of type "SizeValue" of the return value of this _cat api.

This commit removes the "size" param from the spec and documentation.

This commit also adds support for the "time" param since and support to
format the time param for the "keep_alive" column. By default, the output
should not change since the "TimeValue" rendered default (via RestTable)
is toString(), and the code prior to this also called toString().

closes #54478
2020-05-06 14:26:08 -05:00
Dan Hermann 117055d49e
Get index includes parent data stream for backing indices (#56022) 2020-05-05 13:40:15 -05:00
Jake Landis e392ce939a
deprecrate size from cat.thread_pool in json spec (#55984) 2020-04-30 11:36:20 -05:00
Andrei Dan e256becad7
Conditionally run tests asserting overlapping templates (#56028)
Only run the tests verifyin the overlapping index templates when there is
no `global` index template (ie. when the default shards are not changed)
2020-04-30 16:07:34 +01:00
Andrei Dan 475790c34e
Add HLRC support for simulate index template api (#55936) 2020-04-30 14:24:46 +01:00
Andrei Dan e3e9782b20
Update template v2 api rest spec (#55948)
This removed the specification of `order` as it is not a parameter of the
v2 put template api (the priority is the equivalent of `order` and is
defined in the body) and add a bit of description for the `cause` parameter
(which is currently used as a cluster update task tracking)
2020-04-30 10:52:52 +01:00
Andrei Dan 1a5845edce
Add simulate template composition API _index_template/_simulate_index/{name} (#55686)
This adds a new api to simulate matching the given index name against the
 index templates in the system.

The syntax for the new API takes the following form:

POST _index_template/_simulate_index/{index_name}
{
  "index_patterns": ["logs-*"],
  "priority": 15,
  "template": {
	"settings": {
		"number_of_shards": 3
	}
       ...
   }
}

Where the body is optional, but we support the entire body used by the
PUT _index_template/{name} api. When the body is specified we'll simulate
matching the given index against a system that'd have the given index
template together with the index templates that exist in the system.

The response, in both cases, will return the matching template's resolved
settings, mappings and aliases, together with a special field that'll print any
overlapping templates and their corresponding index patterns.
2020-04-29 11:27:15 +01:00
David Roberts e0f38896fd
[ML] Adjust BWC after daily_model_snapshot_retention_after_days backport (#55911)
Simplifying BWC code after merging #55891
2020-04-29 10:49:40 +01:00
zacharymorn 498fc66cc8
Add API specs for voting config exclusions (#55760)
Closes #48131
2020-04-29 08:34:10 +01:00
Lee Hinman 3fc17b1b55
Adjust skip version for _cat/templates yml tests (#55871)
Now that #55829 has been backported (#55866) we can adjust these skip versions to allow testing with
7.8+.

Relates to #53101
2020-04-28 11:05:00 -06:00
Dan Hermann 0077714bfe
REST test for rolling data streams (#55802) 2020-04-28 11:52:36 -05:00
Lee Hinman 61acf602fc
Add support for V2 index templates to /_cat/templates (#55829)
This adds support for V2 index templates to the cat templates API. It uses the `order` field as
priority in order not to break compatibility, while adding the `composed_of` field to show component
templates that are used from an index template.

Relates to #53101
2020-04-28 09:25:54 -06:00
Dan Hermann bcf86000e5
Delete index API properly handles backing indices for data streams (#55690) 2020-04-24 16:34:57 -05:00
Zachary Tong 76170eded1 Update version skip after backport 2020-04-24 10:19:03 -04:00
Zachary Tong 9f165bd44e
Aggs must specify a `field` or `script` (or both) (#52226)
* Aggs must specify a `field` or `script` (or both)

This adds a validation to VSParserHelper to ensure that a field or
script or both are specified by the user.  This is technically
required today already, but throws an exception much deeper
in the agg framework and has a very unintuitive error for the user
(as well as eating more resources instead of failing early)

* Fix StringStats test

* Add yaml test

* Skip test on older versions

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-23 14:26:38 -04:00
Jake Landis 2b0900d33b
Validate REST specs against schema (#55117)
A JSON schema was recently introduced for the REST API specification. #54252
This PR introduces a 3rd party validation tool to ensure that the
REST specification conforms to the schema.

The task is applied to the 3 projects that contain REST API specifications.
The plugin wires this task into the precommit commit task, and should be
considered as part of the public API for the build tools for any plugin
developer to contribute their plugin's specification.

An ignore parameter has been introduced for the task to allow specific
file to be ignored from the validation. The ignored files in this PR
will soon get issues logged and a link so they can be fixed.

Closes #54314
2020-04-21 18:18:18 -05:00
Fernando Briano 4e9dd2b292
Add skip arbitrary_key to nodes.reload_secure_settings YAML test (#55402) 2020-04-21 16:19:38 +01:00
Lee Hinman 93021f72aa
Adjust serialization versions for prefer_v2_templates flag (#55478)
This adjusts the minimum version for serialization for #55411.

It should only be merged after #55476 has been merged
2020-04-20 14:07:40 -06:00
Lee Hinman 0202e1ae96
Add prefer_v2_templates flag and index setting (#55411)
This commit adds a new querystring parameter on the following APIs:
- Index
- Update
- Bulk
- Create Index
- Rollover

These APIs now support a `?prefer_v2_templates=true|false` flag. This flag changes the preference
creation to use either V2 index templates or V1 templates. This flag defaults to `false` and will be
changed to `true` for 8.0+ in subsequent work.

Additionally, setting this flag internally sets the `index.prefer_v2_templates` index-level setting.
This setting is used so that actions that automatically create a new index (things like rollover
initiated by ILM) will inherit the preference from the original index. This setting is dynamic so
that a transition from v1 to v2 templates can occur for long-running indices grouped by an alias
performing periodic rollover.

This also adds support for sending this parameter to the High Level Rest Client.

Relates to #53101
2020-04-20 10:04:42 -06:00
zhichen 05066aecf0
Add Bulk stats track the bulk per shard (#52208)
* Add Bulk stats track the bulk sizes per shard and the time spent on the bulk shard request (#50536)(#47345)
2020-04-20 11:09:29 +02:00
Dan Hermann 4a8b84349d
Mute data stream YML tests until backport (#55406) 2020-04-17 10:48:43 -05:00
Dan Hermann e1730452e3
Add explicit generation attribute to data streams (#55342) 2020-04-17 09:02:09 -05:00
Martijn van Groningen d649826a94
Re-enable data stream yaml bwc tests. (#55367)
After backporting #55337
2020-04-17 09:44:31 +02:00
Martijn van Groningen fada09a132
Make data streams in APIs resolvable. (#54726)
The INCLUDE_DATA_STREAMS indices option controls whether data streams can be resolved in an api for both concrete names and wildcard expressions. If data streams cannot be resolved then a 400 error is returned indicating that data streams cannot be used.

In this pr, the INCLUDE_DATA_STREAMS indices option is enabled in the following APIs: search, msearch, refresh, index (op_type create only) and bulk (index requests with op type create only). In a subsequent later change, we will determine which other APIs need to be able to resolve data streams and enable the INCLUDE_DATA_STREAMS indices option for these APIs. 

Whether an api resolve all backing indices of a data stream or the latest index of a data stream (write index) depends on the IndexNameExpressionResolver.Context.isResolveToWriteIndex().
If isResolveToWriteIndex() returns true then data streams resolve to the latest index (for example: index api) and otherwise a data stream resolves to all backing indices of a data stream (for example: search api).

Relates to #53100
2020-04-16 19:46:13 +02:00
bellengao 338798a9db
Fix creating filtered alias using now in a date_nanos range query failed (#54785)
Modify the value of nowInMillis in queryShardContext to current timestamp, because the
value will be used lately when validating the filtered alias which uses now in a date_nanos
range query.

Closes #54315
2020-04-16 18:41:44 +02:00
Tomas Della Vedova d7ee30c276
Yaml test: Fixed bad indentation (#55170) 2020-04-15 08:49:39 +02:00
Julie Tibshirani 13053c6ad9
Remove the object format for indices_boost. (#55078)
This format has been deprecated since version 5.2.
2020-04-14 21:01:07 -07:00
Yang Wang 92427d3758
Remove local parameter for get field mapping API (#55100)
The local parameter of get field mapping API is marked as deprecated in 7.x.
This PR removes it for v8.0
2020-04-15 12:02:10 +10:00
muachilin db1236ce3d
Remove deprecated endpoints of hot threads API (#55109)
This removes deprecated endpoints in hot threads action.

Closes #52640
2020-04-14 15:36:57 -04:00
Mark Vieira 0e55fdeae9
Re-add origin url information to publish POM files (#55171) 2020-04-14 11:48:36 -07:00
Igor Motov 3583bc7188
Tests: unmute test after t-test backport (#55122)
Unmutes weighted avg rest test
2020-04-13 14:49:42 -04:00
Igor Motov 6eab90b3db
Prepare for backport of TTest filters (#55072)
Preparation for backport of #55066
2020-04-13 11:32:22 -04:00
Yang Wang 6ce88038f2
Deprecate local parameter for get field mapping request (#55014)
The usage of local parameter for GetFieldMappingRequest has been removed from the underlying transport action since v2.0.

This PR deprecates the parameter from rest layer. It will be removed in next major version.
2020-04-12 12:34:44 +10:00
Ioannis Kakavas 5ee27927e8
Mute test in versions that do not support pwd protected keystores (#55069)
Mute test in versions that do not support password 
protected keystores. This didn't fail in the PR check
since we run MixedClusterClientYamlTestSuiteIT
against 4 nodes (2 old and 2 new ) and this
happened to hit a node that was on master rather
than one that was on 7.8.0-SNAPSHOT
2020-04-10 18:56:45 +03:00
Ioannis Kakavas 16e9433ead
Fix ReloadSecureSettings API to consume password (#54771)
The secure_settings_password was never taken into consideration in
the ReloadSecureSettings API. This commit fixes that and adds
necessary REST layer testing. Doing so, it also

- Allows TestClusters to have a password protected keystore
so that it can be set for tests.
- Adds a parameter to the run task so that elastisearch can
be run with a password protected keystore from source.
2020-04-10 16:48:36 +03:00
Lee Hinman 2e73fe3c6d
Bump minimum version for component template CRUD test (#54992)
These tests do CRUD for component templates, however, for 7.7 some changes weren't backported in the
`_doc` wrapping/unwrapping done for the APIs, this can cause test failures.

This bumps the minimum version for these tests to 7.8, which is okay because component templates are
hidden behind a flag and have no compatibility guarantees for 7.7.

Relates to #53101
2020-04-08 16:38:50 -06:00
Lee Hinman c7dc03345a
Add allowed warnings to index template composition tests (#54916)
We occasionally add a global template for our YAML tests, and this can cause warnings for these
template tests. This commit adds these warnings so they don't cause test failures.

Resolves #54822

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-08 09:22:10 -06:00
Przemko Robakowski b8ca70b8aa
HLRC support for Index Templates V2 (#54838)
* HLRC support for Index Templates V2

This change adds High Level Rest Client support for Index Templates V2.

Relates to #53101
2020-04-08 01:11:02 +02:00
Tal Levy cf9603c6fd
Create new `geo` module and migrate geo_shape registration (#53562)
This commit introduces a new `geo` module that is intended
to be contain all the geo-spatial-specific features in server.

As a first step, the responsibility of registering the geo_shape
field mapper is moved to this module.

Co-authored-by: Nicholas Knize <nknize@gmail.com>
2020-04-07 12:27:29 -07:00
Nik Everett c546cc37aa
Update skip after backport of #54298 (#54900)
We can run these tests again 7.8.0 now that it has the fix.
2020-04-07 13:52:41 -04:00
Nik Everett f942655f22
More pipeline aggregation cleanup (#54298)
This replaces the last bit of validation that pipeline aggregations
performed on the data nodes with explicit checks in a few
`PipelineAggregationBuilders`. We were *already* catching these
validation errors for pipeline aggregations that require that their
parent be squentially ordered. This just adds validation for pipelines
that require *any* parent like `bucket_selector` and `bucket_sort`.
2020-04-07 09:20:43 -04:00
Lee Hinman 7747cfa5f3
Adjust skip version for Index Template V2 tests (#54754)
These were skipped for all 7.x until the backport was finished, it's now backported so these can be
adjusted to be run on 7.8+

Relates to #53101
2020-04-06 22:03:57 -06:00
Przemko Robakowski ad8590e190
HLRC support for Component Templates APIs (#54635)
* HLRC support for Component Templates

* hlrc

* hlrc

* merge fix

* removed unused import

* checkstyle fixes

* metaData -> metadata

* move to ClusterClient

* checkstyle fixes

* checkstyle fixes

* checkstyle fixes

* method in spec fixed

* PR comments

* PR comments

* PR comments

* unused imports fixed

* review comment

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-04-06 18:52:25 +02:00
Nhat Nguyen 61e5350e77
Support hierarchical task cancellation (#54757)
With this change, when a task is canceled, the task manager will cancel 
not only its direct child tasks but all also its descendant tasks.

Closes #50990
2020-04-06 12:00:02 -04:00
Dan Hermann 19da22ebf6
Delete backing indices with data stream (#54693) 2020-04-06 09:55:37 -05:00
Lee Hinman 9f9ade7dcb
Use V2 index templates during index creation (#54669)
* Use V2 index templates during index creation

This commit changes our index creation code to use (and favor!) V2 index templates during index
creation. The creation precedence goes like so, in order of precedence:

- Existing source `IndexMetadata` - for example, when recovering from a peer or a shrink/split/clone
  where index templates should not be applied
- A matching V2 index template, if one is found
  - When a V2 template is found, all component templates (in the `composed_of` field) are applied
    in the order that they appear, with the index template having the 2nd highest precedence (the
    create index request always has the top priority when it comes to index settings)
- All matching V1 templates (the old style)

This also adds index template validation when `PUT`-ing a new v2 index template (because this was
required) and ensures that all index and component templates specify *no* top-level mapping type (it
is automatically added when the template is added to the cluster state).

This does not yet implement fine-grained component template merging of mappings, where we favor
merging only a single field's configuration, that will be done in subsequent work.

This also keeps the existing hidden index behavior present for v1 templates, where a hidden index
will match v2 index templates unless they are global (`*`) templates.

Relates to #53101
2020-04-03 09:34:50 -06:00
Dan Hermann 959f41e3d1
Get data stream accepts single search parameter (#54530) 2020-04-03 09:32:42 -05:00
Dan Hermann 42f513c810
Create first backing index when creating data stream (#54467) 2020-04-02 10:58:06 -05:00
Russ Cam da37e01d32
Update rest API specs (#54252)
This commit updates the rest API specs to validate against a
JSON schema for the specifications. Most updates are to add
a description, whilst others fix typos and unify conventions
e.g. deprecations, descriptions, urls starting with /. The schema 
conforms to draft-07 JSON schema.
2020-04-02 10:40:50 +10:00
Nhat Nguyen ee3d40320a
Broadcast cancellation to only nodes have outstanding child tasks (#54312)
Today when canceling a task we broadcast ban/unban requests to all nodes 
in the cluster. This strategy does not scale well for hierarchical
cancellation. With this change, we will track outstanding child requests
and broadcast the cancellation to only nodes that have outstanding child
tasks. This change also prevents a parent task from sending child
requests once it got canceled.

Relates #50990
Supersedes #51157

Co-authored-by: Igor Motov <igor@motovs.org>
Co-authored-by: Yannick Welsch <yannick@welsch.lu>
2020-04-01 11:22:13 -04:00
Lee Hinman 2a77551b12
Add allowed warnings to index template v2 YAML tests (#54535) (#54541)
There is a setting in `ESClientYamlSuiteTestCase` under `usually()` that can install a `global`
template changing the number of shards for all indices. This can cause warnings when installing v2
templates (see #54367). This adds these as optional warnings so they don't cause failures regardless
of whether the global template is installed or not.

These warnings can be removed when our internal template usage has been moved to index templates v2

Relates to #53101
2020-03-31 16:27:48 -06:00
Nik Everett 2437c5ebeb
Update skip after backport (#54450)
Now that #54161 is backported we can run its tests against nodes that
have the fix.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-31 16:27:41 -04:00
Nik Everett 472dd1b370
Fix a master->7.x serialization bug (#54429)
`master` wasn't sending `auto_date_histogram`'s
`minimumIntervalExpression` over the wire to `7.x` nodes even though
everything above `7.3` expected it. We never noticed this because we
didn't have any yml tests for `auto_date_histogram` until I added some
in #54161.

Closes #54396
2020-03-30 11:37:38 -04:00
Benjamin Trent 49c30ec4de
muting test (#54404) 2020-03-30 08:45:47 -04:00
Jason Tedor 922e09ba7b
Adjust BWC version on node roles being sorted
Node roles are sorted now as of 7.8.0. This commit adjusts the BWC
version for tests.
2020-03-28 15:30:02 -04:00
Jason Tedor 489c7091c4
Ensure that the output of node roles are sorted (#54376)
This commit ensures that node roles are sorted by node role name, which
makes the output easier to consume, and also makes it easier to rely on
the behavior of the output in assertions.
2020-03-28 12:47:49 -04:00
Nik Everett a0f7c4a6a4
Clean up how pipeline aggs check for multi-bucket (#54161)
Pipeline aggregations like `stats_bucket`, `sum_bucket`, and
`percentiles_bucket` only operate on buckets that have multiple buckets.
This adds support for those aggregations to `geo_distance`, `ip_range`,
`auto_date_histogram`, and `rare_terms`.

This all happened because we used a marker interface to mark compatible
aggs, `MultiBucketAggregationBuilder` and it was fairly easy to forget
to implement the interface.

This replaces the marker interface with an abstract method in
`AggregationBuilder`, `bucketCardinality` which makes you return `NONE`,
`ONE`, or `MANY`. The `bucket` aggregations can check for `MANY`. At
this point `ONE` and `NONE` amount to about the same thing, but I
suspect that'll be a useful distinction when validating bucket sorts.

Closes #53215
2020-03-28 11:47:01 -04:00
Dan Hermann 133b743f4c
Test to enforce response to invalid data stream names 2020-03-27 12:20:42 -05:00
Lee Hinman e89e916738
Add REST APIs for IndexTemplateV2Metadata CRUD (#54039)
* Add REST APIs for IndexTemplateV2Metadata CRUD

This commit adds the get/put/delete APIs for interacting with the now v2 versions of index
templates.

These APIs are behind the existing `es.itv2_feature_flag_registered` system property feature flag.

Relates to #53101

* Add exceptions for HLRC tests

* Add skips for 7.x versions

* Use index_template instead of template_v2 in action names

* Add test for MetaDataIndexTemplateService.addIndexTemplateV2

* Move removal to static method and add test

* Add unit tests for request classes (implement hashCode & equals)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-27 07:56:29 -06:00
Mark Tozzi a90c1de874
Add ValuesSource Registry and associated logic (#54281)
* Remove ValuesSourceType argument to ValuesSourceAggregationBuilder (#48638)

* ValuesSourceRegistry Prototype (#48758)

* Remove generics from ValuesSource related classes (#49606)

* fix percentile aggregation tests (#50712)

* Basic thread safety for ValuesSourceRegistry (#50340)

* Remove target value type from ValuesSourceAggregationBuilder (#49943)

* Cleanup default values source type (#50992)

* CoreValuesSourceType no longer implements Writable (#51276)

* Remove genereics & hard coded ValuesSource references from Matrix Stats (#51131)

* Put values source types on fields (#51503)

* Remove VST Any (#51539)

* Rewire terms agg to use new VS registry (#51182)

Also adds some basic AggTestCases for untested code
paths (and boilerplate for future tests once the IT are
converted over)

* Wire Cardinality aggregation to work with the ValuesSourceRegistry (#51337)

* Wire Percentiles aggregator into new VS framework (#51639)

This required a bit of a refactor to percentiles itself.  Before,
the Builder would switch on the chosen algo to generate an
algo-specific factory.  This doesn't work (or at least, would be
difficult) in the new VS framework.

This refactor consolidates both factories together and introduces
a PercentilesConfig object to act as a standardized way to pass
algo-specific parameters through the factory.  This object
is then used when deciding which kind of aggregator to create

Note: CoreValuesSourceType.HISTOGRAM still lives in core, and will
be moved in a subsequent PR.

* Remove generics and target value type from MultiVSAB (#51647)

* fix checkstyle after merge (#52008)

* Plumb ValuesSourceRegistry through to QuerySearchContext (#51710)

* Convert RareTerms to new VS registry (#52166)

* Wire up Value Count (#52225)

* Wire up Max & Min aggregations (#52219)

* ValuesSource refactoring: Wire up Sum aggregation (#52571)

* ValuesSource refactoring: Wire up SigTerms aggregation (#52590)

* Soft immutability for VSConfig (#52729)

* Unmute testSupportedFieldTypes, fix Percentiles/Ranks/Terms tests (#52734)

Also fixes Percentiles which was incorrectly specified to only accept
numeric, but in fact also accepts Boolean and Date (because those are
numeric on master - thanks `testSupportedFieldTypes` for catching it!)

* VS refactoring: Wire up stats aggregation (#52891)

* ValuesSource refactoring: Wire up string_stats aggregation (#52875)

* VS refactoring: Wire up median (MAD) aggregation (#52945)

* fix valuesourcetype issue with constant_keyword field (#53041)

this commit implements `getValuesSourceType` for
the ConstantKeyword field type.

master was merged into feature/extensible-values-source
introducing a new field type that was not implementing
`getValuesSourceType`.

* ValuesSource refactoring: Wire up Avg aggregation (#52752)

* Wire PercentileRanks aggregator into new VS framework  (#51693)

* Add a VSConfig resolver for aggregations not using the registry (#53038)

* Vs refactor wire up ranges and date ranges (#52918)

* Wire up geo_bounds aggregation to ValuesSourceRegistry (#53034)

This commit updates the geo_bounds aggregation to depend
on registering itself in the ValuesSourceRegistry

relates #42949.

* VS refactoring: convert Boxplot to new registry (#53132)

* Wire-up geotile_grid and geohash_grid to ValuesSourceRegistry (#53037)

This commit updates the geo*_grid aggregations to depend
on registering itself in the ValuesSourceRegistry

relates to the values-source refactoring meta issue #42949.

* Wire-up geo_centroid agg to ValuesSourceRegistry (#53040)

This commit updates the geo_centroid aggregation to depend
on registering itself in the ValuesSourceRegistry.

relates to the values-source refactoring meta issue #42949.

* Fix type tests for Missing aggregation (#53501)

* ValuesSource Refactor: move histo VSType into XPack module (#53298)

- Introduces a new API (`getBareAggregatorRegistrar()`) which allows plugins to register aggregations against existing agg definitions defined in Core.
- This moves the histogram VSType over to XPack where it belongs. `getHistogramValues()` still remains as a Core concept
- Moves the histo-specific bits over to xpack (e.g. the actual aggregator logic). This requires extra boilerplate since we need to create a new "Analytics" Percentile/Rank aggregators to deal with the histo field. Doubly-so since percentiles/ranks are extra boiler-plate'y... should be much lighter for other aggs

* Wire up DateHistogram to the ValuesSourceRegistry (#53484)

* Vs refactor parser cleanup (#53198)

Co-authored-by: Zachary Tong <polyfractal@elastic.co>
Co-authored-by: Zachary Tong <zach@elastic.co>
Co-authored-by: Christos Soulios <1561376+csoulios@users.noreply.github.com>
Co-authored-by: Tal Levy <JubBoy333@gmail.com>
2020-03-26 15:01:07 -04:00
Martijn Laarman fbe173723d
Document known features on rest-api-spec tests (#52916)
* Document known features on rest-api-spec tests

Features dictate wheter a `rest-api-spec` test runner can execute a
test. This PR documents all the know features in the java implementation
of the runner.

* Apply suggestions from code review

Co-Authored-By: Luca Cavanna <javanna@users.noreply.github.com>

Co-authored-by: Luca Cavanna <javanna@users.noreply.github.com>
2020-03-25 16:27:45 +01:00
Jason Tedor 1fc0432b24
Introduce formal role for remote cluster client (#53924)
This commit introduce a formal role for identifying nodes that are
capable of making connections to remote clusters.
2020-03-24 19:21:56 -04:00
Dan Hermann 81d8510887
Unmute data stream YML tests 2020-03-24 10:15:42 -05:00
Dan Hermann aed8ce7cda
Cluster state and CRUD operations for data streams (#53877) 2020-03-24 06:08:48 -05:00
Jim Ferenczi 04bd154037
Add heuristics to compute pre_filter_shard_size when unspecified (#53873)
This commit changes the pre_filter_shard_size default from 128 to unspecified.
This allows to apply heuristics based on the request and the target indices when deciding
whether the can match phase should run or not. When unspecified, this pr runs the can match phase
automatically if one of these conditions is met:
  * The request targets more than 128 shards.
  * The request contains read-only indices.
  * The primary sort of the query targets an indexed field.
Users can opt-out from this behavior by setting the `pre_filter_shard_size` to a static value.

Closes #39835
2020-03-23 19:06:32 +01:00
weizijun face37514b
/_cat/shards support path stats (#53461)
* _cat/shards support path stats

* fix some style case

* fix some style case

* fix rest-api-spec cat.shards error

* fix rest-api-spec cat.shards bwc error

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-23 14:27:13 +01:00
Martijn van Groningen abcee01a96
adjusted skip version (#53969) 2020-03-23 14:04:17 +01:00
James Rodewig 1df73828ed
[DOCS] Note doc links should be live in REST API JSON specs (#53871)
Downstream Elasticsearch clients, such as the Elaticsearch-JS client,
use the documentation links in our REST API JSON specifications to
create their docs.

Using a broken link or linking to yet-to-be-created doc pages can
break the docs build for these clients.

This PR adds a related note to the README for the REST API JSON Specs.
2020-03-23 07:36:37 -04:00
Martijn van Groningen 12046084f9
Initial data stream commit (#53666)
* Initial data stream commit

This commits adds a data stream feature flag, initial definition of a data stream and
the stubs for the data stream create, delete and get APIs. Also simple serialization
tests are added and a rest test to thest the data stream API stubs.

This is a large amount of code and mainly mechanical, but this commit should be
straightforward to review, because there isn't any real logic.

The data stream transport and rest action are behind the data stream feature flag and
are only intialized if the feature flag is enabled. The feature flag is enabled if
elasticsearch is build as snapshot or a release build and the
'es.datastreams_feature_flag_registered' is enabled.

The integ-test-zip sets the feature flag if building a release build, otherwise
rest tests would fail.

Relates to #53100

* fixed hlrc test

* ignore bwc until this change has been backported to 7.x branch

* changed data stream apis to be a cluster based action.

before this commit the data steams api were indices based actions,
but data streams aren't indices, data streams encapsulates indices,
but are indices themselves. It is a cluster level attribute, and
therefor cluster based action fits best for now.

Perhaps in the future we will have data stream based actions and
then this would be a right fit for the data stream crud apis.

* this should have been part of the previous commit

* fixed yaml test

* Also add feature flag in other modules that run the yaml test if a release build is executed

* Reverted the commits that make data stream a cluster based api

This reverts commit e362eeb669.

* Make data stream crud apis work like a indices based api.

* renamed timestamp field

* fixed compile error after merging in master

* fixed merge mistake

* moved setting system property

* applied review comments
2020-03-20 11:22:18 +01:00
Lee Hinman d47d74a558
Fix feature flag setting for ComponentTemplate APIs (#53758)
The feature flag was set for *most* of the builds, but there are a couple where it was missing.

Resolves #53708
2020-03-19 08:00:06 -06:00
James Rodewig 03caeaad79
[DOCS] Remove incorrect parms from put index template API docs (#53750)
Removes the `flat_settings` and `timeout` query parameters from the JSON
spec and asciidoc docs for the put index template API.

These parameters are not supported by the API.
2020-03-18 14:33:40 -04:00
Jake Landis 3ef3cc571f
Add Watcher to available rest resources (#53620)
Prior to this commit Watcher explicitly copied test between two
projects with a copy task. This commit removes the explicit copy in favor
of adding the Watcher tests to the available restResources that may be
copied between projects.

This is how inter-project dependencies should be modeled. However, only
Watcher is included here since it is (currently) the only project with
inter-project test dependencies.

Note - this re-introduces: commit: 4f48e053f9
with some additional fixes.
2020-03-18 09:08:13 -05:00
Ioannis Kakavas baccbec5f5
Mute failing test (#53709)
see https://github.com/elastic/elasticsearch/issues/53708
2020-03-18 10:36:16 +02:00
Lee Hinman 263e525e49
Add REST API for ComponentTemplate CRUD (#53558)
* Add REST API for ComponentTemplate CRUD

This adds the Put/Get/DeleteComponentTemplate APIs that allow inserting, retrieving, and removing
ComponentTemplateMetadata into the cluster state metadata.

These APIs are currently only available behind a feature flag system property -
`es.itv2_feature_flag_registered`.

Relates to #53101

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-03-17 10:55:07 -06:00
Gordon Brown 3c25005648
Update the Skip version in hidden index YAML tests (#53641)
This commit adjusts the version ranges used for the _cat API hidden
index/alias tests.
2020-03-17 10:20:48 -06:00
Hendrik Muhs 68a698f9ae
[Transform] add transform discovery node role (#53616)
Enhancement of #52712: Add a discovery node role using the letter t for transform.

Fixes #53156
2020-03-17 11:34:22 +01:00
Jim Ferenczi ff94792e41
Shortcut query phase using the results of other shards (#51852)
This commit, built on top of #51708, allows to modify shard search requests based on informations collected on other shards. It is intended to speed up sorted queries on time-based indices. For queries that are only interested in the top documents.

This change will rewrite the shard queries to match none if the bottom sort value computed in prior shards is better than all values in the shard.
For queries that mix top documents and aggregations this change will reset the size of the top documents to 0 instead of rewriting to match none.
This means that we don't need to keep a search context open for this shard since we know in advance that it doesn't contain any competitive hit.
2020-03-17 10:54:44 +01:00
Nik Everett f2f0fc03de Update skip before backport
PR #53617 has yet to be backported so we should skip its integration
test on nodes earlier than 8.0.0
2020-03-16 15:51:29 -04:00
Nik Everett 3b7843d774
Fix sorting agg buckets by doc_count (#53617)
I broke sorting aggregations by `doc_count` in #51271 by mixing up true
and false. This flips that comparison and adds a few tests to double
check that we don't so this again.
2020-03-16 14:41:56 -04:00
Mayya Sharipova 01eee1a97f
Highlighters skip ignored keyword values (#53408)
Keyword field values with length more than ignore_above are not
indexed. But highlighters still were retrieving these values
from _source and were trying to highlight them. This sometimes lead to
errors if a field length exceeded  max_analyzed_offset. But also this
is a wrong behaviour to attempt to highlight something that was not
ignored during indexing.

This PR checks if a keyword value was ignored because of its length,
and if yes, skips highlighting it.

Closes #43800
2020-03-16 06:49:37 -04:00
Gordon Brown d7bbc9df1d
Allow _cat indices & aliases to use indices options (#53248)
This commit adjusts the _cat/indices and _cat/aliases APIs to allow
specifying indices options, so that these APIs can handle hidden
indices/aliases in the same way as other APIs.

Also adds the hidden option to the expand_wildcards parameter
in the YAML spec for every API that accepts it.
2020-03-13 11:57:00 -06:00
Marios Trivyzas 314145294e
Fix YAML test for search.allow_expensive_queries (#53541)
Remove excessive testing and keep only the checks for when the queries
are disallowed. Fix also the check for the initial value of the setting
to be conmbatible with Go client tests.
2020-03-13 14:42:09 +01:00
Nik Everett d0addbd142
Update skip after backport (#53421)
Now that we've backported #53315 we can run the backwards compatibility
tests against it.
2020-03-11 16:43:43 -04:00
Andy Bristol 4095df443b
aggregator and yaml tests for missing agg (#53214)
Tests for unmapped fields, the missing parameter, scripting, and correct
ValuesSource types in MissingAggregatorTests. Basic yaml tests for the 
missing agg

For #42949
2020-03-11 13:23:38 -07:00
Nik Everett 5b15aa6b0b
Update skip after backport (#53346)
Now that #53296 is backported to 7.x we can run its tests against 7.7.0.
2020-03-10 13:08:36 -04:00
Nik Everett a63232d2bc
Fix date_nanos in composite aggs (#53315)
It looks like `date_nanos` fields weren't likely to work properly in
composite aggs because composites iterate field values using points and
we weren't converting the points into milliseconds. Because the doc
values were coming back in milliseconds we ended up geting very confused
and just never collecting sub-aggregations.

This fixes that by adding a method to `DateFieldMapper.Resolution` to
`parsePointAsMillis` which is similarly in name and function to
`NumberFieldMapper.NumberType`'s `parsePoint` except that it normalizes
to milliseconds which is what aggs need at the moment.

Closes #53168
2020-03-10 11:40:14 -04:00
Nik Everett 57853de283
Fix composite agg sort bug (#53296)
When an composite aggregation is run against an index with a sort that
*starts* with the "source" fields from the composite but has additional
fields it'd blow up in while trying to decide if it could use the sort.
This changes it to decide that it *can* use the sort.

Closes #52480
2020-03-10 09:23:44 -04:00
Nik Everett fbdb4105fe
Add `allowed_warnings` to yaml tests (#53139)
When we test backwards compatibility we often end up in a situation
where we *sometimes* get a warning, and sometimes don't. Like, we won't
get the warning if we're testing against an older version, but we will
in a newer one. Or we won't get the warning if the request randomly
lands on a node with an old version of the code. But we wouldn't if it
randomed into a node with newer code.

This adds `allowed_warnings` to our yaml test runner for those cases:
warnings declared this way are "allowed" but not "required".

Blocks #52959
2020-03-05 08:12:33 -05:00
Filip M. Nowak ad8c6ccb45
tiny typo fix (#52929) 2020-02-27 23:50:14 +01:00
David Turner a3a98c7003
Cache completion stats between refreshes (#51991)
Computing the stats for completion fields may involve a significant amount of
work since it walks every field of every segment looking for completion fields.
Innocuous-looking APIs like `GET _stats` or `GET _cluster/stats` do this for
every shard in the cluster. This repeated work is unnecessary since these stats
do not change between refreshes; in many indices they remain constant for a
long time.

This commit introduces a cache for these stats which is invalidated on a
refresh, allowing most stats calls to bypass the work needed to compute them on
most shards.

Closes #51915
2020-02-27 07:33:16 +00:00
Nhat Nguyen 827f62c990
Fix translog stats on closed indices yaml test (#52800)
We need to wait for no initializing shards before closing; otherwise, 
we might fail to close some recovering replicas.

Closes #52701
2020-02-26 08:13:31 -05:00
Jake Landis 810dc9fce3
Smarter copying of the rest specs and tests (#52114)
This PR addresses the unnecessary copying of the rest specs and allows
for better semantics for which specs and tests are copied. By default 
the rest specs will get copied if the project applies 
`elasticsearch.standalone-rest-test` or `esplugin` and the project 
has rest tests or you configure the custom extension `restResources`. 

This PR also removes the need for dozens of places where the x-pack 
specs were copied by supporting copying of the x-pack rest specs too. 

The plugin/task introduced here can also copy the rest tests to the 
local project through a similar configuration.

The new plugin/task allows a user to minimize the surface area of 
which rest specs are copied. Per project can be configured to include 
only a subset of the specs (or tests). Configuring a project to only 
copy the specs when actually needed should help with build cache hit 
rates since we can better define what is actually in use. 
However, project level optimizations for build cache hit rates are 
not included with this PR.

Also, with this PR you can no longer use the includePackaged flag on 
integTest task.  

The following items are included in this PR:
* new plugin: `elasticsearch.rest-resources` 
* new tasks: CopyRestApiTask and CopyRestTestsTask - performs the copy 
* new extension 'restResources'
```
restResources {
  restApi {
    includeCore 'foo' , 'bar' //will include the core specs that start with foo and bar
    includeXpack 'baz' //will include x-pack specs that start with baz
  }
  restTests {
    includeCore 'foo', 'bar' //will include the core tests that start with foo and bar
    includeXpack 'baz' //will include the x-pack tests that start with baz
  }
}

```
2020-02-25 18:46:32 -06:00
Marios Trivyzas e42c4d1b0b
[Tests] Update skip version for YAML tests (#52324)
Update skip versions upper boundary to match the release
or intended release version of the feature/fix.

Relates to #52310
2020-02-13 20:03:48 +01:00
Nik Everett 24e36ba326
Enable BWC test after backport (#52299)
Now that we've backported #52016 we can run its tests when we're
performance backwards compatibility testing.
2020-02-13 07:56:35 -05:00
Nik Everett 7346cd05ed
Update skip after backport (#52287)
Now that #51868 is fully backported we can run its tests in the
backwards compatibility tests.
2020-02-12 17:01:24 -05:00
Nik Everett b38c04f0c6
Update skip for backported fix (#52240)
Now that #51172 is fully backported we can fix the `skip` clause in the
bwc tests for it.
2020-02-12 13:55:44 -05:00
Marios Trivyzas a8b39ed842
Add a cluster setting to disallow expensive queries (#51385)
Add a new cluster setting `search.allow_expensive_queries` which by
default is `true`. If set to `false`, certain queries that have 
usually slow performance cannot be executed and an error message
is returned.

- Queries that need to do linear scans to identify matches:
  - Script queries
- Queries that have a high up-front cost:
  - Fuzzy queries
  - Regexp queries
  - Prefix queries (without index_prefixes enabled
  - Wildcard queries
  - Range queries on text and keyword fields
- Joining queries
  - HasParent queries
  - HasChild queries
  - ParentId queries
  - Nested queries
- Queries on deprecated 6.x geo shapes (using PrefixTree implementation)
- Queries that may have a high per-document cost:
  - Script score queries
  - Percolate queries

Closes: #29050
2020-02-12 18:06:04 +01:00
Nik Everett da2b67d6e5
Fix a DST error in date_histogram (#52016)
When `date_histogram` attempts to optimize itself it for a particular
time zone it checks to see if the entire shard is within the same
"transition". Most time zone transition once every size months or
thereabouts so the optimization can usually kicks in.

*But* it crashes when you attempt feed it a time zone who's last DST
transition was before epoch. The reason for this is a little twisted:
before this patch it'd find the next and previous transitions in
milliseconds since epoch. Then it'd cast them to `Long`s and pass them
into the `DateFieldType` to check if the shard's contents were within
the range. The trouble is they are then converted to `String`s which are
*then* parsed back to `Instant`s which are then convertd to `long`s. And
the parser doesn't like most negative numbers. And everything before
epoch is negative.

This change removes the
`long` -> `Long` -> `String` -> `Instant` -> `long` chain in favor of
passing the `long` -> `Instant` -> `long` which avoids the fairly complex
parsing code and handles a bunch of interesting edge cases around
epoch. And other edge cases around `date_nanos`.

Closes #50265
2020-02-11 16:04:36 -05:00
Zachary Tong ba9c4fb987
Refactor Percentiles/Ranks aggregation builders and factories (#51887)
- Consolidates HDR/TDigest factories into a single factory
- Consolidates most HDR/TDigest builder into an abstract builder
- Deprecates method(), compression(), numSigFig() in favor of a new
unified PercentileConfig object
- Disallows setting algo options that don't apply to current algo

The unified config method carries both the method and algo-specific
setting. This provides a mechanism to reject settings that apply
to the wrong algorithm.  For BWC the old methods are retained
but marked as deprecated, and can be removed in future versions.

Co-authored-by: Mark Tozzi <mark.tozzi@gmail.com>
2020-02-11 15:32:03 -05:00
Nhat Nguyen ebc4681473
Use local checkpoint to calculate min translog gen for recovery (#51905)
Today we use the translog_generation of the safe commit as the minimum
required translog generation for recovery. This approach has a
limitation, where we won't be able to clean up translog unless we flush.
Reopening an already recovered engine will create a new empty translog,
and we leave it there until we force flush.

This commit removes the translog_generation commit tag and uses the 
local checkpoint of the safe commit to calculate the minimum required
translog generation for recovery instead.

Closes #49970
2020-02-10 08:26:01 -05:00
Martijn Laarman 1c3b341960
Time parameter includes description (#49368)
* Time parameter includes description

In option enumeration causing codegenerators to pick up the description
as a value to send.

* cat.shards missing ending quotes
2020-02-06 17:18:22 +01:00
Jim Ferenczi eb69c6fe7c
Always rewrite search shard request outside of the search thread pool (#51708)
This change ensures that the rewrite of the shard request is executed in the network thread or in the refresh listener when waiting for an active shard. This allows queries that rewrite to match_no_docs to bypass the search thread pool entirely even if the can_match phase was skipped (pre_filter_shard_size > number of shards). Coordinating nodes don't have the ability to create empty responses so this change also ensures that at least one shard creates a full empty response while the other can return null ones. This is needed since creating true empty responses on shards require to create concrete aggregators which would be too costly to build on a network thread. We should move this functionality to aggregation builders in a follow up but that would be a much bigger change.
This change is also important for #49601 since we want to add the ability to use the result of other shards to rewrite the request of subsequent ones. For instance if the first M shards have their top N computed, the top worst document in the global queue can be pass to subsequent shards that can then rewrite to match_no_docs if they can guarantee that they don't have any document better than the provided one.
2020-02-06 08:55:20 +01:00
Nik Everett b6d06c91a0
Fix a sneaky bug in rare_terms (#51868)
When the `rare_terms` aggregation contained another aggregation it'd
break them. Most of the time. This happened because the process that it
uses to remove buckets that turn out not to be rare was incorrectly
merging results from multiple leaves. This'd cause array index out of
bounds issues. We didn't catch it in the test because the issue doesn't
happen on the very first bucket. And the tests generated data in such a
way that the first bucket always contained the rare terms. Randomizing
the order of the generated data fixed the test so it caught the issue.

Closes #51020
2020-02-05 13:38:46 -05:00
Adrien Grand 28e2f16734
Prepare backport of #51260. (#51876)
Backport: #51875
2020-02-05 11:02:46 +01:00
Karel Minarik 2ed9e95100
Fix the type for "slices" in the Reindex and Update By Query REST API specification (#51908)
This patch supplements #51792 and #51535 where the type of the "slices" parameter has been fixed.
2020-02-05 09:50:49 +01:00
Julie Tibshirani e0d57c5181 Correct the serialization version for index field caps.
It needs to be lowered to 7.7 now that the PR has been backported.
2020-02-04 17:00:29 -08:00
Gordon Brown 375e39e579
Mute failing field_caps tests (#51897) 2020-02-04 17:11:32 -07:00
Adrien Grand d5bc6d6de0
Move analysis/mappings stats to cluster-stats. (#51260)
Closes #51138
2020-02-04 16:56:49 +01:00
Jonathan Budzenski 23b31d6abe
[DOCS] Change http://elastic.co -> https (#48479) 2020-02-03 08:52:34 -05:00
Karel Minarik 68db7fc611
Fix the type for "slices" in the Delete By Query REST API specification (#51792)
The previous patch in c1d9966d35 incorrectly set the `type` to `number|auto`,
which is incorrect — the "polymorphic" type, denoted with the `|` sign,
should contain only other types, ie. number, string, bool, etc.

Fixes #51535
2020-02-02 18:09:07 +01:00
Karel Minarik c1d9966d35
Fix the "slices" parameter for the Delete By Query API in the REST specification (#51535)
This patch updates the `type` parameter in the Delete By Query API: according to
[the documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html#docs-delete-by-query-slice),
it can be set to "auto", but the type in the documentation allows only numerical values.

This prevents people from setting the parameter to "auto" eg. in the Go client,
which generates source from the specification, and sets the corresponding Go
type as number.

The patch uses the `|` notation, which we have discussed previously for encoding
a "polymorphic" parameter like this.

Related: https://github.com/elastic/go-elasticsearch/issues/77
2020-02-02 09:59:48 +01:00
Christoph Büscher 54e8d1ce1c Lower range/10_basic.yml skip version after backport
After backport of #50237 in #51741 the skip version in this test can be lowered.
2020-01-31 16:10:49 +01:00
Nhat Nguyen 6e0fbbd4db
Remove translog retention settings (#51697)
The translog retention settings index.translog.retention.size and 
index.translog.retention.age were effectively ignored in 7.4, 
deprecated in 7.7, and now removed in 8.0 in favor of soft-deletes.

Closes #50775
2020-01-31 08:18:07 -05:00
Christoph Büscher 7cec5f93be
Make `date_range` query rounding consistent with `date` (#50237)
Currently the rounding used in range queries can behave differently for `date`
and `date_range` as explained in #50009. The behaviour on `date` fields is 
the one we document in https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html#range-query-date-math-rounding. 
This change adapts the rounding behaviour for RangeType.DATE so it uses the
same logic as the `date` for the `date_range` type.

Closes #50009
2020-01-31 14:15:13 +01:00
Nhat Nguyen 49a6729af1 Adjust bwc for #51588 2020-01-30 10:38:32 -05:00
Nhat Nguyen 2aa650c75e
Deprecate translog retention settings (#51588)
This change deprecates the translog retention settings as they are 
effectively ignored since 7.4.

Relates #50775
Relates #45473
2020-01-29 10:19:22 -05:00
Nik Everett 0483f7c1b7
Begin moving date_histogram to offset rounding (take two) (#51271)
We added a new rounding in #50609 that handles offsets to the start and
end of the rounding so that we could support `offset` in the `composite`
aggregation. This starts moving `date_histogram` to that new offset.

This is a redo of #50873 with more integration tests.

This reverts commit d114c9db3e.
2020-01-27 12:24:52 -05:00
Nik Everett d060d73a7d
Support time_zone on composite's date_histogram (#51172)
We've been parsing the `time_zone` parameter on `date_hitogram` for a
while but it hasn't *done* anything. This wires it up.

Closes #45199
Inspired by #45200
2020-01-27 11:10:53 -05:00
Dan Pickett c3b5f713e2 [DOCS] Fix typos in several REST API specs (#51197)
Changes `effected` to `affected` in several REST API spec files.
2020-01-22 12:17:33 -05:00
Przemyslaw Gomulka a2f23f7ea0
Remove TODO in a test for verifying start of the week (#50894)
The test should be run against 7.7 version at least, as this was only backported and released in that version

relates SPI based implementation #48209
relates backport #50916
2020-01-21 16:58:19 +01:00
Nik Everett 73991daa91
Add "did you mean" to unknown queries (#51177)
This replaces the message we return for unknown queries with the standard
one that we use for unknown fields from `ObjectParser`. This is nice
because it includes "did you mean". One day we might convert parsing
queries to using object parser, but that looks complex. This change is
much smaller and seems useful.
2020-01-20 15:24:59 -05:00
Nhat Nguyen c893a3e495
Make soft-deletes mandatory in 8.0 (#51122)
Creating indices with soft deletes disabled is no longer supported in 8.0.
2020-01-17 17:34:22 -05:00
Maxim 09ebc11b06 Deprecates _upgrade API (#47678) (#50484)
* Deprecates _upgrade API

Ref #47678

* Move deprecation flags to path section. Add deprecation warning tests for _upgrade API.

Ref #47678
2020-01-17 14:52:46 -07:00
Nik Everett 1a727ba277
Update skip after backport (#51175)
Now that we've backported #50869 we can update the skip config for its
test.
2020-01-17 13:32:07 -05:00
Nik Everett 224640a3ca
"did you mean" for ObjectParser with top named (#51018)
When you declare an ObjectParser with top level named objects like we do
with `significant_terms` we didn't support "did you mean". This fixes
that.

Relates #50938
2020-01-17 10:41:14 -05:00
Nhat Nguyen 09b46c8646
Goodbye and thank you synced flush! (#50882)
Synced flush was a brilliant idea. It supports instant recoveries with a 
quite small implementation. However, with the presence of sequence
numbers and retention leases, it is no longer needed. This change
removes it from 8.0.

Relates #5077
2020-01-16 09:43:07 -05:00
Nik Everett 70cee715b0
Update skip after backport (#51015)
Now that we've backported #50938 to 7.x it should be safe to run its
test against BWC clusters that include that branch.
2020-01-14 19:41:14 -05:00
Nik Everett 5da5f44de4
Add "did you mean" to ObjectParser (#50938)
Check it out:
```
$ curl -u elastic:password -HContent-Type:application/json -XPOST localhost:9200/test/_update/foo?pretty -d'{
  "dac": {}
}'

{
  "error" : {
    "root_cause" : [
      {
        "type" : "x_content_parse_exception",
        "reason" : "[2:3] [UpdateRequest] unknown field [dac] did you mean [doc]?"
      }
    ],
    "type" : "x_content_parse_exception",
    "reason" : "[2:3] [UpdateRequest] unknown field [dac] did you mean [doc]?"
  },
  "status" : 400
}
```

The tricky thing about implementing this is that x-content doesn't
depend on Lucene. So this works by creating an extension point for the
error message using SPI. Elasticsearch's server module provides the
"spell checking" implementation.
2020-01-14 10:42:05 -05:00
Nhat Nguyen 08b8450b62 Deprecate synced flush (#50835)
A normal flush has the same effect as a synced flush on Elasticsearch
7.6 or later. It's deprecated in 7.6 and will be removed in 8.0.

Relates #50776
2020-01-13 19:54:23 -05:00
Nik Everett 5a76fac29e
Fix format problem in composite of unmapped (#50869)
When a composite aggregation is reduced using the results from an
index that has one of the fields unmapped we were throwing away the
formatter. This is mildly annoying, except in the case of IP addresses
which were coming out as non-utf-8-characters. And tripping assertions.

This carefully preserves the formatter from the working bucket.

Closes #50600
2020-01-10 15:12:40 -05:00
Nik Everett dfccbf0aa9
Drop BWC suppressions for composite aggs (#50857)
When I implemented #50609 I suppressed a few backwards compatibility
checks until I finished the backport. I've now finished the backport so
this enables the tests.
2020-01-10 12:13:56 -05:00
Julie Tibshirani 8dba29fe2d Correct the skip version in tests for field collapsing on an alias. 2020-01-09 15:34:38 -08:00
Julie Tibshirani e5eff68d10 Adjust the skip version in tests for field collapsing with aliases.
Follow-up to #50722, which was also backported to 7.5 and 7.6.
2020-01-08 15:57:52 -08:00
Julie Tibshirani 2dbaa654c1
Ensure that field collapsing works with field aliases. (#50722)
Previously, the following situation would throw an error:
* A search contains a `collapse` on a particular field.
* The search spans multiple indices, and in one index the field is mapped as a
  concrete field, but in another it is a field alias.

The error occurs when we attempt to merge `CollapseTopFieldDocs` across shards.
When merging, we validate that the name of the collapse field is the same across
shards. But the name has already been resolved to the concrete field name, so it
will be different on shards where the field was mapped as an alias vs. shards
where it was a concrete field.

This PR updates the collapse field name in `CollapseTopFieldDocs` to the
original requested field, so that it will always be consistent across shards.

Note that in #32648, we already made a fix around collapsing on field aliases.
However, we didn't test this specific scenario where the field was mapped as an
alias in only one of the indices being searched.
2020-01-08 13:50:32 -08:00
Adrien Grand 8933919d9b
Reenable bw tests after merging #50333. (#50746)
PR #50333 has been merged.
2020-01-08 17:12:27 +01:00
Nik Everett 326d696d9a
Support offset in composite aggs (#50609)
Adds support for the `offset` parameter to the `date_histogram` source
of composite aggs. The `offset` parameter is supported by the normal
`date_histogram` aggregation and is useful for folks that need to
measure things from, say, 6am one day to 6am the next day.

This is implemented by creating a new `Rounding` that knows how to
handle offsets and delegates to other rounding implementations. That
implementation doesn't fully implement the `Rounding` contract, namely
`nextRoundingValue`. That method isn't used by composite aggs so I can't
be sure that any implementation that I add will be correct. I propose to
leave it throwing `UnsupportedOperationException` until I need it.

Closes #48757
2020-01-07 14:49:09 -05:00
David Turner 8c6f821c75
Remove the 'local' parameter of /_cat/nodes (#50594)
The cat nodes API performs a `ClusterStateAction` then a `NodesInfoAction`.
Today it accepts the `?local` parameter and passes this to the
`ClusterStateAction` but this parameter has no effect on the `NodesInfoAction`.
This is surprising, because `GET _cat/nodes?local` looks like it might be a
completely local call but in fact it still depends on every node in the
cluster.

This parameter was deprecated in 7.x in #50499 and this commit removes it.

Relates #50088
2020-01-06 14:12:51 +00:00
Nhat Nguyen 520958bd56 Adjus bwc for #50502
Relates #50502
2020-01-06 08:44:53 -05:00
Nhat Nguyen 0c0f45538c
Deprecate indices without soft-deletes (#50502)
Soft-deletes will be enabled for all indices in 8.0. Hence, we should 
deprecate new indices without soft-deletes in 7.x.
2020-01-05 18:30:17 -05:00
Alan Woodward b41da0944b
Adjust version skips for intervals rest tests (#50588)
The rest tests for prefix, wildcard and fuzzy intervals can all be run
against 7.x clusters.  Also corrects the invocation of the fuzzy interval.
2020-01-03 11:24:12 +00:00
Alan Woodward 32730cfdc5
Add fuzzy intervals source (#49762)
This intervals source will return terms that are similar to an input term, up to
an edit distance defined by fuzziness, similar to FuzzyQuery.

Closes #49595
2020-01-03 09:55:53 +00:00
Oleg 1c2492136d Deprecate the 'local' parameter of /_cat/nodes (#50499)
The cat nodes API performs a `ClusterStateAction` then a `NodesInfoAction`.
Today it accepts the `?local` parameter and passes this to the
`ClusterStateAction` but this parameter has no effect on the `NodesInfoAction`.
This is surprising, because `GET _cat/nodes?local` looks like it might be a
completely local call but in fact it still depends on every node in the
cluster.

This commit deprecates the `?local` parameter on this API so that it can be
removed in 8.0.

Relates #50088
2020-01-02 14:22:40 +00:00
Adrien Grand 2d627ba757
Add per-field metadata. (#49419)
This PR adds per-field metadata that can be set in the mappings and is later
returned by the field capabilities API. This metadata is completely opaque to
Elasticsearch but may be used by tools that index data in Elasticsearch to
communicate metadata about fields with tools that then search this data. A
typical example that has been requested in the past is the ability to attach
a unit to a numeric field.

In order to not bloat the cluster state, Elasticsearch requires that this
metadata be small:
 - keys can't be longer than 20 chars,
 - values can only be numbers or strings of no more than 50 chars - no inner
   arrays or objects,
 - the metadata can't have more than 5 keys in total.

Given that metadata is opaque to Elasticsearch, field capabilities don't try to
do anything smart when merging metadata about multiple indices, the union of
all field metadatas is returned.

Here is how the meta might look like in mappings:

```json
{
  "properties": {
    "latency": {
      "type": "long",
      "meta": {
        "unit": "ms"
      }
    }
  }
}
```

And then in the field capabilities response:

```json
{
  "latency": {
    "long": {
      "searchable": true,
      "aggreggatable": true,
      "meta": {
        "unit": [ "ms" ]
      }
    }
  }
}
```

When there are no conflicts, values are arrays of size 1, but when there are
conflicts, Elasticsearch includes all unique values in this array, without
giving ways to know which index has which metadata value:

```json
{
  "latency": {
    "long": {
      "searchable": true,
      "aggreggatable": true,
      "meta": {
        "unit": [ "ms", "ns" ]
      }
    }
  }
}
```

Closes #33267
2019-12-18 17:27:38 +01:00
Tomas Della Vedova 9ed323ad1d
Added type definitions in rest-api-spec (#47089)
* Added type definitions in rest-api-spec

* Addressed comments
2019-12-12 13:56:16 +01:00
Martijn Laarman 7bb4781bc9
cat.indices.json bytes enum not exhaustive (#49369)
Missing several valid options that other cat API's do define
2019-12-12 13:12:04 +01:00
Przemyslaw Gomulka 90c59a1dbf
Allow skipping ranges of versions (#50014)
Multiple version ranges are allowed to be used in section skip in yml
tests. This is useful when a bugfix was backported to latest versions
and all previous releases contain a wire breaking bug.
examples:
6.1.0 - 6.3.0, 6.6.0 - 6.7.9, 7.0 -
- 7.2, 8.0.0 -
2019-12-10 14:22:10 +01:00
markharwood b4fa6771b9
Remove serialisation of adjust_pure_negative default value - (#49543)
Closes #49530
2019-12-05 12:13:53 +00:00
Stuart Tettemer 4a078029ed
Scripting: add available languages & contexts API (#49652)
Adds `GET /_script_language` to support Kibana dynamic scripting
language selection.

Response contains whether `inline` and/or `stored` scripts are
enabled as determined by the `script.allowed_types` settings.

For each scripting language registered, such as `painless`,
`expression`, `mustache` or custom, available contexts for the language
are included as determined by the `script.allowed_contexts` setting.

Response format:
```
{
  "types_allowed": [
    "inline",
    "stored"
  ],
  "language_contexts": [
    {
      "language": "expression",
      "contexts": [
        "aggregation_selector",
        "aggs"
        ...
      ]
    },
    {
      "language": "painless",
      "contexts": [
        "aggregation_selector",
        "aggs",
        "aggs_combine",
        ...
      ]
    }
...
  ]
}
```

Fixes: #49463
2019-12-03 18:55:48 -07:00
Jim Ferenczi c2deb287f1
Add a cluster setting to disallow loading fielddata on _id field (#49166)
This change adds a dynamic cluster setting named `indices.id_field_data.enabled`.
When set to `false` any attempt to load the fielddata for the `_id` field will fail
with an exception. The default value in this change is set to `false` in order to prevent
fielddata usage on this field for future versions but it will be set to `true` when backporting
to 7x. When the setting is set to true (manually or by default in 7x) the loading will also issue
a deprecation warning since we want to disallow fielddata entirely when https://github.com/elastic/elasticsearch/issues/26472
is implemented.

Closes #43599
2019-11-27 13:38:09 +01:00
Alan Woodward 35355e25f7
Remove types from internal GetFieldMappings request/response objects (#48815)
Type filters and intermediate type levels in mappings responses have already been
removed from the GetFieldMappings REST layer; we can also remove them from the
internal Node client classes.

Relates to #41059
2019-11-27 11:41:41 +00:00
Martijn Laarman 8098276b7f Remove force from version_type enum in rest-spec (#49370)
As per #47228 `force` is no longer a valid option
2019-11-26 09:58:33 +01:00
Enrico Zimuel eeda29ac56
Slash miss in indices.put_mapping url 2019-11-21 22:59:02 +01:00
Julie Tibshirani 33a7f066e1
Remove include_type_name from the REST API spec and docs. (#48828)
In #48632 we removed support for `include_type_name` in the REST API. This PR
removes it from the API spec and documentation.
2019-11-12 09:42:46 -08:00
Alan Woodward 37a997a9a9
Remove `include_type_name` parameter from REST layer (#48632)
This commit removes support for the include_type_name parameter from all
REST actions that receive or return mapping configurations.

Relates to #41059
2019-11-01 09:30:47 +00:00
Christoph Büscher e5646fefa3
Support `search_type` in Rank Evaluation API (#48542)
Adding support for the `search_type` request parameter to the Ranking Evaluation
API since this parameter can impact the ranking and the metric score and should
be choosen in the same way when evaluating the search as later in the real
search.

Closes #48503
2019-10-29 13:26:41 +01:00
Stuart Tettemer 0f1b076e40
Scripting: fill in get contexts REST API (#48319)
* Scripting: fill in get contexts REST API

Updates response for `GET /_script_context`, returning a `contexts`
object with a list of context description objects.  The description
includes the context name and a list of methods available.  The
methods list has the signature for the `execute` mathod and any
getters. eg.
```
{
  "contexts": [
     {
       "name" : "moving-function",
       "methods" : [
         {
           "name" : "execute",
           "return_type" : "double",
           "params" : [
             {
               "type" : "java.util.Map",
               "name" : "params"
             },
             {
               "type" : "double[]",
               "name" : "values"
             }
           ]
         }
       ]
     },
     {
       "name" : "number_sort",
       "methods" : [
         {
           "name" : "execute",
           "return_type" : "double",
           "params" : [ ]
         },
         {
           "name" : "getDoc",
           "return_type" : "java.util.Map",
           "params" : [ ]
         },
         {
           "name" : "getParams",
           "return_type" : "java.util.Map",
           "params" : [ ]
         },
         {
           "name" : "get_score",
           "return_type" : "double",
           "params" : [ ]
         }
       ]
     },
...
  ]
}
```

fixes: #47411
2019-10-28 13:33:35 -06:00
Alan Woodward afeee4be9e
Remove type filter from GetMappings API (#47364)
This commit removes the types filter from the GetMappings API, which is no longer
useful seeing as we can only have a single mapping type per index. It also changes
the structure of GetMappingsResponse and GetIndexResponse to remove the extra
nesting of mappings below the no-longer-relevant type name, and removes the types
methods from the equivalent request classes.

Relates to #41059
2019-10-21 10:10:34 +01:00
Stuart Tettemer c6037dc93b
Scripting: get context names REST API (#48026)
Adds `GET /_script_context`, returning a `contexts` object with each
available context as a key whose value is an empty object. eg.
```
{
  "contexts": {
    "aggregation_selector": {},
    "aggs": {},
    "aggs_combine": {},
...
  }
}
```

refs: #47411
2019-10-16 16:44:47 -06:00
James Rodewig 64c1dfa727
[DOCS] Remove unsupported `local` and `master_timeout` parms from cat API docs (#47933) 2019-10-14 11:38:46 -04:00
Ioannis Kakavas bac7322f01
Un-mute locale depending mapping tests (#47977)
Reverts 71968c9. The underlying
issue which was related to the bouncycastle security provider
permissions was resolved in
https://github.com/elastic/infra/pull/14995

resolves: https://github.com/elastic/elasticsearch/issues/39981
2019-10-14 11:28:15 +03:00
Alan Woodward 566e1b7d33
Remove type field from DocWriteRequest and associated Response objects (#47671)
This commit removes the type field from index, update and delete requests, and their
associated responses.

Relates to #41059
2019-10-11 10:23:55 +01:00
James Rodewig 15e2de6db8
[DOCS] Document `bytes` and `time` params in cat API docs (#47672) 2019-10-10 08:29:27 -04:00
Alan Woodward 7a622f024f
Remove types from BulkRequest (#46983)
This commit removes types entirely from BulkRequest, both as a global
parameter and as individual entries on update/index/delete lines.

Relates to #41059
2019-10-07 13:29:12 +01:00
Alan Woodward 29463551ae
Remove typename checks in mapping updates (#47347)
This commit removes types validation during mapping updates. This will make
further work on types removal easier, as it will prevent test failures due to type-name
clashes when we remove type information from PutMapping and CreateIndex requests

Part of #41059
2019-10-03 11:25:09 +01:00
Yannick Welsch f52afa3cd4 Adapt version constants after backport (#47353) 2019-10-02 14:32:10 +02:00
Yannick Welsch e1012efbd1
Use optype CREATE for single auto-id index requests (#47353)
Changes auto-id index requests to use optype CREATE, making it compliant with our docs.
This will also make these auto-id index requests compatible with the new "create-doc" index
privilege (which is based on the optype), the default optype is changed to create, just as it is
already documented.
2019-10-02 11:04:19 +02:00
Yannick Welsch c048c86351
Allow optype CREATE for append-only indexing operations (#47169)
Bulk requests currently do not allow adding "create" actions with auto-generated IDs.
This commit allows using the optype CREATE for append-only indexing operations. This is
mainly the user facing aspect of it.
2019-09-30 16:54:46 +02:00
James Rodewig 4568d30ef6
[DOCS] Document missing query parms for cat recovery API (#47181)
Documents the following query parameters for
the /_cat/recovery API:

* `active_only`
* `detailed`
* `index`
2019-09-27 12:19:47 -04:00
Alan Woodward ff99bc1d3f
Remove per-type indexing stats (#47203)
With only a single type, the per-type filters for indexing stats are no longer useful.

Relates to #41059
2019-09-27 13:03:37 +01:00
Alan Woodward c1f99e2d75
Remove `_type` from SearchHit (#46942)
This commit removes the `_type` field from all search hit responses.

Relates to #41059
2019-09-23 19:14:54 +01:00
Colin Goodheart-Smithe a574a66a21 Removes typed URLs from mapping APIs (#41676)
Relates to #41059
2019-09-23 18:20:07 +01:00
Alan Woodward 4ebeca585b
Remove types from TermsLookup (#46943)
TermsLookup uses a GetRequest under the hood to load terms from a particular
document.  Now that GetRequests no longer use a type, we can remove types from
the TermsLookup object and terms query as well.

Relates to #41059
2019-09-23 18:07:39 +01:00
Alan Woodward b733f9e803
Remove types from explain API (#46926)
We no longer need a type to get the source of a document, so we can remove it from
the explain API as well.

Relates to #41059
2019-09-23 17:55:09 +01:00
Luca Cavanna 74e3af5c9e
update _common.json format (#46872)
API spec now use an object for the documentation field. _common was not updated yet. This commit updates _common.json and its corresponding parser.

Closes #46744

Co-Authored-By: Tomas Della Vedova <delvedor@users.noreply.github.com>
2019-09-23 17:00:37 +02:00
Alan Woodward 7c90801aff
Remove types from Get/MultiGet (#46587)
This commit removes types from the ShardGetService, and propagates this API change
up through the Transport and Rest actions for Get and MultiGet

Relates to #41059
2019-09-20 14:22:57 +01:00
Martijn Laarman 716b4e1fdf Document PUT as the prefered HTTP method for index API (#45622)
Follow up from #42346. Since the `methods` array is in order of
preference when calling the index API with an `{id}` we prefer to use
the `PUT` http method.
2019-09-19 14:23:12 +02:00
James Rodewig 4ac134dc0f
[DOCS] Separate and reformat synced flush API docs (#46634) 2019-09-18 16:16:29 -04:00
Tomas Della Vedova a2a502b330
Fixes for API specification (#46522)
Follow-up of #42346
2019-09-16 11:23:57 +02:00
Henning Andersen bc094e63b3
Wait for events in translog stats tests (#46586)
When waiting for no initializing shards we also have to wait for events
when we have more than one node in the cluster. When the primary is
started, there is a short period of time, where neither the primary nor
any of the replicas are initializing.

Closes #46535
2019-09-12 09:11:50 +02:00
Alpar Torok 7dc9323abd Fix muting of test
Can't have multiple skip sections
2019-09-10 14:36:07 +03:00
Alpar Torok 1a8a5a2b22 muted on mater
tracked in  #46535
2019-09-10 14:09:09 +03:00
Nhat Nguyen 2224f8663a
Ensure no ongoing peer recovery in translog yaml test (#46476)
We leave replicas unassigned until we reroute after the primary shard
starts. If a cluster health request with wait_for_no_initializing_shards
is executed before the reroute, it will return immediately although
there will be some initializing replicas. Peer recoveries of those
shards can prevent translog on the primary from trimming.

We add wait_for_events to the cluster health request so that it will
execute after the reroute.

Closes #46425
2019-09-09 09:38:49 -04:00
Benjamin Trent 995be00746
Adjusting bwc serialization after backport (#46400) 2019-09-05 14:06:00 -05:00
Benjamin Trent 9d3467ae30
Support geotile_grid aggregation in composite agg sources (#45810)
Adds support for `geotile_grid` as a source in composite aggs. 

Part of this change includes adding a new docFormat of `GEOTILE` that formats a hashed `long` value into a geotile formatting string `zoom/x/y`.
2019-09-05 10:36:34 -05:00
Alpar Torok a238248706
Bwc testclusters all (#46265)
Convert all bwc projects to testclusters
2019-09-04 15:39:37 +03:00
Tal Levy 3cf174d239
re-enable bwc tests and update cat.alias rest tests (#45822)
* correct version bounds to 7.4 for cat.alias rest tests

* re-enable bwc tests
2019-08-21 16:06:58 -07:00
Tal Levy 7106288c54
Add is_write_index column to cat.aliases (#44772)
Aliases have had the option to set `is_write_index` since 6.4,
but the cat.aliases action was never updated.
2019-08-21 07:40:07 -07:00
Armin Braun 4db49b260f
Fix Broken REST API Spec for Repo Cleanup (#45782)
* Fix Broken REST API Spec for Repo Cleanup
2019-08-21 13:25:08 +02:00
Armin Braun df01766c15
Repository Cleanup Endpoint (#43900)
* Snapshot cleanup functionality via transport/REST endpoint.
* Added all the infrastructure for this with the HLRC and node client
* Made use of it in tests and resolved relevant TODO
* Added new `Custom` CS element that tracks the cleanup logic.
Kept it similar to the delete and in progress classes and gave it
some (for now) redundant way of handling multiple cleanups but only allow one
* Use the exact same mechanism used by deletes to have the combination
of CS entry and increment in repository state ID provide some
concurrency safety (the initial approach of just an entry in the CS
was not enough, we must increment the repository state ID to be safe
against concurrent modifications, otherwise we run the risk of "cleaning up"
blobs that just got created without noticing)
* Isolated the logic to the transport action class as much as I could.
It's not ideal, but we don't need to keep any state and do the same
for other repository operations
(like getting the detailed snapshot shard status)
2019-08-21 12:02:44 +02:00
Nhat Nguyen b0d346fd74
Ignore translog retention policy if soft-deletes enabled (#45473)
Since #45136, we use soft-deletes instead of translog in peer recovery.
There's no need to retain extra translog to increase a chance of
operation-based recoveries. This commit ignores the translog retention
policy if soft-deletes is enabled so we can discard translog more
quickly.

Co-authored-by: David Turner <david.turner@elastic.co>

Relates #45136
2019-08-20 20:54:14 -04:00
Karel Minarik 9166311622 Update the schema for the REST API specification (#42346)
* Update the REST API specification

This patch updates the REST API spefication in JSON files to better encode deprecated entities,
to improve specification of URL paths, and to open up the schema for future extensions.

Notably, it changes the `paths` from a list of strings to a list of objects, where each
particular object encodes all the information for this particular path: the `parts` and the `methods`.

Among the benefits of this approach is eg. encoding the difference between using the `PUT` and `POST`
methods in the Index API, to either use a specific document ID, or let Elasticsearch generate one.

Also `documentation` becomes an object that supports an `url` and also a `description` which is a
new field.

* Adapt YAML runner to new REST API specification format

The logic for choosing the path to use when running tests has been
simplified, as a consequence of the path parts being listed under each
path in the spec. The special case for create and index has been removed.

Also the parsing code has been hardened so that errors are thrown earlier
when the structure of the spec differs from what expected, and their
error messages should be more helpful.
2019-08-15 17:15:30 +02:00
Przemyslaw Gomulka 8d1ea86519
Set start of the week to Monday for root locale (#43652)
Introducing a IsoLocal.ROOT constant which should be used instead of java.util.Locale.ROOT in ES when dealing with dates. IsoLocal.ROOT  customises start of the week to be Monday instead of Sunday.

closes #42588 an issue with investigation details
relates #41670 bug raised (this won't fix it on its own. joda.parseInto has to be reimplemented
closes #43275 an issue raised by community member
2019-08-09 15:24:05 +02:00
Jason Tedor 5fee557163
Introduce formal node ML role (#45174)
This commit builds on the ability for plugins to introduce new roles to
add a formal node ML role.
2019-08-06 12:58:46 -04:00
Nhat Nguyen 0fda586480 Adjust skip version after backport (#44603)
Relates #44603
2019-07-29 14:29:44 -04:00
Tanguy Leroux 321c2b8627
Force Merge should reject requests with `only_expunge_deletes` and `max_num_segments` set (#44761)
This commit changes the ForceMergeRequest.validate() method so that it does 
not accept the parameters only_expunge_deletes and max_num_segments 
to be set at the same time.

The motivation is that InternalEngine.forceMerge() just ignores the max. number 
of segments parameter when the only expunge parameter is set to true, leaving 
the wrong impression to the user that max. number of segments has been applied. 
It also changes InternalEngine.forceMerge() so that it now throws an exception 
when both parameters are set, and modifies tests where needed.

Because it changes the behavior of the REST API I marked this as >breaking. 

Closes #43102
2019-07-26 09:34:36 +02:00
Yannick Welsch ad64ec197b Adapt BWC condition for clone index API after backport (#44267)
Changes the BWC conditions for the clone index API after backport of the feature to 7.x
2019-07-25 22:51:23 +02:00
Yannick Welsch 76fcc81275
Add Clone Index API (#44267)
Adds an API to clone an index. This is similar to the index split and shrink APIs, just with the
difference that the number of primary shards is kept the same. In case where the filesystem
provides hard-linking capabilities, this is a very cheap operation.

Indexing cloning can be done by running `POST my_source_index/_clone/my_target_index` and it
supports the same options as the split and shrink APIs.

Closes #44128
2019-07-25 20:17:51 +02:00
Enrico Zimuel c36f5853d1 Fix URL documentation in API specs (#44487) 2019-07-24 09:04:16 -07:00
Jason Tedor ac5cc15308
Fix cat recovery display of bytes fields (#40379)
The cat APIs support the ?bytes parameter to format bytes value. The cat
recovery API does not follow this because the fields were not using
ByteSizeValue. This commit addresses this.
2019-07-24 00:12:04 -07:00
Nhat Nguyen 6be57f8da7
Return seq_no and primary_term in noop update (#44603)
With this change, we will return primary_term and seq_no of the current
document if an update is detected as a noop. We already return the
version; hence we should also return seq_no and primary_term.

Relates #42497
2019-07-19 10:57:14 -04:00
James Rodewig ea1adb61c2
[DOCS] Update anchors and links for Elasticsearch API relocation (#44500) 2019-07-19 09:16:35 -04:00
James Rodewig 0b9492f10f Revert "[DOCS] Update documentation links in spec"
This reverts commit 83be984399.
2019-07-12 17:06:22 -04:00
James Rodewig f70b3cc0a2 [DOCS] Correct link for synced index flush 2019-07-12 16:54:55 -04:00
James Rodewig 83be984399 [DOCS] Update documentation links in spec 2019-07-12 14:48:57 -04:00
Przemyslaw Gomulka 03f4e81fc3
JSON logging refactoring and X-Opaque-ID support (#41354)
This is a refactor to current JSON logging to make it more open for extensions
and support for custom ES log messages used inDeprecationLogger IndexingSlowLog , SearchSLowLog
We want to include x-opaque-id in deprecation logs. The easiest way to have this as an additional JSON field instead of part of the message is to create a custom DeprecatedMessage (extends ESLogMEssage)

These messages are regular log4j messages with a text, but also carry a map of fields which can then populate the log pattern. The logic for this lives in ESJsonLayout and ESMessageFieldConverter.

Similar approach can be used to refactor IndexingSlowLog and SearchSlowLog JSON logs to contain fields previously only present as escaped JSON string in a message field.

closes #41350
2019-07-10 18:22:50 +02:00
Tanguy Leroux a6743dabd9
Reenable bwc tests (#43872)
This reenables the BWC tests disabled in #43856
2019-07-02 19:00:58 +02:00
Zachary Tong 17c73631c1 Update rare_term version skips, fix SetBackedScalingCuckooFilter javadoc 2019-07-01 10:50:57 -04:00
Zachary Tong baf155dced
Add RareTerms aggregation (#35718)
This adds a `rare_terms` aggregation.  It is an aggregation designed
to identify the long-tail of keywords, e.g. terms that are "rare" or
have low doc counts.

This aggregation is designed to be more memory efficient than the
alternative, which is setting a terms aggregation to size: LONG_MAX
(or worse, ordering a terms agg by count ascending, which has
unbounded error).

This aggregation works by maintaining a map of terms that have
been seen. A counter associated with each value is incremented
when we see the term again.  If the counter surpasses a predefined
threshold, the term is removed from the map and inserted into a cuckoo
filter.  If a future term is found in the cuckoo filter we assume it
was previously removed from the map and is "common".

The map keys are the "rare" terms after collection is done.
2019-07-01 10:02:36 -04:00
Tanguy Leroux 03c2b27c19
Expose translog stats in ReadOnlyEngine (#43752) 2019-07-01 13:52:01 +02:00
Alan Woodward 89a3eb3c6f
Wildcard intervals (#43691)
This commit adds a wildcard intervals source, similar to the prefix. It
also changes the term parameter in prefix to read prefix, to bring it
in to line with the pattern parameter in wildcard.

Closes #43198
2019-06-28 13:58:06 +01:00
Jim Ferenczi a614415838
Remove deprecated sort options: nested_path and nested_filter (#42809)
This commit removes the nested_path and nested_filter options deprecated in 6x.
This change also checks that the sort field has a [nested] option if it is under a nested
object and throws an exception if it's not the case.

Closes #27098
2019-06-27 17:30:02 +02:00
Alan Woodward a520a5d761
Add prefix intervals source (#43635)
This commit adds a prefix intervals source, allowing you to search
for intervals that contain terms starting with a given prefix. The source
can make use of the index_prefixes mapping option.

Relates to #43198
2019-06-26 15:36:47 +01:00
Henning Andersen ac3e4a6799
Reindex remove outer level size (#43373)
This commit finalizes the work done to rename size to max_docs in
reindex and update/delete by query. size is no longer supported in URL
or outer level body for the 3 APIs (though size in update/delete-by-query
will and has always been interpreted as scroll_size, it is not to be relied
upon).

Continuation of #41894

Closes #24344
2019-06-26 09:36:17 +02:00
Yannick Welsch 1765b3868d Change BWC condition after backporting #29076 2019-06-21 09:06:22 +02:00
Yu e8ea83116c Make Recovery API support `detailed` params (#29076)
Properly forwards the `detailed` parameter to show the recovery stats details.

Closes #28910
2019-06-21 09:02:23 +02:00
Andrey Ershov 680d6edc0b
Get snapshots support for multiple repositories (#42090)
This commit adds multiple repositories support to get snapshots
request.
If some repository throws an exception this method does not fail fast
instead, it returns results for all repositories.
This PR is opened in favour of #41799, because we decided to change
the response format in a non-BwC manner. It makes sense to read a
discussion of the aforementioned PR.
This is the continuation of work done here #15151.
2019-06-19 16:04:13 +03:00
Martijn Laarman 61c34bbd92
Introduce stability description to the REST API specification (#38413)
* introduce state to the REST API specification

* change state over to stability

* CCR is no GA updated to stable

* SQL is now GA so marked as stable

* Introduce `internal` as state for API's, marks stable in terms of lifetime but unstable in terms of guarantees on its output format since it exposes internal representations

* make setting a wrong stability value, or not setting it at all an error that causes the YAML test suite to fail

* update spec files to be explicit about their stability state

* Document the fact that stability needs to be defined

Otherwise the YAML test runner will fail (with a nice exception message)

* address check style violations

* update rest spec unit tests to include stability

* found one more test spec file not declaring stability, made sure stability appears after documentation everywhere

* cluster.state is stable, mark response in some way to denote its a key value format that can be changed during minors

* mark data frame API's as beta

* remove internal and private as states for an API

* removed the wrong enum values in the Stability Enum in the previous commit
2019-06-12 20:54:51 +02:00
Ryan Ernst accbffa8b0
Move painless context api spec to test local (#43122)
The painless context api is internal and currently meant only for use in
generating docs. This commit moves the spec file for the api so that it
is only used by the test for this api, and not externally by any clients
building from the public rest spec.
2019-06-12 08:19:14 -07:00
Martijn Laarman 4430f99750
Documents the new deprecations options on the rest-api-spec (#41444)
* Documents the new deprecations options on the rest-api-spec

Relates #41439 #38613 #35262

* remove reference to path now that #41452 is merged, also fixed missing a comma rendering the example json invalid

* removed one more instance of path

* make sure json examples are self contained and not excerpts
2019-06-11 11:38:33 +02:00
Martijn Laarman f5fde1d084
remove path from rest-api-spec (#41452) 2019-06-11 10:20:55 +02:00
Alan Woodward af5e6cad82
Move construction of custom analyzers into AnalysisRegistry (#42940)
Both TransportAnalyzeAction and CategorizationAnalyzer have logic to build
custom analyzers for index-independent analysis. A lot of this code is duplicated,
and it requires the AnalysisRegistry to expose a number of internal provider
classes, as well as making some assumptions about when analysis components are
constructed.

This commit moves the build logic directly into AnalysisRegistry, reducing the
registry's API surface considerably.
2019-06-10 10:26:15 +01:00
Henning Andersen a6b5aaa3b4
Reindex max_docs parameter name (#41894)
Previously, a reindex request had two different size specifications in the body:
* Outer level, determining the maximum documents to process
* Inside the source element, determining the scroll/batch size.

The outer level size has now been renamed to max_docs to
avoid confusion and clarify its semantics, with backwards compatibility and
deprecation warnings for using size.
Similarly, the size parameter has been renamed to max_docs for
update/delete-by-query to keep the 3 interfaces consistent.

Finally, all 3 endpoints now support max_docs in both body and URL.

Relates #24344
2019-06-06 16:01:24 +02:00
Gordon Brown 12af9a913e Correct versions limits for snapshot metadata field (#42911)
Now that the snapshot metadata field has been backported, the version
restrictions used in tests and for serialization need to corrected.
2019-06-05 21:09:11 -04:00