Commit Graph

4805 Commits

Author SHA1 Message Date
Christoph Büscher 78eaffb646 Fixing edge case in RangeQueryBuilder when using time zone
When specifying a time zone, RangeQueryBuilder currently throws an
exeption when the field does not use DateFieldMapper, but if there
are no mappers at all for that field it doesn't complain. To be
consistent we also throw expection now.
2015-06-11 18:09:04 +02:00
Christoph Büscher c928852d4a Query Refactoring: ExistsQueryBuilder and Parser
Refactors ExistsQueryBuilder and Parser, splitting the parse() method into a parsing
and a query building part. Also moving newFilter() utility method from parser to query builder.

Changes in the BaseQueryTestCase include introduction of randomized version to test disabled
FieldNamesFieldMappers and also getting rid of the need for createEmptyBuilder() method by
using registered prototype constants.

Relates to #10217
Closes #11427
2015-06-11 14:40:21 +02:00
srogljan 40f85ccefb UNICODE_CHARACTER_CLASS fix 2015-06-11 13:18:18 +02:00
Simon Willnauer b0fe0096c4 [TEST] Prevent merges from being kicked off after two docs 2015-06-11 12:49:56 +02:00
Christoph Büscher 458d62e4a0 Refactors BoolQueryBuilder and Parser. Splits the parse(QueryParseContext ctx) method into a parsing
and a query building part, adding NamedWriteable implementation for serialization and hashCode(),
equals() for testing.

This change also adds tests using fixed set of leaf queries (Terms, Ids, MatchAll) as nested Queries in test query setup.
Also QueryParseContext is adapted to return QueryBuilder instances for inner filter parses instead of
previously returning Query instances, keeping old methods in place but deprecating them.

Relates to #10217
Closes #11427
2015-06-11 12:42:30 +02:00
Simon Willnauer f77804dad3 Bake in TieredMergePolicy
Today we provide the ability to plug in MergePolicy and
we provide the once lucene ships with. We do not recommend to change
the default and even only a small number of expert users would ever touch
this. This commit removes the ancient log byte size and log doc count
merge policy providers, simplifies the MergePolicy wiring and makes the
tiered MP the one and only default. All notions of a merge policy has been
removed from the docs and should be deprecated in the previous version.

Closes #11588
2015-06-11 11:58:30 +02:00
javanna 22c5205e67 Merge branch 'master' into feature/query-refactoring 2015-06-11 09:59:54 +02:00
Britta Weber e7a99501b0 [TEST] remove node from nodes list if disruption is removed from node
If we don't remove the node from the nodes list then later clearDisruption might fail
in case we shut down the node before.
2015-06-11 09:08:10 +02:00
Ryan Ernst d372bf7d7a Merge pull request #11586 from rjernst/fix/field-names-null
Mappings: Shortcut exists and missing queries when no types/docs exist
2015-06-10 14:58:57 -07:00
Simon Willnauer 657d6dd9cf Remove MergeScheduler pluggability
Nobody should really plug in a different merge scheduler for elasticsearch.
This is too expert and might cause catastrophic failures.
2015-06-10 20:28:30 +02:00
Boaz Leskes 650950c7f4 Merge pull request #11583 from bleskes/mapper_exception_unwrap
Recovery: Fix MapperException detection during translog ops replay
2015-06-10 19:06:53 +02:00
Ryan Ernst de4295cd7f Mappings: Shortcut exists and missing queries when no types/docs exist
There used to be a null check for _field_names mapper not existing. This
was recently removed. However, there is a corner case when the mapper
may be missing: when no types or docs exist at all in the index.

This change adds back a null check and just returns no docs.
2015-06-10 09:51:43 -07:00
Igor Motov 831cfa52d5 Snapshot/Restore: change metadata file format 2015-06-10 11:13:32 -04:00
Boaz Leskes e9d275d3a9 Recovery: fix MapperException detection during translog ops replay
The current ExceptionsHelper.unwrapCause(exception) requires the incoming exception to support ElasticsearchWrapperException , which TranslogRecoveryPerformer.BatchOperationException doesn't implement. I opted for a more generic solution
2015-06-10 17:12:14 +02:00
Boaz Leskes 5951f2580d Merge pull request #11576 from bleskes/wait_on_mapping_remove
Test: rename waitForConcreteMappingsOnAll & waitForMappingOnMaster to assertConcreteMappingsOnAll & assertMappingOnMaster
2015-06-10 14:37:59 +02:00
Adrien Grand fbe617c37b Internal: Make CompressedXContent.equals fast again.
We had to make CompressedXContent.equals decompress data to fix some
correctness issues which had the downside of making equals() slow. Now we store
a crc32 alongside compressed data which should help avoid decompress data in
most cases.

Close #11247
2015-06-10 13:37:08 +02:00
Boaz Leskes 356f0ffde2 Test: rename waitForConcreteMappingsOnAll & waitForMappingOnMaster to assertConcreteMappingsOnAll & assertMappingOnMaster
Now that mapping updates are sync and done before indexing we don't really need the waiting component. Also, removed many places were they were used as safe guard against delayed mapping updates, which are now not needed.
2015-06-10 13:27:57 +02:00
javanna ff9041dc48 Transport: allow to de-serialize arbitrary objects given their name
As part of the query refactoring, we want to be able to serialize queries by having them extend Writeable, rather than serializing their json. When reading them though, we need to be able to identify which query we have to create, based on its name.

For this purpose we introduce a new abstraction called NamedWriteable, which is supported by StreamOutput and StreamInput through writeNamedWriteable and readNamedWriteable methods. A new NamedWriteableRegistry is introduced also where named writeable prototypes need to be registered so that we are able to retrieve the proper instance of query given its name and then de-serialize it calling readFrom against it.

Closes #11553
2015-06-10 12:46:31 +02:00
Adrien Grand ac7ce2b899 Rivers removal.
While we had initially planned to keep rivers around in 2.0 to ease migration,
keeping support for rivers is challenging as it conflicts with other important
changes that we want to bring to 2.0 like synchronous dynamic mappings updates.
Nothing impossible to fix, but it would increase the complexity of how we
deal with dynamic mappings updates and manage rivers, while handling dynamic
mappings updates correctly is important for resiliency and rivers are on the go.
So removing rivers in 2.0 may well be a better trade-off.
2015-06-10 09:22:09 +02:00
javanna 5f66f68135 Merge branch 'master' into feature/query-refactoring
Conflicts:
	core/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java
	core/src/main/java/org/elasticsearch/index/query/SpanTermQueryParser.java
	core/src/main/java/org/elasticsearch/index/query/TermQueryParser.java
2015-06-10 09:09:43 +02:00
Ryan Ernst 6c73647325 Mappings: Remove leftover sugar methods from FieldMapper
These methods are now all in MappedFieldType. This removes the remaining
callers of the methods on FieldMapper, and cuts down the FieldMapper
API to no longer include them.
2015-06-09 14:02:06 -07:00
Simon Willnauer 63ed54017e [TEST] Remove deprecated API 2015-06-09 20:43:01 +02:00
Ryan Ernst 9d57818cee fix field names to be disabled again pre 1.3 2015-06-09 11:42:06 -07:00
Simon Willnauer b0466bbacd [TEST] Add simple test for selecting fiels to be included in mlt query 2015-06-09 20:16:47 +02:00
Ryan Ernst 1fdae75025 Mappings: Make index level mapping apis use MappedFieldType
The MapperService is the "index wide view" of mappings. Methods on it
are used at query time to lookup how to query a field. This
change reduces the exposed api so that any information returned
is limited to that api exposed by MappedFieldType. In the future,
MappedFieldType will be guaranteed to be the same across all
document types for a given field.

Note CompletionFieldType needed some more settings moved to it. Other
than that, this change is almost purely cosmetic.
2015-06-09 10:04:28 -07:00
Ryan Ernst bf805168e9 Merge branch 'master' into refactor/null-value 2015-06-09 09:46:19 -07:00
Ryan Ernst 6719b1b79e add javadocs to null value functions 2015-06-09 09:46:05 -07:00
Alexander Reelsen a54d4e4aa8 Versioning: Adding 1.6.1 development version & 1.6.0 bwc index 2015-06-09 16:30:02 +02:00
Christoph Büscher 71f84b3a0e Fix using java 8 method in LimitQueryBuilder 2015-06-09 15:57:33 +02:00
Christoph Büscher aadfd1794c Query refactoring: refactored LimitQueryBuilder and Parser and added test
Split the parse method into a parsing and a query building part, adding serialization
and hashCode(), equals() for better testing. Add basic unit test for Builder and Parser.

Closes #11551
2015-06-09 14:48:13 +02:00
Britta Weber 2edff1bc4a [TEST] stop disruption before we check for deleted shards
The shard can potentially not be deleted if the obsever that checks for the shard
STARTED is not registered because the registering is delayed by the disruption.
If the sum of delays is more than 10s then the wait for shard deletion will time out.
2015-06-09 14:28:46 +02:00
javanna 42acee3587 Merge branch 'master' into feature/query-refactoring
Conflicts:
	core/src/main/java/org/elasticsearch/index/query/IdsQueryBuilder.java
2015-06-09 10:48:32 +02:00
Alexander Reelsen 3bda78e43b ResourceWatcher: Rename settings to prevent watcher clash
The ResourceWatcher used settings prefixed `watcher.`, which
potentially could clash with the watcher plugin.

In order to prevent confusion, the settings have been renamed to
`resource.reload` prefixes.

This also uses the deprecation logging infrastructure introduced
in #11033 to log deprecated settings and their alternative at
startup.

Closes #11175
2015-06-09 10:02:49 +02:00
Alexander Reelsen 57a94a151d IdsQueryBuilder: Allow to add a list in addition to array
In case a developer gets a list of ids from another data source,
it does not make a lot of sense, to convert it to an array first,
and then internally in IdsQueryBuilder elasticsearch creates a
list out of this.

Closes #5089
2015-06-09 09:31:19 +02:00
Michael McCandless 18609fff0d add node setting to send SegmentInfos debug output to System.out 2015-06-08 18:40:58 -04:00
Ryan Ernst ba15a2f6cb Mapping: Move null value handling into MappedFieldType
In order for exists queries to use the null value for
a field, null value needs to be part of the field type (should
differ between document types). This change moves null value
into the field type, as well as simplifies the null value
methods available to remove supportsNullValue().
2015-06-08 15:08:24 -07:00
Boaz Leskes 16d9480d78 Merge pull request #11536 from bleskes/recovery_translog_op_count_on_mapping_retry
Fix recovered translog ops stat counting when retrying a batch
2015-06-08 18:17:50 +02:00
Christoph Büscher b096984f04 Adapting DummyQueryParser to interfaces on featuer branch 2015-06-08 17:04:07 +02:00
Nirmal Chidambaram 931b9f9c74 Filtered out non data-nodes in relevant cat api
Closes #9214
Closes #9287
2015-06-08 16:05:42 +02:00
javanna 8cdd042cec Merge branch 'master' into feature/query-refactoring 2015-06-08 15:51:22 +02:00
javanna 1b496d09c3 [TEST] moved custom query parser tests to proper location 2015-06-08 15:50:43 +02:00
Boaz Leskes 10adb71445 Recovery: fix recovered translog ops stat counting when retrying a batch
#11363 introduced a retry logic for the case where we have to wait on a mapping update during the translog replay phase of recovery. The retry throws or recovery stats off as it may count ops twice.
2015-06-08 15:32:06 +02:00
javanna 7f673fbdfd Merge branch 'master' into feature/query-refactoring
Conflicts:
	core/src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java
	core/src/test/java/org/elasticsearch/index/query/guice/MyJsonQueryParser.java
	core/src/test/java/org/elasticsearch/index/query/plugin/PluginJsonQueryParser.java
2015-06-08 15:14:13 +02:00
javanna 2ef0fcfd6a Plugins: one single (global) way to register custom query parsers
There are different ways to register custom query parsers through plugins, a couple of them work per index via index settings, which is probably even too flexible. There also three different ways to add a global custom query parser through either IndicesQueriesModule or IndicesQueriesRegistry. This commit consolidates the registration of custom query parsers via IndicesQueriesModule#addQuery(Class<? extends QueryParser>). The complexity of supporting parsers per index is not needed hence it got removed. Also the other ways of registering global custom parsers are dropped in favour of the one mentioned above.

Closes #11481
2015-06-08 12:19:53 +02:00
Colin Goodheart-Smithe f336cea35e Scripting: Execute Scripting Engine before searching for inner templates in template query
The search template and template query did not run the template through the script engine before searching for an inner template. This meant that parsing for the inner template failed because the template was not always valid JSON (if it contained mustache code) when it was parsed to find the inner template. This has been fixed and Tests added to check for the failing behaviour.

Tests are from https://github.com/elastic/elasticsearch/pull/8393
2015-06-08 10:44:58 +01:00
Christoph Büscher b282ac6192 Moving parser tests and base classes to correct location 2015-06-08 09:00:49 +02:00
jaymode 78630e03a2 make prompt placeholders consistent with existing placeholders
In #10918, we introduced the prompt placeholders. These were had a different format
than our existing placeholders. This changes the prompt placeholders to follow the
format of the existing placeholders.

Relates to #11455
2015-06-06 10:41:07 -04:00
Christoph Büscher f1426abe3a Merge branch 'master' into feature/query-refactoring 2015-06-06 14:38:04 +02:00
Simon Willnauer 4c981ff4bf [BUILD] Don't shade core artifacts
This commit adds an additioal jar that is shaded and keeps all the
artifacts that are used by default on the server-side unshaded. Users
that need a shaded jar can now use the `shaded` classifyer to pull
the shaded minimized jar in instead. Including the shaded jar in a
downstream project looks like this:

```XML
<dependency>
  <groupId>org.elasticsearch</groupId>
  <artifactId>elasticsearch</artifactId>
  <classifier>shaded</classifier>
</dependency>
```
2015-06-05 21:52:09 +02:00
Boaz Leskes 6aa27a16c6 GatewayAllocator: reset rerouting flag after error
After asynchronously fetching shard information the gateway allocator issues a reroute via  a cluster state update task. #11421 introduced an optimization trying to avoid submitting unneeded reroutes when results for many shards come in together. This is done by having a rerouting flag, indicating a pending reroute is coming and thus any new incoming shard info doesn't need to issue a reroute. This flag wasn't reset upon an error in the reroute update task. Most notably - if a master node had to step during to a min_master_node violation, it could reject an ongoing reroute. Lacking to reset the flag causing it to skip any future reroute, when the node became master again.

Closes #11519
2015-06-05 21:21:09 +02:00
Igor Motov 1d02212b1c Snapshot/Restore: blob store shouldn't try deleting the write.lock file at the end of the restore process
Since we are creating write.lock earlier now, blob store shouldn't attempt deleting this file during clean up at the end of the restore process. The file is locked and the blog store doesn't succeed, but it generates a lot of useless warnings "failed to delete file [write.lock] during snapshot cleanup".

Closes #11517
2015-06-05 08:54:21 -10:00
Christoph Büscher b1a566fdf2 moving files not existing on master to core after introduction of multi module 2015-06-05 16:26:23 +02:00
Christoph Büscher 0f856cc7f9 Merge branch 'master' into feature/query-refactoring 2015-06-05 16:21:21 +02:00
Simon Willnauer 29d06605c0 add core module 2015-06-05 13:12:05 +02:00
Simon Willnauer 15a6244834 create core module 2015-06-05 13:12:03 +02:00