Commit Graph

8278 Commits

Author SHA1 Message Date
Jim Ferenczi 9ef414fead Merge branch 'mattweber-multiple_collapse_inner_hits' 2017-05-26 13:28:08 +02:00
Matt Weber 601a61a91c Support Multiple Collapse Inner Hits
Support multiple named inner hits on a field collapsing
request.
2017-05-26 13:23:57 +02:00
Ryan Ernst 74e031e842 Scripting: Rename CompiledType to FactoryType in ScriptContext (#24897)
This commit renames the concept of the "compiled type" to a "factory
type", along with all implementations of this class to be named Factory.
This brings it inline with the classes purpose.
2017-05-26 00:02:54 -07:00
Ryan Ernst 8eab1fefa1 Scripting: Make contexts available to ScriptEngine construction (#24896)
This commit adds collection of all contexts to the parameters of
getScriptEngine. This will allow script engines like painless to
precache extra information about the contexts.
2017-05-25 16:55:47 -07:00
Jason Tedor 9a118691bf Mute index and relocate concurrently
This test is failing sporadically and for now we mute it as we have a
failure with additional logging that should hopefully enable us to
assess the situation.
2017-05-25 17:37:36 -04:00
Ryan Ernst 8aaea51a0a Scripting: Move context definitions to instance type classes (#24883)
This is a simple refactoring to move the context definitions into the
type that they use. While we have multiple context names for the same
class at the moment, this will eventually become one ScriptContext per
instance type, so the pattern of a static member on the interface called
CONTEXT can be used. This commit also moves the consolidated list of
contexts provided by core ES into ScriptModule.
2017-05-25 12:18:45 -07:00
Jay Modi f60f79f361 Put mapping and index template requests do not need content type detection for 5.3.0+ (#24835)
This change cleans up some missed TODOs for content type detection on the source of put mapping and
put index template requests. In 5.3.0 and newer versions, the source is always JSON so the content
type detection is not needed. The TODOs were missed after the change was backported to 5.3.

Relates #24798
2017-05-25 12:51:44 -06:00
Jay Modi fab6b00ca7 Add the ability to store objects with a ScrollContext (#24777)
This commit adds the ability to store and retrieve data that should be associated with a
ScrollContext. Additionally the ScrollContext was made final as we should only have a single
implementation of this concept.
2017-05-25 12:30:00 -06:00
Simon Willnauer 1325681a03 Fix error message if an incompatible node connects (#24884)
This message broken in recent refactoring, this commit also adds a
basic unit-test to ensure we maintain the correct version.
2017-05-25 15:02:43 +02:00
Ryan Ernst 7d03cff820 Scripting: Make ScriptEngine.compile generic on the script context (#24873)
This commit changes the compile method of ScriptEngine to be generic in
the same way it is on ScriptService. This moves the shim of handling the
two existing context classes into each script engine, so that each
engine can be worked on independently to convert to real handling of
contexts.
2017-05-24 20:06:32 -07:00
Ryan Ernst 5581a0b2f0 Scripting: Remove unnecessary generic type from ScriptContext (#24877)
When developing the new ScriptContext, the compiled type was original
generic, so that the instance type was also necessary. However, since
CompiledType is all that is used by the compile method signature, we
actually don't need the instance type to be generic. This commit removes
the InstanceType, and finds the Class for it through reflection on the
CompiledType method.
2017-05-24 19:20:49 -07:00
Ryan Ernst 1daacd97b0 Scripting: Add instance and compiled classes to script contexts (#24868)
This commit modifies the compile method of ScriptService to be context
aware. The ScriptContext is now a generic class which contains both the
instance type and compiled type for a script. Instance type may be
stateful (for example, pre loading field information for the index a
script will execute on, like in expressions), while the compiled type is
stateless and used to construct instance type instances. This change is
only a first step to cutover ScriptService to the new paradigm. It only
converts callers to the script service, and has a small shim to wrap
compilation from the script engines to support the current two fixed
instance types, SearchScript and ExecutableScript.
2017-05-24 14:29:02 -07:00
Ryan Ernst 0ddd219423 Scripting: Add default implementation of close() for ScriptEngine (#24851)
Since groovy was removed, we no longer have any ScriptEngines with
resources to release. We may want to keep the option open for a script
engine to close resources, but this would not be common. This commit
adds a default implementation to ScriptEngine for `close()` to reduce
the boiler plate that must be added for a ScriptEngine implementation.
2017-05-24 13:19:27 -07:00
Lee Hinman 7a6db074ee [TEST] Add test for retrying replica operations with real network
Related to #24745
2017-05-24 13:31:30 -06:00
Jason Tedor 0499849b1b Increase logging in concurrent relocation test
This commit increases the logging level on the index and relocate
concurrently test to obtain some insight into the global checkpoint
moving backwards.
2017-05-24 11:51:00 -04:00
Boaz Leskes b58f198d94 NoMasterNodeIT shouldn't try to validate the length of a timeout
The current log tries make sure we waited some (but not too long). This is unpredictable and fails all the time. This commit removes all of it and just make sure that we throw the right exceptions after timing out.

Fixes #24369
2017-05-24 16:15:15 +02:00
Simon Willnauer aa0b9f9b39 Remote duplicate test from RemoteClusterServiceTests
The test `testEnsureConnected` was accidentially introduces during #24845
2017-05-24 16:04:25 +02:00
Ali Beyad 877f2d671b [TEST] adds TRACE logging to org.elasticsearch.snapshots for the
SharedClusterSnapshotRestoreIT#testDataFileCorruptionDuringRestore test
2017-05-24 09:50:17 -04:00
Ali Beyad 68f03b88c4 [TEST] increases testDataFileCorruptionDuringRestore logging to TRACE to
help debug sporadic tests failures.
2017-05-24 09:38:54 -04:00
markharwood b7197f5e21 SignificantText aggregation - like significant_terms, but for text (#24432)
* SignificantText aggregation - like significant_terms but doesn’t require fielddata=true, recommended used with `sampler` agg to limit expense of tokenizing docs and takes optional `filter_duplicate_text`:true setting to avoid stats skew from repeated sections of text in search results.

Closes #23674
2017-05-24 13:46:43 +01:00
Yannick Welsch b5adb3cce9 Remove AlreadyExpiredException (#24857)
This is a relict from the TTL functionality that has been removed in #21670
2017-05-24 13:49:02 +02:00
Boaz Leskes 6bc5b1dbcd Guarantee that translog generations are seqNo conflict free (#24825)
With #24779 in place, we can now guaranteed that a single translog generation file will never have a sequence number conflict that needs to be resolved by looking at primary terms. These conflicts can a occur when a replica contains an operation which isn't part of the history of a newly promoted primary. That primary can then assign a different operation to the same slot and replicate it to the replica.

PS. Knowing that each generation file is conflict free will simplifying repairing these conflicts when we read from the translog.

PPS. This PR also fixes some bugs in the piping of primary terms in the bulk shard action. These bugs are a result of the legacy of IndexRequest/DeleteRequest being a ReplicationRequest. We need to change that as a follow up.

Relates to #10708
2017-05-24 13:26:39 +02:00
Simon Willnauer ac6a6d6fe8 Ensure remote cluster is connected before fetching `_field_caps` (#24845)
If a cluster disconnects and comes back up we should ensure that
we connected to the cluster before we fire the requests.

Closes #24763
2017-05-24 13:15:28 +02:00
Ryan Ernst bf49d37ab3 Test: Convert test script engine impls to use MockScriptEngine (#24854)
This commit cleans up tests which currently use custom script engine
implementations, converting them to use a MockScriptEngine with script
functions provided by the tests. It also creates a common set of metric
scripts which were copied across a couple metric agg tests.
2017-05-23 20:34:12 -07:00
Jim Ferenczi 4707377cea Move InnerHitBuilder queries BWC version to 5.5 after the backport
Relates #24676
2017-05-23 22:41:39 +02:00
Christoph Büscher 24a8ba5ca8 Use ParseField constants in ParsedGeoBounds (#24849) 2017-05-23 20:15:40 +02:00
Lee Hinman 82a369737b [TEST] Add additional assert logging 2017-05-23 10:37:40 -06:00
markharwood c71ae3519f Search: Fairer balancing when routing searches by session ID (#24671)
A user reported uneven balancing of load on nodes handling search requests from Kibana which supplies a session ID in a routing preference. Each shardId was selecting the same node for a given session ID because one data node had all primaries and the other data node held all replicas after cluster startup.
This change counteracts the tendency to opt for the same node given the same user-supplied preference by incorporating shard ID in the hash of the preference key. This will help randomise node choices across shards.

Closes #24642
2017-05-23 14:43:44 +00:00
Boaz Leskes b2ccb6b0a8 simplify flow/stop control in testConcurrentWriteViewsAndSnapshot
Thread starvation of the control thread could cause the writer to keep on generating ops and make the test go out of control (OOM).
2017-05-23 15:40:53 +02:00
Jason Tedor 6ec485d30d Suppress inspections on assertions helper
This commit adds comments to org.elasticsearch.Assertions that disables
IntelliJ from complaining about using assert with side-effects, and
using constant conditions there as the side-effect with a constant
condition is intentionally employed.
2017-05-23 09:34:51 -04:00
Jason Tedor c179c6a4c9 Add assertions enabled helper
Today in the code base we have lots of ugly code blocks like:

  boolean assertionsEnabled = false;
  assert assertionsEnabled = true;
  if (assertionsEnabled) {
    // something
  }

These are a nuisance. Instead, we can do this in exactly one place and
replace these blocks with

  if (Assertions.ENABLED) {
    // something
  }

The cool thing here is that since this is a static final field, the JIT
can optimize away the check at runtime if assertions are disabled.

Relates #24834
2017-05-23 08:22:18 -04:00
Jim Ferenczi 9087803cd9 Add the ability to define custom inner hit sub context builder (#24676)
This commit moves the handling of nested and parent/child inner hits to specialized classes that can be defined outside of ES core.
InnerHitBuilderContext is now used by the parent query (nested or hasChild, ...) to build the sub context from the InnerHitBuilder definition.
BWC is also ensured so that nodes in previous versions can still send/receive inner hits to/from this version.

Relates #20257
2017-05-23 13:06:22 +02:00
Boaz Leskes a5fffa2988 relax the assertion about the existence of MAX_UNSAFE_AUTO_ID_TIMESTAMP_COMMIT_ID in the user commit data
Since #24149 we started storing the maxUnsafeAutoIdTimestamp in the lucene commit. The assertions in that PR were built on the assumption that recovering a primary always ends up committing lucene. That is sadly [not true](a72eaa8e0f/core/src/main/java/org/elasticsearch/index/engine/InternalEngine.java (L313)).

Closes #24809
2017-05-23 09:08:30 +02:00
Ali Beyad d3c95b8d9d Removes the 5.3.3 version constant (#24833)
After releasing 5.3.2, the 5.3.3 version constant was created.  However,
this causes issues for the rolling upgrade tests, which expect to have
all older versions artifacts published and no point releases created off
of the older versions (older meaning more than one version behind the
current version).  This commit removes the 5.3.3 version constant,
assuming we will not need it anywhere.
2017-05-22 21:53:16 -04:00
Jack Conradson 8887bcc4c6 Fix settings names for script.allowed_types and script.allowed_contexts. (#24831)
Fixes #24830
2017-05-22 15:08:45 -07:00
Ryan Ernst 52d504bb5f Scripting: Simplify ScriptContext (#24818)
As we work towards contexts implying the return type of compilation, we
first need ScriptContext to not be an enum. This commit removes the
Standard enum and Plugin subclass of ScriptContext.
2017-05-22 13:11:15 -07:00
Nicholas Knize 5ae48f7dd5 Fix RangeFieldMapper rangeQuery to properly handle relations
This commit fixes the RangeFieldMapper and RangeQueryBuilder to pass the correct relation to the RangeQuery when performing a range query over range fields.
2017-05-22 11:37:06 -05:00
javanna 7a3e38eb8e Merge branch 'master' into feature/client_aggs_parsing 2017-05-22 12:25:14 +02:00
Luca Cavanna 726e6c45ab Move getType to Aggregation interface (#24822)
Given that both InternalAggregation and ParsedAggregation have this method, it makes sense to move it to the interface they both implement.
2017-05-22 10:49:23 +02:00
olcbean e08e92d934 Deleting a document from a non-existing index creates the should not auto create it, unless using EXTERNAL* versioning (#24518)
Currently a `delete document` request against a non-existing index actually **creates** this index.

With this change the `delete document` no longer creates the previously non-existing index and throws an `index_not_found` exception instead.

However as discussed in https://github.com/elastic/elasticsearch/pull/15451#issuecomment-165772026, if an external version is explicitly used, the current behavior is preserved and the index is still created and the document is marked for deletion.

Fixes #15425
2017-05-22 10:00:22 +03:00
Ryan Ernst 679ec99fad Scripting: Simplify search method on script service (#24817)
This commit is a simple cleanup to remove an unnecessary extra method on
ScriptService which was only used in 3 places. There is now only one
search method.
2017-05-20 23:46:53 -07:00
Ryan Ernst 2de748859f Scripting: Remove "inline script enabled" on script engines (#24815)
ScriptEngine implementations have an overridable method to indicate they
are safe to use as inline scripts. Since groovy was removed fro 6.0,
there are no longer any implementations which used the default false
value. Furthermore, the value was not actually read anywhere. This
commit removes the method. The ScriptEngineRegistry was also no longer
necessary as it only was used to build a map from language to engine.
2017-05-20 12:01:25 -07:00
Jason Tedor 3666092099 Remove unnecessary method from index shard
This commit removes a convenience method from index shard that is used
at exactly one call site. This method is used to callback a listener
when an operation is on too old of a primary term. Since it is only used
at one call site, we simply inline the method.
2017-05-20 09:44:09 -04:00
Jason Tedor 4cd70cf986 Block older operations on primary term transition
Today a replica learns of a new primary term via a cluster state update
and there is not a clean transition between the older primary term and
the newer primary term. This commit modifies this situation so that:
 - a replica shard learns of a new primary term via replication
   operations executed under the mandate of the new primary
 - when a replica shard learns of a new primary term, it blocks
   operations on older terms from reaching the engine, with a clear
   transition point between the operations on the older term and the
   operations on the newer term

This work paves the way for a primary/replica sync on primary
promotion. Future work will also ensure a clean transition point on a
promoted primary, and prepare a replica shard for a sync with the
promoted primary.

Relates #24779
2017-05-19 16:17:22 -04:00
Jason Tedor cb7a8d5876 Add version 5.3.3 constant
This commit adds the version 5.3.3 constant to the master branch.
2017-05-19 15:18:14 -04:00
javanna db0490343e Merge branch 'master' into feature/client_aggs_parsing 2017-05-19 18:17:06 +02:00
Nik Everett b9ea579633 Allow plugins to register pre-configured tokenizers (#24751)
Allows plugins to register pre-configured tokenizers. Much
of the decisions are the same as those in #24223, #24572,
and #24223. This only migrates the lowercase tokenizer but
I figure that is a good start because it proves out the features.
2017-05-19 12:07:04 -04:00
Luca Cavanna ae73670257 Mark SearchSourceBuilder as ToXContentObject (#24795)
SearchSourceBuilder#toXContent prints out a complete object, hence it should implement ToXContentObject
2017-05-19 18:00:58 +02:00
Nicholas Knize deb7caf4d3 Upgrade to lucene-7.0.0-snapshot-a0aef2f
This commit upgrades master to a current lucene snapshot with commit id a0aef2f.
2017-05-19 10:20:55 -05:00
Jim Ferenczi d241c4898e Removes parent child fielddata specialization (#24737)
This change removes the field data specialization needed for the parent field and replaces it with
a simple DocValuesIndexFieldData. The underlying global ordinals are retrieved via a new function called
IndexOrdinalsFieldData#getOrdinalMap.
The children aggregation is also modified to use a simple WithOrdinals value source rather than the deleted WithOrdinals.Parent.

Relates #20257
2017-05-19 17:11:23 +02:00
Simon Willnauer b17d23dc99 Obey lock order if working with store to get metadata snapshots (#24787)
Today when we get a metadata snapshot from the index shard we ensure
that if there is no engine started on the shard that we lock the index
writer before we go and fetch the store metadata. Yet, if we concurrently
recover that shard, recovery finalization might fail since it can't acquire
the IW lock on the directory. This is mainly due to the wrong order of aquiring
the IW lock and the metadata lock. Fetching store metadata without a started engine
should block on the metadata lock in Store.java but since IndexShard locks the writer
first we get into a failed recovery dance especially in test. In production
this is less of an issue since we rarely get into this siutation if at all.

Closes #24481
2017-05-19 15:36:39 +02:00
Luca Cavanna 0b8da31ccf SearchResponse#fromXContent to not require START_OBJECT as current token (#24794)
The method should rather advance one token and only then require a START_OBJECT as the current token. This allows to parse given a parser that's at the beginning of the response, where the initial/current token is null.
2017-05-19 15:24:29 +02:00
Tanguy Leroux ad3658a8a3 [Test] Remove ParsedAggregationTests (#24791)
Now the Java High Level Rest Client has tests to parse all aggregations,
 this test is not needed anymore. We have better tests like
 AggregationsTests and sub classes of InternalAggregationTestCase.

 Related to #23965
2017-05-19 13:56:58 +02:00
Christoph Büscher 05acc43505 Fix InternalExtendedStatsTests setUp 2017-05-19 13:37:31 +02:00
Tanguy Leroux 91d7bf474f Remove compareTerm() method in parsed Significant Terms aggregations
This method has been removed in core (see #24714)
2017-05-19 13:20:45 +02:00
Tanguy Leroux 83aa00b3f6 Merge remote-tracking branch 'origin/master' into feature/client_aggs_parsing 2017-05-19 13:13:00 +02:00
Tanguy Leroux 55af1f7a2b [Test] Remove leftover in InternalRangeTests 2017-05-19 13:12:01 +02:00
Tanguy Leroux 4c34ea8fc8 Remove //norelease and cleans up somet aggregations tests (#24789) 2017-05-19 12:46:37 +02:00
Yannick Welsch 7054d24f0d Clear responsibilities for PublishClusterStateAction and ZenDiscovery (#24772)
This commit moves some functionality from PublishClusterStateAction to ZenDiscovery, which allows each class to focus on it's core competencies:
- PendingStatesQueue is now solely managed by ZenDiscovery (no shared access by both PublishClusterStateAction and ZenDiscovery)
- Validation logic is handled exclusively by ZenDiscovery
2017-05-19 09:34:23 +02:00
Jack Conradson 1196dfb6bb Remove Deprecated Script Settings (#24756)
Removes all fine-grained script settings replaced by scripts.types_allowed and scripts.contexts_allowed.
2017-05-18 13:32:46 -07:00
Jason Tedor fe83df2a50 Refactor update shard logic for primaries
This commit is a simple refactoring of the update shard logic for
primaries. Namely, there was some duplicated code here that was annoying
to have to read twice so it is now collapsed with this commit.
2017-05-18 15:15:45 -04:00
Boaz Leskes 3d5154191c TransportShardBulkAction: s/tha that/that/ 2017-05-18 21:15:17 +02:00
Boaz Leskes ff374f1d0d TransportShardBulkAction: remove hard version assertion and improve todo comment
We have decided not to force a future version upgrade to deal with this todo. Rather, we'll keep the code until its in our way / the opportunity arises to deal with it.
2017-05-18 20:59:08 +02:00
Nik Everett 82d2c7a142 Remove vagrant testing versions (#24754)
Now that we generate the versions list from Versions.java we can
drop the list of versions maintained for vagrant testing. One nice
thing that the vagrant testing did was to check if the list of
versions was out of date. This moves that test to the core
project.
2017-05-18 09:33:13 -04:00
Tanguy Leroux 96dac4c670 Remove the unused SignificantTerms.compareTerm() method (#24714)
This method is not used and not tested. While it exists it forces
implementations of the interface to implement it while it's unused.
2017-05-18 14:57:12 +02:00
Koen De Groote 905eb422f6 Use StringBuilder to construct a String instead of relying on appending where possible (#24753)
This PR revolves around places in the code where introducing a StringBuilder might make the construction
of a String easier to follow and also, maybe avoid a case where the compiler's very safe way of introducing 
StringBuilder instead of String might not always be optimal for performance.
2017-05-18 12:02:29 +02:00
Simon Willnauer 831c497638 [TEST] Fix compatibilty tests for wire compatibility based on Version.java 2017-05-18 11:21:50 +02:00
Christoph Büscher f658a8d137 DateHistogram: Fix 'extended_bounds' with 'offset' (#23789)
This fixes a bug in the 'date_histogram' aggregation that can happen when using 'extended_bounds'
together with some 'offset' parameter. Offsets should be applied after rounding the extended bounds 
and also be applied when adding empty buckets during the reduce phase in InternalDateHistogram.

Closes #23776
2017-05-18 11:07:48 +02:00
Tanguy Leroux eeef2e6c31 Merge remote-tracking branch 'origin/master' into feature/client_aggs_parsing 2017-05-18 09:43:57 +02:00
Tanguy Leroux f10391e16e Fix checkstyle violation in ParsedScriptedMetric 2017-05-18 09:41:04 +02:00
Tanguy Leroux 055875392e Add parsing method for Top Hits aggregation (#24717)
Related to #23331
2017-05-18 09:37:46 +02:00
Tanguy Leroux 25fceb8c0f Add parsing method for binary range aggregation (#24706)
Related to #23331
2017-05-18 09:24:33 +02:00
Koen De Groote d744d77f61 Fix String concatenation within a StringBuilder append chain
This commit replaces String concatenation within a StringBuilder append chain by using explicit append calls.
2017-05-18 08:51:30 +02:00
Ryan Ernst 26e2e933f5 Scripting: Remove native scripts (#24726)
Native scripts have been replaced in documentation by implementing
a ScriptEngine and they were deprecated in 5.5.0. This commit
removes the native script infrastructure for 6.0.

closes #19966
2017-05-17 14:49:24 -07:00
Ryan Ernst 463fe2f4d4 Scripting: Remove file scripts (#24627)
This commit removes file scripts, which were deprecated in 5.5.

closes #21798
2017-05-17 14:42:25 -07:00
Ryan Ernst f8a48badcf Settings: Remove shared setting property (#24728)
Shared settings were added intially to allow the few common settings
names across aws plugins. However, in 6.0 these settings have been
removed. The last use was in netty, but since 6.0 also has the netty 3
modules removed, there is no longer a need for the shared property. This
commit removes the shared setting property.
2017-05-17 13:14:12 -07:00
Luca Cavanna da669f0554 Add fromXContent method to SearchResponse (#24720)
SearchResponse#fromXContent allows to parse a search response, including search hits, aggregations, suggestions and profile results. Only the aggs that we can parse today are supported (which means all of them but a couple that are left to support). SearchResponseTests reuses the existing test infra to randomize aggregations, suggestions and profile response.

Relates to #23331
2017-05-17 20:28:33 +02:00
Jay Modi 7ce0b1b7c6 Allow SearchOperationListeners to validate a search context (#24650)
This commit adds a new method to the SearchOperationListener that allows implementers to validate
the SearchContext immediately after it is retrieved from the active contexts. The listener may
throw a runtime exception if it deems the SearchContext is not valid and that the use of the context
should be terminated.
2017-05-17 13:07:57 -04:00
Lee Hinman 01bcbd868d [TEST] Fix TransportReplicationActionTests.testRetryOnReplica for replica request (#24745)
* [TEST] Fix TransportReplicationActionTests.testRetryOnReplica for replica request

We were improperly testing that it was a `ConcreteShardRequest` instead of a
`ConcreteReplicaRequest`. This adds that change and also ensures that the
checkpoint is retrievable from the request.

* Fix line-length
2017-05-17 10:58:50 -06:00
Christoph Büscher 9fc9db26fd Add parsing for InternalScriptedMetric aggregation (#24738) 2017-05-17 18:55:57 +02:00
javanna ce7326eb88 Merge branch 'master' into feature/client_aggs_parsing 2017-05-17 17:59:00 +02:00
Simon Willnauer 2ccc223ff7 Fix Version based BWC and set correct minCompatVersion (#24732)
Approaching the release of 6.0 we need to sort out the usage of
`Version#minimumCompatibilityVersion` which was still set to 5.0.0.
Now this change moves it to the latest released version of 5.x (5.4 at this point)
to ensure we are compatible with the latest minor of the previous major. This change
also removes all the `_UNRELEASED` from the versions that where released and drops versions
that were never released and are not expected to be released (bugfixes in minors that are not
the latest in the previous major).
2017-05-17 17:27:09 +02:00
Nik Everett f56d8676cf Fix GetTermVectorsIT
It was assuming that payloads were available in a context where
they weren't.

Relates to #24716
2017-05-17 09:32:07 -04:00
Jim Ferenczi 67c41d2e77 Fix ExpandSearchPhase when response contains no hits (#24688)
This change skips the expand search phase entirely when there is no search hits in the response.
2017-05-17 14:15:40 +02:00
Simon Willnauer cf846af0e5 Fix `_field_caps` serialization in order to support cross cluster search (#24722)
Today the `_field_caps` API doesn't implement its request serialization
correctly since indices and indices options are not serialized at all.
This will likely break with all transport clients etc. and if this request
must be send across the network. This commit fixes this and adds correct
handling if we have only remote indices to prevent the inclusion of
all local indices.
2017-05-17 14:02:45 +02:00
George Papadrosou 8a4d8909a1 Fix ArrayIndexOutOfBoundsException when no ranges are specified in the query (#23241)
* Fix ArrayIndexOutOfBoundsException in Range Aggregation when no ranges are specified in the query

* Revert "Fix ArrayIndexOutOfBoundsException in Range Aggregation when no ranges are specified in the query"

This reverts commit ad57d8feb3577a64b37de28c6f3df96a3a49fe93.

* Fix range aggregation out of bounds exception when there are no ranges in a range or date_range query

* Fix range aggregation out of bounds exception when there are no ranges in the query

This fix is applied to range queries, date range queries, ip range queries and geo distance aggregation queries
2017-05-17 10:34:01 +01:00
Simon Willnauer 11ea588aee Move BWC versin to 5.5 after backport
Relates to #24678
2017-05-16 21:01:19 +02:00
Ryan Ernst 25dd64497b Scripting: Deprecate native scripts (#24692)
Native scripts are no longer documented and instead using a ScriptEngine
is recommended. This change adds a deprecation warning for removal in
6.0.

relates #19966
2017-05-16 11:57:18 -07:00
Lee Hinman d09e64323f Add ability to automatically adjust search threadpool queue_size
This PR adds a new thread pool type: `fixed_auto_queue_size`. This thread pool
behaves like a regular `fixed` threadpool, except that every
`auto_queue_frame_size` operations (default: 10,000) in the thread pool,
[Little's Law](https://en.wikipedia.org/wiki/Little's_law) is calculated and
used to adjust the pool's `queue_size` either up or down by 50. A minimum and
maximum is taken into account also. When the min and max are the same value, a
regular fixed executor is used instead.

The `SEARCH` threadpool is changed to use this new type of thread pool. However,
the min and max are both set to 1000, meaning auto adjustment is opt-in rather
than opt-out.

Resolves #3890
2017-05-16 11:13:16 -06:00
Nik Everett 7ef390068a Move remaining pre-configured token filters into analysis-common (#24716)
Moves the remaining preconfigured token figured into the analysis-common module. There were a couple of tests in core that depended on the pre-configured token filters so I had to touch them:

* `GetTermVectorsCheckDocFreqIT` depended on `type_as_payload` but didn't do anything important with it. I dropped the dependency. Then I moved the test to a single node test case because we're trying to cut down on the number of `ESIntegTestCase` subclasses.
* `AbstractTermVectorsTestCase` and its subclasses depended on `type_as_payload`. I dropped their usage of the token filter and added an integration test for the termvectors API that uses `type_as_payload` to the `analysis-common` module.
* `AnalysisModuleTests` expected a few pre-configured token filtes be registered by default. They aren't any more so I dropped this assertion. We assert that the `CommonAnalysisPlugin` registers these pre-built token filters in `CommonAnalysisFactoryTests`
* `SearchQueryIT` and `SuggestSearchIT` had tests that depended on the specific behavior of the token filters so I moved the tests to integration tests in `analysis-common`.
2017-05-16 13:10:24 -04:00
Jason Tedor a00165913b Adjust comment lengths in IndexShard
This commit adjusts the length of some comments in IndexShard.java that
were written when the column width was set to 100.
2017-05-16 12:26:07 -04:00
Ryan Ernst 97d2657e18 Remove script access to term statistics (#19462)
In scripts (at least some of the languages), the terms dictionary and
postings can be access with the special _index variable. This is for
very advanced use cases which want to do their own scoring. The problem
is segment level statistics must be recomputed for every document.
Additionally, this is not friendly to the terms index caching as the
order of looking up terms should be controlled by lucene.

This change removes _index from scripts. Anyone using it can and should
instead write a Similarity plugin, which is explicitly designed to allow
doing the calculations needed for a relevance score.

closes #19359
2017-05-16 09:10:09 -07:00
Simon Willnauer 1cae850cf5 Add a cluster block that allows to delete indices that are read-only (#24678)
Today when an index is `read-only` the index is also blocked from
being deleted which sometimes is undesired since in-order to make
changes to a cluster indices must be deleted to free up space. This is
a likely scenario in a hosted environment when disk-space is limited to switch
indices read-only but allow deletions to free up space.
2017-05-16 17:34:37 +02:00
Simon Willnauer 65218fea6d Allow resetting settings that use and IP validator (#24713)
The IP validator doesn't expect a null value for a setting that causes NPEs
if a user tries to reset a setting that uses this validator.

Closes #24709
2017-05-16 16:06:24 +02:00
Zachary Tong 1e97184519 Automatically close releasables after test (#24687)
This moves the releasing logic to the base test, so that individual test cases don't need
to worry about releasing the aggregators.  It's not a big deal for individual aggs,
but once tests start using sub-aggs, it can become tricky to free (without double-freeing)
all the aggregators.
2017-05-16 09:01:38 -04:00
Tanguy Leroux d5fc520741 Add parsing to Significant Terms aggregations (#24682)
Related to  #23331
2017-05-16 14:54:42 +02:00
Christoph Büscher ef7c2e62c3 Add parsing for InternalAdjacencyMatrix aggregation (#24700) 2017-05-16 14:35:49 +02:00
Martijn van Groningen f6e19dcedc
percolator: Fix range queries with date range based on current time.
Range queries with now based date ranges were previously not allowed,
but since #23921 these queries were allowed. This change should really
fix range queries with now based date ranges.
2017-05-16 13:13:11 +02:00
Christoph Büscher 059b23e92e Merge branch 'master' into feature/client_aggs_parsing 2017-05-16 11:54:02 +02:00
Christoph Büscher 8c6b5a953e [Tests] Add unit test for InternalAdjecencyMatrix aggregation (#24698)
Adding a unit test to InternalAdjecencyMatrix that extends the shared InternalAggregationTestCase
 that we use for testing aggregations.
Relates to #22278
2017-05-16 11:51:45 +02:00