Commit Graph

4805 Commits

Author SHA1 Message Date
Adrien Grand 13c1efd4d1 Propagate DocValueFormat to all terms aggs. #17646
TL;DR This commit should not have any impact on terms aggs, it will just make
supporting ipv6 easier.

Currently only the numeric terms aggs propagate the DocValueFormat instance since
we use numerics to represent also dates or ip addresses. Since string terms aggs
are only used for text/keyword/string fields, they do not use the format and just
call toUt8String(). However when we support ipv6, ip addresses as well will be
encoded in sorted doc values (just like strings) so we will need to use the
DocValueFormat to format the keys.
2016-04-11 16:33:19 +02:00
Alexander Reelsen 9fc4ce294a Tests: Fixing SimulateProcessorResultTests due to recent ingest attachment changes 2016-04-11 15:52:22 +02:00
Alexander Reelsen da19ddf3e6 Ingest Attachment: Allow to prevent base64 conversions by using raw bytes (#16601)
CBOR is natively supported in Elasticsearch and allows for byte arrays.
This means, that by using CBOR the user can prevent base64 conversions
for the data being sent back and forth.

This PR adds support to extract data from a byte array in addition to
a string. This also required to add a ByteArrayValueSource class.
2016-04-11 14:14:56 +02:00
Jim Ferenczi 2713a08fb3 Merge pull request #17613 from jimferenczi/all_field
Simplify AllEntries, AllField and AllFieldMapper
2016-04-11 12:13:48 +02:00
Daniel Mitterdorfer 0cdea41bf5 Turn RestChannel into an interface
In #17133 we introduce request size limit handling and need a custom
channel implementation. In order to ensure we delegate all methods
it is better to have this channel implement an interface instead of
an abstract base class (so changes on the interface turn into
compile errors).

Relates #17133
2016-04-11 11:06:39 +02:00
David Pilato 1e346d1ac1 Merge branch 'fix/17625-close-ingest-factory' 2016-04-11 10:00:19 +02:00
David Pilato cc4fb61a38 Simplify the test 2016-04-11 09:59:13 +02:00
Nik Everett 525ce40d1c Give SearchContext a toString
and move the string capturing to capture time.
2016-04-10 20:55:31 -04:00
Nik Everett ac94e5f287 Provide more information about open contexts
Sometimes we get a test failure caused by search contexts left open.
The tests include a stack trace of the call that opened the context
but nothing else about the context. This adds more information about
the context that has been left open like what query it was running,
what shard it targeted, and whether or not it was a scroll.

Relates to #17582
2016-04-10 20:55:31 -04:00
David Pilato 24f48b86b5 Update after review and add a Test 2016-04-09 13:14:25 +02:00
Jason Tedor 4ff8f5c16c Revert "Exploit DiscoveryNode immutability..."
This reverts commit e76038e076.
2016-04-08 19:29:55 -04:00
Adrien Grand 4adc31fe11 Use `mmapfs` by default.
I case any problem was discovered, you can still enable the legacy `default`
directory instead. But the plan is to get rid of it in 6.0.

Closes #16983
2016-04-08 20:23:27 +02:00
David Pilato 09fc9485c6 Ingest does not close its factories
When you implement an ingest factory which implements `Closeable`:

```java
public static final class Factory extends AbstractProcessorFactory<MyProcessor> implements Closeable {
    @Override
    public void close() throws IOException {
        logger.debug("closing my processor factory");
    }
}
```

The `close()` method is never called which could lead to some leak threads when we close a node.

The `ProcessorsRegistry#close()` method exists though and seems to do the right job:

```java
@Override
public void close() throws IOException {
    List<Closeable> closeables = new ArrayList<>();
    for (Processor.Factory factory : processorFactories.values()) {
        if (factory instanceof Closeable) {
            closeables.add((Closeable) factory);
        }
    }
    IOUtils.close(closeables);
}
```

But apparently this method is never called in `Node#stop()`.

Closes #17625.
2016-04-08 18:19:57 +02:00
Adrien Grand 42526ac28e Remove Settings.settingsBuilder.
We have both `Settings.settingsBuilder` and `Settings.builder` that do exactly
the same thing, so we should keep only one. I kept `Settings.builder` since it
has my preference but also it is the one that we use in examples of the Java API.
2016-04-08 18:10:02 +02:00
Nik Everett df8a971966 Assert names of read writeables
Adds an assertion that when reading a NamedWriteable it has the same name
you read. It'd be *super* weird if it didn't.
2016-04-08 08:30:22 -04:00
Nik Everett d349de71aa Remove registerQueryParser
We've fully cut over to registerQuery!
2016-04-08 08:17:25 -04:00
Jim Ferenczi c565718ae6 Simplify AllEntries, AllField and AllFieldMapper:
* Create one AllField field per field eligible for _all.
  * Add a positionIncrementGap (with a size of 100, not configurable) between
  each entry in order to distinguish fields when doing phrase query on _all.
2016-04-08 10:58:58 +02:00
Adrien Grand 0d8e399781 Fix `MapperService.unmappedType("string")` to not raise an error.
A deprecation log will be emitted if you do. This should fix the kibana build.
2016-04-08 10:08:36 +02:00
Nik Everett e0cde29a68 Cut over remaining queries to registerQuery 2016-04-07 18:48:10 -04:00
Chris Earle d97d5ebb8b Remove hostname from NetworkAddress.format
This removes the inconsistent output of IP addresses. The format was parsing-unfriendly and it makes it hard
to reason about API responses, such as to _nodes.

With this change in place, it will never print the hostname as part of the default format, which has the
added benefit that it can be used consistently for URIs, which was not the case when the hostname might
appear at the front with "hostname/ip:port".
2016-04-07 17:27:59 -04:00
Ali Beyad 763a659830 Fixes reading of CORS pre-flight headers and methods
CORS headers and methods config parameters must be read as arrays.  This
commit fixes the issue.  It affects http.cors.allow-methods and
http.cors.allow-headers.

Fixes #17483
2016-04-07 15:32:47 -04:00
Lee Hinman 82c2b1e48e Merge remote-tracking branch 'dakrone/allocation-explain-show-delay' 2016-04-07 12:56:28 -06:00
Lee Hinman 199c7256c8 Make passed in settings final and use Settings instead of strings 2016-04-07 12:55:25 -06:00
Lee Hinman 38d6ae1e20 Merge commit '8e01b093d0307a67a09bcb238452078becb62707' into dakrone/disk-info-ignore-shadow-size 2016-04-07 11:35:51 -06:00
Igor Motov 81c59cae18 Add _cat/tasks
Adds new _cat endpoint that lists all tasks
2016-04-07 09:28:21 -06:00
Jason Tedor 6a0e2d1f2d Remove leftover forbidden suppression in ZD 2016-04-07 11:22:29 -04:00
Adrien Grand c33300c543 Make MappedFieldType responsible for providing a parser/formatter. #17546
Aggregations need to perform instanceof calls on MappedFieldType instances in
order to know how they should be parsed or formatted. Instead, we should let
the field types provide a formatter/parser that can can be used.
2016-04-07 16:57:50 +02:00
jaymode f9d1e8a5f3 Root rest api delegates to a transport action
This change makes the root (/) rest api delegate to a transport action to get the
data for the response. This aligns this rest api with all of the other apis, which
delegate to one or more actions.

In doing this, unit tests were added to provide coverage of the RestMainAction
and the associated classes.
2016-04-07 10:03:49 -04:00
Adrien Grand e1bfe23c22 ExtendedStatsAggregator should also pass sigma to emtpy aggs. #17388
Because sigma is also used at reduce time, it should be passed to empty aggs.
Otherwise it causes bugs when an empty aggregation is used to perform reduction
is it would assume a sigma of zero.

Closes #17362
2016-04-07 09:34:11 +02:00
Jason Tedor 0a69985153 Merge pull request #17038 from jasontedor/enable_acked
Prepare for enabling acked indexing
2016-04-06 18:13:28 -04:00
Nik Everett 4841c5a3d3 Cut CustomQueryParserIT to registerQuery
This is the last place inside of ES other than SearchModule.
2016-04-06 16:38:56 -04:00
Jimmy Jones f157dae053 Disallow unquoted field names, fix testcases using unquoted JSON 2016-04-06 14:37:15 -06:00
Martijn van Groningen 63261f14d4 test: better fix for: 78d2311c5f 2016-04-06 22:23:00 +02:00
Martijn van Groningen ec4ebf31b0 Revert "test: don't do fuzzy on bool field"
This reverts commit 78d2311c5f.
2016-04-06 22:18:57 +02:00
Martijn van Groningen 5ff68d173d Removed unneeded refresh during post recovery.
and removed an obsolete exception, `_percolator` type is now `.percolator` since version 1.0
2016-04-06 22:06:14 +02:00
Adrien Grand 57059f1410 Fail if an object is added after a field with the same name. #17568
Today we fail if you try to add a field and an object from another type already
has the same name. However, we do NOT fail if you insert the field first and the
object afterwards. This leads to bad bugs since mappings are not necessarily
parsed in the same order at recovery time, so a mapping update could succeed and
then you would fail to reopen the index.
2016-04-06 20:16:11 +02:00
Jason Tedor 95feb40bef Remove superfluous validation of incoming states
This commit removes a superfluous check when validing incoming cluster
states. The check in question prevents out-of-order cluster states from
the same master from entering the queue. However, such out-of-order
cluster states will be cleaned from the queue when a commit message for
that cluster state arrives or a commit message for any higher-versioned
cluster state arrives.
2016-04-06 13:53:21 -04:00
Michael McCandless 8a9b5ccbc4 Merge pull request #17569 from mikemccand/imc_version_conflict_recovery
NullPointerException from IndexingMemoryController when a version conflict happens during recovery
2016-04-06 13:47:00 -04:00
Mike McCandless dea3678ef9 handle null Engine.Operation.getTranslogLocation in IndexingMemoryController 2016-04-06 13:34:01 -04:00
Nik Everett 16c12afabe Rework ScoreFunctionBuilder registration to remove PROTOTYPEs
This removes PROTOTYPEs from ScoreFunctionsBuilders. To do so we rework
registration so it doesn't need PROTOTYPEs and lines up with the recent
changes to query registration.
2016-04-06 13:04:11 -04:00
Nik Everett 1afc9b7e56 Cut multi_match query to registerQuery 2016-04-06 12:30:05 -04:00
Nik Everett f61c29e67b Move more queries to registerQuery 2016-04-06 11:51:06 -04:00
Nik Everett 03ce5e19eb 4 more queries 2016-04-06 11:15:23 -04:00
Nik Everett 2b6866d26b Fix references to the removed parsers
Mostly stuff is just in the builder now.
2016-04-06 11:15:22 -04:00
Nik Everett c68a58b67e Move the bottom third of queries to registerQuery
Mostly this is just moving fromXContent, making it public, and moving
the ParseFields used in parsing and making them private.
2016-04-06 11:15:22 -04:00
Colin Goodheart-Smithe c5ce78ed44 Aggregations: Fixes NPE when no window is specified in moving average request
This PR fixes a bug where a NPE was thrown when parsing a moving average pipeline aggregation request which did not specify a window size.

Closes #17516
2016-04-06 15:56:26 +01:00
Martijn van Groningen 78d2311c5f test: don't do fuzzy on bool field 2016-04-06 16:49:26 +02:00
Christoph Büscher bdc70df319 Merge pull request #17547: Add shuffling xContent to aggregation tests
This adds shuffling of xContent similar to #17521 to the aggregation and pipeline aggregation base test.
The additional shuffling uncovered that some aggregation builders internally store some properties in a 
way that made the equals() testing fail when the xContent is shuffled.
For TopHitsAggregatorBuilder, the internal scriptFields parameter was changed to a set because the order 
they appear in the xContent should not matter. For FiltersAggregatorBuilder, the internal list of KeyedFilters 
is sorted by key now. As a side effect, the keys in the aggregation response are now not always in the same 
order as the filters in the query, but sorted by key as well (unless they are anonymous).
2016-04-06 14:09:36 +02:00
James Bertouch 3651854bf6 Enhanced lat/long error handling
NumberFormatExceptions caused by non-double lat/long values are now
handled when the ignore_malformed flag is set to true.

Closes #16833
2016-04-06 07:14:01 -04:00
Christoph Büscher f409d0b763 Make defensive copies of filters list internally 2016-04-06 11:40:08 +02:00
Igor Motov f599ac5d5a Expose whether a task is cancellable in the _tasks list API
Closes #17369
2016-04-05 19:16:08 -06:00
Jason Tedor e76038e076 Exploit DiscoveryNode immutability in toString
DiscoveryNode is immutable yet we rebuild DiscoveryNode#toString on
every invocation. Most importantly, this just leads to unnecessary
allocations. This is most germane to ZenDiscovery and the processing of
cluster states where DiscoveryNode#toString is invoked when submitting
update tasks and processing cluster state updates.

Closes #17543
2016-04-05 19:17:04 -04:00
Christoph Büscher cbcbe75cf0 Adressing comments 2016-04-06 00:05:26 +02:00
Jason Tedor 66cc2029cd Refactor old state version check to ZenDiscovery 2016-04-05 17:31:36 -04:00
Jason Tedor c2ed5a1c9e Reorder pending queue clean checks 2016-04-05 15:59:54 -04:00
Jason Tedor 3abf8177e8 Add comment about older cluster states 2016-04-05 15:56:16 -04:00
Christoph Büscher b01e3f0d3b Add shuffling xContent to aggregation tests 2016-04-05 19:33:52 +02:00
Jason Tedor 7cdd647d7b Clarify cluster state local node validation 2016-04-05 13:04:34 -04:00
Colin Goodheart-Smithe 65a5366cba Aggregations: Fixes Filter and FiltersAggregation to work with empty query
This fix ensures the filter and filters aggregation will not throw a NPE when `{}` is passed in as a filter. Instead `{}` is interpreted as a MatchAllDocsQuery.

Closes #17518
2016-04-05 17:20:29 +01:00
Jason Tedor cffc315dca Reject old cluster states and keep the queue clean
This commit adds a guard preventing old cluster states from entering
into the pending queue when we are following a master, and cleans old
cluster states from the pending queue when processing a commit.
2016-04-05 11:03:29 -04:00
Luca Cavanna 67ccfc354e Switch to using ParseField to parse query names
* [TEST] check registered queries one by one in SearchModuleTests

* Switch to using ParseField to parse query names

If we have a deprecated query name, at the moment we don't have a way to log any deprecation warning nor fail when we are in strict mode. With this change we use ParseField, which will take care of the camel casing that we currently do manually (so that one day we can remove it more easily). This also means, that each query will have a unique preferred name, and all the other names are deprecated.

Terms query "in" synonym is now formally deprecated, as well as fuzzy_match, match_fuzzy, match_phrase and match_phrase_prefix for match query, mlt for more_like_this and geo_bbox for geo_bounding_box. All these will be removed in 6.0.

Every QueryParser holds now a ParseField constant called QUERY_NAME_FIELD that holds the name for it. The first name is the preferred one, all the others are deprecated. The first name is taken from the NAME constant already present in each query builder object, so that we somehow keep the serialization constant separated from ParseField. This change also allowed us to remove the names method from the QueryParser interface.
2016-04-05 15:38:53 +02:00
Colin Goodheart-Smithe 84eacadd51 Splits `phrase` and phrase_prefix` in match query into `MatchPhraseQueryBuilder` and `MatchPhrasePrefixQueryBuilder`
The `phrase` and `phrase_prefix` options in the `MatchQueryBuilder` have been deprecated in favour of using the new `MatchPhraseQueryBuilder` and `MatchPhrasePrefixQueryBuilder`. This is not a breaking change since `MatchQueryBuilder` still supports `phrase` and `phrase_prefix` but this option will be removed from the `MatchQueryBuilder` in the future (probably in 6.0)

Relates to https://github.com/elastic/elasticsearch/pull/17458#discussion_r58351998
2016-04-05 12:55:03 +01:00
Jim Ferenczi 6c8d9acc75 Merge pull request #17530 from jimferenczi/bwc_2.3.1
Replace problematic bwc indices for 2.3.1 with newly generated one.
2016-04-05 11:19:43 +02:00
Christoph Büscher 7254eac840 Add more fromXContent() testing with shuffled field order 2016-04-05 10:07:51 +02:00
Jim Ferenczi 0225376a49 Replace problematic bwc indices for 2.3.1 with newly generated one.
Restore the test OldIndexBackwardsCompatibilityIT.testOldIndexes which now works fine with 2.3.1 bwc indices.
2016-04-05 09:50:34 +02:00
Lee Hinman 05e2358ffb Fail hot_threads in a better way if unsupported by JDK
Currently if thread cpu time is not supported (for instance, on
operating systems such as FreeBSD), an `IllegalStateException` is thrown
in `HotThreads#innerDetect()` that causes the API to return a useless
response.

This changes the check to be earlier, substituting a message for the
hot_threads output (in case some nodes *do* support it).

Additionally, if an exception is thrown during the hot_threads
generation it is now logged and the best effort output is returned.
2016-04-04 15:36:21 -06:00
Zachary Tong 0a472cb359 [TEST] Temporarily silence failing bwc test
More details at #17514
2016-04-04 16:17:24 -04:00
Lee Hinman 78e6ff6e5e Show configured and remaining delay for an unassigned shard.
When a shard is delayed, we now show output like:

```json
{
  "shard" : {
    "index" : "i",
    "index_uuid" : "QzoKda9aQCG_hCaZQ18GEg",
    "id" : 3,
    "primary" : false
  },
  "assigned" : false,
  "unassigned_info" : {
    "reason" : "NODE_LEFT",
    "at" : "2016-04-04T16:44:47.520Z",
    "details" : "node_left[HyRLmMLxR5m_f58RKURApQ]"
  },
  "allocation_delay" : "59.9s",
  "allocation_delay_ms" : 59910,
  "remaining_delay" : "38.9s",
  "remaining_delay_ms" : 38991,
  "nodes" : {
    "jKiyQcWFTkyp3htyyjxoCw" : {
      "node_name" : "Landslide",
      "node_attributes" : { },
      "final_decision" : "YES",
      "weight" : 1.0,
      "decisions" : [ ]
    },
    "9bzF0SgoQh-G0F0sRW_qew" : {
      "node_name" : "Caretaker",
      "node_attributes" : { },
      "final_decision" : "NO",
      "weight" : 2.0,
      "decisions" : [ {
        "decider" : "same_shard",
        "decision" : "NO",
        "explanation" : "the shard cannot be allocated on the same node id [9bzF0SgoQh-G0F0sRW_qew] on which it already exists"
      } ]
    }
  }
}
```

Where the new addition is this section:

```
  "allocation_delay" : "59.9s",
  "allocation_delay_ms" : 59910,
  "remaining_delay" : "38.9s",
  "remaining_delay_ms" : 38991,
```

Which shows the configured delay as well as the remaining delay until
the shard can be considered "assignable". This data is only shown if the
shard is unassigned.

Relates to #17372
2016-04-04 11:37:29 -06:00
Nik Everett 90f300bb71 Remove PROTOTYPE from some enums in query builders 2016-04-04 13:19:36 -04:00
Clinton Gormley b7fb34fed2 Bumped current version to 2.3.2-SNAPSHOT and added bwc indices for 2.3.1 2016-04-04 17:45:27 +02:00
Lee Hinman 8e01b093d0 When considering the size of shadow replica indices, set size to 0
Otherwise, when trying to calculate the amount of disk usage *after* the
shard has been allocated, it has incorrectly subtracted the shadow
replica size.

Resolves #17460
2016-04-04 08:28:03 -06:00
Luca Cavanna f75086fcee ParseField#getAllNamesIncludedDeprecated to not return duplicate names 2016-04-04 15:08:43 +02:00
Jason Tedor e201f5c8b0 Fix missing parenthesis in commit timeout message 2016-04-02 14:16:32 -04:00
Jason Tedor c7c8b1d825 Merge branch 'master' into enable_acked
* master: (156 commits)
  Make JNA calls optional
  Added RPM metadata
  Remove PROTOTYPE from MLT.Item
  Remove PROTOTYPE from VersionType
  Fix mistake in TopHits change
  Remove PROTOTYPEs from highlighting
  Clean up some log messages
  Command line arguments with comma must be quoted on windows
  Cluster Health should run on applied states, even if waitFor=0 #17440
  ingest: make concrete processor impl final, like all other processor concrete impls.
  Improve some test method comments.
  Document task id's as string in the rest spec
  Replace FieldStatsProvider with a method on MappedFieldType. #17334
  cleanup test
  Remove MathUtils. #17454
  Addressing review comments
  fix javadocs
  Make TranslogConfig immutable and pass TranslogGeneration as a ctor arg to Translog
  [reindex] Don't get rejected
  Remove redundant commit - #openTranslog() already commits in that case
  ...
2016-04-02 13:56:00 -04:00
Jason Tedor 8b970d970d Clarify closing of timeout listeners 2016-04-02 13:41:23 -04:00
Jason Tedor 1f12beea9a Reword received superseded cluster state message 2016-04-02 13:32:29 -04:00
Jason Tedor e85535724e Make JNA calls optional
The introduction of max number of processes and max size virtual memory
checks inadvertently made JNA non-optional on OS X and Linux. This
commit wraps these calls in a check to see if JNA is available so that
JNA remains optional.

Closes #17492
2016-04-02 12:08:05 -04:00
Nik Everett 0539def016 Remove PROTOTYPE from MLT.Item
Relates to #17085
2016-04-01 22:01:20 -04:00
Nik Everett ca54b408a3 Remove PROTOTYPE from VersionType 2016-04-01 21:48:51 -04:00
Nik Everett b7afd80b3f Fix mistake in TopHits change 2016-04-01 21:35:35 -04:00
Nik Everett d919031469 Remove PROTOTYPEs from highlighting 2016-04-01 21:35:34 -04:00
Christoph Büscher 9d68a515b8 Merge pull request #17453 from cbuescher/add-xcontent-randomization
Add randomization of XContentBuilder output to query tests
2016-04-01 15:02:01 +02:00
Tanguy Leroux 662c34b888 Clean up some log messages 2016-04-01 14:44:50 +02:00
Boaz Leskes 283eff13aa Merge pull request #17457 from s1monw/make_translog_config_immutable
Make TranslogConfig immutable and pass TranslogGeneration as a ctor arg to Translog

This mutable state is confusing and is easily missed. By default this is null and
wipes all translog. This commit makes the TranslogGeneration mandatory on the Translog
constructor and removes the mutalbe state.
2016-04-01 12:18:28 +02:00
Boaz Leskes 0b12cab07a Cluster Health should run on applied states, even if waitFor=0 #17440
We already protect against making decisions based on an inflight cluster state if someone asks for a waitFor rule (like wait for green). We should do the same for normal health checks as well (unless timeout is set to 0) as it be trappy to debug failures when health says the cluster is in a certain state, but that state wasn't applied yet.

Closes #17440
2016-04-01 11:14:17 +02:00
Martijn van Groningen 9ebc0c8f47 ingest: make concrete processor impl final, like all other processor concrete impls. 2016-04-01 11:05:16 +02:00
Christoph Büscher 7a1b06ce0b Improve some test method comments. 2016-04-01 11:04:56 +02:00
Adrien Grand 4c4bbb3e45 Replace FieldStatsProvider with a method on MappedFieldType. #17334
FieldStatsProvider had to perform instanceof calls to properly handle dates or
ip addresses. By moving the logic to MappedFieldType, each field type can check
whether all values are within bounds its way.

Note that this commit only keeps rewriting support for dates, which are the only
field for which the rewriting mechanism is likely to help (because of time-based
indices).
2016-04-01 10:28:58 +02:00
Martijn van Groningen 11fdd2608f cleanup test 2016-04-01 09:45:28 +02:00
Adrien Grand 8afc0f1748 Remove MathUtils. #17454
It has a single method: mod, which can be replaced with Math.floorMod since
we always coll it with a positive divisor.
2016-04-01 08:31:31 +02:00
Christoph Büscher 1a697a1ae6 Addressing review comments 2016-03-31 21:46:17 +02:00
Simon Willnauer 7f8235b004 fix javadocs 2016-03-31 21:33:01 +02:00
Simon Willnauer 23ea59b06f Make TranslogConfig immutable and pass TranslogGeneration as a ctor arg to Translog
This mutable state is confusing and is easily missed. By default this is null and
wipes all translog. This commit makes the TranslogGeneration mandatory on the Translog
constructor and removes the mutalbe state.
2016-03-31 21:24:48 +02:00
Simon Willnauer baa2d51e59 Merge pull request #17422 from s1monw/recovery_mem_buffer_access
Move translog recover outside of the engine

We changed the way we manage engine memory buffers to an
open model where each shard can essentially has infinite memory.
The indexing memory controller is responsible for moving memory to disk
when it's needed. Yet, this doesn't work today when we recover from store/translog
since the engine is not fully initialized such that IMC has no access to the engine,
neither to it's memory buffer nor can it move data to disk.

The biggest issue here is that translog recovery happends inside the Engine constructor
which is problematic by itself since it might take minutes and uses a not yet fully
initialzied engine to perform write operations on.

This change detaches the translog recovery and makes it the responsibility of the caller
to run it once the engine is fully constructed or skip it if not necessary.
2016-03-31 21:03:00 +02:00
Simon Willnauer 6fb588156c Remove redundant commit - #openTranslog() already commits in that case 2016-03-31 20:46:28 +02:00
Nik Everett 75a9899813 Start to rework query registration
Changes QueryParser into a @FunctionalInterface and provides a way to
register queries using that. Cuts match and function_score queries over
to that registration method as a proof of concept.

Once all queries have been cut over we can remove their PROTOTYPES.
2016-03-31 13:43:07 -04:00
Christoph Büscher bbb6d91147 Add randomization of XContentBuilder output to query tests
Currently our testing of parsing query builders is limited to the
default order of the parameters that each builders toXContent()
method produces. To better test real queries where the order of
parameters can be different, this change adds a helper
method to ESTestCase that takes a XContentBuilder and randomly
shuffles the order of the fields inside an object. This is
used in AbstractQueryTestCase, but it can be used in other similar
places in the future.
2016-03-31 18:17:39 +02:00
Nik Everett c7780e6e0a Use ObjectParser in highlighting 2016-03-31 10:34:26 -04:00
Martijn Laarman 7de2377d38 Merge pull request #13906 from Mpdreamz/fix/remove-deprecated-get-alias-api
Remove deprecated indices.get_aliases
2016-03-31 15:57:03 +02:00
Simon Willnauer ea055d2ac9 add a comment why and when we can ignore skipTranslogRecovery in IndexShard 2016-03-31 15:54:21 +02:00
Simon Willnauer 4657796b24 fix test 2016-03-31 15:15:39 +02:00
Nik Everett 30a1862339 Remove PROTOTYPE from BulkItemResponse.Failure
Closes #17086
2016-03-31 09:10:36 -04:00
Nik Everett f8a67a2622 Remove PROTOTYPEs from ingest 2016-03-31 09:09:35 -04:00
Simon Willnauer f7cbc384f7 add tests to ensure translog ID is baked into commit on all open modes 2016-03-31 15:09:11 +02:00
Martijn Laarman dfe2c0ff0a Remove deprecated indices.get_aliases
This has been deprecated since the first release of Elasticsearch 1.0
2016-03-31 14:46:53 +02:00
Christoph Büscher 2843194635 Merge pull request #17441 from cbuescher/remove-RescoreParseElement
Remove RescoreParseElement after refactoring to RescoreBuilder.
2016-03-31 14:38:56 +02:00
Christoph Büscher 06184ee006 Remove RescoreParseElement
The refactoring of RescoreBuilder and QueryRescoreBuilder moved parsing
previously in RescoreParseElement into the builders. This removes the
left over parse element.
2016-03-31 14:37:21 +02:00
Simon Willnauer 0a277227c3 add back opem mode randomization 2016-03-31 13:06:23 +02:00
Simon Willnauer a356f74d4d Add test for IMC to ensure we also move buffers to disk during translog recovery 2016-03-31 12:58:00 +02:00
Simon Willnauer d006200c77 Make EngineConfig less mutable and ensure we prevent flushes during translog recovery phase. 2016-03-31 12:00:51 +02:00
Luca Cavanna 6b00b4b8dc Merge pull request #17410 from javanna/enhancement/discovery_node_one_getter
Remove duplicate getters from DiscoveryNode and DiscoveryNodes
2016-03-31 11:45:41 +02:00
Christoph Büscher c850b960fb Remove unused 'reverse' parse field from ScoreSortBuilder 2016-03-31 11:18:46 +02:00
javanna 32b6e529f4 Merge branch 'master' into enhancement/discovery_node_one_getter 2016-03-31 10:49:26 +02:00
Martijn van Groningen ccb009e45f percolator: Add scoring support to the percolator query
Percolator query documents are scored based on how well they match with the document being percolated.

Closes #13827
2016-03-31 10:08:43 +02:00
Martijn van Groningen 7600dc9943 percolator: Add support to extract terms from several types of span queries 2016-03-31 09:54:29 +02:00
Lee Hinman e266452cb2 Switch request parsing in ClusterAllocationExplainRequest to ObjectParser
Relates to #17305
2016-03-30 19:29:19 -06:00
Igor Motov e073b0c75d Add ability to group tasks by common parent
By default, tasks are grouped by node. However, task execution in elasticsearch can be quite complex and an individual task that runs on a coordinating node can have many subtasks running on other nodes in the cluster. This commit makes it possible to list task grouped by common parents instead of by node. When this option is enabled all subtask are grouped under the coordinating node task that started all subtasks in the group. To group tasks by common parents, use the following syntax:

 GET /tasks?group_by=parents
2016-03-30 17:50:27 -04:00
Simon Willnauer 1e06139584 Move translog recover outside of the engine
We changed the way we manage engine memory buffers to an
open model where each shard can essentially has infinite memory.
The indexing memory controller is responsible for moving memory to disk
when it's needed. Yet, this doesn't work today when we recover from store/translog
since the engine is not fully initialized such that IMC has no access to the engine,
neither to it's memory buffer nor can it move data to disk.

The biggest issue here is that translog recovery happends inside the Engine constructor
which is problematic by itself since it might take minutes and uses a not yet fully
initialzied engine to perform write operations on.

This change detaches the translog recovery and makes it the responsibility of the caller
to run it once the engine is fully constructed or skip it if not necessary.
2016-03-30 23:24:24 +02:00
Nik Everett 78ab6c5b7f [reindex] Dynamic throttle!
This allows the user to update the reindex throttle on the fly, with changes
that speed up the throttling being applied immediately and changes that
slow down the throttling being applied during the next batch. This means
that if a user throttles reindex in such a way that it tries to sleep for
16 years and then realizes that they've done something wrong then they
can change the throttle and reindex will wake up again. We don't apply
slow downs immediately so we never get in danger of losing the scan context.

Also, if reindex is canceled while it is sleeping (how it honor throttling)
then it'll immediately wake up and cancel itself.
2016-03-30 16:40:42 -04:00
Nik Everett 1ffb072df3 Replace static bwc data for new releases
The ones we had for 2.2.2 and 2.3.0 were broken.
2016-03-30 15:22:23 -04:00
Clinton Gormley bc998fd0c2 Added bwc indices for 2.2.2 and 2.3.0 2016-03-30 18:58:08 +02:00
javanna b9f9b2e3ee Merge branch 'master' into enhancement/discovery_node_one_getter 2016-03-30 17:22:40 +02:00
Simon Willnauer 97eaf6c04b Merge pull request #17414 from s1monw/issues/17412
Don't take recovery indexing into account on indexing stats

Closes #17412
2016-03-30 17:15:00 +02:00
Christoph Büscher f012b73947 Remove HighlighterParseElement
The old HighlightParseElement was only left because it was still
used in tests and some places in InnerHits. This PR removes it
and replaces the tests that checked that the original parse element
and the rafactored highlighter code produce the same output with
new tests that compare builder input to the SearchContextHighlight
that is created.
2016-03-30 16:59:49 +02:00
Adrien Grand d7179cafcc Add a soft limit on the number of shards that can be queried in a single search request. #17396
This commit adds the new `action.search.shard_count.limit` setting which
configures the maximum number of shards that can be queried in a single search
request. It has a default value of 1000.
2016-03-30 16:55:01 +02:00
Simon Willnauer dbcb9a29a5 Don't take recovery indexing into account on indexing stats
Closes #17412
2016-03-30 16:42:09 +02:00
Simon Willnauer e25ccb91ae [TEST] Make type inference simpler 2016-03-30 16:38:07 +02:00
javanna 52dcc9899e fix checkstyle line lenght issue 2016-03-30 15:45:41 +02:00
Simon Willnauer 43b87e8f86 Invoke `IndexingOperationListeners` also when recovering from store or remote
Today we don't invoke `IndexingOperationListeners` when we are running
a recovery form store or replaying translog from remote. This is problematic since
the actual code path for indexing is different between normal indexing and recovery.
An important detail is left out on recovery since we implemented the `IndexingMemoryController`
as an `IndexingOperationListener` we might never flush the `IndexWriter` of a recovering shard
which can lead to `OOMs` on node startup / recovery.
2016-03-30 15:32:43 +02:00
javanna 70573a35e1 remove unused DiscoveryNodes#valid method 2016-03-30 15:28:39 +02:00
javanna 30b57be8f4 Rename DiscoveryNodes#localNodeMaster to isLocalNodeElectedMaster 2016-03-30 15:28:39 +02:00
javanna 2075c7f0a7 Rename DiscoveryNodes#smallestNonClientNodeVersion to getSmallestNonClientNodeVersion 2016-03-30 15:28:39 +02:00
javanna 030420768c Rename DiscoveryNodes#smallestNodeVersion to getSmallestNodeVersion 2016-03-30 15:28:39 +02:00
javanna 62ac7d219f Remove DiscoveryNodes#masterNode in favour of existing DiscoveryNodes#getMasterNode 2016-03-30 15:28:32 +02:00
javanna 7ebc094353 Remove DiscoveryNodes#localNode in favour of existing DiscoveryNodes#getLocalNode 2016-03-30 15:28:23 +02:00
javanna f26d05eac8 Remove DiscoveryNodes#localNodeId in favour of existing DiscoveryNodes#getLocalNodeId 2016-03-30 15:28:15 +02:00
javanna f8b5d1f5b0 Remove DiscoveryNodes#masterNodeId in favour of existing DiscoveryNodes#getMasterNodeId 2016-03-30 15:28:06 +02:00
javanna 97f7aef776 Rename DiscoveryNodes#masterAndDataNodes to getMasterAndDataNodes 2016-03-30 15:28:04 +02:00
javanna 4032859e90 Remove DiscoveryNodes#masterNodes in favour of existing DiscoveryNodes#getMasterNodes 2016-03-30 15:27:56 +02:00
javanna 463fbe45c6 Remove DiscoveryNodes#dataNodes in favour of existing DiscoveryNodes#getDataNodes 2016-03-30 15:27:46 +02:00
javanna c175e07c8a Remove DiscoveryNodes#nodes in favour of existing DiscoveryNodes#getNodes 2016-03-30 15:27:38 +02:00
javanna fc2e6d7ce0 Remove DiscoveryNodes#size in favour of existing DiscoveryNodes#getSize 2016-03-30 15:27:28 +02:00
javanna 131f5b0596 Remove unused emptyDelta method from DiscoveryNodes and related EMPTY_LIST from DiscoveryNode 2016-03-30 15:27:26 +02:00
javanna 2dbba45f2c Rename static DiscoveryNode#localNode(Settings) to DiscoveryNode#isLocalNode(Settings) 2016-03-30 15:27:26 +02:00
javanna 7751b45f0f Rename static DiscoveryNode#ingestNode(Settings) to isIngestNode 2016-03-30 15:27:05 +02:00
javanna 49e952e272 Rename static DiscoveryNode#dataNode(Settings) to isDataNode 2016-03-30 15:26:41 +02:00
javanna 2230fec9ea Rename static DiscoveryNode#masterNode(Settings) to isMasterNode 2016-03-30 15:26:10 +02:00
Martijn van Groningen 7e2696c570 Refactored inner hits parsing and intoduced InnerHitBuilder
Both top level and inline inner hits are now covered by InnerHitBuilder.
Although there are differences between top level and inline inner hits,
they now make use of the same builder logic.

The parsing of top level inner hits slightly changed to be more readable.
Before the nested path or parent/child type had to be specified as encapsuting
json object, now these settings are simple fields. Before this was required
to allow streaming parsing of inner hits without missing contextual information.

Once some issues are fixed with inline inner hits (around multi level hierachy of inner hits),
top level inner hits will be deprecated and removed in the next major version.
2016-03-30 15:15:56 +02:00
Simon Willnauer ee140f4ee2 Remove unused 'node.client' setting 2016-03-30 15:03:05 +02:00
Nik Everett 1c16d63a9a Merge pull request #17394 from camilojd/refactor/replace-getrandom
Refactor: replace all ocurrences of ESTestCase.getRandom() with LuceneTestCase.random()
2016-03-30 08:58:21 -04:00