Commit Graph

5860 Commits

Author SHA1 Message Date
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
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