Commit Graph

8688 Commits

Author SHA1 Message Date
Martijn van Groningen 076167fbe5
inner hits: Unfiltered nested source should keep its full path
like filtered nested source.

Closes #23090
2017-08-10 15:58:29 +02:00
Adrien Grand 0bf8a354a0 Use `global_ordinals_hash` execution mode when sorting by sub aggregations. (#26014)
This is a safer default since sorting by sub aggregations prevents these
aggregations from being deferred. `global_ordinals_hash` will at least
make sure that we do not use memory for buckets that are not collected.

Closes #24359
2017-08-10 12:28:19 +02:00
Martijn van Groningen 0e5460324c
Removed static indices and repos and the scripts that create them.
Two tests were still using the static indices:
* IndexFolderUpgraderTests#testUpgradeRealIndex()
* InternalEngineTests#testUpgradeOldIndex()

I removed these tests too, because these tests functionally overlap
with the full-cluster-restart qa tests.

Relates to #24939
2017-08-10 09:52:29 +02:00
Colin Goodheart-Smithe 20b7258d41
[TEST] fixes mutate methods in aggs tests
Closes #26121
2017-08-10 07:05:46 +01:00
Christoph Büscher 566992d2a1 Tests: Fix failure in InternalGeoBoundsTests (#26112)
This occasionally fails now because if `top` is `-Infinity` (which we sometimes 
test for in randomization), the value might not get changed for the
equals/hashCode tests.

Closes #26107
2017-08-09 23:01:36 +02:00
Colin Goodheart-Smithe dfbaf90951 Adds ToXContentFragment (#25771)
* Adds ToXContentFragment

This interface is meant for objects that implement `ToXContent` but are not complete objects. It is basically the opposite of `ToXContentObject`. It means that it will be easier to track the migration of classes over to the fragment/not fragment ToXContent model as it will be clear which classes are not migrated. When no classes directly implement `ToXContent` we can make `ToXContent` package private to be sure that all new classes must implement `ToXContentObject` or `ToXContentFragment`.

* review comments

* more review comments

* javadocs

* iter

* Adds tests

* iter

* adds toString test for aggs

* improves tests following review comments

* iter

* iter
2017-08-09 15:53:30 +01:00
Sergey Galkin d8ff6e9831 Reject out of range numbers for float, double and half_float (#25826)
* validate half float values

* test upper bound for numeric mapper

* test for upper bound for float, double and half_float

* more tests on NaN and Infinity for NumberFieldMapper

* fix checkstyle errors

* minor renaming

* comments for disabled test

* tests for byte/short/integer/long removed and will be added in separate PR

* remove unused import

* Fix scaledfloat out of range validation message

* 1) delayed autoboxing in numbertype.parse(...)
2) no redudant checks in half_float validation
3) tests with negative values for half_float/float/double
2017-08-09 12:44:57 +01:00
Jim Ferenczi 15598f2174 #26097: Adapt version check for the new query option: auto_generate_synonyms_phrase_query 2017-08-09 13:19:08 +02:00
Albert Zaharovits b22147854b Workaround Eclipse Oxygen type inference error (#26001) 2017-08-09 13:36:23 +03:00
Jim Ferenczi a7e1610134 Add support for auto_generate_synonyms_phrase_query in match_query, multi_match_query, query_string and simple_query_string (#26097)
* Add support for auto_generate_synonyms_phrase_query in match_query, multi_match_query, query_string and simple_query_string

This change adds a new parameter called auto_generate_synonyms_phrase_query (defaults to true).
This option can be used in conjunction with synonym_graph token filter to generate phrase queries
when multi terms synonyms are encountered.
For example, a synonym like "ny, new york" would produce the following boolean query when "ny city" is parsed:
((ny OR "new york") AND city)

Note how the multi terms synonym "new york" produces a phrase query.
2017-08-09 12:15:09 +02:00
Zachary Tong 59c670cbfa
Add version 6.0.0-beta2 after release 2017-08-08 14:13:47 -04:00
Adrien Grand f0c1e30544 Upgrade to lucene-7.0.0-snapshot-a128fcb. (#26090) 2017-08-08 13:03:19 +02:00
Colin Goodheart-Smithe 18e0fb5b3f [TEST] Adds mutate method to more tests (#26094)
* Adds mutate method to more tests

Relates to #25929

* fixes tests
2017-08-08 11:31:45 +01:00
olcbean 5c4c1c5e15 Verify that _bulk and _msearch requests are terminated by a newline (#25740) 2017-08-08 10:45:44 +02:00
Simon Willnauer 82fa531ab4 Remove `_index` fielddata hack if cluster alias is present (#26082)
We introduced a hack in #25885 to respect the cluster alias if available on the `_index` field. This is important if aggregations or other field data related operations are executed. Yet, we added a small hack that duplicated an implementation detail from the `_index` field data builder to make this work. This change adds a necessary but simple API change that allows us to remove the hack and only have a single implementation.
2017-08-08 09:24:24 +02:00
Adrien Grand f0cba4fce5 Add a scripted similarity. (#25831)
The goal of this similarity is to help users who would like to keep the
functionality of the `tf-idf` similarity that we want to remove, or to allow
for specific usec-cases (disabling idf, disabling tf, disabling length norm,
etc.) to not have to build a custom plugin and familiarize with the low-level
Lucene API.
2017-08-08 08:55:12 +02:00
Christoph Büscher 0ad4c0529b Tests: Fix edge case in InternalBucketMetricValueTests
Same problem as in #26084.
2017-08-07 18:37:51 +02:00
Christoph Büscher 729e09ed6e Tests: Fix edge case in InternalSimpleValueTests (#26084)
When value is NaN, the mutate function might return a new instance that is
equal to the original one.

* Add same fix for InternalDerivativeTests
2017-08-07 18:30:18 +02:00
Colin Goodheart-Smithe a4ae8a9156 [TEST] Adds mutate function for all metric aggregation tests (#26056)
* Adds mutate function for all metric aggregation tests

Relates to #25929

* fixes tests

* fixes review comments

* Fixes cardinality equals method

* Fixes scripted metric test
2017-08-07 13:30:49 +01:00
Colin Goodheart-Smithe 8fda74aee1 Adds mutate function for all pipeline aggregation tests (#26058)
* Adds mutate function for all metric aggregation tests

 Relates to #25929

* Fixes review comments
2017-08-07 10:09:41 +01:00
Boaz Leskes e11cbed534 Adding a refresh listener to a recovering shard should be a noop (#26055)
When `refresh=wait_for` is set on an indexing request, we register a listener on the shards that are call during the next refresh. During the recover translog phase, when the engine is open, we have a window of time when indexing operations succeed and they can add their listeners. Those listeners will only be called when the recovery finishes as we do not refresh during recoveries (unless the indexing buffer is full). Next to being a bad user experience, it can also cause deadlocks with an ongoing peer recovery that may wait for those operations to mark the replica in sync (details below).

To fix this, this PR changes refresh listeners to be a noop when the shard is not yet serving reads (implicitly covering the recovery period). It doesn't matter anyway. 

Deadlock with recovery:

When finalizing a peer recovery we mark the peer as "in sync". To do so we wait until the peer's local checkpoint is at least as high as the global checkpoint. If an operation with `refresh=wait_for` is added as a listener on that peer during recovery, it is not completed from the perspective of the primary. The primary than may wait for it to complete before advancing the local checkpoint for that peer. Since that peer is not considered in sync, the global checkpoint on the primary can be higher, causing a deadlock. Operation waits for recovery to finish and a refresh to happen. Recovery waits on the operation.
2017-08-04 19:51:15 +02:00
Igor Motov c9bb686927 Snapshot/Restore: Update version of shard failure reason serialization
Updating the version in SnapshotsInProgress serialization method to reflect that #25941 was backported to 6.0.0-beta1.

Relates to #25878
2017-08-03 16:16:30 -04:00
Stuart Neivandt 8ef7438d6c Accept ingest simulate params as ints or strings (#23885)
* Allow ingest simulate to parse _id, _index, _type, _routing and _parent as either string or int (#23823)

* Generate data that includes Integer and String type fields for testing document parsing.
2017-08-03 11:29:21 -07:00
Colin Goodheart-Smithe 5f1634dff4 Fixes array out of bounds for value count agg (#26038)
https://github.com/elastic/elasticsearch/pull/17379 fixed many metric aggs so that if the parent aggregation does not collect any documents an empty bucket value is returned instead of an ArrayOutOfBoundsException being thrown. Unfortunately the value count aggregation was mised from this fix.

This change applies this fix from #17379 for the value count aggregation.
2017-08-03 10:19:14 +01:00
Colin Goodheart-Smithe aafd7f90fd [TEST] fix NPE when generating random query (#26023)
`ClusterSearchShardsResponseTests.testSerialization` randomly uses `IdsQueryBuilderTests` to generate an alias filter. `IdsQueryBuilderTests` shecks if the array of current types is length zero but it can also be null which causes a `NullPointerException`. This changes adds a null check to avoid the exception.

Closes #26021
2017-08-02 18:28:26 +01:00
Colin Goodheart-Smithe 87c6e63e73 Adds mutate function to various tests (#25999)
* Adds mutate function to various tests

Relates to #25929

* fix test

* implements mutate function for all single bucket aggs

* review comments

* convert getMutateFunction to mutateIInstance
2017-08-02 11:38:31 +01:00
Adrien Grand 88d456989e Make FieldMapper.copyTo() always non-null. (#25994)
Otherwise it is confusing that both a null copyTo and an empty copyTo should
be treated the same.
2017-08-02 10:07:29 +02:00
Adrien Grand 58feb5efa0 Fix `_exists_` in query_string on empty indices. (#25993)
It currently fails if there are no mappings yet.

Closes #25956
2017-08-02 10:06:34 +02:00
Luca Cavanna e2d25c3c89 [TEST] Remove duplicated main response unit test (#25855)
Also move MainResponseTets to extend AbstractStreamableXContentTestCase
2017-08-02 08:42:38 +02:00
Tim Brooks 0f4f49496f Use nio transport in test clusters (#25986)
This commit adds the nio transport as an option in place of the mock tcp
transport for tests. Each test will only use one transport type. The
transport type is decided by a random boolean generated inside of the
`ESTestCase` class.
2017-08-01 16:19:31 -05:00
Ryan Ernst 072281d5aa Update version to 7.0.0-alpha1 (#25876)
This commit updates the version for master to 7.0.0-alpha1. It also adds
the 6.1 version constant, and fixes many tests, as well as marking some
as awaits fix.

Closes #25893
Closes #25870
2017-08-01 15:47:48 -04:00
Adrien Grand e9669b3762 Better validation of `copy_to`. (#25983)
We are currently quite lenient about the targets of `copy_to`. However in a
number of cases we can detect illegal use of `copy_to` at mapping update time.
For instance, it does not make sense to use object fields as targets of
`copy_to`, or fields that would end up in a different nested document.
2017-08-01 16:23:28 +02:00
Boaz Leskes 9f1d116967 Node should start up despite of a lingering `.es_temp_file` (#21210)
When ES starts up we verify we can write to all data folders and that they support atomic moves. We do so by creating and deleting temp files. If for some reason the files was successfully created but not successfully deleted, we still shut down correctly but subsequent start attempts will fail with a file already exists exception.

This commit makes sure to first clean any existing temporary files.

Superseeds #21007
2017-08-01 15:41:27 +02:00
Tanguy Leroux 52c79629e2 QueryBuilders does not need to be abstract (#25982) 2017-08-01 10:39:21 +02:00
Luca Cavanna 4d589afbc2 AbstractQueryBuilder to no longer extend ToXContentBytes (#25948)
ToXContentToBytes is used as a base class that adds toString and buildAsBytes method implementation to classes that implement ToXContent. With the ongoing cleanups, this class is limited and doesn't add a lot of value, given that buildAsBytes can be replaced with XContentHelper.toXContent and toString can be replaced with Strings.toString(this).

The plan would be to remove ToXContentToBytes entirely, and AbstractQueryBuilder is the first place where we can remove its usage.
2017-07-31 17:38:24 +02:00
Boaz Leskes 9d10ffd547 Goodbye, Translog Views (#25962)
During peer recoveries, we need to copy over lucene files and replay the operations they miss from the source translog. Guaranteeing that translog files are not cleaned up has seen many iterations overtime. Back in the old 1.0 days, recoveries went through the Engine and actively prevented both translog cleaning and lucene commits. We then moved to a notion called Translog Views, which allowed the recovery code to "acquire" a view into the translog which is then guaranteed to be kept around until the view is closed. The Engine code was free to commit lucene and do what it ever it wanted without coordinating with recoveries. Translog file deletion logic was based on reference counting on the file level. Those counters were incremented when a view was acquired but also when the view was used to create a `Snapshot` that allowed you to read operations from the files. At some point we removed the file based counting complexity in favor of constructs on the Translog level that just keep track of "open" views and the minimum translog generation they refer to. To do so, Views had to be kept around until the last snapshot that was made from them was consumed. This was fine in recovery code but lead to [a subtle bug](https://github.com/elastic/elasticsearch/pull/25862) in the [Primary Replica Resyncer](https://github.com/elastic/elasticsearch/pull/25862). 

Concurrently, we have developed the notion of a `TranslogDeletionPolicy` which is responsible for the liveness aspect of translog files. This class makes it very simple to take translog Snapshot into account for keep translog files around, allowing people that just need a snapshot to just take a snapshot and not worry about views and such. Recovery code which actually does need a view can now prevent trimming by acquiring a simple retention lock (a `Closable`). This removes the need for the notion of a View.
2017-07-31 17:29:43 +02:00
honourednihilist 0848ffd52e Fixed bug that mapper_parsing_exception is thrown for numeric field with ignore_malformed=true when inserting "NaN", "Infinity" or "-Infinity" values (#25967) 2017-07-31 16:14:30 +02:00
Sam Cinco e0359e7331 Fix term(s) query for range field (#25918) 2017-07-31 16:01:01 +02:00
Martijn van Groningen 0b776a1de0
Move more token filters to analysis-common module
The following token filters were moved: delimited_payload_filter, keep, keep_types, classic, apostrophe, decimal_digit, fingerprint, min_hash and scandinavian_folding.

Relates to #23658
2017-07-31 15:15:04 +02:00
Jason Tedor 2ef0f8af38 Add max file size bootstrap check
This commit adds a bootstrap check for the maximum file size, and
ensures the limit is set correctly when Elasticsearch is installed as a
service on systemd-based systems.

Relates #25974
2017-07-31 21:01:47 +09:00
Jason Tedor 1afc9afcac Version option should display if snapshot
We have a command-line flag -V or --version that can be used to display
the version of Elasticsearch. However, the version that we display does
not contain whether or not the version is a snapshot build. This commit
changes the behavior here so that if the build is a snapshot, that is
included in the version string.

Relates #25970
2017-07-31 11:45:06 +09:00
Jason Tedor 9267048878 Remove dead code for checking exclusive options
Previously we manually checked if mutually exclusive options are passed
on the command line. Yet, after an upgrade to our option parser
dependency, we were able to use built-in functionality to establish
these mutually exclusive options and the parser would take care of
checking if such options are passed on the command line. However, the
previous manually checking code is now dead and was left behind. This
commit removes that dead code.

Relates #19278
2017-07-31 10:00:31 +09:00
Jason Tedor b54886d502 Fix typo in Elasticsearch help
This commit fixes a small typo in the help output displayed by
Elasticsearch when the --help flag is passed.
2017-07-31 09:56:47 +09:00
Jason Tedor 4c37335f1d Format CLI error message when es.path.conf not set
This commit adds some formatting to the message displayed when
es.path.conf is not set.
2017-07-30 09:49:55 +09:00
Jim Ferenczi 636748e270 [Test] Make sure the same exception is thrown for every test run. Fixes #25952 2017-07-28 19:02:58 +02:00
Igor Motov fe46ef393b Snapshot/Restore: Ensure that shard failure reasons are correctly stored in CS (#25941)
The failure reason for snapshot shard failures might not be propagated properly if the master node changes after the errors were reported by other data nodes. This commits ensures that the snapshot shard failure reason is preserved properly and adds workaround for reading old snapshot files where this information might not have been preserved.

Closes #25878
2017-07-28 12:28:02 -04:00
Martijn van Groningen 7c3735bdc4
percolator: Store the QueryBuilder's Writable representation instead of its XContent representation.
The Writeble representation is less heavy to parse and that will benefit percolate performance and throughput.

The query builder's binary format has now the same bwc guarentees as the xcontent format.

Added a qa test that verifies that percolator queries written in older versions are still readable by the current version.
2017-07-28 12:24:10 +02:00
Yannick Welsch 1a01514081 Move tribe to a module (#25778)
This commit moves tribe to a module, stripping core from the tribe functionality.
2017-07-28 11:23:50 +02:00
Jim Ferenczi 562c3744ca Merge FunctionScoreQuery and FiltersFunctionScoreQuery (#25889)
This change merges the functionality of the FiltersFunctionScoreQuery in the FunctionScoreQuery.
It also ensures that an exception is thrown when the computed score is equals to Float.NaN or Float.NEGATIVE_INFINITY.
These scores are invalid for TopDocsCollectors that relies on score comparison.

Fixes #15709
Fixes #23628
2017-07-28 09:22:20 +02:00
Jason Tedor 1492ccd7ae Fix environment-aware command tests
This commit fixes tests for environment-aware commands. A previous
change added a check that es.path.conf is not null. The problem is that
this system property is not being set in tests so this check trips every
single time. To fix this, we move the check into a method that can be
overridden, and then override this method in relevant places in tests to
avoid having to set the property in tests. We also add a test that this
check works as expected.
2017-07-28 14:37:04 +09:00