Commit Graph

58126 Commits

Author SHA1 Message Date
Nik Everett 6a1220e7f3
Convert metric aggs docs runtime fields (#71260)
This replaces the `script` docs for bucket aggregations with runtime
fields. We expect runtime fields to be nicer to work with because you
can also fetch them or filter on them. We expect them to be faster
because their don't need this sort of `instanceof` tree:
a92a647b9f/server/src/main/java/org/elasticsearch/search/aggregations/support/values/ScriptDoubleValues.java (L42)

Relates to #69291

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-04-05 13:08:13 -04:00
James Rodewig c23f001151
[DOCS] Add how-to guide for time series data (#71195) 2021-04-05 13:00:06 -04:00
Adam Locke 2c050ef4bb
[DOCS] Adding note about TLS-related files. (#71255) 2021-04-05 12:54:31 -04:00
Henning Andersen 410dbf40ad
Fix testCreateAndRestorePartialSearchableSnapshot (#71277)
Wait for replicas to recover before checking stats

Closes #71132
2021-04-05 18:17:50 +02:00
Stuart Tettemer 44dc1af04b
Script: whitelist CIDR api (#71258)
* Script: whitelist CIDR api

Exposes the CIDR convenience class in painless.

API:
```
class CIDR {
  CIDR(String)
  boolean contains(String)
}
```

```
CIDR c = new CIDR('10.1.1.0/25');
c.contains('10.1.1.127'); // true
c.contains('10.1.1.129'); // false

c = new CIDR('2001:0db8:85a3::/64');
c.contains('2001:0db8:85a3:0000:0000:8a2e:0370:7334'); // true
c.contains('2001:0db8:85a3:0001:0000:8a2e:0370:7334'); // false

c.contains(null); // false
c.contains(''); // false
```

Closes: #60668
2021-04-05 09:44:53 -05:00
Joe Gallo dc6a242dce
Adjust PUT watch validation in the case of an empty body (#71262) 2021-04-05 10:41:48 -04:00
Costin Leau e202e544b9
QL: Make canonical form take into account children (#71266)
Currently the canonical form takes into account only the node itself and
not its children.
For commutative cases this creates subtle issues in that the children
are swapped based on their canonical form but not canonicalize and thus
semantic comparison fail.

This PR fixes that by taking into account the canonical children and,
for commutative expressions, applies semantic ordering.
In the process, improve handling of nested negated expressions.
2021-04-05 14:49:03 +03:00
Costin Leau d77263be18
SQL: Introduce dedicated node for HAVING declaration (#71279)
Currently HAVING is modeled as a Filter - while this works well
conceptually, it leads to false positives when validation correct usage
of HAVING (only on aggregate functions or grouped expressions).
This occurs because there's no way to detect whether a filter was
declared as a WHERE or HAVING call - the existing heuristic works in
basic queries but fails when dealing with subqueries.

This PR addresses the issue by introducing a dedicated HAVING node that,
through its definition, clearly disambiguate between regular Filter
(WHERE) and aggregated one (HAVING).

Fix #69758
2021-04-05 14:48:40 +03:00
Costin Leau 15e8ecf469
QL: Propagate nullability constraints across conjunctions (#71187)
IsNull/IsNotNull inside a conjunction influences other operations done
on the same expression:

f > 10 AND f IS NULL -> f IS NULL
IFNULL(f + 1, f - 1) AND f IS NOT NULL -> f + 1 AND f IS NOT NULL

Fix #70683
2021-04-05 14:48:23 +03:00
Nhat Nguyen 541cb02077
Fix search states of CCS requests in mixed cluster (#71265)
Previously, the search states are stored in ReaderContext on data nodes.
Since 7.10, we send them to the coordinating node in a QuerySearchResult
of a ShardSearchRequest and the coordinating node then sends them back
in ShardFetchSearchRequest. We must keep the search states in data nodes
unless they are sent back in the fetch phase. We used the channel version
to determine this guarantee. However, it's not correct in CCS requests in 
mixed clusters.

1. The coordinating node of the local cluster on the old version sends a
ShardSearchRequest to a proxy node of the remote cluster on the new
version. That proxy node delivers the request to the data node. In this
case, the channel version between the data node and the proxy node is 
>= 7.10, but we won't receive the search states in the fetch phase as they
are stripped out in the channel between the old coordinating node and
the new proxy.

```
[coordinating node v7.9] --> [proxy node v7.10] --> [data node on v7.10]
```

2. The coordinating node of the local on the new version sends a
ShardSearchRequest to a proxy node of the remote cluster on the new
version. However, the coordinating node sends a ShardFetchSearchRequest
to another proxy node of the remote cluster that is still on an old
version. The search states then are stripped out and never reach the
data node.

```
-> query phase: [coordinating node v7.10] --> [proxy node v7.10] --> [data node on v7.10]
-> fetch phase: [coordinating node v7.10] --> [proxy node v7.9] --> [data node on v7.10]
```

This commit fixes the first issue by explicitly serializing the channel version in 
a ShardSearchRequest and the second by continue storing the search states 
in ReaderContext unless all nodes are upgraded.

Relates #52741
2021-04-04 09:47:53 -04:00
Nhat Nguyen ab10ed8e48 Disable BWC tests
Relates #71265
2021-04-03 15:47:45 -04:00
Costin Leau 168dbc49f5
QL: Improve removal of items during iteration (#71193)
Clean-up the range optimization rule by avoid the use of indices during
iteration and removal (since it skips an element each time)
Remove redundant ternary calls
2021-04-03 18:47:59 +03:00
Costin Leau fcea3032e4
SQL: Improve the optimization of null conditionals (#71192)
Enhance the existing rules so that
Coalesce(ex) -> ex
NullIf(a, a) -> null
NullIf(null, a) -> null
NullIf(a, null) -> a
2021-04-03 18:46:16 +03:00
Ryan Ernst 6cf4eb7273
Deprecate multiple path.data entries (#71207)
This commit adds a node level deprecation log message when multiple
data paths are specified.

relates #71205
2021-04-02 14:55:36 -07:00
James Rodewig d3c56e6fca [DOCS] Remove unneeded articles for Elasticsearch Service and Elastic Agent 2021-04-02 16:01:59 -04:00
Joe Gallo 4ff17c1b7a
[REST Compatible API] 'template' parameter and field on PUT index template (#71238) 2021-04-02 15:16:14 -04:00
Adam Locke 14aba7bcff
[DOCS] Expand examples for runtime fields in a search query (#71237)
* Add warning admonition for removing runtime fields.

* Add cross-link to runtime fields.

* Expanding examples for runtime fields in a search request.

* Clarifying language and simplifying response tests.
2021-04-02 15:00:54 -04:00
Jason Tedor d340432622
Remove frozen cache setting leniency (#71013)
We previously allowed but deprecated the ability for the shared cache to
be positively sized on nodes without the frozen role. This is because we
only allocate shared_cache searchable snapshots to nodes with the frozen
role. This commit completes our intention to deprecate/remove this
ability.
2021-04-02 14:26:01 -04:00
Benjamin Trent 9b1ef4982d
Muting test for issue #71251 (#71253) 2021-04-02 13:39:30 -04:00
Jake Landis 279fde375e
Apply REST API compatibility testing for the :modules (#71137) 2021-04-02 11:20:54 -05:00
Nik Everett a9d9ee0d4b
Convert bucket aggs docs to runtime fields (#71202)
This replaces the `script` docs for bucket aggregations with runtime
fields. We expect runtime fields to be nicer to work with because you
can also fetch them or filter on them. We expect them to be faster
because their don't need this sort of `instanceof` tree:
a92a647b9f/server/src/main/java/org/elasticsearch/search/aggregations/support/values/ScriptDoubleValues.java (L42)

Relates to #69291

Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-04-02 12:12:06 -04:00
Benjamin Trent c7e57763d6
[ML] fixes bug with composite agg datafeed extraction (#71221)
If a `max` value in a given composite aggregation bucket is the same as the current after page floor, the datafeed could cancel processing composite aggregation pages too early.

It will see that `max` timestamp aligned with the interval and stop processing. This is a bug. There may be still other terms
to process within that `date_histogram` bucket in subsequent pages as the order of the buckets are done by term NOT by max timestamp.

This commit corrects this to verify that if the process is canceled, the datafeed continues to finish out the current date_histogram bucket, regardless if the first timestamp seen after cancelling aligns with the current page or not.

closes https://github.com/elastic/elasticsearch/issues/71212
2021-04-02 12:05:24 -04:00
Benjamin Trent 75e74918c2
[ML] updating rest and HLRC ML tests to wait for no initializing shards & necessary indices (#71146)
In the high level rest client tests, we should clean up trained models, same as we do for datafeeds, jobs, etc.

But, to delete a trained model, it needs to not be used in a pipeline, so we grab the model stats. 

This commit does:
- waiting for no more initializing shards when ML integration tests are cleaning up before attempting to delete things
- The specific inference stats test now waits for the `.ml-stats-00001` index to exist before continuing 
- And we make sure that config index is green before attempting to run the `pipeline_inference.yml` tests

closes https://github.com/elastic/elasticsearch/issues/71139
2021-04-02 11:59:26 -04:00
Nik Everett bde105bca2
Test unrounding half_floats (#70937)
Now that #70653 is merged we can send all kinds of strange values to the
`fields` round trip test for `half_float`.
2021-04-02 11:56:52 -04:00
Benjamin Trent b4b4994f5d
[Text Structure][ML] adjust spec to reflect accurate stability (#71236)
the text_structure/find_structure API is stable and GA as of 7.12.

This commit adjusts the spec to reflect that.
2021-04-02 11:56:27 -04:00
Julie Tibshirani 29af73c69c
In ARS, correct default number of outstanding requests (#71022)
When computing node’s ARS rank, we use the number of outstanding search
requests to the node. If there are no connections to the node, we consider
there to be 1 outstanding request. This isn’t accurate, the default should be 0
to indicate no outstanding requests. The ARS rank we return in node stats
actually uses 0 instead of 1.

This small fix lets us remove a test workaround. It also ensures the ARS ranks
we return in node stats match the ranks we use to select shards during search.

Follow-up to #70283.
2021-04-02 08:32:16 -07:00
Jason Tedor 32314493a2
Pass override settings when creating test cluster (#71203)
Today when creating an internal test cluster, we allow the test to
supply the node settings that are applied. The extension point to
provide these settings has a single integer parameter, indicating the
index (zero-based) of the node being constructed. This allows the test
to make some decisions about the settings to return, but it is too
simplistic. For example, imagine a test that wants to provide a setting,
but some values for that setting are not valid on non-data nodes. Since
the only information the test has about the node being constructed is
its index, it does not have sufficient information to determine if the
node being constructed is a non-data node or not, since this is done by
the test framework externally by overriding the final settings with
specific settings that dicate the roles of the node. This commit changes
the test framework so that the test has information about what settings
are going to be overriden by the test framework after the test provide
its test-specific settings. This allows the test to make informed
decisions about what values it can return to the test framework.
2021-04-02 10:20:36 -04:00
James Rodewig 55f3db74a6
[DOCS] Fix 'Register a snapshot repo' title (#71224) 2021-04-02 09:26:20 -04:00
Yannick Welsch a8f99d6193
Remove bogus assertion in CacheFile (#71174)
There's a bogus assertion in CacheFile that expects a channel to be available whenever we continue writing to it. In case
where the range listener does not care about the write anymore (i.e. all reads are ok), it does not continues to hold onto
the file, however, which is ok.

Closes #71083
2021-04-02 15:19:32 +02:00
James Rodewig 0b9f71f3f5
[DOCS] Rename Glossary (#71222)
Changes title from "Glossary of terms" to "Glossary."
"Glossary of terms" is redundant.
2021-04-02 09:12:05 -04:00
James Rodewig 4963118fcc
[DOCS] Update button copy (#71220) 2021-04-02 09:06:50 -04:00
Dan Hermann 579d0367b1
[DOCS] http.client_stats.enabled setting (#71188) 2021-04-02 07:58:05 -05:00
Dan Hermann 64a99eeeb7
Setting [http.client_stats.enabled] permits disabling of HTTP client stats (#71185) 2021-04-02 07:57:04 -05:00
Dimitris Athanasiou 9e77bdca84
[ML] Rename autodetect flush id counter (#71217)
Renames `AutodetectControlMsgWriter` static member
for counting flush ids from the legacy `ms_FlushNumber`
to `flushIdCounter`.
2021-04-02 15:41:09 +03:00
Benjamin Trent 34fda8aaa0
[ML] fixing test related to #67756 (#71136)
The test was originally waiting on a lookback only datafeed to complete and autoclose the job

But, there were times where the lookback completed right when the node was shutting down.
Consequently, the job never closed, but the datafeed did. So, the job never autoclosed.

This commit makes the test's datafeed a realtime datafeed so it always gets reassigned.

closes: https://github.com/elastic/elasticsearch/issues/67756
2021-04-02 07:24:22 -04:00
Armin Braun fabc43704e
Optimize BytesReferenceStreamInput Number Reads (#71181)
`readByte` was used for all primitive reads which via the expensive `maybeNextSlice`
which did not inline well caused slowness when reading large aggregate messages.

This commit makes these reads do bulk operations on the underlying `byte[]` where possible
instead. Also, it extracts cold path from `maybeNextSlice` so that we get a fast bounds check
branch instead of the loop with a large body for the hot case.

closes #70800
2021-04-02 05:47:38 +02:00
Mark Vieira 74db5b9a7b Mute CompositeAggregationDataExtractorTests.testExtractionGivenCancelHalfWay 2021-04-01 16:46:30 -07:00
Jason Tedor a5a5278954
Remove legacy role settings (#71163)
This commit removes the previously deprecated legacy role
settings. These settings have been replaced by node.roles.
2021-04-01 19:31:55 -04:00
Jason Tedor d4dc14adfe
Pull forward deprecation checks infrastructure
We have been developing deprecation checks infrastructure in 7.x and not
porting it to master. This commit addresses this by pulling forward some
of the infrastructure that has accreted there.
2021-04-01 17:42:14 -04:00
Mark Vieira 07a5ed2bf7 Remute GeoIpCliTests 2021-04-01 12:55:41 -07:00
James Rodewig 3c02ab4190
[DOCS] Add ECS and runtime fields tip to data stream tutorial (#71183) 2021-04-01 15:54:53 -04:00
James Rodewig 2dd034bc65
[DOCS] Rename ES Reference to ES Guide (#71198) 2021-04-01 15:38:41 -04:00
Dan Hermann 370ce5d516
Exclude invalid url-encoded strings from randomized tests (#71085) 2021-04-01 11:11:55 -05:00
Costin Leau 0b1dc7f231
EQL: Optimize redundant toString (#71070)
Replace toString("string") with "string"
Refactor the underlying rule to reuse code across QL

Fix #70671
2021-04-01 17:59:52 +03:00
James Rodewig 115d2b2680 [DOCS] Reword data stream indexing section 2021-04-01 10:23:48 -04:00
James Rodewig a4fa22c099 [DOCS] Reword link to Fleet data stream docs 2021-04-01 10:15:56 -04:00
Dan Hermann 4f0c76e411
Case-insensitive handling of HTTP header names in HTTP client stats (#71079) 2021-04-01 08:48:26 -05:00
David Roberts a59805acbf
[ML] Do not create ML annotations index in upgrade mode (#71175)
The ML annotations index is created automatically as soon as
any other ML index is created. It's done this way so that the
ML UI can index into it as soon as ML is being used, but the
index is owned by the backend.

However, if it's detected that the annotations index needs to
be created when upgrade mode is enabled then we shouldn't
instantly create it, as we may be fighting against a user
trying to repair the index in some way.

Additionally, the annotations index should not be created
during a feature reset. Doing this could fight against the
reset process if the annotations index happened to get removed
before some other ML index but then immediately got added back.
(We get away with this at the moment as there is custom test
cleanup code to ensure .ml-annotations is deleted after other
ML indices, but we want ML feature reset to completely and
robustly replace custom ML test cleanup.)
2021-04-01 14:08:43 +01:00
Yannick Welsch e2c574db8b
Adapt frozen write buffer and thread pool (#71172)
Increases the write buffer size to 2MB, which has shown in benchmarks to provide better throughput on the frozen tier.
Also makes the corresponding cache fetch thread pool size adaptive, as we're otherwise consuming too much memory
on smaller instance nodes. For the instance types (e.g. i3en.2xl) considered on Cloud (8 CPU), the number of
cache_fetch threads stay roughly the same.
2021-04-01 14:58:50 +02:00
Benjamin Trent 27000b54d6
[ML] fix test failure from issue #71150 (#71176)
Recently merged was a change that modified the default value of: `action.destructive_requires_name` to `true`.

The original merge was fairly careful to adjust all the test clusters to account for the default value change.

However, the machine learning test runner was missed. We create custom node settings and thus require
the handling of the default value change.

relates to https://github.com/elastic/elasticsearch/issues/71150
2021-04-01 08:56:55 -04:00