Commit Graph

1729 Commits

Author SHA1 Message Date
Simon Willnauer ca9b2b9931
Repsect indices options on _msearch (#35887)
Today we don't respect the indices options when they are passed
as request parameters to the `_msearch` endpoint. This is unintuitive
and doesn't cause any errors. This changes uses the top-level indices
options as the defaults for each sub search-request.

Closes #35851
2018-11-26 14:26:39 +01:00
Christophe Bismuth 04ebc63e34 RoutingMissingException in more like this (#33974)
More like this query allows to provide identifiers of documents to be retrieved as like/unlike items. 
It can happen that at retrieval time an error is thrown, for instance caused by missing routing value when `_routing` is set required in the mapping. 
Instead of ignoring such error and returning no documents for the query, the error should be re-thrown and returned to users. As part of this 
change also mget and mtermvectors are unified in the way they throw such exception like it happens in other places, so that a `RoutingMissingException` is raised.

Closes #29678
2018-11-26 13:57:57 +01:00
Tanguy Leroux 9bdbba23f8 [Tests] Fix IndexShardTests.testAcquirePrimaryAllOperationsPermits()
This test fails on CI because of an inappropriate assertion, which is
I think a leftover and has no real value.
2018-11-26 13:44:12 +01:00
Luca Cavanna e44390ac20
InitialSearchPhase minor cleanups (#35864)
This commit simplifies  the throttling logic in InitialSearchPhase and removes some asserts from it. Also, a few formatting changes are applied to its code and surrounding classes.
2018-11-26 13:42:41 +01:00
iverase 401b814d1a [CI] Muting method testOperationPermitOnReplicaShards in IndexShardTests
Relates to #35850
2018-11-26 09:33:23 +01:00
Martijn van Groningen 7624734f14
Added wait_for_metadata_version parameter to cluster state api. (#35535)
The `wait_for_metadata_version` parameter will instruct the cluster state
api to only return a cluster state until the metadata's version is equal or
greater than the version specified in `wait_for_metadata_version`. If  
the specified `wait_for_timeout` has expired then a timed out response 
is returned. (a response with no cluster state and wait for timed out flag set to true)
In  the case metadata's version is equal or higher than  `wait_for_metadata_version`
then the api will immediately return.

This feature is useful to avoid external components from constantly
polling the cluster state to whether somethings have changed in the
cluster state's metadata.
2018-11-26 08:50:08 +01:00
Simon Willnauer 4711c5cdf3
Always return false from `refreshNeeded` on ReadOnlyEngine (#35837)
Acquiring a searcher is unnecessary to determine if a refresh is
necessary since read-only engines never refresh.

Closes #35785
2018-11-24 09:25:42 +01:00
Simon Willnauer e46e44ce38
Wrap can_match reader with ElasticsearchDirectoryReader (#35857)
Code that operates on-top of the engine requires all readers returned to be
unwrapped into ElasticsearchDirectoryReader. The special reader
the FrozenEngine uses wasn't wrapped.
2018-11-24 09:23:53 +01:00
Yannick Welsch 51d2e986c5 Remove BWC conditions after backport of #35731
This PR was backported to 6.x, so the extra BWC conditions are not needed anymore
2018-11-23 17:11:06 +01:00
Adrien Grand 5b370316a6
Remove some legacy code from when indices could have multiple types. (#35815)
This code is only necessary up to indices created with version 5.x while 7.0
only supports indices created with 6.x or 7.0.
2018-11-23 15:15:26 +01:00
Yannick Welsch 2970abfce9
Add read-only repository verification (#35731)
Adds a verification mode for read-only repositories. It also makes the extra bucket check on
repository creation obsolete, which fixes #35703.
2018-11-23 14:45:05 +01:00
Christoph Büscher 88d862e69f [CI] Muting two methods in IndexShardTests
Relates to #35850
2018-11-23 14:29:26 +01:00
David Turner d01436de3c
Copy checkpoint atomically when rolling generation (#35407)
Today when rolling a transog generation we copy the checkpoint from
`translog.ckp` to `translog-nnnn.ckp` using a simple `Files.copy()` followed by
appropriate `fsync()` calls. The copy operation is not atomic, so if we crash
at the wrong moment we can leave an incomplete checkpoint file on disk. In
practice the checkpoint is so small that it's either empty or fully written.
However, we do not correctly handle the case where it's empty when the node
restarts.

In contrast, in `recoverFromFiles()` we _do_ copy the checkpoint atomically.
This commit extracts the atomic copy operation from `recoverFromFiles()` and
re-uses it in `rollGeneration()`.
2018-11-23 08:43:34 +00:00
Jim Ferenczi be69a774df
Fix analyzed prefix query in query_string (#35756)
This change fixes analyzed prefix queries in `query_string` to be ignored
if all terms are removed during the analysis.

Closes #31702
2018-11-23 09:42:23 +01:00
Tanguy Leroux 2e37f17a7d
Expose all permits acquisition in IndexShard and TransportReplicationAction (#35540)
This pull request exposes two new methods in the IndexShard and 
TransportReplicationAction classes in order to allow transport replication 
actions to acquire all index shard operation permits for their execution.

It first adds the acquireAllPrimaryOperationPermits() and the 
acquireAllReplicaOperationsPermits() methods to the IndexShard class 
which allow to acquire all operations permits on a shard while exposing 
a Releasable. It also refactors the TransportReplicationAction class to 
expose two protected methods (acquirePrimaryOperationPermit() and 
acquireReplicaOperationPermit()) that can be overridden when a transport 
replication action requires the acquisition of all permits on primary and/or 
replica shard during execution.

Finally, it adds a TransportReplicationAllPermitsAcquisitionTests which
 illustrates how a transport replication action can grab all permits before 
adding a cluster block in the cluster state, making subsequent operations 
that requires a single permit to fail).

Related to elastic #33888
2018-11-23 09:26:38 +01:00
Dimitris Athanasiou 43d6ec8bcd
Remove unnecessary throws IOException in CompressedXContent.string() (#35821) 2018-11-22 15:08:46 +00:00
Jim Ferenczi e37a0ef844
Upgrade to lucene-8.0.0-snapshot-67cdd21996 (#35816) 2018-11-22 15:42:59 +01:00
Albert Zaharovits 4fc911a129 Mute test InternalEngineTests
Relates #35823
2018-11-22 15:34:53 +02:00
Tanguy Leroux f9f7261d60 Revert "Revert "[RCI] Check blocks while having index shard permit in TransportReplicationAction (#35332)""
This reverts commit d3d7c01
2018-11-22 12:13:19 +01:00
Mayya Sharipova b6014d971c
Forbid negative scores in functon_score query (#35709)
* Forbid negative scores in functon_score query

- Throw an exception when scores are negative in field_value_factor
function
- Throw an exception when scores are negative in script_score
function

Relates to #33309
2018-11-22 06:08:48 -05:00
Tanguy Leroux 11052b75c7
TransportResyncReplicationAction should not honour blocks (#35795)
After #35332 has been merged, we noticed some test failures like #35597 
in which one or more replica shards failed to be promoted as primaries 
because the primary replica re-synchronization never succeed.

After some digging it appeared that the execution of the resync action was 
blocked because of the presence of a global cluster block in the cluster state 
(in this case, the "no master" block), making the resync action to fail when 
executed on the primary.

Until #35332 such failures never happened because the 
TransportResyncReplicationAction is skipping the reroute phase, the only 
place where blocks were checked. Now with #35332 blocks are checked 
during reroute and also during the execution of the transport replication 
action on the primary. After some internal discussion, we decided that the TransportResyncReplicationAction should never be blocked. This action is 
part of the replica to primary promotion and makes sure that replicas are in 
sync and should not be blocked when the cluster state has no master or 
when the index is read only.

This commit changes the TransportResyncReplicationAction to make obvious 
that it does not honor blocks. It also adds a simple test that fails if the resync 
action is blocked during the primary action execution.

Closes #35597
2018-11-22 10:50:12 +01:00
Igor Motov 39789d0a10
GEO: More robust handling of ignore_malformed in geoshape parsing (#35603)
Adds an XContent sub parser class that can to wrap another
XContent parser at the beginning of an object and allow skiping
all children in case of the parsing failure. It also uses this
subparser to ignore the rest of the GeoJson shape if the 
parsing fails and we need to ignore the geoshape due to the 
ignore_malformed flag.

Supersedes #34498

Closes #34047
2018-11-21 11:04:01 -10:00
Armin Braun 1a5553d495
MINOR: Cleanup Runnables in SnapshotsService (#35796)
* Simplify complex `Runnable` by moving to `AbstractRunnable`
2018-11-21 19:58:51 +01:00
Nick Knize 3bee25cb70
[GEO] Add support to ShapeBuilders for building Lucene geometry (#35707)
* [GEO] Add support to ShapeBuilders for building Lucene geometry

This commit adds support for building lucene geometry from the ShapeBuilders.
This is needed for integrating LatLonShape as the primary indexing approach
for geo_shape field types. All unit and integration tests are updated to
add randomization for testing both jts/s4j shapes and lucene shapes.
2018-11-21 11:15:01 -06:00
Armin Braun bdf632b6f9
SNAPSHOTING+MINOR: Simplify SnapshortShardService (#35769) 2018-11-21 13:50:17 +01:00
Christoph Büscher 6638708b56
Remove deprecated QueryStringQueryBuilder#splitOnWhiteSpace (#35763)
This parameter has been deprecated and was ignored since 6.0, so its Java API
methods can be removed.
2018-11-21 10:29:08 +01:00
Christoph Büscher 5847f8379c
Move ScoreAccessor to test-framework (#35766)
This class is only used by RandomScoreFunctionIT and the MockScriptEngine, so it
shouldn't be part of the server codebase.
2018-11-21 10:28:31 +01:00
Christoph Büscher ff03443ab9
Fix problem with MatchNoDocsQuery in disjunction queries (#35726)
Queries across multiple fields generate MatchNoDocsQuerys for fields that are
unmapped. In certain situation this can lead to erroneous behaviour,
for example when an umapped field is used in a query_string query across
several fields. If some of the tokens in the query string get eliminated by an
analyzer on the mapped fields, the same token will currently generate
MatchNoDocsQuerys combined into a disjunction, which in turn
leads to no matches in the overall query. Instead we should simply not add
MatchNoDocsQuerys to those disjunctions.

Closes #34708
2018-11-21 03:49:49 +01:00
Mayya Sharipova 643bb20137
Add a new query type - ScriptScoreQuery (#34533)
* Add a new query type - ScriptScoreQuery

script_score query uses script to calculate document scores.
Added as a substitute for function_score with an intentation
to deprecate function_scoreq query.

```http
GET /_search
{
    "query": {
        "script_score" : {
            "query": {
                "match": { "message": "elasticsearch" }
            },
            "script" : {
              "source": "Math.log(2 + doc['likes'].value)"
            },
            "min_score" : 2
        }
    }
}
```

Add several functions to painless to be used inside script_score:

double rational(double, double)
double sigmoid(double, double, double)
double randomNotReproducible() 
double randomReproducible(String, int) 

double decayGeoLinear(String, String, String, double, GeoPoint)
double decayGeoExp(String, String, String, double, GeoPoint)
double decayGeoGauss(String, String, String, double, GeoPoint)

double decayNumericLinear(String, String, String, double, double)
double decayNumericExp(String, String, String, double, double)
double decayNumericGauss(String, String, String, double, double)

double decayDateLinear(String, String, String, double, JodaCompatibleZonedDateTime)
double decayDateExp(String, String, String, double, JodaCompatibleZonedDateTime)
double decayDateGauss(String, String, String, double, JodaCompatibleZonedDateTime)

Date functions only works on dates in  the default format and default time zone
2018-11-20 16:10:06 -05:00
Ryan Ernst c07ad67718 Add 6.5.2 version 2018-11-20 12:33:26 -08:00
Gordon Brown 4bda469861
Fix line lengths in misc other files (#35650) 2018-11-20 12:29:48 -07:00
Vladimir Dolzhenko 953c8586df
Fix PrimaryAllocationIT#testForceStaleReplicaToBePromotedToPrimary (#35728)
Closes 35497
2018-11-20 20:05:23 +01:00
Christoph Büscher e91f404d16
Remove remains of 'auto_generate_phrase_queries' (#35735)
This parameter in the `query_string` query was deprecated in 6.0 and ignored
since then. Its API methods and remaining uses can be removed in the upcoming
major version.

Relates to #35734
2018-11-20 16:07:17 +01:00
Jim Ferenczi a5f5ceb869
Remove remaining line length violations for o.e.index (#35652)
This commit removes line length violations in the classes under
org.elasticsearch.index.
2018-11-20 08:09:14 +01:00
Simon Willnauer 29ef442841
Add a `_freeze` / `_unfreeze` API (#35592)
This commit adds a rest endpoint for freezing and unfreezing an index.
Among other cleanups mainly fixing an issue accessing package private APIs
from a plugin that got caught by integration tests this change also adds
documentation for frozen indices.
Note: frozen indices are marked as `beta` and available as a basic feature.

Relates to #34352
2018-11-20 08:03:24 +01:00
Benjamin Trent 7a779a9988
[TEST] fixing ClusterApplierService#testClusterStateUpdateLogging() (#35714) 2018-11-19 14:23:49 -06:00
Gordon Brown b2057138a7
Remove AbstractComponent from AbstractLifecycleComponent (#35560)
AbstractLifecycleComponent now no longer extends AbstractComponent. In
order to accomplish this, many, many classes now instantiate their own
logger.
2018-11-19 09:51:32 -07:00
Nik Everett 036c15d8a3
Build: Fix official plugins list (#35661)
The list of official plugins accidentally included `qa` projects like,
well, `qa` and `amazon-ec2`. This changes the mechanism that we use to
build the list and adds a test to catch this.

Closes #35623
2018-11-19 10:17:05 -05:00
Ekal Golas 450db7fcf7 [Tests] Fix slowness of AutoDateHistogramAggregatorTests (#35072)
Randomize test assertion and test set size instead of asserting on an
exhaustive list of dates with fixed test set size. Also refactor common 
objects used to avoid recreating them, avoid date to string conversion
and reduce duplicate test code

Closes #33181
2018-11-19 15:21:01 +01:00
Martijn van Groningen c468d928b8
Remove line length violations in o.e.indices package (#35647)
Relates to #34884
2018-11-19 07:36:24 +01:00
Lee Hinman 22933ebcd5
Fix line length for org.elasticsearch.action.* files (#35607)
This removes the checkstyle suppressions for things in the `action` package.

Relates to #34884
2018-11-16 14:11:39 -07:00
Arthur Gavlyukovskiy 022726011c Remove use of AbstractComponent in server (#35444)
Removed extending of AbstractComponent and changed logger usage to
explicit declaration. Abstract classes still have logger
declaration using this.getClass() in order to show implementation class
name in its logs.

See #34488
2018-11-16 16:10:32 -05:00
Julie Tibshirani c6a0904e0e
Deprecate types in count and msearch. (#35421)
* Deprecate types in count requests.
* Move RestCountAction to the 'search' package.
* Deprecate types in multi search requests.
* Add tests for types deprecation in the _search endpoint.
2018-11-16 13:04:43 -08:00
Jack Conradson d62bbca56d
[Scripting] Use Number as a return value for BucketAggregationScript (#35653)
This change fixes #35351. Users were no longer able to return types of numbers other than doubles for bucket aggregation scripts. This change reverts to the previous behavior of being able to return any type of number and having it converted to a double outside of the script.
2018-11-16 12:33:01 -08:00
Jernej Klancic baf33b3162 Removes AbstractComponent from several classes (#35566)
Removes inhertiting from AbstractComponent for some classes (mostly
in the plugins module).

Relates to #34488
2018-11-16 20:50:18 +01:00
Julie Tibshirani 40ba4de5e6
Deprecate types in validate query requests. (#35575) 2018-11-16 08:59:04 -08:00
Tanguy Leroux d3d7c0158e Revert "[RCI] Check blocks while having index shard permit in TransportReplicationAction (#35332)"
This reverts commit 31567cefb4.
2018-11-16 15:38:51 +01:00
Tom Callahan 76b77dbaa4
Remove remaining line length violations for o.e.action.admin.cluster (#35156)
This inserts newlines in order to reduce line lengths in the
o.e.action.admin.cluster package to 140 characters or less.  This
also remves the checkstyle suppressions for affected files.

Relates #34884, #34923
2018-11-16 09:37:42 -05:00
Christoph Büscher 2da4bc85cf
Remove usages of CharSequence in Sets (#35501)
The javadocs of the CharSequence interface state that not all of its
implementations define the general contracts of the Object#equals and
Object#hashCode methods, therefore it is dangerous to use different CharSequence
instances as elements in a set or as keys in a map. While we probably mostly use
Strings in sets, in some places this is not enforced. To prevent this from
accidentally happening, this change replaces all occurances of Set<CharSequence>
which are currently mostly used in the completion suggester code with the more
concrete usage of Set<String>.
2018-11-16 09:35:22 +01:00
Jim Ferenczi 903d27a8fd
Fix phrase_slop in query_string query (#35533)
This change ensures that custom `phrase_slop`s are correctly handled
in the `query_string` query.

Fixes #35125
2018-11-16 09:08:07 +01:00