Commit Graph

24605 Commits

Author SHA1 Message Date
Adrien Grand c1e5421b77 Make range queries round up upper bounds again. (#20582)
Elasticsearch 1.x used to implicitly round up upper bounds of queries when they
were inclusive so that eg. `[2016-09-18 TO 2016-09-20]` would actually run
`[2016-09-18T00:00:00.000Z TO 2016-09-20T23:59:59.999Z]` and include dates like
`2016-09-20T15:32:44`. This behaviour was lost in the cleanups of #8889.

Closes #20579
2016-10-07 14:22:15 +02:00
Jason Tedor d01a62908a Change separator for shards preference
The shards preference on a search request enables specifying a list of
shards to hit, and then a secondary preference (e.g., "_primary") can be
added. Today, the separator between the shards list and the secondary
preference is ';'. Unfortunately, this is also a valid separtor for URL
query parameters. This means that a preference like "_shards:0;_primary"
will be parsed into two URL parameters: "_shards:0" and "_primary". With
the recent change to strict URL parsing, the second parameter will be
rejected, "_primary" is not a valid URL parameter on a search
request. This means that this feature has never worked (unless the ';'
is escaped, but no one does that because our docs do not that, and there
was no indication from Elasticsearch that this did not work). This
commit changes the separator to '|'.

Relates #20786
2016-10-07 07:17:01 -05:00
Simon Willnauer 194a6b1df0 Remove LocalTransport in favor of MockTcpTransport (#20695)
This change proposes the removal of all non-tcp transport implementations. The
mock transport can be used by default to run tests instead of local transport that has
roughly the same performance compared to TCP or at least not noticeably slower.

This is a master only change, deprecation notice in 5.x will be committed as a
separate change.
2016-10-07 11:27:47 +02:00
Colin Goodheart-Smithe eba60ee63c Removes the now callable in the date math parser in favour of a LongSupplier (#20796)
Previous to this change the DateMathParser accepted a Callable<Long> to use for accessing the now value. The implementations of this callable would fall back on System.currentTimeMillis() if there was no context object provided. This is no longer necessary for two reasons:

We should not fall back to System.currentTimeMillis() as a context should always be provided. This ensures consistency between shards for the now value in all cases
We should use a LongSupplier rather than requiring an implementation of Callable. This means that we can just pass in context::noInMillis for this parameter and not have not implement anything.
2016-10-07 10:26:25 +01:00
Michael McCandless 0a1b8a3176 also ignore AccessDeniedException (for Windows) when checking file size for store stats (#20790)
Closes #17580
2016-10-07 05:24:15 -04:00
Ali Beyad 5d38248afa Shard Decision class improvements for Explain API (#20742)
This commit improves the shard decision container class in the following
ways:

 1. Renames UnassignedShardDecision to ShardAllocationDecision, so that
    the class can be used for general shard decisions, not just unassigned
    shard decisions.
 2. Changes ShardAllocationDecision to have the final decision as a Type
    instead of a Decision, because all the information needed from the final
    decision is contained in `Type`.
 3. Uses cached instances of ShardAllocationDecision for NO and THROTTLE
    decisions when no explanation is needed (which is the common case when
    executing reroute's as opposed to using the explain API).
2016-10-06 22:53:05 -04:00
Clinton Gormley e83e8e890e Fixed released_state docs switch to build correctly and include missing links 2016-10-06 21:42:11 +02:00
Clinton Gormley d822a642b0 Document how to run a single docs test 2016-10-06 21:10:49 +02:00
Simon Willnauer a6fa96d513 Remove confusing capturing groups in _rollover index name pattern 2016-10-06 20:41:19 +02:00
Nik Everett 6d42e197b8 CONSOLEify remaining getting-started docs
Moves some test data used by those docs into the Elasticsearch
repository so we can use it when we test the docs during the build.

Relates to #18160
2016-10-06 14:06:48 -04:00
Nik Everett d9781bd069 Fix broken regex in doc tests
Regexes are hard.
2016-10-06 13:53:20 -04:00
Simon Willnauer 9c9afe3f01 Remove SearchContext#current and all it's threadlocals (#20778)
Today SearchContext expose the current context as a thread local which makes any kind of sane interface design very very hard. This PR removes the thread local entirely and instead passes the relevant context anywhere needed. This simplifies state management dramatically and will allow for a much leaner SearchContext interface down the road.
2016-10-06 19:51:54 +02:00
Nik Everett d7d5df8863 CONSOLEify some _cat docs
Added `// NOTCONSOLE` to some `_cat` docs that rely on `sort` or
are otherwise too difficult for us to test at this point.

Relates to #20717
2016-10-06 13:37:21 -04:00
Clinton Gormley 40bf2c206c Add placeholder to the docs to distinguish released from unreleased from prerelease versions (#20644)
Closes https://github.com/elastic/stack/issues/18
2016-10-06 17:58:03 +02:00
Igor Motov 63bcb4f534 Named analyzer should close the analyzer that it wraps 2016-10-06 10:15:33 -04:00
Boaz Leskes b847a835e9 Improve scheduling fairness when batching cluster state changes with equal priority (#20775)
As the wise man @ywelsch said: currently when we batch cluster state update tasks by the same executor, we the first task un-queued from the pending task queue. That means that other tasks for the same executor are left in the queue. When those are dequeued, they will trigger another run for the same executor. This can give unfair precedence to future tasks of the same executor, even if they weren't batched in the first run. Take this queue for example (all with equal priority)

 ```
 T1 (executor 1)
 T2 (executor 1)
 T3 (executor 2)
 T4 (executor 2)
 T5 (executor 1)
 T6 (executor 1)
 ```

 If T1 & T2 are picked up first (when T5 & T6 are not yet queued), one would expect T3 & T4 to run second. However, since T2 is still in the queue, it will trigger execution of T5 & T6.

 The fix is easy - ignore processed tasks when extracting them from the queue.

Closes #20768
2016-10-06 16:11:27 +02:00
David Pilato 591a8d4ec6 Merge branch 'fix/20669-master-azure-log' 2016-10-06 16:00:43 +02:00
Clinton Gormley 43a851f1f6 Most date-math chars in index names need to be percent encoded
Updated docs to provide encodings
2016-10-06 15:44:42 +02:00
Colin Goodheart-Smithe 3aed047bde #20750 Prevent requests that use scripts or now() from being cached
Prevent requests that use scripts or now() from being cached
2016-10-06 10:24:57 +01:00
Colin Goodheart-Smithe 40f8f281e0 Merge branch 'master' into dont_cache_scripts 2016-10-06 09:09:23 +01:00
Colin Goodheart-Smithe ce6f6d3835 Review comments 2016-10-06 08:55:31 +01:00
Adrien Grand 6174e21f47 The `top_hits` aggregation should compile scripts only once. (#20738)
Today it compiles when creating the aggregator, meaning that scripts will be
compiled as many times as there are buckets. Instead it should compile when
creating the factory so that scripts are compiled only once regardless of the
number of buckets.
2016-10-06 09:55:30 +02:00
Boaz Leskes a2e82adc6f TransportReplicationAction subclasses shouldn't have to resolve shards (#20730)
TRA currently resolves incoming requests to IndexShards in order to acquire operations locks on them. There is no need for all subclasses to have to go through the same IndicesService/IndexService song and dance. Also, doing it once means we don't need to worry about edge cases where the shard is removed while a TRA is in flight.
2016-10-06 08:45:35 +02:00
Simon Willnauer ce21b607bb move test to a single node test 2016-10-05 21:55:50 +02:00
Simon Willnauer 134b1f9b4d Prevent thread suspension when inside SecurityManager (#20770)
LongGCDisruption suspends and resumes node threads but respects several
`unsafe` class name patterns where it's unsafe to suspend. For instance
log4j uses a global lock so we can't suspend a thread that is currently
calling into log4j. The same is true for the security manager, it's similar
to log4j a shared resource between the test and the node that is _suspended_.
This change adds `java.lang.SecrityManager` to the unsafe patterns.
This prevents test framework deadlocking if a nodes thread is supended
while it's calling into the security manager that uses synchronized maps etc.
2016-10-05 21:40:27 +02:00
Simon Willnauer 50ca10378e Merge branch 'master' into dont_cache_scripts 2016-10-05 20:43:52 +02:00
Simon Willnauer 838c28eeb4 add percolate with script query test 2016-10-05 20:43:46 +02:00
Ali Beyad 15950b71b8 BalancedShardAllocator code improvements (#20746)
This commit improves the logic flow of BalancedShardsAllocator in
preparation for separating out components of this class to be used
in the cluster allocation explain APIs.  In particular, this commit:

 1. Adds a minimum value for the index/shard balance factor settings (0.0)
 2. Makes the Balancer data structures immutable and pre-calculated at
    construction time.
 3. Removes difficult to follow labeled blocks / GOTOs
 4. Better logic for skipping over the same replica set when one of
    the replicas received a NO decision
 5. Separates the decision making logic for a single shard from the logic
    to iterate over all unassigned shards.
2016-10-05 14:23:25 -04:00
Jack Conradson 8e27d741c0 Merge pull request #20766 from jdconrad/now
Remove all date 'now' methods from Painless
2016-10-05 10:01:19 -07:00
Jack Conradson ba88d9af57 Remove all date 'now' methods from the Painless whitelist to ensure
Painless scripts are pure functions.
2016-10-05 09:47:20 -07:00
Dimitrios Liappis 02dd1ba61a [vagrant] packaging tests: add parametrized retries for dnf install (#20749)
* Add parametrized retries for dnf install

Given that dnf doesn't do retries installation of openjdk can sometimes
be affected by checksum or network issues with mirrors offered by
metalink.

Allow setting number of retries through the parameter
`install_command_retries`

* Insert delay between package install retries

Fedora's metalink occasionally returns broken mirrors. Pausing for a few
seconds between retries increases the chance of receiving a different
list of mirrors from metalink and success with package installation.
2016-10-05 11:42:25 -04:00
Jason Tedor 8c4108d886 Add response params to REST params did you mean
This commit adds the response params as candidates for the did you mean
suggestions for strict REST params handling.

Relates #20753
2016-10-05 11:26:19 -04:00
Nik Everett 41d6529d06 CONSOLEify scroll docs
This causes the snippets to be tested during the build and gives
helpful links to the reader to open the docs in console or copy them
as curl commands.

Relates to #18160
2016-10-05 11:21:54 -04:00
Anatolii Stepaniuk f895abcf40 Fix grammar issues in some docs
This commit fixes some grammar issues in various docs.

Closes #20751
Closes #20752
Closes #20754
Closes #20755
2016-10-05 11:20:45 -04:00
Ryan Ernst 6da0f0dcc0 Build: Fix plugin poms to have correct artifact id (#20764)
We already override the name in plugin pom files to be that configured
for the plugin but we also need to explicitly set the artifactId.
2016-10-05 08:10:27 -07:00
Simon Willnauer 57afbadf33 PercolateQuery is never cacheable 2016-10-05 16:38:47 +02:00
Colin Goodheart-Smithe 7bffe95025 Fix percolator queries to not be cacheable 2016-10-05 15:03:29 +01:00
Simon Willnauer a008959f7a cleanup freeze methods and move them down to QueryShardContext 2016-10-05 12:22:54 +02:00
Simon Willnauer 5687549ad8 clone the entire serach context for rewriting 2016-10-05 12:14:48 +02:00
Simon Willnauer 4000a4a106 Merge branch 'master' into dont_cache_scripts 2016-10-05 11:51:41 +02:00
Simon Willnauer e556c289b9 use a private rewrite context to prevent exposing isCachable 2016-10-05 11:41:49 +02:00
Simon Willnauer 7ba22bb75b fix random score function builder to deal with empty seeds 2016-10-05 10:45:24 +02:00
Colin Goodheart-Smithe 764a5fbb37 Fix date_range aggregation to not cache if now is used
Before this change the processing of the ranges in the date range (and
other range type) aggregations was done when the Aggregator was created.
This meant that the SearchContext did not know that now had been used in
a range until after the decision to cache was made.

This change moves the processing of the ranges to the aggregation builders
so that the search context is made aware that now has been used before
it decides if the request should be cached
2016-10-05 10:45:24 +02:00
Martijn van Groningen 0c7860f533 ingest: Upgrade geoip2 dependency
Closes #20563
2016-10-05 10:45:24 +02:00
Jason Tedor d7dca15970 Add did you mean to strict REST params
This commit adds a did you mean feature to the strict REST params error
message. This works by comparing any unconsumed parameters to all of the
consumer parameters, comparing the Levenstein distance between those
parameters, and taking any consumed parameters that are close to an
unconsumed parameter as candiates for the did you mean.

* Fix pluralization in strict REST params message

This commit fixes the pluralization in the strict REST parameters error
message so that the word "parameter" is not unconditionally written as
"parameters" even when there is only one unrecognized parameter.

* Strength strict REST params did you mean test

This commit adds an unconsumed parameter that is too far from every
consumed parameter to have any candidate suggestions.

Relates #20747
2016-10-05 10:45:24 +02:00
Jason Tedor 4b82703bf7 Clarify wording for the strict REST params message
This commit changes the strict REST parameters message to say that
unconsumed parameters are unrecognized rather than unused. Additionally,
the test is beefed up to include two unused parameters.

Relates #20745
2016-10-05 10:45:24 +02:00
Luca Cavanna 04f5d4766d Make getter for bulk shard requests items visible (#20743) 2016-10-05 10:45:24 +02:00
Colin Goodheart-Smithe 3ba0bd6ec9 fix check style errors 2016-10-05 09:32:31 +01:00
Colin Goodheart-Smithe 5a308f8a5e move extended bounds rounding to date histo agg builder 2016-10-05 09:15:00 +01:00
Colin Goodheart-Smithe cbb3cc625e move extended bounds parse and validate to date hitso factory 2016-10-05 09:05:58 +01:00