Commit Graph

5945 Commits

Author SHA1 Message Date
Christoph Büscher 4385b29f80 Merge branch 'master' into feature/rank-eval 2016-08-08 10:10:58 +02:00
Nicholas Knize ab0a0cd4d4 fix rogue license header 2016-08-05 23:21:16 -05:00
Nicholas Knize 2d590af593 Deprecate GeoDistance enumerators and remove geo distance script helpers
GeoDistance is implemented using a crazy enum that causes issues with the scripting modules. This commit moves all distance calculations to arcDistance and planeDistance static methods in GeoUtils. It also removes unnecessary distance helper methods from ScriptDocValues.GeoPoints.
2016-08-05 18:42:06 -05:00
Areek Zillur 469eb2546d Merge pull request #19536 from areek/enhancement/completion_suggester_documents
Add support for returning documents with completion suggester
2016-08-05 18:55:08 -04:00
Areek Zillur fee013c07c Add support for returning documents with completion suggester
This commit enables completion suggester to return documents
associated with suggestions. Now the document source is returned
with every suggestion, which respects source filtering options.

In case of suggest queries spanning more than one shard, the
suggest is executed in two phases, where the last phase fetches
the relevant documents from shards, implying executing suggest
requests against a single shard is more performant due to the
document fetch overhead when the suggest spans multiple shards.
2016-08-05 17:51:45 -04:00
Christoph Büscher fbbb633d81 Merge pull request #19825 from cbuescher/register-namedWritables-transportClient
Add NamedWriteables from plugins to TransportClient
2016-08-05 22:51:04 +02:00
Christoph Büscher 6ccb70e1ab Avoid using injector and more test to TransportClientTests 2016-08-05 21:39:44 +02:00
Christoph Büscher 37c433aace Merge pull request #19837
Ensure PutMappingRequest.buildFromSimplifiedDef input are pairs
2016-08-05 20:31:49 +02:00
Christoph Büscher e57f76aa2d Ensure PutMappingRequest.buildFromSimplifiedDef fails when input isn't pairs
The method requires pairs of fieldnames and property arguments and will fail if
the varargs input is an uneven number. We should check this and fail with an
appropriate IllegalArgumentException instead.
2016-08-05 19:25:20 +02:00
Britta Weber 981478e4a9 mute test 2016-08-05 19:10:13 +02:00
Britta Weber 899cddefb6 make ctors protected (#19831)
This is useful if we need an acknowledged instance in a test
2016-08-05 17:13:26 +02:00
Nik Everett 8bebf2599e Add note explaining analysis caching for plugins
```
Elasticsearch doesn't have any automatic mechanism to share these
components between indexes. If any component is heavy enough to
warrant such sharing then it is the Pugin's responsibility to do
it in their {@link AnalysisProvider} implementation. We recommend
against doing this unless absolutely necessary because it can be
difficult to get the caching right given things like behavior
changes across versions.
```

Closes #19814
2016-08-05 11:11:53 -04:00
Christoph Büscher e162935656 Add test to check that plugin NamedWriteables are registerd with TransportClient 2016-08-05 17:08:59 +02:00
Luca Cavanna 4c1a3b9a53 Merge pull request #19791 from javanna/fix/multiple_fields_queries
Query parsers to throw exception when multiple field names are provided
2016-08-05 15:53:35 +02:00
Ali Beyad f59ca9083b Snapshot repository cleans up empty index folders (#19751)
This commit cleans up indices in a snapshot repository when all
snapshots containing the index are all deleted. Previously, empty
indices folders would lay around after all snapshots containing
them were deleted.
2016-08-05 09:39:02 -04:00
Adrien Grand 284b9794c0 Do not parse the created version from the settings every time a field is parsed. #19824
I found it while looking at some jfr telemetry reports from Rally.
2016-08-05 15:35:53 +02:00
Christoph Büscher c32a4324b0 Add NamedWriteables from plugins to TransportClient
Plugins provide NamedWriteables that are added to the
NamedWriteableRegistry. Those are added on Nodes already, the same mechanism is
added to the setup for TransportClient.
2016-08-05 14:11:01 +02:00
javanna 7f0bd56094 [TEST] use expectThrows wherever possible in query builder unit tests 2016-08-05 13:55:18 +02:00
Tanguy Leroux 841d5a210e Update to Jackson 2.8.1
This commit updates Jackson to the 2.8.1 version, which is more strict when it comes to build objects. It also adds the snakeyaml dependency that was previously shaded in jackson libs.

It also closes #18076
2016-08-05 12:26:06 +02:00
Christoph Büscher 3895aa470a Merge branch 'master' into feature/rank-eval 2016-08-05 12:09:07 +02:00
javanna 6a5c44a271 fix line length in FuzzyQueryBuilder 2016-08-05 10:58:19 +02:00
javanna 0ac7dd6137 Make query parsing stricter by requiring each parser to stop at END_OBJECT token
Instead of being lenient in QueryParseContext#parseInnerQueryBuilder we check that the token where the parser stopped reading was END_OBJECT, and throw error otherwise. This is a best effort to verify that the parsers read a whole object rather than stepping out in the middle of it due to malformed queries.
2016-08-05 10:58:19 +02:00
javanna 43fee1d7fa Throw parsing error if fuzzy query contains multiple fields
Fuzzy Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna 6d228bb09c [TEST] test that term query throws error when made against multiple fields 2016-08-05 10:58:19 +02:00
javanna 389bd06846 [TEST] check validation error messages in AbstractTermQueryTestCase 2016-08-05 10:58:19 +02:00
javanna 1bcf0722c4 Throw parsing error if span_term query contains multiple fields
Span term Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna c3dfe0846c Throw parsing error if common terms query contains multiple fields
Common Terms Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna 1e45fd5850 Throw parsing error if match query contains multiple fields
Match Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna f7b3dce4bc Throw parsing error if match_phrase_prefix query contains multiple fields
Match phrase prefix Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna ad8f5e7e4b Throw parsing error if geo_distance query contains multiple fields
Geo distance Query, like many other queries, used to parse even when the query referred to multiple fields and the last one would win. We rather throw an exception now instead.
2016-08-05 10:58:19 +02:00
javanna 195320f2d6 [TEST] check validation error messages in IdsQueryBuilderTests 2016-08-05 10:58:19 +02:00
javanna f56333048a Throw parsing error if match_phrase query contains multiple fields
Match phrase Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna 51ea913248 Throw parsing error if wildcard query contains multiple fields
Wildcard Query, like many other queries, used to parse even when the query referred to multiple fields and the first one would win. We rather throw an exception now instead.
Also added test for short prefix query variant and modified the parsing code to consume the whole query object.
2016-08-05 10:58:19 +02:00
javanna 003a7b6eb3 Throw parsing error if regexp query contains multiple fields
Regexp Query, like many other queries, used to parse even when the query referred to multiple fields and the last one would win. We rather throw an exception now instead.
Also added test for short prefix query variant.
2016-08-05 10:58:19 +02:00
javanna 69c2deedc7 Throw parsing error if prefix query contains multiple fields
Prefix Query, like many other queries, used to parse when the query refers to multiple fields and the last one would win. We rather throw an exception now instead.
Also added tests for short prefix quer variant.
2016-08-05 10:58:19 +02:00
javanna 11e4b0168b Throw parsing error if range query contains multiple fields
Range Query, like many other queries, used to parse when the query refers to multiple fields and the last one would win. We rather throw an exception now instead.

Closes #19547
2016-08-05 10:58:19 +02:00
Colin Goodheart-Smithe a01475a20b #19781 Refactored Rounding simplify Date Histogram code
Refactored Rounding simplify Date Histogram code
2016-08-05 09:28:38 +01:00
Boaz Leskes 609a199bd4 Upon being elected as master, prefer joins' node info to existing cluster state (#19743)
When we introduces [persistent node ids](https://github.com/elastic/elasticsearch/pull/19140) we were concerned that people may copy data folders from one to another resulting in two nodes competing for the same id in the cluster. To solve this we elected to not allow an incoming join if a different with same id already exists in the cluster, or if some other node already has the same transport address as the incoming join. The rationeel there was that it is better to prefer existing nodes and that we can rely on node fault detection to remove any node from the cluster that isn't correct any more, making room for the node that wants to join (and will keep trying).

Sadly there were two problems with this:
1) One minor and easy to fix - we didn't allow for the case where the existing node can have the same network address as the incoming one, but have a different ephemeral id (after node restart). This confused the logic in `AllocationService`, in this rare cases. The cluster is good enough to detect this and recover later on, but it's not clean.
2) The assumption that Node Fault Detection will clean up is *wrong* when the node just won an election (it wasn't master before) and needs to process the incoming joins in order to commit the cluster state and assume it's mastership. In those cases, the Node Fault Detection isn't active. 

This PR fixes these two and prefers incoming nodes to existing node when finishing an election. 
On top of the, on request by @ywelsch , `AllocationService` synchronization between the nodes of the cluster and it's routing table is now explicit rather than something we do all the time. The same goes for promotion of replicas to primaries.
2016-08-05 08:58:03 +02:00
Jason Tedor 3f6a3c01da Merge pull request #19803 from elastic/fix/transportClientTests
Fix PreBuiltTransportClientTests to run and pass
2016-08-04 16:55:08 -04:00
Simon Willnauer e08f11dabc Remove BWC serialization logic for pre 2.2 nodes (#19810)
This change removes all pre 2.2 logic from InternalSearchResponse serialization. It's unneeded in 5.0 since we require full cluster restart
2016-08-04 22:47:39 +02:00
Daniel Mitterdorfer 4598c36027 Fix various concurrency issues in transport (#19675)
Due to various issues (most notably a missing happens-before edge
between socket accept and channel close in MockTcpTransport),
MockTcpTransportTests sometimes did not terminate.

With this commit we fix various concurrency issues that led to
this hanging test.

Failing example build: https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-os-compatibility/os=oraclelinux/835/console
2016-08-04 21:00:59 +02:00
Boaz Leskes 7010082112 Add checksumming and versions to the Translog's Checkpoint files (#19797)
This prepares the infrastructure to be able to extend the checkpoint file to store more information.
2016-08-04 20:42:12 +02:00
javanna cd9388ce66 [TEST] parse query alternate versions in strict mode
AbstractQueryTestCase parses the main version of the query in strict mode, meaning that it will fail if any deprecated syntax is used. It should do the same for alternate versions (e.g. short versions). This is the way it is because the two alternate versions for ids query are both deprecated. Moved testing for those to a specific test method that isolates the deprecations and actually tests that the two are deprecated.
2016-08-04 19:49:43 +02:00
Colin Goodheart-Smithe b6ef99195d Remove offset rounding
This is in favour of doing the offset calculations in the date histogram
2016-08-04 16:24:19 +01:00
Colin Goodheart-Smithe c14155e4a8 Remove TimeZoneRounding abstraction
Because the Rounding class now only deals with date based rounding of
values we can remove the TimeZoneRounding abstraction to simplify the
code.
2016-08-04 16:24:19 +01:00
Colin Goodheart-Smithe 5ab5cc69b8 Remove unused rounding code
Factor rounding and Interval rounding (the non-date based rounding)
was no longer used so it has been removed. Offset rounding has been
retained for no since both date based rounding classes rely on it
2016-08-04 16:24:19 +01:00
Ali Beyad 34bb150863 [TEST] Fixes primary term in TransportReplicationActionTests#testReplicaProxy 2016-08-04 10:18:48 -04:00
Colin Goodheart-Smithe b0730bb214 Fix PreBuiltTransportClientTests to run and pass
This change does three things:

1. Makes PreBuiltTransportClientTests run since it was silently
failing on a missing dependency
2. Makes PreBuiltTransportClientTests pass
3. Removes the http.type and transport.type from being set in the
transport clients additional settings since these are set to `netty4` by
default anyway.
2016-08-04 14:15:28 +01:00
Ali Beyad 8bbc312fdd Fixes issue with dangling index being deleted instead of re-imported (#19666)
Fixes an issue where a node that receives a cluster state
update with a brand new cluster UUID but without an
initial persistence block could cause indices to be wiped out,
preventing them from being reimported as dangling indices.
This commit only removes the in-memory data structures and
thus, are subsequently reimported as dangling indices.
2016-08-04 08:47:46 -04:00
Christoph Büscher 1b4b4a6298 Merge branch 'master' into feature/rank-eval 2016-08-04 12:52:23 +02:00