Commit Graph

6048 Commits

Author SHA1 Message Date
javanna ebb7ecb00e [TEST] RestClient to use a non static pooling connection manager
When closing an instance of RestClient, the connection manager gets shutdown, which makes it not usable anymore. If that is static, like it is now, no RestClient will work anymore from that moment on. Each instance of RestClient should have its own instance of connection manager
2015-02-03 16:46:54 +01:00
Adrien Grand 8540a863aa Search: Avoid calling DocIdSets.toSafeBits.
This method is heavy as it builds a bitset out of a DocIdSet in order to be
able to provide random-access. Now that Lucene has removed out-of-order scoring
true random-access is very rarely needed and we could instead return an Bits
instance that wraps the iterator. Ideally, we would use the DISI API directly
but I have to admit that the Bits API is more friendly.

Close #9546
2015-02-03 16:16:19 +01:00
javanna e5b174ff77 [TEST] Move SimpleNettyTransportTests to expected exception
Replaced try catch with expected exception, since no additional check was done on the exception thrown.
2015-02-03 15:51:51 +01:00
javanna 338766fd4d [TEST] Remove needless ClusterScope annotation from NettyTransportMultiPortTests
NettyTransportMultiPortTests is not an integration test, it doesn't rely on the test cluster thus the ClusterScope annotation doesn't have any effect.
2015-02-03 15:51:44 +01:00
javanna 0e67dda15d [TEST] Make sure that match assertion throws error if run against an object
We had a REST test that relied on matching a json response against a regex. It worked but the match wasn't done against the actual json object, but its java map representation converted into a string by calling `toString`. Since all other clients test runners don't work in this case, as they try to match a json object against a regex, we should do the same and prevent it from working.
2015-02-03 10:18:18 +01:00
javanna dfe67da013 [TEST] support stashed values within property names in our REST tests
Closes #9533
2015-02-03 10:17:50 +01:00
Boaz Leskes 4342237acf Test: reduce load in RecoveryWhileUnderLoadTests 2015-02-03 09:32:42 +01:00
Robert Muir 027730006b core: add 'checksum' option for index.shard.check_on_startup
The current "checkindex" on startup is very very expensive. This is
like running one of the old school hard drive diagnostic checkers and
usually not a good idea.

But we can do a CRC32 verification of files. We don't even need to
open an indexreader to do this, its much more lightweight.

This option (as well as the existing true/false) are randomized in
tests to find problems.

Also fix bug where use of the current option would always leak
an indexwriter lock.

Closes #9183
2015-02-03 00:10:08 -05:00
Ryan Ernst 6079d88d43 Mappings: Remove type prefix support from field names in queries
This is the first part of #8872.
2015-02-02 13:10:56 -08:00
Lee Hinman 0f405e9710 Merge branch 'pr/8795' 2015-02-02 11:49:45 -07:00
Michael McCandless e29cf903c8 Core: upgrade to Lucene snapshot r1656366
* IndexWriter deadlock and DV update concurrency fix
  * BytesRef reuse bug with SortedSetDVTermsEnum
  * Int overflow skip data corruption bug
  * Compound file API cleanups
  * IndexWriter doesn't accept per-doc Analyzer anymore

Closes #9524
2015-02-02 13:37:45 -05:00
Christoph Büscher 44193e7ba5 Aggregations: Add 'offset' option to histogram aggregation
Histogram aggregation supports an 'offset' option to move bucket boundaries.
In a histogram with buckets of size X these can be moved from 0, X, 2X, 3X,...
by an offset value of Y to Y, X+Y, 2X+Y, 3X+Y... by using the 'offset' option.
The previous 'pre_offset' and 'post_offset' options are removed in favour of
the simplified 'offset' option.

Closes #9417
Closes #9505
2015-02-02 18:23:01 +01:00
Alexander Reelsen a55476bf70 Tests: Ensure no use of potentially resolving internal ips 2015-02-02 09:45:42 +01:00
Boaz Leskes 79c8621a47 Test: add trace logging to testNodeFailuresAreProcessedOnce 2015-02-02 09:32:53 +01:00
Alexander Reelsen 59f8c0951a Netty Transport: Add profiles to transport infos
Until now, there was no possibility to expose infos about configured
transport profiles. This commit adds the ability to expose those
information in the TransportInfo class.

The channel was well as the netty pipeline handler now also contain
the profile they were configured for, as this information cannot be
extracted elsewhere.

In addition, each profile now can set its own publish host and port,
which might be needed in case of portforwarding or using docker.

Closes #9134
2015-02-02 08:17:55 +01:00
Martijn van Groningen 3ce05b6919 inner hits: Fix bug that resolves parent docs properly as inner hit when inner hit is defined on has_parent query. 2015-02-01 22:29:21 +01:00
Martijn van Groningen d038f372d4 cleanup: Move catching of IOException higher op the stack to reduce the number of try-catch clauses. 2015-02-01 22:27:00 +01:00
Lee Hinman 25f944009c Remove unneeded null checks from IndicesClusterStateService 2015-02-01 12:13:57 -07:00
Simon Willnauer 42bb5deca2 Revert "[ENGINE] Fail engine if Lucene commit fails"
This reverts commit dda7242848.
2015-01-31 23:48:34 +01:00
Simon Willnauer dda7242848 [ENGINE] Fail engine if Lucene commit fails
This is similar to refresh, if we fail to commit the data we have to fail the
engine since in-ram data is likely discarded. Yet, it's still in translog and might
be recoverable when the node is restarted but we have to treat the engine as failed.
2015-01-31 16:45:38 +01:00
Lee Hinman 9557625ae7 Disallow method pointer expressions in Groovy scripting 2015-01-30 15:55:19 -07:00
Lee Hinman 9fe84062a1 Add `beforeIndexAddedToCluster` callback
This callback is executed only once, on the master node during an
index's creation. An exception thrown during this listener will cancel
the index creation.

This also adds checks in `IndicesClusterStateService` for the
indexService being null as well as if the `indicesService.createIndex`
throws an exception on data nodes after an index has already been
created.
2015-01-30 15:25:58 -07:00
Adrien Grand b2010f788d [TESTS] IndicesQueryCacheTests: Ensure that shards are searchable before starting to query them. 2015-01-30 23:22:27 +01:00
Boaz Leskes eabc3cde98 Recovery: update access time of ongoing recoveries
#8720 introduced a timeout mechanism for ongoing recoveries, based on a last access time variable. In the many iterations on that PR the update of the access time was lost. This adds it back, including a test that should have been there in the first place.

Closes #9506
2015-01-30 21:06:28 +01:00
Adrien Grand 00d54fabb2 Search: Remove query-cache serialization optimization.
The query-cache has an optimization to not deserialize the bytes at the shard
level. However this is a bit fragile since it assumes that serialized streams
can be concatenanted (which is not the case with shared strings) and also does
not update the QueryResult object that is held by the SearchContext. So you
need to make sure to use the right one.

With this change, the query cache just deserializes bytes into the QueryResult
object from the context.

Close #9500
2015-01-30 20:02:18 +01:00
Simon Willnauer fb377d48bd Remove dead code 2015-01-30 13:52:26 +01:00
Simon Willnauer 380fcd1d02 Reset MergePolicProvider settings only if the value actually changed
Due to some unreleased refactorings we lost the persitence of
a perviously set values in MergePolicyProvider. This commit adds this
back and adds a simple unittest.

Closes #8890
2015-01-30 13:24:08 +01:00
Ryan Ernst 1ebc95ee28 Tests: Add type-unrestricted version of field mapper getter to SearchContext.
This fixes an NPE when using TestSearchContext in SignificanceHeuristicTests.
2015-01-29 13:42:07 -08:00
Michael McCandless ecc8b702d3 also remove force option from logger.trace 2015-01-29 16:18:21 -05:00
Ryan Ernst 4e0e5e7328 Aggs: Remove limitation on field access within aggs to the types
provided in the search

Currently, doing a field lookup within a terms agg will restrict the
fields available to those within the types passed into the search
request.  However, when doing sub aggs within a children agg, the
fields available should not be restricted to those of the search.

This change makes the field lookup use the index level mapper service.
2015-01-29 10:49:38 -08:00
Simon Willnauer c0fa60eb26 Remove HandlesStreamInput/Output
The optimization we do in the HandlesStreamInput / Output
adds a lot of complexity with a rather unknown benefit. It tries
to compress commonly used strings and write ids instead. This
should rather be done on a lower level if at all necessary for
the small message we send over the network.
2015-01-29 17:43:32 +01:00
Simon Willnauer 1d77c3af82 Fix compilation 2015-01-29 17:41:53 +01:00
Simon Willnauer 03f1fcc85e [ENGINE] Remove dirty flag and force boolean for refresh
Today we have a dirty flag indicating that a refresh must
be executed. We also allow users to bypass this by setting
a force=true boolean on the refresh request / command. All
these flags are unneeded since the SearcherManager has all
the information to do the right thing if it's dirty or not.
2015-01-29 17:30:00 +01:00
Simon Willnauer b275e917b7 [CACHE] Use a smaller expected size when serializing query results
BytesStreamOutput allows to pass the expected size but by default uses
BigArrays.PAGE_SIZE_IN_BYTES which is 16k. A common cached result ie.
a date histogram with 3 buckets is ~100byte so 16k might be very wasteful
since we don't shrink to the actual size once we are done serializing.
By passing 512 as the expected size we will resize the byte array in the stream
slowly until we hit the page size and don't waste too much memory for small query
results.
2015-01-29 17:27:08 +01:00
Britta Weber 0a07ce8916 core: disable auto gen id optimization
This pr removes the optimization for auto generated ids.
Previously, when ids were auto generated by elasticsearch then there was no
check to see if a document with same id already existed and instead the new
document was only appended. However, due to lucene improvements this
optimization does not add much value. In addition, under rare circumstances it might
cause duplicate documents:

When an indexing request is retried (due to connect lost, node closed etc),
then a flag 'canHaveDuplicates' is set to true for the indexing request
that is send a second time. This was to make sure that even
when an indexing request for a document with autogenerated id comes in
we do not have to update unless this flag is set and instead only append.

However, it might happen that for a retry or for the replication the
indexing request that has the canHaveDuplicates set to true (the retried request) arrives
at the destination before the original request that does have it set false.
In this case both request add a document and we have a duplicated a document.
This commit adds a workaround: remove the optimization for auto
generated ids and always update the document.
The asumtion is that this will not slow down indexing more than 10 percent,
see: http://benchmarks.elasticsearch.org/

closes #8788
closes #9468
2015-01-29 16:26:04 +01:00
Simon Willnauer 15a766084d [CACHE] Use correct number of bytes in query cache accounting
today we use the length of the BytesReference which is misleading since
the reference is paged such that the length != ramBytesUsed. This can lead
to a way higher memory consuption than expected if query results are tiny
since each query result requires at least 16kb. Yet, we should rethink this
strategy for query results that are very small ie. less than 20% of the ramBytesUsed
but this commit first tries to make the acocunting correct.
2015-01-29 10:59:36 +01:00
Simon Willnauer 4917121de2 Remove Unused code and remove unnecessary abstraction
HashedBytesArray is not used anymore and Releable makes only sense on
Paged implementation such that the marker interface is unneeded.
2015-01-29 09:51:14 +01:00
Lee Hinman 86e52c30a1 Make `script.groovy.sandbox.method_blacklist_patch` truly append-only
Additionally, this setting can be specified in elasticsearch.yml if
desired, to pre-populate the list of methods to be added to the default
blacklist.

When making a change to this setting dynamically, the entire blacklist
is logged as well.
2015-01-28 17:09:27 -07:00
Ryan Ernst afcedb94ed Mappings: Remove `index_analyzer` setting to simplify analyzer logic
The `analyzer` setting is now the base setting, and `search_analyzer`
is simply an override of the search time analyzer.  When setting
`search_analyzer`, `analyzer` must be set.

closes #9371
2015-01-28 13:43:15 -08:00
Lee Hinman cc461a837f Avoid NullPointerException if optional Groovy jar is removed 2015-01-28 13:49:50 -07:00
Lee Hinman c610524392 Make groovy sandbox method blacklist dynamically additive
Using the `script.groovy.sandbox.method_blacklist_patch` setting, the
blacklist can be dynamically *added* to by specifying a comma-separated
list of methods (for example, "toString,size" would add .toString and
.size to the blacklist).

When the `script.groovy.sandbox.method_blacklist_patch` setting is
changed, the script cache is cleared to force new scripts to be
recompiled. Additionally the on-disk cache is cleared so that scripts in
the `config/scripts` directory are re-compiled as well.

This also fixes an issue where script engines were injected more than
once, which can cause multiple instances of the script engine per node.
2015-01-28 12:26:09 -07:00
Zachary Tong a4eb1d5505 Aggregations: Add standard deviation bounds to extended_stats
Extended_stats now displays the upper and lower bounds on standard deviations (e.g. avg +/- std).
Default is to show 2 std above/below, but can be changed using the `sigma` parameter.
Accepts non-negative doubles

Closes #9356
2015-01-28 11:47:20 -05:00
gmarz 3e4fc2659d Nodes Stats: Fix open file descriptors count on Windows
Closes #1563
2015-01-28 10:30:02 -05:00
Nicholas Knize 9622f78fe6 Revert "[GEO] Update GeoPolygonFilter to handle ambiguous polygons"
This reverts commit 06667c6aa8 which introduces an undesireable dependency on JTS.
2015-01-28 08:03:26 -06:00
Colin Goodheart-Smithe 29c24d75e7 Aggregations: Unify histogram implementations
This change makes InternalHistogram the only InternalAggregation used by the Histogram Aggregator. There is still a separate Bucket implementation and Factory implementation. All buckets are created through the factory passed into the InternalHistogram meaning and the correct factory implementation is serialised as part of the aggregation to make sure the correct bucket types are always generate.

This is needed by the Transformers (namely the derivative transformer) to allow it to generate buckets of the right type without having to know what the underlying bucket implementation is.
2015-01-28 10:45:28 +00:00
Boaz Leskes 1695f76f68 Test: testOldIndexes should disable merging
It verifies some segments need to be upgraded, but if they are merged away, there are upgraded implicitly
2015-01-28 11:34:58 +01:00
Boaz Leskes 22a576d5ba Recovery: flush immediately after a remote recovery finishes (unless there are ongoing ones)
To properly replicate, we currently stop flushing during recovery so we can repay the translog once copying files are done. Once recovery is done, the translog will be flushed by a background thread that, by default, kicks in every 5s. In case of a recovery failure and a quick re-assignment of a new shard copy, we may fail to flush before starting a new recovery, causing it to deal with potentially even longer translog. This commit makes sure we flush immediately when the ongoing recovery count goes to 0.

I also added a simple recovery benchmark.

Closes #9439
2015-01-28 09:14:23 +01:00
Igor Motov 13ef7d73b9 Snapshot/Restore: better handling of index deletion during snapshot
If an index is deleted during initial state of the snapshot operation, the entire snapshot can fail with NPE. This commit improves handling of this situation and allows snapshot to continue if partial snapshots are allowed.

Closes #9024
2015-01-27 21:06:29 -05:00
Boaz Leskes 3512860956 Test: always use replicas in testClusterInfoServiceInformationClearOnError
It assume the local node always has a shard
2015-01-28 00:23:03 +01:00
Nicholas Knize 06667c6aa8 [GEO] Update GeoPolygonFilter to handle ambiguous polygons
PR #8672 addresses ambiguous polygons - those that either cross the dateline or span the map - by complying with the OGC standard right-hand rule. Since ```GeoPolygonFilter``` is self contained logic, the fix in #8672 did not address the issue for the ```GeoPolygonFilter```. This was identified in issue #5968

This fixes the ambiguous polygon issue in ```GeoPolygonFilter``` by moving the dateline crossing code from ```ShapeBuilder``` to ```GeoUtils``` and reusing the logic inside the ```pointInPolygon``` method.  Unit tests are added to ensure support for coordinates specified in either standard lat/lon or great-circle coordinate systems.

closes #5968
closes #9304
2015-01-27 15:45:05 -06:00
Boaz Leskes 9ac6d78308 Internal: ClusterInfoService should wipe local cache upon unknown exceptions
The InternalClusterInfoService reaches out to the nodes to get information about their disk usage and shard store size. Upon a node level error we currently remove the node info from the local cache. We should also clear the cache when we run into an error on the action level (excluding any info from all nodes).

 This also adds settings for the timeout used when waiting for nodes.

Closes #9449
2015-01-27 22:38:08 +01:00
simaov 1ca8404674 #9444 join lines
Fixes #9445
2015-01-27 18:14:56 +00:00
simaov f3e1a66133 #9444 throw StrictDynamicMappingException exception if dynamic is 'strict' and undeclared field value is NULL, test for this
Fixes #9445
2015-01-27 18:14:56 +00:00
Lee Hinman 39c064ce8b [TEST] remove AwaitsFix from DeleteByQuery test 2015-01-27 10:15:44 -07:00
Ryan Ernst cff0ec3972 Mappings: Remove type level default analyzers
closes #8874
2015-01-27 08:30:51 -08:00
Colin Goodheart-Smithe 6f894b1d2c [TEST] Fix HistogramTests
Fixed histogram tests for value scripts as it was picking the wrong buckets form the bucket list following the removal of the getBucketByKey method
2015-01-27 12:10:38 +00:00
Martijn van Groningen 7e6e9dbb96 Aggs: nested agg needs to reset root doc between segments.
Closes #9437
Closes #9436
2015-01-27 12:53:47 +01:00
javanna 93bf737f34 Internal: fix shard state tranport action names
When we renamed all of the transport actions in #7105, shard started and failed were flipped around by mistake. This commit fixes their naming.

Closes #9440
2015-01-27 12:38:16 +01:00
Colin Goodheart-Smithe 285ef0f06d Aggregations: Clean up response API for Aggregations
This change makes the response API object for Histogram Aggregations the same for all types of Histogram, and does the same for all types of Ranges.
The change removes getBucketByKey() from all aggregations except filters and terms. It also reduces the methods on the Bucket class to just getKey() and getKeyAsString().
The getKey() method returns Object and the actual Type is returns will be appropriate for the type of aggregation being run. e.g. date_histogram will return a DateTime for this method and Histogram will return a Number.
2015-01-27 10:53:44 +00:00
Sourav Mitra 78c52d559d Minor hygiene, Removed Redundant inheritance
Close #9427
2015-01-27 11:02:43 +01:00
Lee Hinman 0143d835d4 [TEST] Add `ensureGreen` to indices created in TopHitsTests 2015-01-26 18:45:04 -07:00
Lee Hinman 8fc58dc00a [TEST] Add `ensureGreen` where needed in NestedTests 2015-01-26 18:26:04 -07:00
Lee Hinman 92b218ba51 [TEST] Mute DeleteByQueryTests.testDeleteAllOneIndex
See:
https://github.com/elasticsearch/elasticsearch/issues/9421
2015-01-26 18:01:08 -07:00
Martijn van Groningen a645994086 Aggs: fix handling of the same child doc id being processed multiple times in the `reverse_nested` aggregation.
Closes #9263
Closes #9345
2015-01-26 18:36:35 +01:00
Ryan Ernst 385c43c141 Mappings: Remove _analyzer
closes #9279
2015-01-26 09:14:17 -08:00
Lee Hinman 537769c225 Relax restrictions on filesystem size reporting
Apparently some filesystems such as ZFS and occasionally NTFS can report
filesystem usages that are negative, or above the maximum total size of
the filesystem. This relaxes the constraints on `DiskUsage` so that an
exception is not thrown.

If 0 is passed as the totalBytes, `.getFreeDiskAsPercentage()` will
always return 100.0% free (to ensure the disk threshold decider fails
open)

Fixes #9249
Relates to #9260
2015-01-26 09:46:21 -07:00
Martijn van Groningen 7ca2ef9b93 Nested aggregator: Fix handling of multiple buckets being emitted for the same parent doc id.
This bug was introduced by #8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small.

Closes #9317
Closes #9346
2015-01-26 17:41:25 +01:00
Britta Weber f8294352f7 [TEST] mute test for now becasue we have an issue for it 2015-01-26 17:30:43 +01:00
Martijn van Groningen f9c0e0d4c7 aggs: The `nested` aggregator's parent filter is n't resolved properly in the case the nested agg gets created on the fly for buckets that are constructed during query execution.
The fix is the move the parent filter resolving from the nextReader(...) method to the collect(...) method, because only then any parent nested filter's parent filter is then properly instantiated.

Closes #9280
Closes #9335
2015-01-26 12:17:52 +01:00
Britta Weber c3f1982f21 [TEST] check that primaries succeeded
We want to check if at least the primaries succeeded if we do not
wait for green and not if all succeeded if we wait for green.
That was a misconception in c617af37e8
2015-01-26 11:14:38 +01:00
javanna aa6bf5fd1d Snapshot status api: make sure headers and request context are handed over to inner nodes request
Closes #9409
2015-01-26 10:33:57 +01:00
Boaz Leskes 974fafb2da Test: add logging to SearchWithRandomExceptionsTests 2015-01-26 09:59:01 +01:00
Robert Muir be3e60efc8 Upgrade to lucene r1654549 snapshot.
Closes #9402.

Squashed commit of the following:

commit 85c71b6478441a73738c81f02257193f9837f3ba
Author: Robert Muir <rmuir@apache.org>
Date:   Sat Jan 24 11:24:36 2015 -0500

    upgrade to lucene r1654549 snapshot
2015-01-25 15:01:45 -05:00
Michael McCandless 50e9108305 Core: do not throttle recovery indexing operations when replaying transaction log
Closes #9396

Closes #9394
2015-01-23 17:41:37 -05:00
Ryan Ernst dfc2c9f3a1 Tests: Tweaking static bwc tests to improve stability 2015-01-23 13:59:42 -08:00
Ryan Ernst 54d01c48cb Tests: Add memory info to static bwc index tests. 2015-01-23 13:20:23 -08:00
Britta Weber c617af37e8 [TESTS] ensureGreen, else reported successful shards will be lower than expected 2015-01-23 17:12:33 +01:00
Britta Weber b6c74fb21c [TESTS] Mute test until issue is resolved 2015-01-23 16:41:56 +01:00
Britta Weber 35e507ad54 [TEST] Check for total shards >= number of shards instead of ==
Requests are sent to two shard copies in case a shard is relocating.
This will show up in the the _shards header. Therefore we must check
with greaterThanOrEqualTo(..).
2015-01-23 15:40:30 +01:00
Christoph Büscher eeb96db76b Rest: Adding support of multi-index query parameters for _cluster/state
Adding missing support for the multi-index query parameters 'ignore_unavailable',
'allow_no_indices' and 'expand_wildcards' to '_cluster/state' API. These
parameters are supposed to be supported for APIs that work across multiple indices.
So far overwriting the default settings per REST call was not possible which is
fixed here.

Closes #5229
Closes #9295
2015-01-22 16:47:14 +01:00
Ryan Ernst 314b62c8ae Tests: Rename tests with the same name
These two tests are confusing because they have the same class name in
different packages.  This results in accidentally looking at the wrong
file when trying to open the test by class name. They are also
not "simple"..
2015-01-20 15:41:53 -08:00
Igor Motov c0da353ef5 Snapshot/Restore: add support for changing index settings during restore process
Closes #7887
2015-01-20 15:49:47 -05:00
Ryan Ernst 81621840b8 Tests: Block replica check for static index bwc tests until all pending
tasks are complete

Blocking once replicas are set to 0 here should remove the chance of a
race condition while the replicas are being removed.
2015-01-20 11:08:42 -08:00
Ryan Ernst a7a726700e Tests: Increase timeout for waiting on replicas for static index tests 2015-01-20 09:54:03 -08:00
Britta Weber 23c358d2ef [TEST] mute test, we have issue #9270 for it 2015-01-20 15:01:05 +01:00
David Pilato fb10346953 [Mapper] Add `ignore_missing` option to `timestamp`
Related to #9049.

By default, the default value for `timestamp` is `now` which means the date the document was processed by the indexing chain.

You can now reject documents which not provide a `timestamp` value by setting `ignore_missing` to false (default to `true`):

```js
{
    "tweet" : {
        "_timestamp" : {
            "enabled" : true,
            "ignore_missing" : false
        }
    }
}
```

When you update the cluster to 1.5 or master, this index created with 1.4 we automatically migrate an index created with 1.4 to the 1.5 syntax.

Let say you have defined this in elasticsearch 1.4.x:

```js
DELETE test
PUT test
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  }
}
PUT test/type/_mapping
{
  "type" : {
      "_timestamp" : {
          "enabled" : true,
          "default" : null
      }
  }
}
```

After migration, the mapping become:

```js
{
   "test": {
      "mappings": {
         "type": {
            "_timestamp": {
               "enabled": true,
               "store": false,
               "ignore_missing": false
            },
            "properties": {}
         }
      }
   }
}
```

Closes #8882.
2015-01-20 13:20:05 +01:00
Igor Motov fcb0186d2e Tests: Make sure snapshots created with old version of elasticsearch can be restored
Closes #8968
2015-01-19 20:28:33 -05:00
Michael McCandless 3c0d2081cf Core: change default xlog size from 200 MB to 512 MB
Closes #9341
2015-01-19 15:52:29 -05:00
Britta Weber e037250ce9 [TEST] fix scores in ExplainableScriptTests 2015-01-19 20:00:39 +01:00
javanna 6c2139c186 Tribe node: remove closed indices from cluster state
At startup the tribe node ignores closed indices, but if you closed an index that was part of the tribe node cluster state, its state change was not currently handled. A NullPointerException could be seen in the logs instead as the routing table for the closed index was null. As a result, the index stayed in the tribe node cluster state in open state, although that didn't reflect reality. Also, subsequent cluster state updates happening in the tribe node kept failing, affecting updates related to any other index. The only way to recover from this was to restart the tribe node every time an index is closed on any tribe.

This commit properly handles index state changes, making sure that when an index gets closed it gets removed from the tribe node cluster state. Note that it makes little sense to keep the closed index around in the tribe node, as from the tribe node you can't do anything with it. The tribe node simply doesn't see any closed index, it's the same as if they didn't exist.

Closes #6411
Closes #9334
2015-01-19 16:27:52 +01:00
Lee Hinman 283a467e20 Pass through all exceptions in IndicesLifecycleListeners
This allows a plugin or user that registers a listener to be able to
stop actions like creating an index or starting a shard by throwing an
exception. Previously all exceptions were logged without being rethrown.
2015-01-19 15:10:54 +01:00
Britta Weber 366ddfc89a scripts: add explainable script again
explainable scripts were removed in #7245 but they were used.
This commit adds them again.

closes #8561
2015-01-19 13:44:47 +01:00
Britta Weber 7230e605fe function_score: use query and filter together
Before, if filter and query was defined for function_score, then the
filter was silently ignored. Now, if both is defined then function score
query wraps this in a filtered_query.

closes #8638
closes #8675
2015-01-19 12:12:38 +01:00
Britta Weber 75e1500e68 cleanup: Remove `gateway.type: local`
This property was removed in 45408844e7 and 1247774ff1

closes #9128
2015-01-19 11:53:27 +01:00
Martijn van Groningen fcbba930a4 Children aggregation: The children aggs' post collection translates the buckets on the parent level to the child level and because of that it needs to invoke the post collection of its nested aggs.
Closes #9271
2015-01-19 11:42:52 +01:00
Martijn van Groningen 12a2e761c5 Fix identation 2015-01-19 11:42:40 +01:00
sweetest eaa1674d6d Introduce index option named 'index.percolator.map_unmapped_fields_as_string', that handles unmapped fields in percolator queries as type string.
Closes #9053
Closes #9054
2015-01-19 09:51:10 +01:00
Igor Motov a4c92eb67e Snapshot/Restore: add validation of restored persistent settings
Closes #8830
2015-01-17 19:39:35 -05:00
Nicholas Knize e69b5c3424 [GEO] NPE parsing GeoJSON polygon with single LinearRing
ShapeBuilder threw a NPE when a polygon coordinate array consisted of a single LinearRing. This PR fixes the error handling to throw a more useful ElasticsearchParseException to provide the user with better insight into the problem.
2015-01-16 13:08:29 -06:00
Michael McCandless 6ab21e5b1b test must start with auto_throttle enabled 2015-01-16 13:50:17 -05:00
Ryan Ernst 795c347db3 Upgrade: Fix version check in bytes to upgrade that spans major versions
The previous check did not account for major version, so upgrading to
5.1 caused 4.1 (from 0.90.0.Beta1) to look the same as current master.
2015-01-16 10:41:02 -08:00
Michael McCandless b9358ccca8 Core: switch to auto IO throttle for merges
This adds a new boolean (index.merge.scheduler.auto_throttle) dynamic
setting, default true (matching Lucene), to adaptively set the IO rate
limit for merges over time.

This is more flexible than the previous fixed rate throttling because
it responds depending on the incoming merge rate, so search-heavy
applications that are not doing much indexing will see merges heavily
throttled while indexing-heavy cases will lighten the throttle so
merges can keep up within incoming indexing.

The fixed rate throttling is still available as a fallback if things
go horribly wrong.

Closes #9243

Closes #9133
2015-01-16 13:00:08 -05:00
Adrien Grand f6d5b3932a [TESTS] Mute OldIndexBackwardsCompatibilityTests. 2015-01-16 12:15:59 +01:00
Adrien Grand 1fc24a8837 Upgrade to lucene-5.1.0-snapshot-1652032.
This new Lucene snapshot does not have out-of-order scoring anymore.

Close #9318
2015-01-16 09:37:29 +01:00
Ryan Ernst 95bc7df289 Fix snapshot flag accidentally switched for 1.0 beta2 2015-01-15 23:57:46 -08:00
Ryan Ernst 1ee6ff0ea5 Tests: Add final missing static bwc index for 1.2.0
See #9297
2015-01-15 23:12:41 -08:00
Ryan Ernst 979f99af7f Remove irrelevant bwc comment 2015-01-15 23:02:02 -08:00
Robert Muir 365ec15d2b Backcompat: Fix backcompat for 0.90.0.Beta1 indexes 2015-01-15 22:54:26 -08:00
Ryan Ernst 8e864d037e Tests: Add tests for missing static indexes, and ensure newly added
versions will force indexes to be added.
2015-01-15 22:52:41 -08:00
Shay Banon 716cc5fb05 [TEST] Mmm, still wrap wrappers still its needed post closing dir
previous push was partial by mistake, we still need the wrapped dirs around after being closed for the test infra, for now, explicitly clear it in the leak test (which is still bad apple)
2015-01-15 17:57:47 -07:00
Shay Banon 683050c6ed [TEST] Mock Directory didn't clean wrapped dirs
I ran the bad apple test for index memory leaks and still saw leaks, it seems like we don't properly clean the dirs from the static mock test dir wrapper
2015-01-15 17:38:10 -07:00
Lee Hinman 5acf565e05 Add validator for `cluster.routing.allocation.disk` boolean settings
`cluster.routing.allocation.disk.include_relocations` and
`cluster.routing.allocation.disk.reroute_interval` are both boolean
settings, so they should have the `Validator.BOOLEAN` applied.

Fixes #9309
2015-01-15 11:11:16 +01:00
Michael McCandless 107099affa put back fixed throttling, but off by default 2015-01-14 05:35:09 -05:00
Michael McCandless 87d8fbff28 put back fixed throttling, but off by default 2015-01-14 05:26:37 -05:00
Ryan Ernst f241125302 Internal: Change snapshot state for unreleased versions and add
validation tests for constants

Currently the snapshot flag for Version constants is only set to true
for CURRENT.  However, this means that the snapshot state changes from
branch to branch.  Instead, snapshot should be "is this version
released?".  This change also adds a validation test checking that
ID -> constant and vice versa are correct, and fixes one bug found there
(for an unreleased version).
2015-01-13 12:42:48 -08:00
Michael McCandless ff3e2cb569 remove version checks 2015-01-13 14:21:21 -05:00
Adrien Grand a56520d26d Internal: clean up memory reuse a bit.
- don't allow for soft references anymore in the recycler
 - remove some abusive thread locals
 - don't recycle independently float/double and int/long pages, they are the
   same and just interpret bits differently.

Close #9272
2015-01-13 18:08:12 +01:00
Adrien Grand d9165dfe73 Aggregations: simplifications.
BucketAggregationMode used to be part of the framework, now it's only an
implementation detail of the terms, histogram, geohash grid and scripted
aggregators.

Aggregator.estimatedBucketCount() was a complicated way to do the initial sizing
of the data structures, but it did not work very well in practice and was rather
likely to lead to over-sized data-structures causing OOMEs. It's removed now and
all data-structures start with a size of 1 and grow exponentially.

Aggregator.preCollection() is now symetric with postCollection(): it exists on
all aggregation objects where postCollection() also is and recursively calls its
children.

Fixed other minor issues related to generics and exceptions.

Close #9097
2015-01-13 18:05:09 +01:00
Adrien Grand b8be8e432e Query cache: Make the query cache usable on time-based data.
The query cache has a mechanism that disables it automatically when
SearchContext.nowInMillis() is used. One issue with that is that the date math
parser always evaluates the current timestamp when parsing a date, even if it
is not needed. As a consequence, whenever you use a date expression in your
queries, the query cache would not be used.

Close #9225
2015-01-13 17:23:59 +01:00
Luca Cavanna 4bdc89fca0 Java API: package private getters to become public if there have corresponding public setters
Some of our Java API requests have public setters but their corresponding getters are package private only. This commit makes those getters public as well.

Closes #9273
2015-01-13 15:22:01 +01:00
Adrien Grand d583080f20 Remove unused DoubleObjectPagedHashMap. 2015-01-13 10:49:32 +01:00
David Pilato be1610ba63 [Mapper] Using default=null for _timestamp field creates a index loss on restart
Step to reproduce:

* Create new index and type.

```
DELETE new_index
PUT new_index
 {
    "mappings": {
    	"power": {
	        "_timestamp" : {
	            "enabled" : true,
	            "default": null
	        }
	    }
    }
}
```

* Add a document

```
PUT new_index/power/1
{
    "foo": "bar"
}
```

* Restart cluster ... and **index is missing**...

```
GET new_index
```

Gives IndexMissingException

Closes #9223.

(cherry picked from commit e654a2c)
(cherry picked from commit aef3bc2)
2015-01-13 09:49:26 +01:00
Ryan Ernst 48bc132927 Mappings: Remove fieldSearchAnalyzer and fieldSearchQuoteAnalyzer from
MapperService.

Instead, get the FieldMapper for the field and check the analyzer there.
2015-01-12 14:53:18 -08:00
Ryan Ernst c29c18f0f2 Internal: Log when upgrade starts and stops
closes #9227
2015-01-12 14:40:04 -08:00
Ryan Ernst 69f74d714f Tests: Fix failure introduced in #8967 2015-01-12 09:27:27 -08:00
Ryan Ernst 6f214d791f Tests: Fix test failure introduced in #8967 2015-01-12 08:42:59 -08:00
Ryan Ernst 7d5a15e461 Mapping: serialize doc values settings for _timestamp
This change fixes _timestamp's serialization method to write out
`doc_values` and `doc_values_format`, which could already be set,
but would not be written out.

closes #8893
closes #8967
2015-01-12 08:26:59 -08:00
Lee Hinman a3972f03c6 Pass index settings where appropriate in IndicesLifecycle
This allows plugins to be able to perform some needed setup before and
after an index/shard is in use.
2015-01-12 15:04:37 +01:00
Lee Hinman 6b24921bd4 [TEST] Re-add rebalance disable setting in RecoveryFromGatewayTests 2015-01-12 14:21:31 +01:00
David Pilato 052645903a Rest: remove status code from main action
Today we give the HTTP status back within the HTTP response itself and within the JSON response as well:

```sh
curl localhost:9200/
```

```js
{
  "status" : 200,
  "name" : "Red Wolf",
  "version" : {
    "number" : "2.0.0",
    "build_hash" : "6837a61d8a646a2ac7dc8da1ab3c4ab85d60882d",
    "build_timestamp" : "2014-08-19T13:55:56Z",
    "build_snapshot" : true,
    "lucene_version" : "4.9"
  },
  "tagline" : "You Know, for Search"
}
```
2015-01-12 12:37:46 +01:00
Sebastian Utz 358bb9bd75 fixup! fixup! add support for registering custom circuit breaker 2015-01-12 10:32:14 +01:00
Martijn van Groningen a88dd36df4 Test: Only run the test that verifies the `pending` field in the `_shards` header if the test cluster has two are more data nodes. 2015-01-12 10:29:23 +01:00
Michael McCandless 1aad275c55 expose current CMS throttle in merge stats; fix tests, docs; also log per-merge stop/throttle/rate 2015-01-11 05:52:43 -05:00
Michael McCandless 31e6acf3f2 first cut 2015-01-10 16:38:56 -05:00
Boaz Leskes 102e7adfad Recovery: be more resilient to partial network partitions
This commits adds a test that simulate disconnecting nodes and dropping requests during the various stages of recovery and solves all the issues that were raised by it. In short:

1) On going recoveries will be scheduled for retry upon network disconnect. The default retry period is 5s (cross node connections are checked every 10s by default).
2) Sometimes the disconnect happens after the target engine has started (but the shard is still in recovery). For simplicity, I opted to restart the recovery from scratch (where little to no files will be copied again, because there were just synced).
3) To protected against dropped requests, a Recovery Monitor was added that fails a recovery if no progress has been made in the last 30m (by default), which is equivalent to the long time outs we use in recovery requests.
4) When a shard fails on a node, we try to assign it to another node. If no such node is available, the shard will remain unassigned, causing the target node to clean any in memory state for it (files on disk remain). At the moment the shard will remain unassigned until another cluster state change happens, which will re-assigned it to the node in question but if no such change happens the shard will remain stuck at unassigned. The commits adds an extra delayed reroute in such cases to make sure the shard will be reassinged
5) Moved all recovery related settings to the RecoverySettings.

Closes #8720
2015-01-10 15:19:30 +01:00
Michael McCandless dd8000c865 use Lucene's 4.10.3 version constant 2015-01-10 06:25:39 -05:00
Simon Willnauer e416ed2426 Don't pass indexing buffer side to the translog 2015-01-09 23:45:27 +01:00
Ryan Ernst 4cda543637 Tests: Add logic to handle static index upgrade case where index is
already on latest version.

See #9207
2015-01-09 12:40:44 -08:00
Robert Muir d226a973f7 core: upgrade to lucene 5 r1650327.
refactor _version docvalues migration to be more efficient.

closes #9206
2015-01-09 12:12:31 -05:00
Colin Goodheart-Smithe 91e00c6c8e Aggregations: Numeric metric aggregations are now formattable
You can now specify `format` in the request definition for most numeric metric aggregations. The exceptions are Percentile_Ranks, Cardinality and Value_Count as the response type of these can be different from the field type so the formatter won't work.

Closes #6812
2015-01-09 16:10:58 +00:00
Simon Willnauer d2277d70ff [ENGINE] Simplify Engine construction and ref counting
Today the internal engine closes itself it the engine hits an exception
it can not recover from. This complicates a lot of refcounting issues
if such an exception happens during engine creation. This commit
only markes the engine as failed and let the user close it once the exception
bubbles up. Additionally it rolls back the indexwriter to prevent any changes after
the engine is failed.
2015-01-09 02:04:16 +01:00
Martijn van Groningen 592f517583 Serialize the rest status code, not the rest status enum. 2015-01-08 23:58:46 +01:00
David Pilato 6d58db8868 Mapping With a `null` Default Timestamp Causes NullPointerException on Merge
I have a field with a `null` [default `_timestamp` value](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html#mapping-timestamp-field-default) and when I try to update the mapping I get a server error caused by a `NullPointerException`

```
[2015-01-08 17:28:56,040][DEBUG][action.admin.indices.mapping.put] [...] failed to put mappings on indices [[feed_170_v1, feed_204_v1, feed_229_v1, feed_232_v1, feed_239_v1, feed_248_v1, feed_268_v1, feed_256_v1, feed_272_v1, feed_159_v1, feed_255_v1, feed_164_v1, feed_259_v1, feed_266_v1, feed_188_v1, feed_240_v1, feed_233_v1, feed_13_v1, feed_184_v1, feed_261_v1, feed_267_v1, feed_271_v1, feed_257_v1, feed_172_v1, feed_238_v1, feed_254_v1, feed_223_v1, feed_274_v1, feed_203_v1, feed_269_v1, feed_262_v1, feed_205_v1, feed_168_v1, feed_219_v1, feed_253_v1, feed_251_v1, feed_173_v1, feed_252_v1, feed_210_v1, feed_216_v1, feed_218_v1, feed_118_v1, feed_273_v1, feed_227_v1, feed_166_v1, feed_213_v1, feed_226_v1]], type [history]
java.lang.NullPointerException
        at org.elasticsearch.index.mapper.internal.TimestampFieldMapper.merge(TimestampFieldMapper.java:287)
        at org.elasticsearch.index.mapper.object.ObjectMapper.merge(ObjectMapper.java:936)
        at org.elasticsearch.index.mapper.DocumentMapper.merge(DocumentMapper.java:693)
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$4.execute(MetaDataMappingService.java:508)
        at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:329)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:153)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
```

https://github.com/elasticsearch/elasticsearch/blob/v1.4.2/src/main/java/org/elasticsearch/index/mapper/internal/TimestampFieldMapper.java#L286

Looks like the existence of default timestamp is not checked before use. The next line also has the same issue -- uses of default timestamp without checked to see if it's not null.

To reproduce:

```
$ curl -XPUT localhost:9200/twitter2

$ curl -XPUT localhost:9200/twitter2/tweet/_mapping -d '{
     "tweet" : {
         "_timestamp" : {
             "enabled" : true,
             "default" : null
         }
     }
}'

$ curl -XPUT localhost:9200/twitter2/tweet/_mapping -d '{
     "tweet" : {
         "_timestamp" : {
             "enabled" : true,
             "default" : null
         },
         "properties": {
             "user": {"type": "string"}
         }
     }
}'
```

Closes #9204.

(cherry picked from commit 62c6d63)
2015-01-08 21:33:17 +01:00
Ryan Ernst 7f9ffea97c Tests: Add upgrade step to static bwc tests 2015-01-08 11:53:48 -08:00
Ryan Ernst 060f963a8e Mappings: Remove allow_type_wrapper setting
Before Elasticsearch 1.0, the type was allowed to be passed as the root
element when uploading a document.  However, this was ambiguous if the
mappings also contained a field with the same name as the type.  The
behavior was changed in 1.0 to not allow this, but a setting was added
for backwards compatibility.  This change removes the setting for 2.0.
2015-01-08 09:13:40 -08:00
Martijn van Groningen ca4f27f40e Core: Added `_shards` header to all write responses.
The header indicates to how many shard copies (primary and replicas shards) a write was supposed to go to, to how many
shard copies to write succeeded and potentially captures shard failures if writing into a replica shard fails.

For async writes it also includes the number of shards a write is still pending.

Closes #7994
2015-01-08 18:10:08 +01:00
Ryan Ernst 1ad64a97ec Mappings: Remove includeExisting flag from adding ObjectMapper and
FieldMapper listeners

This flag is unused by the 2 places that add these listeners.
2015-01-08 09:08:54 -08:00
Simon Willnauer 959e3ca9da [CORE] Fold engine into IndexShard
This commit removes most of the Engine abstractions and removes
Engine exposure via dependency injection. It also removes the Holder
abstraction and makes the engine itself start at constrcution time.
It removes the start method from the engine entire which means no engine
instances exists until it's started. There is also no way to stop the
engine to restart, it needs to be an entire new Engine
2015-01-08 17:48:27 +01:00
Martijn van Groningen dedaf9387e Core: Also check if indices resolved via aliases resolution aren't closed and deal with this according to IndicesOptions.
Closes #9057
2015-01-08 16:45:34 +01:00
Martijn van Groningen b0b61ee0c3 Renamed allowNoIndices to failNoIndices and changed parameter order. 2015-01-08 16:43:56 +01:00