Commit Graph

6276 Commits

Author SHA1 Message Date
Luca Cavanna 119d198cc5 Merge pull request #20424 from javanna/enhancement/error_fetch_source_disabled
Throw error when trying to fetch fields from source and source is disabled
2016-09-12 18:36:43 +02:00
Boaz Leskes b08352047d Introduce IndexShardTestCase (#20411)
Introduce a base class for unit tests that are based on real `IndexShard`s. The base class takes care of all the little details needed to create and recover shards. 

This commit also moves `IndexShardTests` and `ESIndexLevelReplicationTestCase` to use the new base class. All tests in `IndexShardTests` that required a full node environment were moved to a new `IndexShardIT` suite.
2016-09-12 18:20:25 +02:00
Ali Beyad f39f9b9760 Update discovery nodes after cluster state is published (#20409)
Before, when there was a new cluster state to publish,
zen discovery would first update the set of nodes to
ping based on the new cluster state, then publish the new
cluster state. This is problematic because if the cluster
state failed to publish, then the set of nodes to ping
should not have been updated.

This commit fixes the issue by updating the set of
nodes to ping for fault detection only *after* the new
cluster state has been published.
2016-09-12 12:07:51 -04:00
javanna 2a1ed80262 With #20093 we fixed a NPE thrown when using _source include/exclude and source is disabled in the mappings. Fixing meant ignoring the _source parameter in the request as no fields can be extracted from it.
We should rather throw a clear exception to clearly point out that we cannot extract fields from _source. Note that this happens only when explicitly trying to extract fields from source. When source is disabled and no _source parameter is specified, no errors will be thrown and no source will be returned.

Closes #20408
Relates to #20093
2016-09-12 17:36:48 +02:00
Jim Ferenczi 82fd95fd24 Merge pull request #20400 from jimferenczi/function_score_highlight
Fix highlighting of MultiTermQuery within a FunctionScoreQuery
2016-09-12 15:56:06 +02:00
Luca Cavanna b1a2768d7d Merge pull request #20188 from qwerty4030/fix/3839_multi_index_add_remove
Fix IndexNotFoundException in multi index search request.
2016-09-12 14:42:56 +02:00
Jun Ohtani 770abd7af8 Merge pull request #20396 from johtani/fix/fail_loading_non_prebuilt_tokenfilter_in_analyze_api
Can load non-PreBuiltTokenFilter in Analyze API
2016-09-10 09:35:23 +09:00
Luca Cavanna 4b00cc37a1 Merge pull request #20382 from javanna/enhancement/cleanup_parse_elements
Cleanup sub fetch phase extension point
2016-09-09 22:47:15 +02:00
javanna 9a84cb99f4 remove writeBoolean from searchExtBuilders serialization in SearchSourceBuilder
The list is not optional anymore, default is empty list
2016-09-09 21:24:18 +02:00
Tal Levy dda32545bb add ignore_missing option to relevant processors (#20194) 2016-09-09 12:20:18 -07:00
javanna 17d48c1ff6 adjust SearchExtBuilder javadocs 2016-09-09 21:17:16 +02:00
javanna 90ab460fcc move parsing of search ext sections to the coordinating node 2016-09-09 19:10:42 +02:00
Nicholas Knize 297fc8373d [TEST] Fix offsets in BaseXContentTestCase.testBinaryValueWithOffsetLength
The max value for randomIntBetween is inclusive, so we should use byte array length minus one to avoid an AIOB exception.
2016-09-09 11:47:37 -05:00
javanna 65c7f61ad9 decouple registration of SearchExtParsers from sub fetch phases
Search section supports an ext section that is used to provide additional config needed from plugins. It is now tied to sub fetch phases because it is the only section that may need additional config, but there is no reason for the two to be tightly coupled.

It is now possible to register a searchExtParser independently from a sub fetch phase. All a search ext parser does is parsing some ext section of a search request, whose parsed resulting object is stored in the search context for later retrieval.
2016-09-09 18:05:49 +02:00
javanna 455a2143f1 move SearchExtParser back to o.e.search package
The parser is now needed only for sub fetch phases, but doesn't have to be strictly connected to them, it could be used for something else as well potentially
2016-09-09 18:05:49 +02:00
javanna 12eaeb3945 FetchSubPhase to support a single parser that extends SearchExtParser 2016-09-09 18:05:49 +02:00
javanna f9530dfe8f remove FetchSubPhaseContext in favour of generic fetch sub phase builder of type object
The context was an object where the parsed info are stored. That is more of what we call the builder since after the search refactoring. No need for generics in FetchSubPhaseParser then. Also the previous setHitsExecutionNeeded wasn't useful, it can be removed as well, given that once there is a parsed ext section, it will become a builder that can be retrieved by the sub fetch phase. The sub fetch phase is responsible for doing nothing in case the builder is not set, meaning that the fetch sub phase is plugged in but the request didn't have the corresponding section.
2016-09-09 18:05:49 +02:00
javanna dc2ba90f48 clarify that SearchParseElement is only used for custom fetch sub phases and clean up extension point
SearchParseElement is renamed to FetchSubPhaseParser and moved to the search.fetch package. Its parse method doesn't get the SearchContext as argument anymore, only the XContentParser, and the return type is what gets parsed (the fetch sub phase context which we may as well rename later).

It is the parser that initializes the FetchSubPhaseContext then. SearchService retrieves the parser by name, calls parse against it and stores the result of parsing by name. No need for FetchSubPhase.ContextFactory anymore, which can be removed.
2016-09-09 18:05:49 +02:00
javanna 4b57a0fd97 resolve some line length problems and remove some entry from checkstyle suppressions (deleted classes) 2016-09-09 18:05:49 +02:00
javanna a33ca70ff5 make docValueFields similar to other standard sub fetch phases
Given that doc value fields is our own fetch sub phase, it doesn't need to be implemented like if it was plugged in from the outside. It doesn't need its own fetch sub phase context, but it can just be an instance member in SearchContext
2016-09-09 18:05:49 +02:00
javanna 060e732f50 remove unused topLevelSearcher method from FetchSubPhase.HitContext 2016-09-09 18:05:49 +02:00
javanna 319280bde3 add java docs to all of the SearchPhase implementations 2016-09-09 18:05:49 +02:00
javanna fe6b9d62a5 Remove parseElements method from SearchPhase interface
Parse elements are always empty for all of our search phases. They can be non empty only for sub fetch phases as they are pluggable and search parse element is left to be used only for plugins that plug in their own sub fetch phase. Only FetchPhase needs now the parseElements method then.
2016-09-09 18:05:49 +02:00
Jason Tedor 55a2f26b21 Logging shutdown hack
Log4j has a bug where on shutdown it ignores that JMX might be disabled;
since it does not respect this on shutdown, it proceeds to attempt to
access JMX leading to a security exception that should have otherwise
not occurred had it respected that JMX is disabled. This commit
intentionally introduces jar hell with the Server class to work around
this bug until a fix is released.

Relates #20389
2016-09-09 11:59:15 -04:00
Jason Tedor d8475488b8 Disable console logging
Previously we would disable console logging in certain circumstances
(for example, if Elasticsearch is not in the foreground, or if
Elasticsearch is in the foreground but an exception was thrown during
bootstrap). This commit makes this handling work with Log4j 2. This will
prevent users from seeing double bootstrap check failure messages.

Relates #20387
2016-09-09 09:15:35 -04:00
Tanguy Leroux a148cda476 [TEST] make BaseXContentTestCase platform independent (bis) 2016-09-09 15:07:07 +02:00
Jim Ferenczi 4a1a09cf43 Fix highlighting of MultiTermQuery within a FunctionScoreQuery
Since the sub query of a function score query is checked on CustomQueryScorer#extractUnknwonQuery we try to extract the terms from the rewritten form of the sub query.
MultiTermQuery rewrites query within a constant score query/weight which returns an empty array when extractTerms is called.
The extraction of the inner terms of a constant score query/weight changed in Lucene somewhere between ES version 2.3 and 2.4 (https://issues.apache.org/jira/browse/LUCENE-6425) which is why this problem occurs on ES > 2.3.
This change moves the extraction of the sub query from CustomQueryScorer#extractUnknownQuery to CustomQueryScorer#extract in order to do the extraction of the terms on the original form of the sub query.
This fixes highlighting of sub queries that extend MultiTermQuery since there is a special path for this kind of query in the QueryScorer (which extract the terms to highlight).
2016-09-09 13:00:41 +02:00
Simon Willnauer ac959847ff [TEST] make BaseXContentTestCase platform independent 2016-09-09 09:19:11 +02:00
Jun Ohtani 4c8452f31e Can load non-PreBuiltTokenFilter in Analyze API
Fix the error when using default min_hash in analyze API
2016-09-09 16:10:17 +09:00
Lee Hinman 49695af2ac Remove FORCE version_type
This was an error-prone version type that allowed overriding previous
version semantics. It could cause primaries and replicas to be out of
sync however, so it has been removed.

Resolves #19769
2016-09-08 15:29:47 -06:00
Chris Earle 07ccabbebc Add "version" field to Templates
This adds a version field to Templates, which is itself is unused by Elasticsearch, but exists for users to better manage their own templates. Like description, it's optional.
2016-09-08 16:01:42 -04:00
Simon Willnauer 51de39f21b Remove unreleased version, these versons should be added once they are released 2016-09-08 20:42:03 +02:00
Jason Tedor 27ff4f327c Remove allow unquoted JSON
Previous versions of Elasticsearch permitted unquoted JSON field names even though this is against the JSON spec. This leniency was disabled by default in the 5.x series of Elasticsearch but a backwards compatibility layer was added via a system property with the intention of removing this layer in 6.0.0. This commit removes this backwards compatibility layer.

Relates #20388
2016-09-08 13:36:31 -04:00
Jason Tedor ef2ff1aeab Remove assertion for cluster name in data path
This commit removes an assertion regarding removing the support for
cluster name being part of the data path in favor of a tracking issue.

Relates #20391
2016-09-08 13:09:05 -04:00
Lee Hinman 6666892038 Default `include_in_all` for numeric-like types to false
This includes:

- All regular numeric types such as int, long, scaled-float, double, etc
- IP addresses
- Dates
- Geopoints and Geoshapes

Relates to #19784
2016-09-08 09:09:48 -06:00
Jason Tedor 8fc38f623b Remove logging configuration warning
The 5.x series of Elasticsearch emits a warning if any of the old
logging configuration formats are present. This commit removes that
warning.

Relates #20386
2016-09-08 10:57:48 -04:00
Jason Tedor de43565abc Do not log full bootstrap checks exception
By default, when an exception causes the JVM to terminate, the stack
trace is printed. In the case of failing bootstrap checks, this stack
trace is useless to the user, and might even distract them from seeing
that the bootstrap checks failed for reasons under their control. With
this commit, we cause the stack trace for a failing bootstrap check to
be truncated.

We also modify some methods to not declare that they throw the top level
checked exception type Exception, but instead explicitly declare the
exceptions that they throw. These exceptions are caught and wrapped in a
BootstrapException so that we can percolate only two exception types out
of Bootstrap#init as checked exception, BootstrapException and
NodeValidationException.

Relates #19989
2016-09-08 10:56:11 -04:00
Simon Willnauer 9e3d399ad2 Skip unreleased versions in RestoreBackwardsCompatIT 2016-09-08 16:16:46 +02:00
Lee Hinman b418889665 Revert "Remove FORCE version_type"
This reverts commit b4cc3cd35d.
2016-09-08 07:43:55 -06:00
Jason Tedor 8e7dfae7d1 Remove collect payloads parameter
The collect_payloads parameter of the span_near query was previously
deprecated with the intention to be removed. This commit removes this
parameter.

Relates #20385
2016-09-08 09:37:36 -04:00
Tanguy Leroux 4fb7ac8254 Clean up XContentBuilder
This commit cleans most of the methods of XContentBuilder so that:
- Jackson's convenience methods are used instead of our custom ones (ie field(String,long) now uses Jackson's writeNumberField(String, long) instead of calling writeField(String) then writeNumber(long))
- null checks are added for all field names and values
- methods are grouped by type in the class source
- methods have the same parameters names
- duplicated methods like field(String, String...) and array(String, String...) are removed
- varargs methods now have the "array" name to reflect that it builds arrays
- unused methods like field(String,BigDecimal) are removed
- all methods now follow the execution path: field(String,?) -> field(String) then value(?), and value(?) -> writeSomething() method. Methods to build arrays also follow the same execution path.
2016-09-08 15:09:09 +02:00
Jim Ferenczi f761038dfd Fix UpdateSettingsIT#testUpdateMergeMaxThreadCount.
Log the setting(s) that changed in the compound updater.
2016-09-08 13:38:18 +02:00
Simon Willnauer f319545814 Prepare master branch to be 6.0.0-alpha1 2016-09-08 12:55:30 +02:00
Simon Willnauer e41ae25b1e Add Version [5.0.0.beta1] 2016-09-08 12:50:25 +02:00
Jim Ferenczi 3ad8459e7b Validate max thread/merge settings
This change checks that `index.merge.scheduler.max_thread_count` < `index.merge.scheduler.max_merge_count` and fails index creation
and settings update if the condition is not met.

Fixes #20380
2016-09-08 10:47:43 +02:00
Jason Tedor b8396cd2d6 Shutdown logging in logging configuration tests
The logging configuration tests write to log files which are deleted at
the end of the test. If these files are not closed, some operating
systems will complain when these deletes are performed. This commit
ensures that the logging system is properly shutdown so that these files
can be properly deleted.
2016-09-07 21:27:39 -04:00
Lee Hinman 409fae7607 Merge remote-tracking branch 'dakrone/remove-force-version-type' 2016-09-07 15:48:58 -06:00
Lee Hinman b4cc3cd35d Remove FORCE version_type
This was an error-prone version type that allowed overriding previous
version semantics. It could cause primaries and replicas to be out of
sync however, so it has been removed.

Resolves #19769
2016-09-07 13:05:18 -06:00
Simon Willnauer a96f3d46b7 Add field with dot in name to 2.4+ static bwc indexes (#20360)
This change adds a `field.with.dots` to all 2.4 bwc indicse and above.
It also adds verification code to OldIndexBackwardsCompatibilityIT to
ensure we upgrade the indices cleanly and the field is present.

Closes #19956
2016-09-07 17:21:28 +02:00
Simon Willnauer 8502d2761f Ensure all static BWC indices have some translog entries (#20362)
Due to the way the nodes where shut down etc. we always flushed
away the translog. This means we never tested upgrades of transaction
logs from older version. This change regenerates all valid bwc indices
and repositories with transaction logs and adds correspondent changes
to the OldIndexBackwardsCompatibilityIT.java
2016-09-07 16:53:24 +02:00