`ThreadLocal` variables have a tendency to complicate control flow,
especially if these variables are "context" variables. This PR drops the
`ThreadLocal` that SQL was using for its request context in favor of
delaying construction of the components that need the context until what
they need is ready.
This further simplifies things by passing to components what they need
rather than a larger context object. This is important because not all
of the context is ready at all parts of the request. In particular we
haven't resolved the index until long after the parsing stage, but the
parser wants to know the time zone.
This way of doing things does create a few more objects on each request
but those objects are fairly light and should die as soon as the SQL has
been translated to an Elasticsearch query.
relates elastic/x-pack-elasticsearch#3178
Original commit: elastic/x-pack-elasticsearch@8331f24399
Tests that rely on the security index and security index template being present should not remove
the template between tests as this can cause test failures. The template upgrade service relies
on cluster state updates to trigger the template being added after a delete, but there is a
scenario where the test will just wait for template that never shows up as there is no cluster
state update in that time. Instead of fighting ourselves, we should just leave the template in
place.
Relates elastic/x-pack-elasticsearch#2915
Relates elastic/x-pack-elasticsearch#2911
Original commit: elastic/x-pack-elasticsearch@3ca4aef0be
* Calendar jobs endpoints
* Refactor put and delete calendar job to use the same action
* Check jobs exist when creating the calendar
* Address review comments
* Add isGroupOrJobMethod
* Increase default page size for calendar query
Original commit: elastic/x-pack-elasticsearch@7484799fe9
# 2650 added the mapping for the interval_ms field in the Elasticsearch
template but not for Kibana,Logstash and Beats templates.
Original commit: elastic/x-pack-elasticsearch@44fb501bb3
`JOIN`s aren't supported right yet so we should send back a nice 400
level error to the user telling them that.
Also pulls out some common code in `RestSqlTestCase` that I've been
staring at for a while.
Relates to elastic/x-pack-elasticsearch#3176
Original commit: elastic/x-pack-elasticsearch@1c1bd1c355
Since matrix aggs module isn't on the classpath at runtime, we shouldn't
compile with it on the classpath. Doing so makes it possible for us to
die with dignity when we can't load the class. Which happens right now.
Original commit: elastic/x-pack-elasticsearch@6d2ca5e367
SQL was adding scroll timeouts to aggregation only queries. At best this
is just confusing because we never scroll these queries. It *might*
leave behind a scroll context that we don't want. It is failing some new
validation that says that we have to have a `size` for every scroll
query.
Anyway, the simplest thing to do is to not put a scroll on aggregation
only queries.
Original commit: elastic/x-pack-elasticsearch@f6819a32b8
The getShortPathName method can only be used on a directory that actually exists, otherwise it will fail with a cryptic message.
Original commit: elastic/x-pack-elasticsearch@44552dcfc8
The API JAR POM picks up the wrong artifact name for the :core:cli
dependency, using the project name instead of the archive base
name. This commit fixes this issue by explicitly referring to the
artifact as a runtime dependency. With this change, the correct artifact
name is used in the API JAR POM.
Relates elastic/x-pack-elasticsearch#3336
Original commit: elastic/x-pack-elasticsearch@68026168da
This changes the default behavior of .watch* indices to be green on one-node clusters, instead of constantly yellow.
Original commit: elastic/x-pack-elasticsearch@cdaee7cd72
* Add remaining matrix aggregations
This adds the remaining [matrix aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search-aggregations-matrix-stats-aggregation.html).
These aggregations aren't currently implemented due to the inter-plugin
communication not being set up, so they return "innerkey/matrix stats not
handled (yet)".
For matrix aggs that share a name with an existing aggregation (like 'count'),
they have be prefixed with "matrix_", so, "matrix_count", "matrix_mean", and
"matrix_variance".
Relates to elastic/x-pack-elasticsearch#2885
* Return HTTP 400 for innerkey/matrix stats aggs
* Add integration test for unimplemented matrix aggs
Original commit: elastic/x-pack-elasticsearch@34459c59aa
The index action allowed to set the id of a document dynamically,
however this was not allowed for the index or the type.
If a user wants to execute a search, modify the found documents and
index them back, then this would only work across a single index and a
single type. This change allows the watch writer to just take a search
result, read index and type out of that and configure this as part of
the index action.
On top of that the integration tests have been changed to become fast
running unit tests.
Original commit: elastic/x-pack-elasticsearch@640b085dd4
When running `gradle run` at the top level (at least with Gradle 4.4) it
attempts to run multiple instances of the server, causing the run to fail since
they can't both bind to 9200/9300.
This renames the tasks for the `qa` directories to be `runqa` and the task for
the `cli` directory to be `runcli`.
Original commit: elastic/x-pack-elasticsearch@734ab8e132
Only the Logstash and Kibana version mismatch watches contain a time
filter, the others are only sorting by timestamp. In combination with
searching in all `.monitoring-es-*` indices, this is IMO pretty resource
intensive, as we cannot exit early on any search request.
This commit adds time based filters to remaining three watches, using
the same range than the other two.
Original commit: elastic/x-pack-elasticsearch@3eb6bf0de2
* Fix license messaging for Logstash functionality
With a Basic license, users are still able to perform CRUD operations on the `.logstash` index, therefore manage their Logstash pipelines. However, Logstash itself will not pick up any changes from this index and act on them. With an expired license Logstash functionality continues to operate as normal.
* Fixing messages after feedback
* Removing extraneous tabs at end of line
* Fixing typo
Original commit: elastic/x-pack-elasticsearch@bc069cf00f
It also makes it possible to use the Version class to parse the version that we get from Elasticsearch.
Original commit: elastic/x-pack-elasticsearch@73a3268b12
`UnresolvedRelation`'s equality test would sometimes not properly mutate
the object under test. This is because `ESTestCase#randomValueOtherThan`
will only run its provider one time if passed `null` for the "other
than" value.
Original commit: elastic/x-pack-elasticsearch@7b13e8dc98
This adds:
* The CLI jar itself into the `bin`. It is an executable jar.
* A shell and bat script to start the CLI. This isn't strictly required but folks will appreciate the consistency.
* Basic packaging tests for the CLI.
Relates to elastic/x-pack-elasticsearch#2979
Original commit: elastic/x-pack-elasticsearch@158f70a530
Fixes the error message that SQL produces when it sees unsupported
indexes. It was always returning all broken indexes as "unknown" even
though we have much better error messages. It was just throwing them
away.
I caught this originally when backporting to 6.x where we had a test
that we produced a useful error message when the user attempted to run
SQL on an index with more than one type. We couldn't run that in the
feature/sql branch because it is inside the full cluster restart tests
and the "old" version of Elasticsearch used in those tests in
feature/sql is 6.x which doesn't allow indexes with multiple types. When
I backported to 6.x the test failed because it hadn't been run before.
In addition to fixing that test and the problem, this adds another test
that will reveal the problem when run in the feature/sql and master
branch.
Original commit: elastic/x-pack-elasticsearch@c7b787baee
Verify that the configuration directory `$ES_PATH_CONF/x-pack`
exists before attempting to run any of the `users` commands, and
return a helpful error message to the user if it doesn't.
Original commit: elastic/x-pack-elasticsearch@6d663b6654
This changes the default behavior of .monitoring indices to be green on one-node clusters, instead of constantly yellow.
Note: This only impacts .monitoring* indices. Watcher indices currently still require a replica.
Original commit: elastic/x-pack-elasticsearch@6eb8a48a9f
I have no idea why this logic was only looking at snapshot JARs (what is
suppose to happen in production?). This breaks the release tests though
which we really need to have stable. This commit fixes this by also
considering non-snapshot JARs.
Original commit: elastic/x-pack-elasticsearch@47020ed3aa
* Rename folder x-pack-core -> core
The jar remains 'x-pack-core-*.jar'
* Put group in top-level build.gradle instead of plugin/core/build.gradle
Original commit: elastic/x-pack-elasticsearch@b23452fa55
This commit adds additional checks around resize operations and alias creation operations to
add an extra layer of security around these APIs.
Original commit: elastic/x-pack-elasticsearch@b79f16673c
Upon selecting a node to run a datafeed we normally check that the
data indices exists and their primaries are active. However, these
checks cannot be applied for CCS to a remote cluster. This commit
skips these checks for remote indices.
This removes the last obstacle for running CCS datafeeds.
Relates elastic/x-pack-elasticsearch#1071
Original commit: elastic/x-pack-elasticsearch@092f44feee