Commit Graph

27653 Commits

Author SHA1 Message Date
markharwood b7197f5e21 SignificantText aggregation - like significant_terms, but for text (#24432)
* SignificantText aggregation - like significant_terms but doesn’t require fielddata=true, recommended used with `sampler` agg to limit expense of tokenizing docs and takes optional `filter_duplicate_text`:true setting to avoid stats skew from repeated sections of text in search results.

Closes #23674
2017-05-24 13:46:43 +01:00
Yannick Welsch b5adb3cce9 Remove AlreadyExpiredException (#24857)
This is a relict from the TTL functionality that has been removed in #21670
2017-05-24 13:49:02 +02:00
Boaz Leskes 6bc5b1dbcd Guarantee that translog generations are seqNo conflict free (#24825)
With #24779 in place, we can now guaranteed that a single translog generation file will never have a sequence number conflict that needs to be resolved by looking at primary terms. These conflicts can a occur when a replica contains an operation which isn't part of the history of a newly promoted primary. That primary can then assign a different operation to the same slot and replicate it to the replica.

PS. Knowing that each generation file is conflict free will simplifying repairing these conflicts when we read from the translog.

PPS. This PR also fixes some bugs in the piping of primary terms in the bulk shard action. These bugs are a result of the legacy of IndexRequest/DeleteRequest being a ReplicationRequest. We need to change that as a follow up.

Relates to #10708
2017-05-24 13:26:39 +02:00
Simon Willnauer ac6a6d6fe8 Ensure remote cluster is connected before fetching `_field_caps` (#24845)
If a cluster disconnects and comes back up we should ensure that
we connected to the cluster before we fire the requests.

Closes #24763
2017-05-24 13:15:28 +02:00
António Ribeiro 85a1b2b406 Fix link to perl docs (#24842)
* Fixes Elasticsearch issue #24606.

* Fixes Elasticsearch issue #24606.

* Fixes Elasticsearch issue #24606.

* Fixes Elasticsearch issue #24606.

* Issue #24606 - Changed the link text to Search::Elasticsearch::Client::5_0::Bulk and
Search::Elasticsearch::Client::5_0::Scroll.
2017-05-24 11:43:54 +02:00
Ryan Ernst bf49d37ab3 Test: Convert test script engine impls to use MockScriptEngine (#24854)
This commit cleans up tests which currently use custom script engine
implementations, converting them to use a MockScriptEngine with script
functions provided by the tests. It also creates a common set of metric
scripts which were copied across a couple metric agg tests.
2017-05-23 20:34:12 -07:00
Jason Tedor 2e570fc6fa Increase max compilations per minute in tests
Large test suites with unfortunate seed choices can easily exceed the
1000 script compilations per minute limit. This commit increases the
limit in integration tests to 2048.
2017-05-23 20:04:20 -04:00
Jim Ferenczi 4707377cea Move InnerHitBuilder queries BWC version to 5.5 after the backport
Relates #24676
2017-05-23 22:41:39 +02:00
Nik Everett 13a86fec99 Add magic $_path stash key to docs tests (#24724)
Adds a "magic" key to the yaml testing stash mostly for use with
documentation tests. When unstashing an object, `$_path` is the
path into the current position in the object you are unstashing.
This means that in docs tests you can use
`// TESTRESPONSEs/somevalue/$body.${_path}/` to mean "replace
`somevalue` with whatever is the response in the same position."

Compare how you must carefully mock out all the numbers in the profile
response without this change:
```
// TESTRESPONSE[s/"id": "\[2aE02wS1R8q_QFnYu6vDVQ\]\[twitter\]\[1\]"/"id": $body.profile.shards.0.id/]
// TESTRESPONSE[s/"rewrite_time": 51443/"rewrite_time": $body.profile.shards.0.searches.0.rewrite_time/]
// TESTRESPONSE[s/"score": 51306/"score": $body.profile.shards.0.searches.0.query.0.breakdown.score/]
// TESTRESPONSE[s/"time_in_nanos": "1873811"/"time_in_nanos": $body.profile.shards.0.searches.0.query.0.time_in_nanos/]
// TESTRESPONSE[s/"build_scorer": 2935582/"build_scorer": $body.profile.shards.0.searches.0.query.0.breakdown.build_scorer/]
// TESTRESPONSE[s/"create_weight": 919297/"create_weight": $body.profile.shards.0.searches.0.query.0.breakdown.create_weight/]
// TESTRESPONSE[s/"next_doc": 53876/"next_doc": $body.profile.shards.0.searches.0.query.0.breakdown.next_doc/]
// TESTRESPONSE[s/"time_in_nanos": "391943"/"time_in_nanos": $body.profile.shards.0.searches.0.query.0.children.0.time_in_nanos/]
// TESTRESPONSE[s/"score": 28776/"score": $body.profile.shards.0.searches.0.query.0.children.0.breakdown.score/]
// TESTRESPONSE[s/"build_scorer": 784451/"build_scorer": $body.profile.shards.0.searches.0.query.0.children.0.breakdown.build_scorer/]
// TESTRESPONSE[s/"create_weight": 1669564/"create_weight": $body.profile.shards.0.searches.0.query.0.children.0.breakdown.create_weight/]
// TESTRESPONSE[s/"next_doc": 10111/"next_doc": $body.profile.shards.0.searches.0.query.0.children.0.breakdown.next_doc/]
// TESTRESPONSE[s/"time_in_nanos": "210682"/"time_in_nanos": $body.profile.shards.0.searches.0.query.0.children.1.time_in_nanos/]
// TESTRESPONSE[s/"score": 4552/"score": $body.profile.shards.0.searches.0.query.0.children.1.breakdown.score/]
// TESTRESPONSE[s/"build_scorer": 42602/"build_scorer": $body.profile.shards.0.searches.0.query.0.children.1.breakdown.build_scorer/]
// TESTRESPONSE[s/"create_weight": 89323/"create_weight": $body.profile.shards.0.searches.0.query.0.children.1.breakdown.create_weight/]
// TESTRESPONSE[s/"next_doc": 2852/"next_doc": $body.profile.shards.0.searches.0.query.0.children.1.breakdown.next_doc/]
// TESTRESPONSE[s/"time_in_nanos": "304311"/"time_in_nanos": $body.profile.shards.0.searches.0.collector.0.time_in_nanos/]
// TESTRESPONSE[s/"time_in_nanos": "32273"/"time_in_nanos": $body.profile.shards.0.searches.0.collector.0.children.0.time_in_nanos/]
```

To how you can cavalierly mock all the numbers at once with this change:
```
// TESTRESPONSE[s/(?<=[" ])\d+(\.\d+)?/$body.$_path/]
```
2017-05-23 15:33:48 -04:00
Christoph Büscher 24a8ba5ca8 Use ParseField constants in ParsedGeoBounds (#24849) 2017-05-23 20:15:40 +02:00
Lee Hinman 82a369737b [TEST] Add additional assert logging 2017-05-23 10:37:40 -06:00
markharwood c71ae3519f Search: Fairer balancing when routing searches by session ID (#24671)
A user reported uneven balancing of load on nodes handling search requests from Kibana which supplies a session ID in a routing preference. Each shardId was selecting the same node for a given session ID because one data node had all primaries and the other data node held all replicas after cluster startup.
This change counteracts the tendency to opt for the same node given the same user-supplied preference by incorporating shard ID in the hash of the preference key. This will help randomise node choices across shards.

Closes #24642
2017-05-23 14:43:44 +00:00
Martijn van Groningen 34093735e3
Added unit tests for MatrixStatsAggregator 2017-05-23 16:19:12 +02:00
Boaz Leskes b2ccb6b0a8 simplify flow/stop control in testConcurrentWriteViewsAndSnapshot
Thread starvation of the control thread could cause the writer to keep on generating ops and make the test go out of control (OOM).
2017-05-23 15:40:53 +02:00
Jason Tedor 6ec485d30d Suppress inspections on assertions helper
This commit adds comments to org.elasticsearch.Assertions that disables
IntelliJ from complaining about using assert with side-effects, and
using constant conditions there as the side-effect with a constant
condition is intentionally employed.
2017-05-23 09:34:51 -04:00
Jason Tedor a85c1bcede Remove unused assertions enabled method
This commit removes an unused assertions enabled method in
ESTestCase. For future uses of such a method, use the field ENABLED in
org.elasticsearch.Assertions.
2017-05-23 09:32:48 -04:00
Jason Tedor c179c6a4c9 Add assertions enabled helper
Today in the code base we have lots of ugly code blocks like:

  boolean assertionsEnabled = false;
  assert assertionsEnabled = true;
  if (assertionsEnabled) {
    // something
  }

These are a nuisance. Instead, we can do this in exactly one place and
replace these blocks with

  if (Assertions.ENABLED) {
    // something
  }

The cool thing here is that since this is a static final field, the JIT
can optimize away the check at runtime if assertions are disabled.

Relates #24834
2017-05-23 08:22:18 -04:00
Luca Cavanna 747fa721e4 Build: add client jar for aggs-matrix-stats (#24827)
This will be useful for the high level client to add support for the matrix stats aggregation, as we will ship with this jar by default like we do for parent-join-client which is aligned with distributing core with the modules already included.

Relates to #24796
2017-05-23 13:33:54 +02:00
Jim Ferenczi 9087803cd9 Add the ability to define custom inner hit sub context builder (#24676)
This commit moves the handling of nested and parent/child inner hits to specialized classes that can be defined outside of ES core.
InnerHitBuilderContext is now used by the parent query (nested or hasChild, ...) to build the sub context from the InnerHitBuilder definition.
BWC is also ensured so that nodes in previous versions can still send/receive inner hits to/from this version.

Relates #20257
2017-05-23 13:06:22 +02:00
Boaz Leskes a5fffa2988 relax the assertion about the existence of MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID in the user commit data
Since #24149 we started storing the maxUnsafeAutoIdTimestamp in the lucene commit. The assertions in that PR were built on the assumption that recovering a primary always ends up committing lucene. That is sadly [not true](a72eaa8e0f/core/src/main/java/org/elasticsearch/index/engine/InternalEngine.java (L313)).

Closes #24809
2017-05-23 09:08:30 +02:00
Ali Beyad d3c95b8d9d Removes the 5.3.3 version constant (#24833)
After releasing 5.3.2, the 5.3.3 version constant was created.  However,
this causes issues for the rolling upgrade tests, which expect to have
all older versions artifacts published and no point releases created off
of the older versions (older meaning more than one version behind the
current version).  This commit removes the 5.3.3 version constant,
assuming we will not need it anywhere.
2017-05-22 21:53:16 -04:00
Jack Conradson 8887bcc4c6 Fix settings names for script.allowed_types and script.allowed_contexts. (#24831)
Fixes #24830
2017-05-22 15:08:45 -07:00
Ryan Ernst 52d504bb5f Scripting: Simplify ScriptContext (#24818)
As we work towards contexts implying the return type of compilation, we
first need ScriptContext to not be an enum. This commit removes the
Standard enum and Plugin subclass of ScriptContext.
2017-05-22 13:11:15 -07:00
Nicholas Knize 5ae48f7dd5 Fix RangeFieldMapper rangeQuery to properly handle relations
This commit fixes the RangeFieldMapper and RangeQueryBuilder to pass the correct relation to the RangeQuery when performing a range query over range fields.
2017-05-22 11:37:06 -05:00
Luca Cavanna c584c2fd71 Merge pull request #24824 from elastic/feature/client_aggs_parsing
Add aggs parsers for high level REST Client
2017-05-22 14:43:40 +02:00
javanna 7a3e38eb8e Merge branch 'master' into feature/client_aggs_parsing 2017-05-22 12:25:14 +02:00
Martijn van Groningen 08eda43899
percolator: Use QueryBuilder.rewriteQuery(...) to rewrite query builder instead of QueryBuilder.rewrite(...)
Relates to #24617
2017-05-22 12:20:26 +02:00
Luca Cavanna 726e6c45ab Move getType to Aggregation interface (#24822)
Given that both InternalAggregation and ParsedAggregation have this method, it makes sense to move it to the interface they both implement.
2017-05-22 10:49:23 +02:00
Clinton Gormley 086abe6216 Marked `fixed_auto_queue_size` as experimental
Relates to https://github.com/elastic/elasticsearch/pull/23884
2017-05-22 10:03:31 +02:00
Jim Ferenczi 4e70235d55 Upgrade icu4j to latest version (#24821) 2017-05-22 09:34:50 +02:00
olcbean e08e92d934 Deleting a document from a non-existing index creates the should not auto create it, unless using EXTERNAL* versioning (#24518)
Currently a `delete document` request against a non-existing index actually **creates** this index.

With this change the `delete document` no longer creates the previously non-existing index and throws an `index_not_found` exception instead.

However as discussed in https://github.com/elastic/elasticsearch/pull/15451#issuecomment-165772026, if an external version is explicitly used, the current behavior is preserved and the index is still created and the document is marked for deletion.

Fixes #15425
2017-05-22 10:00:22 +03:00
Ryan Ernst 679ec99fad Scripting: Simplify search method on script service (#24817)
This commit is a simple cleanup to remove an unnecessary extra method on
ScriptService which was only used in 3 places. There is now only one
search method.
2017-05-20 23:46:53 -07:00
Ryan Ernst 2de748859f Scripting: Remove "inline script enabled" on script engines (#24815)
ScriptEngine implementations have an overridable method to indicate they
are safe to use as inline scripts. Since groovy was removed fro 6.0,
there are no longer any implementations which used the default false
value. Furthermore, the value was not actually read anywhere. This
commit removes the method. The ScriptEngineRegistry was also no longer
necessary as it only was used to build a map from language to engine.
2017-05-20 12:01:25 -07:00
archana a5358f34b3 Update mappings.asciidoc
typo
2017-05-20 13:39:05 -05:00
Jason Tedor 3666092099 Remove unnecessary method from index shard
This commit removes a convenience method from index shard that is used
at exactly one call site. This method is used to callback a listener
when an operation is on too old of a primary term. Since it is only used
at one call site, we simply inline the method.
2017-05-20 09:44:09 -04:00
Jason Tedor 4cd70cf986 Block older operations on primary term transition
Today a replica learns of a new primary term via a cluster state update
and there is not a clean transition between the older primary term and
the newer primary term. This commit modifies this situation so that:
 - a replica shard learns of a new primary term via replication
   operations executed under the mandate of the new primary
 - when a replica shard learns of a new primary term, it blocks
   operations on older terms from reaching the engine, with a clear
   transition point between the operations on the older term and the
   operations on the newer term

This work paves the way for a primary/replica sync on primary
promotion. Future work will also ensure a clean transition point on a
promoted primary, and prepare a replica shard for a sync with the
promoted primary.

Relates #24779
2017-05-19 16:17:22 -04:00
Jason Tedor cb7a8d5876 Add version 5.3.3 constant
This commit adds the version 5.3.3 constant to the master branch.
2017-05-19 15:18:14 -04:00
Jason Tedor 8e2ab43009 Fix handling of dirty PID file
When Elasticsearch dies during a standalone REST test we might leave a
dirty PID file laying around. We tried to log about this, but the log
messages contained references to undefined variables so we simply died
instead of providing a helpful message to run clean. This commit
addresses this issue.
2017-05-19 13:29:14 -04:00
javanna db0490343e Merge branch 'master' into feature/client_aggs_parsing 2017-05-19 18:17:06 +02:00
Nik Everett b9ea579633 Allow plugins to register pre-configured tokenizers (#24751)
Allows plugins to register pre-configured tokenizers. Much
of the decisions are the same as those in #24223, #24572,
and #24223. This only migrates the lowercase tokenizer but
I figure that is a good start because it proves out the features.
2017-05-19 12:07:04 -04:00
Luca Cavanna ae73670257 Mark SearchSourceBuilder as ToXContentObject (#24795)
SearchSourceBuilder#toXContent prints out a complete object, hence it should implement ToXContentObject
2017-05-19 18:00:58 +02:00
Nicholas Knize deb7caf4d3 Upgrade to lucene-7.0.0-snapshot-a0aef2f
This commit upgrades master to a current lucene snapshot with commit id a0aef2f.
2017-05-19 10:20:55 -05:00
Jim Ferenczi d241c4898e Removes parent child fielddata specialization (#24737)
This change removes the field data specialization needed for the parent field and replaces it with
a simple DocValuesIndexFieldData. The underlying global ordinals are retrieved via a new function called
IndexOrdinalsFieldData#getOrdinalMap.
The children aggregation is also modified to use a simple WithOrdinals value source rather than the deleted WithOrdinals.Parent.

Relates #20257
2017-05-19 17:11:23 +02:00
Kristen b18df27d74 Small typo in Painless Dispatch page (#24792) 2017-05-19 10:56:41 -04:00
Oleksandr Chychkan 065d91bccc Typo in setup/configuration.asciidoc (#24797) 2017-05-19 10:49:56 -04:00
Simon Willnauer b17d23dc99 Obey lock order if working with store to get metadata snapshots (#24787)
Today when we get a metadata snapshot from the index shard we ensure
that if there is no engine started on the shard that we lock the index
writer before we go and fetch the store metadata. Yet, if we concurrently
recover that shard, recovery finalization might fail since it can't acquire
the IW lock on the directory. This is mainly due to the wrong order of aquiring
the IW lock and the metadata lock. Fetching store metadata without a started engine
should block on the metadata lock in Store.java but since IndexShard locks the writer
first we get into a failed recovery dance especially in test. In production
this is less of an issue since we rarely get into this siutation if at all.

Closes #24481
2017-05-19 15:36:39 +02:00
Luca Cavanna 0b8da31ccf SearchResponse#fromXContent to not require START_OBJECT as current token (#24794)
The method should rather advance one token and only then require a START_OBJECT as the current token. This allows to parse given a parser that's at the beginning of the response, where the initial/current token is null.
2017-05-19 15:24:29 +02:00
Jason Tedor e71a3ea1bb Disable the Netty recycler in the client
The Netty recycler is nothing but trouble, so let us disable this by
default in the client too.

Relates #24793
2017-05-19 09:05:30 -04:00
Tanguy Leroux ad3658a8a3 [Test] Remove ParsedAggregationTests (#24791)
Now the Java High Level Rest Client has tests to parse all aggregations,
 this test is not needed anymore. We have better tests like
 AggregationsTests and sub classes of InternalAggregationTestCase.

 Related to #23965
2017-05-19 13:56:58 +02:00
Christoph Büscher 05acc43505 Fix InternalExtendedStatsTests setUp 2017-05-19 13:37:31 +02:00