Commit Graph

2479 Commits

Author SHA1 Message Date
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
Gordon Brown eaa3f874b6
Add custom metadata to snapshots (#41281)
Adds a metadata field to snapshots which can be used to store arbitrary
key-value information. This may be useful for attaching a description of
why a snapshot was taken, tagging snapshots to make categorization
easier, or identifying the source of automatically-created snapshots.
2019-06-05 10:55:07 -06:00
Colin Goodheart-Smithe 795fa816d9
Removes type from TermVectors APIs (#42198) 2019-06-05 09:32:48 +01:00
Marios Trivyzas 6dd4d2b7a6
Remove CommonTermsQuery and cutoff_frequency param (#42654)
Remove `common` query and `cutoff_frequency` parameter of
`match` and `multi_match` queries. Both have already been
deprecated for the next 7.x version.

Closes: #37096
2019-05-31 17:06:06 +02:00
Colin Goodheart-Smithe 3f10cea87a
Removes types from SearchRequest and QueryShardContext (#42112) 2019-05-29 08:50:30 +01:00
Tanguy Leroux 81f3b5d4c2 Improve Close Index Response (#39687)
This changes the `CloseIndexResponse` so that it reports closing result
for each index. Shard failures or exception are also reported per index,
and the global acknowledgment flag is computed from the index results
only.

The response looks like:
```
{
  "acknowledged" : true,
  "shards_acknowledged" : true,
  "indices" : {
    "docs" : {
      "closed" : true
    }
  }
}
```

The response reports shard failures like:
```
{
  "acknowledged" : false,
  "shards_acknowledged" : false,
  "indices" : {
    "docs-1" : {
      "closed" : true
    },
    "docs-2" : {
      "closed" : false,
      "shards" : {
        "1" : {
          "failures" : [
            {
              "shard" : 1,
              "index" : "docs-2",
              "status" : "BAD_REQUEST",
              "reason" : {
                "type" : "index_closed_exception",
                "reason" : "closed",
                "index_uuid" : "JFmQwr_aSPiZbkAH_KEF7A",
                "index" : "docs-2"
              }
            }
          ]
        }
      }
    },
    "docs-3" : {
      "closed" : true
    }
  }
}
```

Co-authored-by: Tanguy Leroux <tlrx.dev@gmail.com>
2019-05-23 14:18:34 -04:00
Luca Cavanna 13dc1cf6b1
Update max_concurrent_shard_request parameter docs (#42227)
Some of the docs were outdated as they did not mention that the limit is
not per node. Also, The default value changed.

Relates to #31206
2019-05-23 16:02:46 +02:00
Zachary Tong 385dfd95d6
Update version skips and constants after backport (#42290)
After https://github.com/elastic/elasticsearch/pull/41906 was
backported, we need to update the various test skips and version
constants
2019-05-22 08:10:10 -04:00
Zachary Tong 3b79300f7b Update skip version after backport 2019-05-20 10:09:22 -04:00
Zachary Tong 0635f5a9e2
Fix FiltersAggregation NPE when `filters` is empty (#41459)
If `keyedFilters` is null it assumes there are unkeyed filters...which
will NPE if the unkeyed filters was actually empty.

This refactors to simplify the filter assignment a bit, adds an empty
check and tidies up some formatting.
2019-05-20 09:46:37 -04:00
Russ Cam e700c4c374 Remove parent query string parameter (#41098)
This commit removes the deprecated parent query string
parameter. The routing parameter should be used instead.
2019-05-20 06:07:28 -04:00
Ryan Ernst 0e48bbbfc9
Remove 6.0 version constant uses (#41965)
This commit removes all uses of the 6.0 version constants, since master
no longer needs to know about them.
2019-05-13 18:28:24 -07:00
Nhat Nguyen 40b32cdcb2
Wait for active shard after close in mixed cluster (#42029)
The segment stats can be null in a mixed cluster because we do not wait
for active shards after closing an index in 7.x.

Closes #40331
2019-05-10 08:49:53 -04:00
Zachary Tong a3b1e5f6d7
Fix max_bucket test by disallowing partial results (#41959)
The Max Bucket test can potentially return a partial response,
where one of the shards suceeds but another fails due to the max_bucket
setting.  In the case of a partial failure, the status code is 200 OK
since some results were returned (with failures listed in the body).

This makes the yaml test fail since it is expecting a 4xx/5xx failure
when catching exception messages.

We need to disallow partial results so that the entire query fails
and we can check for the max_bucket failure.
2019-05-09 17:38:25 -04:00
Colin Goodheart-Smithe 3647d7c94e
Removes typed REST endpoints from search and related APIs (#41640) 2019-05-09 14:41:11 +01:00
Benjamin Trent 68c87eb1ae
Muting failing test 240_max_buckets/Max Buckets (#41949) 2019-05-08 09:04:57 -05:00
Zachary Tong 290c8b8256
Force selection of calendar or fixed intervals in date histo agg (#33727)
The date_histogram accepts an interval which can be either a calendar 
interval (DST-aware, leap seconds, arbitrary length of months, etc) or 
fixed interval (strict multiples of SI units). Unfortunately this is inferred
by first trying to parse as a calendar interval, then falling back to fixed
if that fails.

This leads to confusing arrangement where `1d` == calendar, but 
`2d` == fixed.  And if you want a day of fixed time, you have to 
specify `24h` (e.g. the next smallest unit).  This arrangement is very
error-prone for users.

This PR adds `calendar_interval` and `fixed_interval` parameters to any
code that uses intervals (date_histogram, rollup, composite, datafeed, etc).
Calendar only accepts calendar intervals, fixed accepts any combination of
units (meaning `1d` can be used to specify `24h` in fixed time), and both
are mutually exclusive.  

The old interval behavior is deprecated and will throw a deprecation warning.
It is also mutually exclusive with the two new parameters. In the future the 
old dual-purpose interval will be removed.

The change applies to both REST and java clients.
2019-05-06 17:17:11 -04:00
jaymode 0f6bd6ec5f
Fix skip version in indices open test 2019-05-01 15:12:05 -06:00
Jason Tedor 434efd1664
Add version 7.2.0 constant to master branch
This commit adds the 7.2.0 constant to the master branch, and bumps the
BWC logic accordingly.
2019-05-01 13:54:45 -04:00
Tomas Della Vedova 39284f58c1 Add missing skip: arbitrary_key (#41492)
In `indices.split/30_copy_settings.yml` we are using the `arbitrary_key`
feature, but it is not declared inside the skip list.
2019-04-27 06:09:24 +01:00
Jim Ferenczi f89420e216
field_caps: adapt bwc version after backport (#41427) 2019-04-25 18:12:43 +02:00
Zachary Tong 07710f8646 Update 230_composite yaml skips after backport 2019-04-24 13:25:40 -04:00
Zachary Tong 5ccc0b5a32
Disallow null/empty or duplicate composite sources (#41359)
Adds some validation to prevent duplicate source names from being 
used in the composite agg.

Also refactored to use a ConstructingObjectParser and removed the 
private ctor and setter for sources, making it mandatory.
2019-04-24 13:22:06 -04:00
Martijn Laarman 125f5890ce
get.json documents deprecated _source_include (#38613)
This brings it inline with other REST spec files which only document the plural
2019-04-23 16:30:47 +02:00
Martijn Laarman 7e06023e76
fix #35262 define deprecations of API's as a whole and urls (#39063)
* fix #35262 define deprecations of API's as a whole and urls

* document hot threads deprecated paths

* deprecate scroll_id as part of the URL, documented only as part of the body which is a safer behaviour as well

* use version numbers up to patch version

* rest spec parser picks up deprecated paths as paths too
2019-04-23 16:23:20 +02:00
Jim Ferenczi 5375465ddc
Handle unmapped fields in _field_caps API (#34071)
Today the `_field_caps` API returns the list of indices where a field
is present only if this field has different types within the requested indices.
However if the request is an index pattern (or an alias, or both...) there
is no way to infer the indices if the response contains only fields that have
the same type in all indices. This commit changes the response to always return
the list of indices in the response. It also adds a way to retrieve unmapped field
in a specific section per field called `unmapped`. This section is created for each field
that is present in some indices but not all if the parameter `include_unmapped` is set to
true in the request (defaults to false).
2019-04-19 09:17:35 +02:00
Jim Ferenczi 419a159ffb
Fix unmapped field handling in the composite aggregation (#41280)
The `composite` aggregation maps unknown fields as numerics, this means that
any `after` value that is set on a query with an unmapped field on some indices
will fail if the provided value is not numeric. This commit changes the default
value source to use keyword instead in order to be able to parse any type of after
values.
2019-04-18 22:48:22 +02:00
Nhat Nguyen 8b0a74f11c
Clean up outdated skip statements in yaml tests (#41165)
These skip statements become no-ops in 8.0 for we don't support
a mixed cluster between 6.x and 8.0.

Relates #41164
2019-04-18 14:19:31 -04:00
Zachary Tong 2619d8f5b4
Better error messages when pipelines reference incompatible aggs (#40068)
Pipelines require single-valued agg or a numeric to be returned.
If they don't get that, they throw an exception.  Unfortunately, this
exception text is very confusing to users because it usually arises
from pathing "through" multiple terms aggs.  The final target is a numeric,
but it's the intermediary aggs that cause the problem.

This commit adds the current agg name to the exception message
so the user knows which "level" is the issue.
2019-04-15 10:35:20 -04:00
Nik Everett 31b5e36770
Fix some documentation urls in rest-api-spec (#40618)
Fixes some documentation urls in the rest-api-spec. Some of these URLs
pointed to 404s and a few others pointed to deprecated documentation
when we have better documentation now. I'm not consistent about `master`
vs `current` because we're not consistent in other places and I think we
should solve all of those at once with something a little more
automatic.
=
2019-04-12 08:20:28 -04:00
Nhat Nguyen 0bac74c852 Adjust bwc version for flush parameter validation
Relates to #40213
2019-04-11 18:42:21 -04:00
Jason Tedor 72958cd25d
Adjust BWC version on packaging types from backport
The packaging types addition to cluster stats nodes has been backported,
so this commit adjusts the version in master to reflect this.
2019-04-10 13:48:07 -04:00
Jason Tedor 57032c0ebb
Add packaging to cluster stats response (#41048)
This commit adds a packaging_types field to the cluster stats response
that outlines the build flavors and types present in a cluster.
2019-04-10 13:38:44 -04:00
Mark Vieira 323f312bbc
Replace usages RandomizedTestingTask with built-in Gradle Test (#40978)
This commit replaces the existing RandomizedTestingTask and supporting code with Gradle's built-in JUnit support via the Test task type. Additionally, the previous workaround to disable all tasks named "test" and create new unit testing tasks named "unitTest" has been removed such that the "test" task now runs unit tests as per the normal Gradle Java plugin conventions.
2019-04-08 14:13:59 -07:00
Mark Vieira b439127be5
Revert "Replace usages RandomizedTestingTask with built-in Gradle Test (#40564)"
This reverts commit 2b2a3f50
2019-04-04 21:52:47 -07:00
Mark Vieira 2b2a3f5086
Replace usages RandomizedTestingTask with built-in Gradle Test (#40564)
This commit replaces the existing RandomizedTestingTask and supporting code with Gradle's built-in JUnit support via the Test task type. Additionally, the previous workaround to disable all tasks named "test" and create new unit testing tasks named "unitTest" has been removed such that the "test" task now runs unit tests as per the normal Gradle Java plugin conventions
2019-04-04 19:51:13 -07:00
Adrien Grand a78d79f796
Fix alias resolution runtime complexity. (#40263)
A user reported that the same query that takes ~900ms when querying an index
pattern only takes ~50ms when only querying indices that have matches. The
query is a date range query and we confirmed that the `can_match` phase works
as expected. I was able to reproduce this issue locally with a single node: with
900 1-shard indices, a query to an index pattern that matches all indices runs
in ~90ms while a query to the only index that has matches runs in 0-1ms.

This ended up not being related to the `can_match` phase but to the cost of
resolving aliases when querying an index pattern that matches lots of indices.
In that case, we first resolve the index pattern to a list of concrete indices
and then for each concrete index, we check whether it was matched through an
alias, meaning we might have to apply alias filters. Unfortunately this second
per-index operation runs in linear time with the number of matched concrete
indices, which means that alias resolution runs in O(num_indices^2) overall.
So queries get exponentially slower as an index pattern matches more indices.

I reorganized alias resolution into a one-step operation that runs in linear
time with the number of matches indices, and then a per-index operation that
runs in linear time with the number of aliases of this index. This makes alias
resolution run is O(num_indices * num_aliases_per_index) overall instead. When
testing the scenario described above, the `took` went down from ~90ms to ~10ms.
It is still more than the 0-1ms latency that one gets when only querying the
single index that has data, but still much better than what we had before.

Closes #40248
2019-04-03 16:54:21 +02:00
Zachary Tong 6acdddce64
Remove yaml skips older than 7.0 (#40183)
These are now obsolete in 8.0, and make adding new skips complicated.
Also found some very old skips (5.4!)
2019-04-02 16:39:13 -04:00
Andy Bristol d0acf6285c
lower bwc skip for search as you type (#40599) 2019-03-28 16:06:06 -07:00
Andy Bristol 6bba9fc83b
search as you type fieldmapper (#35600)
Adds the search_as_you_type field type that acts like a text field optimized
for as-you-type search completion. It creates a couple subfields that analyze
the indexed terms as shingles, against which full terms are queried, and a
prefix subfield that analyze terms as the largest shingle size used and
edge-ngrams, against which partial terms are queried

Adds a match_bool_prefix query type that creates a boolean clause of a term
query for each term except the last, for which a boolean clause with a prefix
query is created.

The match_bool_prefix query is the recommended way of querying a search as you
type field, which will boil down to term queries for each shingle of the input
text on the appropriate shingle field, and the final (possibly partial) term
as a term query on the prefix field. This field type also supports phrase and
phrase prefix queries however
2019-03-27 10:03:30 -07:00
David Turner 7d2d140c63
Get node ID from nodes info in REST tests (#40052)
* Get master identity from nodes info in REST tests

We discussed recently that the cluster state API should be considered
"internal" and therefore our usual cast-iron stability guarantees do not hold
for this API.

However, there are a good number of REST tests that need to identify the master
node. Today they call `GET /_cluster/state` API and extract the master node ID
from the response. An alternative that avoids the unstable cluster state API is
to call `GET _nodes/_master`: the master node ID is the unique key in the
`nodes` map in the response.

This change adds the ability for YAML-based REST tests to extract the unique
key of a singleton map so that they can obtain the master node ID from the
nodes info API instead of the cluster state API.

* Allow access to an arbitrary node ID and adjust all YAML tests to use this

* Warnings
2019-03-27 15:19:04 +00:00
Conor Landry 3af0c1746b Expose external refreshes through the stats API (#38643)
Right now, the stats API only provides refresh metrics regarding
internal refreshes. This isn't very useful and somewhat misleading for
cluster administrators since the internal refreshes are not indicative
of documents being available for search.

In this PR I added a new metric for collecting external refreshes as
they occur and exposing them through the stats API. Now, calling an
endpoint for stats will yield external refresh metrics as well.

Relates #36712
2019-03-24 22:20:30 -04:00
Zachary Tong b76ae4a820 Mute SegmentStats yaml tests
Tracking issue: https://github.com/elastic/elasticsearch/issues/40331
2019-03-21 16:49:25 -04:00
Mayya Sharipova 2945b8f57b Adjust the version for 250_distance_feature test
Relates to #39385
2019-03-20 16:04:41 -04:00
Simon Willnauer b8f8ed7f89 Bump BWC version to 7.1 after backport
Relates to #39698
2019-03-20 12:09:25 +01:00
Simon Willnauer 159eb721ea
Return cached segments stats if `include_unloaded_segments` is true (#39698)
Today we don't return segments stats for closed indices which makes it
hard to tell how much memory such an index would require. With this change
we return the statistics if requested by setting `include_unloaded_segments` to
true on the rest request.

Relates to #39512
2019-03-20 11:24:29 +01:00
Nhat Nguyen fe03d24229
Reject illegal flush parameters (#40213)
This change rejects an illegal combination of flush parameters where
force is true, but wait_if_ongoing is false. This combination is trappy
and should be forbidden.

Closes #36342
2019-03-19 21:23:25 -04:00
Zachary Tong 6f0f8ab4bc
Remove MovingAverage pipeline aggregation (#39328)
This was deprecated in 6.4.0 and for the entirety of 7.0.  Removed
in 8.0
2019-03-19 15:31:05 -04:00
Mayya Sharipova a87b1391d6
Expose proximity boosting (#39385)
Expose DistanceFeatureQuery for geo, date and date_nanos types

Closes #33382
2019-03-19 07:04:35 -04:00
Nhat Nguyen 2d03aff58b Remove external refresh stats from yml test
Having these new fields to the basic cat shards yaml test does not add
much while they are causing a BWC issue (i.e., we need to skip this yaml
test until 8.0).

Relates #38643
2019-03-18 21:22:10 -04:00
Conor Landry 4d7348518f Expose external refreshes through the stats API (#38643)
Right now, the stats API only provides refresh metrics regarding
internal refreshes. This isn't very useful and somewhat misleading for
cluster administrators since the internal refreshes are not indicative
of documents being available for search.

In this PR I added a new metric for collecting external refreshes as
they occur and exposing them through the stats API. Now, calling an
endpoint for stats will yield external refresh metrics as well.

Relates #36712
2019-03-18 15:16:36 -04:00
Jason Tedor 0195626b6d
Remove cluster state size (#40061)
This commit removes the cluster state size field from the cluster state
response, and drops the backwards compatibility layer added in 6.7.0 to
continue to support this field. As calculation of this field was
expensive and had dubious value, we have elected to remove this field.
2019-03-15 13:06:22 -04:00
Jack Conradson d80367644b
Add a Painless Context REST API (#39382)
This PR adds an internal REST API for querying context information about 
Painless whitelists.

Commands include the following:
GET /_scripts/painless/_context -- retrieves a list of contexts
GET /_scripts/painless/_context?context=%name% retrieves all available 
information about the API for this specific context
2019-03-14 09:18:57 -07:00
Jason Tedor 343183a9fe
Adjust BWC version on cluster state size response
This work has been backported all the way now, so this commit adjusts
the BWC version.

Relates #40016
2019-03-14 09:40:21 -04:00
Jason Tedor 6c2ec3332f
Stop returning cluster state size by default (#40016)
Computing the compressed size of the cluster state on every invocation
of cluster:monitor/state action is expensive, and the value of this
field is dubious anyway. Therefore we want to remove computing this
field. As a first step, we stop computing and return this field by
default. To avoid breaking users, we will give them a system property to
use to tide them over until the next major release when we will actually
remove this field. This comes with a deprecation warning too, and the
backport to the appropriate minor will also include a note in the
migration guide. There will be a follow-up to remove this field in the
next major version.
2019-03-14 08:56:19 -04:00
Ioannis Kakavas 71968c92a2
Mute locale dependent mapping tests (#39996) 2019-03-13 17:05:34 +02:00
Tal Levy 78c27b37d2
fix index refresh in test within 20_mix_typeless_typeful (#39198)
the test "Implicitly create a typeless ... typed template"
fails occasionally because the index operation hasn't
propogated to update the index mapping in time for the
following assertion about a dynamically mapped field "bar".

error failed with:

```
field [test-1.mappings.my_type.properties.bar] doesn't have a true value
Expected: not null
     but: was null
```

refreshing the index should resolve this timing issue.
2019-03-07 10:06:13 -08:00
Martijn Laarman 1c42178672 Document scroll param on reindex.json (#38615)
The Reindex API also exposes `scroll` as a querystring parameter.
2019-03-07 11:34:01 +01:00
Zachary Tong cec666bd3b
Remove deprecated _time and _term sort orders (#39450)
Deprecated in 6.0, removed in 8.0
2019-03-05 09:48:37 -05:00
Simon Willnauer 73d4516ba7
Allow inclusion of unloaded segments in stats (#39512)
Today we have no chance to fetch actual segment stats for segments that
are currently unloaded. This is relevant in the case of frozen indices.
This allows to monitor how much memory a frozen index would use if it was
unfrozen.
2019-03-05 14:01:41 +01:00
Jim Ferenczi 91d8c4e03f
Handle total hits equal to track_total_hits (#37907)
This change ensures that a total hits equal to the value set for
track_total_hits is not considered as a lower bound.
2019-03-05 12:03:39 +01:00
Tanguy Leroux 20595e6af8
Adapt bwc after the backport of replicated closed indices (#39566)
This commit adapts the bwc layer et reenables the bwc tests 
after #39506 has been backported to 7.x.

Related to #33888
2019-03-01 19:57:40 +01:00
Tanguy Leroux 309a3e4ccb
Add support for replicating closed indices (#39499)
Before this change, closed indexes were simply not replicated. It was therefore 
possible to close an index and then decommission a data node without knowing 
that this data node contained shards of the closed index, potentially leading to 
data loss. Shards of closed indices were not completely taken into account when 
balancing the shards within the cluster, or automatically replicated through shard 
copies, and they were not easily movable from node A to node B using APIs like 
Cluster Reroute without being fully reopened and closed again.

This commit changes the logic executed when closing an index, so that its shards 
are not just removed and forgotten but are instead reinitialized and reallocated on 
data nodes using an engine implementation which does not allow searching or
 indexing, which has a low memory overhead (compared with searchable/indexable 
opened shards) and which allows shards to be recovered from peer or promoted 
as primaries when needed.

This new closing logic is built on top of the new Close Index API introduced in 
6.7.0 (#37359). Some pre-closing sanity checks are executed on the shards before 
closing them, and closing an index on a 8.0 cluster will reinitialize the index shards 
and therefore impact the cluster health.

Some APIs have been adapted to make them work with closed indices:
- Cluster Health API
- Cluster Reroute API
- Cluster Allocation Explain API
- Recovery API
- Cat Indices
- Cat Shards
- Cat Health
- Cat Recovery

This commit contains all the following changes (most recent first):
* c6c42a1 Adapt NoOpEngineTests after #39006
* 3f9993d Wait for shards to be active after closing indices (#38854)
* 5e7a428 Adapt the Cluster Health API to closed indices (#39364)
* 3e61939 Adapt CloseFollowerIndexIT for replicated closed indices (#38767)
* 71f5c34 Recover closed indices after a full cluster restart (#39249)
* 4db7fd9 Adapt the Recovery API for closed indices (#38421)
* 4fd1bb2 Adapt more tests suites to closed indices (#39186)
* 0519016 Add replica to primary promotion test for closed indices (#39110)
* b756f6c Test the Cluster Shard Allocation Explain API with closed indices (#38631)
* c484c66 Remove index routing table of closed indices in mixed versions clusters (#38955)
* 00f1828 Mute CloseFollowerIndexIT.testCloseAndReopenFollowerIndex()
* e845b0a Do not schedule Refresh/Translog/GlobalCheckpoint tasks for closed indices (#38329)
* cf9a015 Adapt testIndexCanChangeCustomDataPath for replicated closed indices (#38327)
* b9becdd Adapt testPendingTasks() for replicated closed indices (#38326)
* 02cc730 Allow shards of closed indices to be replicated as regular shards (#38024)
* e53a9be Fix compilation error in IndexShardIT after merge with master
* cae4155 Relax NoOpEngine constraints (#37413)
* 54d110b [RCI] Adapt NoOpEngine to latest FrozenEngine changes
* c63fd69 [RCI] Add NoOpEngine for closed indices (#33903)

Relates to #33888
2019-02-28 18:35:33 +01:00
Tal Levy 7f881c894a mute failing test in 20_mix_typeless_typeful
awaits fix in #39198
2019-02-20 16:11:29 -08:00
Adrien Grand 29caf477b6
Reenable test in `indices.put_mapping/20_mix_typeless_typeful.yml`. (#39056)
This test had been disabled because of test failures, but it only affected the
6.x branch. The fix for 6.x is at #39054. On master/7.x/7.0 we can reenable the
test as-is.
2019-02-20 11:32:53 +01:00
Lee Hinman f9d11ca152
Revert "Mute failing test 20_mix_typless_typefull (#38781)" (#38912)
This reverts commit b91e0589fe.

This should be fixed by #38873

Resolves #38711
2019-02-19 12:15:44 -07:00
Alan Woodward 3f8e022988
Adjust backwards-compatibility versions for before,after,overlapping interval filters (#39062)
Follow up to #38999, this commit re-enables backwards-compatibility REST tests
for `before`, `after` and `overlapping` filters against versions 7.1 and up.
2019-02-19 10:11:01 +00:00
Alan Woodward 8c2c1cbd96
Add overlapping, before, after filters to intervals query (#38999)
Lucene recently added `overlapping`, `before` and `after` filters to the intervals package. This
commit exposes them in elasticsearch.
2019-02-18 14:44:07 +00:00
Alpar Torok b91e0589fe
Mute failing test (#38781)
Tracking #38711
2019-02-12 15:55:08 +02:00
Jason Tedor 83e9d0b9c6 Add 7.1 and 8.0 version constants to master (#38514)
* Add 7.1 and 8.0 version constants to master

This commit adds the 7.1 and 8.0 version constants to the master branch,
and bumps the master branch to 8.0.0.

Fixing many BWC and other tests  affected by the version bumps.
2019-02-08 08:50:46 +02:00
Tanguy Leroux 510829f9f7
TransportVerifyShardBeforeCloseAction should force a flush (#38401)
This commit changes the `TransportVerifyShardBeforeCloseAction` so that it 
always forces the flush of the shard. It seems that #37961 is not sufficient to 
ensure that the translog and the Lucene commit share the exact same max 
seq no and global checkpoint information in case of one or more noop 
operations have been made.

The `BulkWithUpdatesIT.testThatMissingIndexDoesNotAbortFullBulkRequest` 
and `FrozenIndexTests.testFreezeEmptyIndexWithTranslogOps` test this trivial 
situation and they both fail 1 on 10 executions.

Relates to #33888
2019-02-06 13:22:54 +01:00
Boaz Leskes 033ba725af
Remove support for internal versioning for concurrency control (#38254)
Elasticsearch has long [supported](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-versioning) compare and set (a.k.a optimistic concurrency control) operations using internal document versioning. Sadly that approach is flawed and can sometime do the wrong thing. Here's the relevant excerpt from the resiliency status page:

> When a primary has been partitioned away from the cluster there is a short period of time until it detects this. During that time it will continue indexing writes locally, thereby updating document versions. When it tries to replicate the operation, however, it will discover that it is partitioned away. It won’t acknowledge the write and will wait until the partition is resolved to negotiate with the master on how to proceed. The master will decide to either fail any replicas which failed to index the operations on the primary or tell the primary that it has to step down because a new primary has been chosen in the meantime. Since the old primary has already written documents, clients may already have read from the old primary before it shuts itself down. The version numbers of these reads may not be unique if the new primary has already accepted writes for the same document 

We recently [introduced](https://www.elastic.co/guide/en/elasticsearch/reference/6.x/optimistic-concurrency-control.html) a new sequence number based approach that doesn't suffer from this dirty reads problem. 

This commit removes support for internal versioning as a concurrency control mechanism in favor of the sequence number approach.

Relates to #1078
2019-02-05 20:53:35 +01:00
Julie Tibshirani 3ce7d2c9b6
Make sure to reject mappings with type _doc when include_type_name is false. (#38270)
`CreateIndexRequest#source(Map<String, Object>, ... )`, which is used when
deserializing index creation requests, accidentally accepts mappings that are
nested twice under the type key (as described in the bug report #38266).

This in turn causes us to be too lenient in parsing typeless mappings. In
particular, we accept the following index creation request, even though it
should not contain the type key `_doc`:

```
PUT index?include_type_name=false
{
  "mappings": {
    "_doc": {
      "properties": { ... }
    }
  }
}
```

There is a similar issue for both 'put templates' and 'put mappings' requests
as well.

This PR makes the minimal changes to detect and reject these typed mappings in
requests. It does not address #38266 generally, or attempt a larger refactor
around types in these server-side requests, as I think this should be done at a
later time.
2019-02-05 10:52:32 -08:00
Tal Levy ae47c025e2
add basic REST test for geohash_grid (#37996) 2019-02-05 09:44:47 -08:00
Boaz Leskes 12657fda44
`if_seq_no` and `if_primary_term` parameters aren't wired correctly in REST Client's CRUD API (#38411) 2019-02-05 18:05:56 +01:00
Yogesh Gaikwad fe36861ada
Add support for API keys to access Elasticsearch (#38291)
X-Pack security supports built-in authentication service
`token-service` that allows access tokens to be used to 
access Elasticsearch without using Basic authentication.
The tokens are generated by `token-service` based on
OAuth2 spec. The access token is a short-lived token
(defaults to 20m) and refresh token with a lifetime of 24 hours,
making them unsuitable for long-lived or recurring tasks where
the system might go offline thereby failing refresh of tokens.

This commit introduces a built-in authentication service
`api-key-service` that adds support for long-lived tokens aka API
keys to access Elasticsearch. The `api-key-service` is consulted
after `token-service` in the authentication chain. By default,
if TLS is enabled then `api-key-service` is also enabled.
The service can be disabled using the configuration setting.

The API keys:-
- by default do not have an expiration but expiration can be
  configured where the API keys need to be expired after a
  certain amount of time.
- when generated will keep authentication information of the user that
   generated them.
- can be defined with a role describing the privileges for accessing
   Elasticsearch and will be limited by the role of the user that
   generated them
- can be invalidated via invalidation API
- information can be retrieved via a get API
- that have been expired or invalidated will be retained for 1 week
  before being deleted. The expired API keys remover task handles this.

Following are the API key management APIs:-
1. Create API Key - `PUT/POST /_security/api_key`
2. Get API key(s) - `GET /_security/api_key`
3. Invalidate API Key(s) `DELETE /_security/api_key`

The API keys can be used to access Elasticsearch using `Authorization`
header, where the auth scheme is `ApiKey` and the credentials, is the 
base64 encoding of API key Id and API key separated by a colon.
Example:-
```
curl -H "Authorization: ApiKey YXBpLWtleS1pZDphcGkta2V5" http://localhost:9200/_cluster/health
```

Closes #34383
2019-02-05 14:21:57 +11:00
Mayya Sharipova 641704464d
Deprecate types in rollover index API (#38039)
Relates to #35190
2019-02-04 16:07:45 -05:00
Alexander Reelsen 87f3579125
Add nanosecond field mapper (#37755)
This adds a dedicated field mapper that supports nanosecond resolution -
at the price of a reduced date range.

When using the date field mapper, the time is stored as milliseconds since the epoch
in a long in lucene. This field mapper stores the time in nanoseconds
since the epoch - which means its range is much smaller, ranging roughly from
1970 to 2262.

Note that aggregations will still be in milliseconds.
However docvalue fields will have full nanosecond resolution

Relates #27330
2019-02-04 11:31:16 +01:00
Boaz Leskes f6e06a2b19 Adapt minimum versions for seq# powered operations in Watch related requests and UpdateRequest (#38231)
After backporting #37977, #37857 and #37872
2019-02-01 20:37:16 -05:00
Julie Tibshirani c2e9d13ebd
Default include_type_name to false in the yml test harness. (#38058)
This PR removes the temporary change we made to the yml test harness in #37285
to automatically set `include_type_name` to `true` in index creation requests
if it's not already specified. This is possible now that the vast majority of
index creation requests were updated to be typeless in #37611. A few additional
tests also needed updating here.

Additionally, this PR updates the test harness to set `include_type_name` to
`false` in index creation requests when communicating with 6.x nodes. This
mirrors the logic added in #37611 to allow for typeless document write requests
in test set-up code. With this update in place, we can remove many references
to `include_type_name: false` from the yml tests.
2019-02-01 11:44:13 -08:00
Nhat Nguyen f5f3cb8f4c
AwaitsFix PUT mapping with _doc on an index that has types (#38204)
Tracked at #38202
2019-02-01 12:00:43 -05:00
Adrien Grand 2229e7231e
Enable bw tests for #37871 and #38032. (#38167)
Mixed-version clusters tests had been disabled initially since they wouldn't
work until the functionality would be backported.
2019-02-01 13:55:51 +01:00
Jim Ferenczi b7308aa03c
Don't load global ordinals with the `map` execution_hint (#37833)
The terms aggregator loads the global ordinals to retrieve the cardinality of the field to aggregate on. This information is then used to select the strategy to use for the aggregation (breadth_first or depth_first). However this should be avoided if the execution_hint is explicitly set to map since this mode doesn't really need the global ordinals. Since we still need the cardinality of the field this change picks the maximum cardinality in the segments as an estimation of the total cardinality to select the strategy to use (breadth_first or depth_first). This estimation is only used if the execution hint is set to map, otherwise the global ordinals are still used to retrieve the accurate cardinality.

Closes #37705
2019-02-01 09:35:46 +01:00
Yuri Astrakhan f3cde06a1d
geotile_grid implementation (#37842)
Implements `geotile_grid` aggregation

This patch refactors previous implementation https://github.com/elastic/elasticsearch/pull/30240

This code uses the same base classes as `geohash_grid` agg, but uses a different hashing
algorithm to allow zoom consistency.  Each grid bucket is aligned to Web Mercator tiles.
2019-01-31 19:11:30 -05:00
Luca Cavanna 622fb7883b
Introduce ability to minimize round-trips in CCS (#37828)
With #37566 we have introduced the ability to merge multiple search responses into one. That makes it possible to expose a new way of executing cross-cluster search requests, that makes CCS much faster whenever there is network latency between the CCS coordinating node and the remote clusters. The coordinating node can now send a single search request to each remote cluster, which gets reduced by each one of them. from + size results are requested to each cluster, and the reduce phase in each cluster is non final (meaning that buckets are not pruned and pipeline aggs are not executed). The CCS coordinating node performs an additional, final reduction, which produces one search response out of the multiple responses received from the different clusters.

This new execution path will be activated by default for any CCS request unless a scroll is provided or inner hits are requested as part of field collapsing. The search API accepts now a new parameter called ccs_minimize_roundtrips that allows to opt-out of the default behaviour.

Relates to #32125
2019-01-31 15:12:14 +01:00
Adrien Grand a536fa7755
Treat put-mapping calls with `_doc` as a top-level key as typed calls. (#38032)
Currently the put-mapping API assumes that because the type name is `_doc` then
it is dealing with a typeless put-mapping call. Yet we still allow running the
put-mapping API in a typed fashion with `_doc` as a type name. The current logic
triggers surprising errors when doing a typed put-mapping call with `_doc` as a
type name on an index that has a type already.

This is a bit of a corner-case, but is more important on 6.x due to the fact
that using the index API with `_doc` as a type name triggers typed calls to the
put-mapping API with `_doc` as a type name.
2019-01-31 13:57:42 +01:00
Adrien Grand 3c439d3b92
Fix test bug when testing the merging of mappings and templates. (#38021)
This test performs a typed index call when it actually means to run a typeless
index call.
2019-01-31 13:52:09 +01:00
David Turner 81c443c9de
Deprecate minimum_master_nodes (#37868)
Today we pass `discovery.zen.minimum_master_nodes` to nodes started up in
tests, but for 7.x nodes this setting is not required as it has no effect.
This commit removes this setting so that nodes are started with more realistic
configurations, and deprecates it.
2019-01-30 20:09:15 +00:00
Colin Goodheart-Smithe 21e392e95e
Removes typed calls from YAML REST tests (#37611)
This PR attempts to remove all typed calls from our YAML REST tests. The PR adds include_type_name: false to create index requests that use a mapping and also to put mapping requests. It also removes _type from index requests where they haven't already been removed. The PR ignores tests named *_with_types.yml since this are specifically testing typed API behaviour.

The change also includes changing the test harness to add the type _doc to index, update, get and bulk requests that do not specify the document type when the test is running against a mixed 7.x/6.x cluster.
2019-01-30 16:32:58 +00:00
Adrien Grand c8af0f4bfa
Use mappings to format doc-value fields by default. (#30831)
Doc-value fields now return a value that is based on the mappings rather than
the script implementation by default.

This deprecates the special `use_field_mapping` docvalue format which was added
in #29639 only to ease the transition to 7.x and it is not necessary anymore in
7.0.
2019-01-30 10:31:51 +01:00
Adrien Grand b63b50b945
Give precedence to index creation when mixing typed templates with typeless index creation and vice-versa. (#37871)
Currently if you mix typed templates and typeless index creation or typeless
templates and typed index creation then you will end up with an error because
Elasticsearch tries to create an index that has multiple types: `_doc` and
the explicit type name that you used.

This commit proposes to give precedence to the index creation call so that
the type from the template will be ignored if the index creation call is
typeless while the template is typed, and the type from the index creation
call will be used if there is a typeless template.

This is consistent with the fact that index creation already "wins" if a field
is defined differently in the index creation call and in a template: the
definition from the index creation call is used in such cases.

Closes #37773
2019-01-30 10:28:24 +01:00
Albert Zaharovits d05a4b9d14
Get Aliases with wildcard exclusion expression (#34230)
This commit adds the code in the HTTP layer that will parse exclusion wildcard
expressions.
The existing code issues 404s for wildcards as well as explicit indices.
But, in general, in an expression with exclude wildcards (-...*) following other
include wildcards, there is no way to tell if the include wildcard produced no
results or they were subsequently excluded.
Therefore, the proposed change is breaking the behavior of 404s for
wildcards. Specifically, no 404s will be returned for wildcards, even
if they are not followed by exclude wildcards or the exclude wildcards
could not possibly exclude what has previously been included.
Only explicitly requested aliases will be called out as missing.
2019-01-29 18:56:20 +02:00
Boaz Leskes 65a9b61a91
Add Seq# based optimistic concurrency control to UpdateRequest (#37872)
The update request has a lesser known support for a one off update of a known document version. This PR adds an a seq# based alternative to power these operations.

Relates #36148 
Relates #10708
2019-01-29 09:18:05 -05:00
Jim Ferenczi cb451edb01
Allow nested fields in the composite aggregation (#37178)
This changes adds the support to handle `nested` fields in the `composite`
aggregation. A `nested` aggregation can be used as parent of a `composite`
aggregation in order to target `nested` fields in the `sources`.

Closes #28611
2019-01-25 14:00:39 +01:00
Boaz Leskes 9d87ca567a 300_sequence_numbers should not rely on 7.0 total hits structure 2019-01-24 23:41:10 +01:00
Boaz Leskes af2f4c8f73 enable bwc tests and bump versions after backporting https://github.com/elastic/elasticsearch/pull/37639 2019-01-24 20:55:55 +01:00
Alexander Reelsen daa2ec8a60
Switch mapping/aggregations over to java time (#36363)
This commit moves the aggregation and mapping code from joda time to
java time. This includes field mappers, root object mappers, aggregations with date
histograms, query builders and a lot of changes within tests.

The cut-over to java time is a requirement so that we can support nanoseconds
properly in a future field mapper.

Relates #27330
2019-01-23 10:40:05 +01:00
Boaz Leskes 52ba407931
Expose sequence number and primary terms in search responses (#37639)
Users may require the sequence number and primary terms to perform optimistic concurrency control operations. Currently, you can get the sequence number via the `docvalues_fields` API but the primary term is not accessible because it is maintained by the `SeqNoFieldMapper` and the infrastructure can't find it. 

This commit adds a dedicated sub fetch phase to return both numbers that is connected to a new `seq_no_primary_term` parameter.
2019-01-23 09:01:58 +01:00
Tomas Della Vedova 257f3eff22
Add note about how the body is referenced (#33935) 2019-01-22 09:07:48 +01:00
Julie Tibshirani 8da7a27f3b
Deprecate types in the put mapping API. (#37280)
From #29453 and #37285, the `include_type_name` parameter was already present and defaulted to false. This PR makes the following updates:
- Add deprecation warnings to `RestPutMappingAction`, plus tests in `RestPutMappingActionTests`.
- Add a typeless 'put mappings' method to the Java HLRC, and deprecate the old typed version. To do this cleanly, I opted to create a new `PutMappingRequest` object that differs from the existing server one.
2019-01-18 12:28:31 -08:00
Christoph Büscher 2f0e0b2426
Allow indices.get_mapping response parsing without types (#37492)
This change adds deprecation warning to the indices.get_mapping API in case the
"inlcude_type_name" parameter is set to "true" and changes the parsing code in
GetMappingsResponse to parse the type-less response instead of the one
containing types. As a consequence the HLRC client doesn't need to force
"include_type_name=true" any more and the GetMappingsResponseTests can be
adapted to the new format as well. Also removing some "include_type_name"
parameters in yaml test and docs where not necessary.
2019-01-18 09:33:36 +01:00