Commit Graph

1983 Commits

Author SHA1 Message Date
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