Commit Graph

27819 Commits

Author SHA1 Message Date
jaymode 5997e4a39d
Remove incorrect bwc branch logic from master
Commit bf007e8d93 was a forward port of logic needed in 5.x to get
the correct bwc branch. However, other changes on master meant that this forward port was not
needed and actually broke the bwc tests. This change removes the incorrect if statement.

Relates #25134
2017-06-09 09:47:06 -06:00
Koen De Groote 64888f6f01 Correctly format arrays in output
There are a few places where arrays are output in messages yet the
output would merely use the default toString implementation rather than
actually putting the content of the array in the message. This commit
fixes the issue.

Relates #24340
2017-06-09 11:45:07 -04:00
Christoph Büscher 823cbb437b [Test] Extending parsing checks for SearchResponse (#25148)
This change extends the tests and parsing of SearchResponse to make sure we can
skip additional fields the parser doesn't know for forward compatibility
reasons.
2017-06-09 17:33:44 +02:00
Ryan Ernst a03b6c2fa5 Scripting: Change keys for inline/stored scripts to source/id (#25127)
This commit adds back "id" as the key within a script to specify a
stored script (which with file scripts now gone is no longer ambiguous).
It also adds "source" as a replacement for "code". This is in an attempt
to normalize how scripts are specified across both put stored scripts and script usages, including search template requests. This also deprecates the old inline/stored keys.
2017-06-09 08:29:25 -07:00
Tanguy Leroux 29502107b9 [Test] Add test for custom requests in High Level Rest Client (#25106)
This commit adds a test that tests and demonstrates how
{@link RestHighLevelClient} can be extended to support
custom endpoint.
2017-06-09 17:03:57 +02:00
Martijn van Groningen c7ae27d57f
nested: In case of a single type the _id field should be added to the nested document instead of _uid field.
When `index.mapping.single_type` is `true` the `_uid` field is not used and instead `_id` field is used.
Prior to this change nested documents would in this case still use the `_uid` field to mark to what root
document they belong to. In case of deleting documents this could lead to only the root  Lucene document
to be deleted and not the nested Lucene documents. This broke the docid block ordering the block join
relies on in order to work correctly and thus causing the `nested` query, `nested` aggregation, nested sorting
and nested inner hits to either fail or yield incorrect results.

This bug only manifests in 6.0.0-ALPHA2 release and snaphots (5.5.0-SNAPSHOT, 5.6.0-SNAPSHOT, 6.0.0-SNAPSHOT).
2017-06-09 14:57:11 +02:00
Adrien Grand 87d19b21c7 `type` and `id` are lost upon serialization of `Translog.Delete`. (#24586)
This was introduced in #24460: the constructor of `Translog.Delete` that takes
a `StreamInput` does not set the type and id. To make it a bit more robust, I
made fields final so that forgetting to set them would make the compiler
complain.
2017-06-09 14:56:23 +02:00
Jim Ferenczi 5e8b569255 fix highlighting docs 2017-06-09 14:42:08 +02:00
Sergey Galkin dc5aa993e0 Fix NPE in token_count datatype with null value (#25046)
Fixes an issue with the handling of null values for the token_count data type.

Closes #24928
2017-06-09 14:13:05 +02:00
Jim Ferenczi 8250aa4267 Remove the postings highlighter and make unified the default highlighter choice (#25028)
This change removes the `postings` highlighter. This highlighter has been removed from Lucene master (7.x) because it behaves
exactly like the `unified` highlighter when index_options is set to `offsets`:
https://issues.apache.org/jira/browse/LUCENE-7815

It also makes the `unified` highlighter the default choice for highlighting a field (if `type` is not provided).
The strategy used internally by this highlighter remain the same as before, it checks `term_vectors` first, then `postings` and ultimately it re-analyzes the text.
Ultimately it rewrites the docs so that the options that the `unified` highlighter cannot handle are clearly marked as such.
There are few features that the `unified` highlighter is not able to handle which is why the other highlighters (`plain` and `fvh`) are still available.
I'll open separate issues for these features and we'll deprecate the `fvh` and `plain` highlighters when full support for these features have been added to the `unified`.
2017-06-09 14:09:57 +02:00
Christoph Büscher eca4f24b16 [Test] Adding test for parsing SearchShardFailure leniently (#25144)
This change extends the tests and parsing of SearchShardFailure to make sure we
can skip fields the parser doesn't know for forward compatibility reasons.
2017-06-09 12:46:09 +02:00
Pandiyan Murugan 34c3d1d5bf Fix typo in shards.asciidoc (#25143) 2017-06-09 12:45:43 +02:00
Sanne Grinovero a2d9b0edcd List Hibernate Search (#25145)
among the community framework integrations
2017-06-09 12:05:53 +02:00
javanna 85df978d80 [DOCS] update maxRetryTimeout in java REST client usage page 2017-06-09 11:20:50 +02:00
Christoph Büscher 79057b1c61 [Test] Extending checks for Suggestion parsing (#25132)
When parsing responses we should be ignoring any new unknown fields or inner
objects in most cases to be forward compatible with changes in core on the
client side. This change adds test for this for Suggestions and its various
subclasses to check if we are able to ignore new fields and objects in the
xContent.
2017-06-09 10:11:08 +02:00
Andrey Groshev e4fd8485ce Made the same length of opening and closing lines (#23583) 2017-06-09 00:50:43 -07:00
Tanguy Leroux 348884bda4 [Test] Remove redundant assertions in SearchIT
The SearchResponse's took time is already checked by the assertSearchHeader()
method so it does not need to be checked twice.
2017-06-09 09:44:57 +02:00
Jim Ferenczi ad905924ae update docs that claim that classic is the default similarity 2017-06-09 09:22:48 +02:00
Deb Adair 3b71e6288e [DOCS] Removing duplicate attribute definition. 2017-06-08 19:09:51 -07:00
Deb Adair ebec1029d4 [DOCS] Everything should match now in the doc-tests attribute. 2017-06-08 18:41:27 -07:00
Deb Adair 8f32fedfb9 [DOCS] Added the actual file name to the doctests attribute. 2017-06-08 18:30:17 -07:00
Deb Adair c35a14830a [DOCS] Fixed doctests attribute name to match. 2017-06-08 18:13:51 -07:00
Deb Adair c63c3fbbec [DOCS] Added missing attribute to specify the location of the included tests. 2017-06-08 17:54:26 -07:00
Deb Adair dbe2de0891 [DOCS] Fixed callout reference error. 2017-06-08 16:47:13 -07:00
Tal Levy a771912a22 Add Ingest-Processor specific Rest Endpoints & Add Grok endpoint (#25059)
This PR enables Ingest plugins to leverage processor-scoped REST
endpoints. First of which being the Grok endpoint that retrieves
Grok Patterns for users to retrieve all the built-in patterns.
Example usage: Kibana Grok Autocomplete!
2017-06-08 15:24:35 -07:00
Tal Levy 340909582f remove Ingest's Internal Template Service (#25085)
Ingest was using it's own wrapper around TemplateScripts and the ScriptService.
This commit removes that abstraction
2017-06-08 15:24:03 -07:00
Lee Hinman 119f8ed9f0 Correctly enable _all for older 5.x indices
When we disabled `_all` by default for indices created in 6.0, we missed adding
a layer that would handle the situation where `_all` was not enabled in 5.x and
then the cluster was updated to 6.0, this means that when the cluster was
updated the `_all` field would be disabled for 5.x indices and field values
would not be added to the `_all` field.

This adds a compatibility layer for 5.x indices where we treat the default
enabled value for the `_all` field to be `true` if unset on 5.x indices.

Resolves #25068
2017-06-08 14:37:44 -06:00
Guillaume Le Floch 3f6d80aa66 Allow removing multiple fields in ingest processor (#24750)
* Allow removing multiple fields in ingest processor

* Iteration 2

* Few fixes
2017-06-08 13:17:44 -07:00
Jason Tedor 1708f1773b Mark Log4j API dependency as non-optional
The Log4j dependency is separated into two artifacts, the API and the
core implementation. This is to enable replacing Log4j on the backend
through the SLF4J bridge with another logging implementation. For this
reason, the dependencies are marked as optional. This causes confusion
amongst users as to use the bridge, the API should be non-optional since
it is needed for the bridge to function correctly. While they could pull
it into their application directly, it would be clearer if we simply
marked this depdendency as non-optional. Note that this does not mean
that users have to use Log4j for logging in their application, so we are
not marking core as required, it only clarifies what they need to be
able to plug in a different logging implementation.

Relates #25136
2017-06-08 16:09:34 -04:00
jaymode bf007e8d93
Fix branch logic for bwc tests in the same major version (#25134)
When testing against the previous 5.x release, the bwc project incorrectly would checkout the 5.x
branch instead of the 5.5 branch as it still had the logic that applies for major versions bwc. This change adds
a check to compare the major version when making the decision on the branch to use.
2017-06-08 11:39:29 -06:00
Lee Hinman 050b7cd0f9 Include empty mappings in GET /{index}/_mappings requests (#25118)
Previously this would output:

```
GET /test-1/_mappings

{ }
```

And after this change:

```
GET /test-1/_mappings

{
  "test-1": {
    "mappings": {}
  }
}
```

To bring parity back to the REST output after #24723.

Relates to #25090
2017-06-08 10:57:04 -06:00
Lee Hinman 5b2ab96364 Return index name and empty map for /{index}/_alias with no aliases
Previously in #24723 we changed the `_alias` API to not go through the
`RestGetIndicesAction` endpoint, instead creating a `RestGetAliasesAction` that
did the same thing.

This changes the formatting so that it matches the old formatting of the
endpoint, before:

```
GET /test-1/_alias

{ }
```

And after this change:

```
GET /test-1/_alias

{
  "test-1": {
    "aliases": {}
  }
}
```

This is related to #25090
2017-06-08 10:03:03 -06:00
Eli Skeggs ee0e921643 Fix typo in GeoUtils#isValidLongitude (#25121)
GeoUtils#isValidLongitude is inconsistent with GeoUtils#isValidLatitude. 
Neither technically need the isInfinite() check because they then compare 
against min and max values.
2017-06-08 17:23:22 +02:00
Christoph Büscher a0afa917ac [Tests] Check QueryProfileShardResult parser robustness for new fields (#25130)
When parsing resonses we should be ignoring any new unknown fields or inner
objects in most cases to be forward compatible with changes in core on the
client side. This change adds test for this for QueryProfileShardResult and
nested substructures and changes the parsing code where necessary to be able to
ignore new fields and objects in the xContent.
2017-06-08 16:40:00 +02:00
Nik Everett 4a8c09c5f1 Make randomVersionBetween work with unreleased versions (#25042)
Test: randomVersionBetween works with unreleased

Modifies randomVersionBetween so that it works with unreleased
versions. This should make switching a version from unreleased
to released much simpler.
2017-06-08 10:19:06 -04:00
Christoph Büscher 542b0616ac [Test] Fix high-level-rest SearchIT so that quick responses don't fail the test 2017-06-08 16:06:39 +02:00
Yannick Welsch cd57395c98 Use correct primary term for replicating NOOPs (#25128)
NOOPs should be, same as for indexing operations, written on the replica using the original operation term instead of the current term of the replica.
2017-06-08 14:20:26 +02:00
Martijn van Groningen 326fa33d4e
fielddata: Binary script doc values should make a deep copy of the BytesRef before populating it in the values array.
Added common base class for ScriptDocValues.Strings and ScriptDocValues.BytesRefs now that these classes are very similar.

Also cleaned up the BinaryDVFieldDataTests:
* Use junit assertions instead of hamcrest
* Use BytesRef directly instead of byte[]

Closes #24785
2017-06-08 13:20:35 +02:00
Jim Ferenczi eeac4b9721 Fix Fast Vector Highlighter NPE on match phrase prefix (#25116)
The FVH fails with an NPE when a match phrase prefix is rewritten in an empty phrase query.
This change makes sure that the multi match query rewrites to a MatchNoDocsQuery (instead of an empty phrase query) when there is
a single term and that term does not expand to any term in the index.

Fixes #25088
2017-06-08 12:27:11 +02:00
Jim Ferenczi 36a5cf8f35 Automatically early terminate search query based on index sorting (#24864)
This commit refactors the query phase in order to be able
to automatically detect queries that can be early terminated.
If the index sort matches the query sort, the top docs collection is early terminated
on each segment and the computing of the total number of hits that match the query is delegated to a simple TotalHitCountCollector.
This change also adds a new parameter to the search request called `track_total_hits`.
It indicates if the total number of hits that match the query should be tracked.
If false, queries sorted by the index sort will not try to compute this information and 
and will limit the collection to the first N documents per segment.
Aggregations are not impacted and will continue to see every document
even when the index sort matches the query sort and `track_total_hits` is false.

Relates #6720
2017-06-08 12:10:46 +02:00
Jim Ferenczi 21a57c1494 Always use DisjunctionMaxQuery to build cross fields disjunction (#25115)
This commit modifies query_string, simple_query_string and multi_match queries to always use a DisjunctionMaxQuery when a disjunction over multiple fields is built. The tiebreaker is set to 1 in order to behave like the boolean query in terms of scoring.
The removal of the coord factor in Lucene 7 made this change mandatory to correctly handle minimum_should_match.

Closes #23966
2017-06-08 11:18:17 +02:00
Simon Willnauer d6d416cacc Break out clear scroll logic from TransportClearScrollAction (#25125)
This change extracts the main logic from `TransportClearScrollAction`
into a new class `ClearScrollController` and adds a corresponding unit test.

Relates to #25094
2017-06-08 11:13:08 +02:00
Simon Willnauer bdc3a16fa4 Fix naminig in GroupedActionListener
GroupedActionListener still had some members named from it's specialization
before it was factored out in a general purpose class.
2017-06-08 10:21:15 +02:00
Adrien Grand a8ea2f0df4 Leverage scorerSupplier when applicable. (#25109)
The `scorerSupplier` API allows to give a hint to queries in order to let them
know that they will be consumed in a random-access fashion. We should use this
for aggregations, function_score and matched queries.
2017-06-08 10:19:38 +02:00
David Roberts f9503af0d5 [TEST] Move test skip/blacklist assumptions out of @Before method (#25100)
This commit moves the assumeFalse() calls that implement test skipping
and blacklisting out of the @Before method of ESClientYamlSuiteTestCase.
The problem with having them in the @Before method is that if an
assumption triggers then the @Before methods of classes that extend
ESClientYamlSuiteTestCase will not run, but their @After methods will.
This can lead to inconsistencies that cause assertions in the @After
methods and fail the test even though it was skipped/blacklisted.

Instead the assumeFalse() calls are now at the beginning of the test()
method, which runs after all @Before methods (including those in classes
that extend ESClientYamlSuiteTestCase) have completed.  The only side
effect is that overridden test() methods in classes that extend
ESClientYamlSuiteTestCase which call super.test() and also do other things
must now be designed not to consume any InternalAssumptionViolatedException
that may be thrown by the super.test() call.

Relates elastic/x-pack-elasticsearch#1650
2017-06-08 09:06:42 +01:00
Boaz Leskes 087f182481 Translog file recovery should not rely on lucene commits (#25005)
When we open a translog, we rely on the `translog.ckp` file to tell us what the maximum generation file should be and on the information stored in the last lucene commit to know the first file we need to recover. This requires coordination and is currently subject to a race condition: if a node dies after a lucene commit is made but before we remove the translog generations that were unneeded by it, the next time we open the translog we will ignore those files and never delete them (I have added tests for this).

This PR changes the approach to have the translog store both of those numbers in the `translog.ckp`. This means it's more self contained and easier to control. 

This change also decouples the translog recovery logic from the specific commit we're opening. This prepares the ground to fully utilize the deletion policy introduced in #24950 and store more translog data that's needed for Lucene, keep multiple lucene commits around and be free to recover from any of them.
2017-06-08 09:21:28 +02:00
Simon Willnauer ce24331d1f Add helper methods to TransportActionProxy to identify proxy actions and requests (#25124)
Downstream users of out network intercept infrastructure need this information which is
hidden due to member and class visibility.
2017-06-08 09:07:22 +02:00
Jack Conradson d187fa78fd Generate Painless Factory for Creating Script Instances (#25120) 2017-06-07 16:06:11 -07:00
Jason Tedor 4034cd429d Fix formatting of random testing seed
The whitespace is not aligned correctly and it might be crazy-making to
some developers.
2017-06-07 15:16:46 -04:00
Christoph Büscher 9e741cd13d Tests: Add ability to generate random new fields for xContent parsing test (#23437)
For the response parsing we want to be lenient when it comes to parsing
new xContent fields. In order to ensure this in our testing, this change
adds a utility method to XContentTestUtils that takes xContent bytes
representation as input and recursively a random field on each object
level.

Sometimes we also want to exclude a whole subtree from this treatment 
(e.g. skipping "_source"), other times an element (e.g. "fields", "highlight" 
in SearchHit) can have arbitraryly named objects. Those cases can be 
specified as exceptions.
2017-06-07 21:01:20 +02:00