Commit Graph

4445 Commits

Author SHA1 Message Date
Martijn van Groningen 60793a848e test: make sure we don't flush during indexing the percolator queries 2016-03-29 16:24:49 +02:00
Colin Goodheart-Smithe ff3fd99074 Prevents exception being raised when ordering by an aggregation which wasn't collected
If a terms aggregation was ordered by a metric nested in a single bucket aggregator which did not collect any documents (e.g. a filters aggregation which did not match in that term bucket) an ArrayOutOfBoundsException would be thrown when the ordering code tried to retrieve the value for the metric. This fix fixes all numeric metric aggregators so they return their default value when a bucket ordinal is requested which was not collected.

Closes #17225
2016-03-29 13:28:03 +01:00
Adrien Grand cb31e591f1 Fix test bug in TypeQueryBuilderTests. 2016-03-29 11:43:27 +02:00
Adrien Grand c7bdfb1126 Add comment why it is safe to check the number of nested fields in MapperService.merge. 2016-03-29 10:02:29 +02:00
Adrien Grand 0eedc784fe Automatically add a sub keyword field to string dynamic mappings. #17188
If you add a string field to a document, it will have the following default
mapping:

```
{
  "type": "text",
  "fields": {
    "keyword": {
      "type": "keyword",
      "ignore_above": 256
    }
  }
}
```
2016-03-29 09:49:16 +02:00
Adrien Grand 4bd27bc2a0 Type filters should not have a performance impact when there is a single type. #17350
Today, if you call /index/type/_search instead of /index/_search, elasticsearch
will automatically insert a type filter to only match documents of the given
type. This commit uses a new TypeQuery instead of a TermQuery for this filter,
which rewrites to a MatchAllDocsQuery when all documents of a shard match the
filtered type. This is helpful because BooleanQuery has a special rewrite rule
to remove MatchAllDocsQuery as FILTER clauses. So for instance if your query is
`+body:"quick fox" #_type:my_type`, it will be rewritten to
`+body:"quick fox" #*:*` which is then rewritten to `body:"quick fox"`.
2016-03-29 08:52:49 +02:00
Lee Hinman c63cb21745 Merge remote-tracking branch 'dakrone/allocation-explain' 2016-03-28 16:06:49 -06:00
Lee Hinman 80ab366de4 Add API to explain why a shard is or isn't assigned
This adds a new `/_cluster/allocation/explain` API that explains why a
shard can or cannot be allocated to nodes in the cluster. Additionally,
it will show where the master *desires* to put the shard, according to
the `ShardsAllocator`.

It looks like this:

```
GET /_cluster/allocation/explain?pretty
{
  "index": "only-foo",
  "shard": 0,
  "primary": false
}
```

Though, you can optionally send an empty body, which means "explain the
allocation for the first unassigned shard you find".

The output when a shard is unassigned looks like this:

```
{
  "shard" : {
    "index" : "only-foo",
    "index_uuid" : "KnW0-zELRs6PK84l0r38ZA",
    "id" : 0,
    "primary" : false
  },
  "assigned" : false,
  "unassigned_info" : {
    "reason" : "INDEX_CREATED",
    "at" : "2016-03-22T20:04:23.620Z"
  },
  "nodes" : {
    "V-Spi0AyRZ6ZvKbaI3691w" : {
      "node_name" : "Susan Storm",
      "node_attributes" : {
        "bar" : "baz"
      },
      "final_decision" : "NO",
      "weight" : 0.06666675,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    },
    "Qc6VL8c5RWaw1qXZ0Rg57g" : {
      "node_name" : "Slipstream",
      "node_attributes" : {
        "bar" : "baz",
        "foo" : "bar"
      },
      "final_decision" : "NO",
      "weight" : -1.3833332,
      "decisions" : [ {
        "decider" : "same_shard",
        "decision" : "NO",
        "explanation" : "the shard cannot be allocated on the same node id [Qc6VL8c5RWaw1qXZ0Rg57g] on which it already exists"
      } ]
    },
    "PzdyMZGXQdGhqTJHF_hGgA" : {
      "node_name" : "The Symbiote",
      "node_attributes" : { },
      "final_decision" : "NO",
      "weight" : 2.3166666,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    }
  }
}
```

And when the shard *is* assigned, the output looks like:

```
{
  "shard" : {
    "index" : "only-foo",
    "index_uuid" : "KnW0-zELRs6PK84l0r38ZA",
    "id" : 0,
    "primary" : true
  },
  "assigned" : true,
  "assigned_node_id" : "Qc6VL8c5RWaw1qXZ0Rg57g",
  "nodes" : {
    "V-Spi0AyRZ6ZvKbaI3691w" : {
      "node_name" : "Susan Storm",
      "node_attributes" : {
        "bar" : "baz"
      },
      "final_decision" : "NO",
      "weight" : 1.4499999,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    },
    "Qc6VL8c5RWaw1qXZ0Rg57g" : {
      "node_name" : "Slipstream",
      "node_attributes" : {
        "bar" : "baz",
        "foo" : "bar"
      },
      "final_decision" : "CURRENTLY_ASSIGNED",
      "weight" : 0.0,
      "decisions" : [ {
        "decider" : "same_shard",
        "decision" : "NO",
        "explanation" : "the shard cannot be allocated on the same node id [Qc6VL8c5RWaw1qXZ0Rg57g] on which it already exists"
      } ]
    },
    "PzdyMZGXQdGhqTJHF_hGgA" : {
      "node_name" : "The Symbiote",
      "node_attributes" : { },
      "final_decision" : "NO",
      "weight" : 3.6999998,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    }
  }
}
```

Only "NO" decisions are returned by default, but all decisions can be
shown by specifying the `?include_yes_decisions=true` parameter in the
request.

Resolves #14593
2016-03-28 15:21:02 -06:00
Igor Motov 8a5c19b25f Handle RejectedExecution gracefully in TransportService during shutdown
Today we might run into a rejected execution exception when we shutdown the node while handling a transport exception. The exception is run in a seperate thread but that thread might not be able to execute due to the shutdown. Today we barf and fill the logs with large exception. This commit catches this exception and logs it as debug logging instead.

Extends changes made in 8652cd8
2016-03-28 15:12:50 -04:00
Areek Zillur 976b8d2cee Remove dead code
This commit removes dead DeleteByQuery class from core.
2016-03-28 14:48:40 -04:00
Nik Everett 9402251eaf Remove PROTOTYPE from ShapeBuilders
Also cuts lots of tests over to expectThrows and fixes DistanceUnit's
serialization.
2016-03-26 13:58:33 -04:00
Igor Motov ee49081bc7 Take filterNodeIds into consideration while sending tasks actions requests to nodes
This commit fixes a bug that was causing the result of TransportTasksAction#filterNodeIds to be ignored and as a result the tasks actions were executed on all nodes.
2016-03-26 13:15:39 -04:00
Martijn van Groningen 444641ac55 test: cleanup imports and method rename 2016-03-26 15:13:56 +01:00
Nik Everett 8a89482555 Remove PROTOTYPE from SortBuilders 2016-03-25 22:08:50 -04:00
Martijn van Groningen 6cb82965bf percolator: Add query extract support for the blended term query and the common terms query. 2016-03-25 23:22:44 +01:00
Simon Willnauer 3b753ea4c9 Don't iterate over shard routing if it's null 2016-03-25 23:05:55 +01:00
Nicholas Knize 43d0d3e11f [TEST] Reduce size of random shapes
This commit reduces the size of the random generated shapes for eliminating stalled `geo_shape` testing.

closes #17245
2016-03-25 13:41:20 -05:00
Boaz Leskes 6c15e782af Add some debug logging to testPrimaryRelocationWhileIndexing 2016-03-25 17:25:52 +01:00
Boaz Leskes 749a851f93 Order methods in IndicesClusterStateService according to execution 2016-03-25 17:09:50 +01:00
Boaz Leskes b8227a7222 Enforce `discovery.zen.minimum_master_nodes` is set when bound to a public ip #17288
discovery.zen.minimum_master_nodes is the single most important setting to set on a production cluster. We have no way of supplying a good default so it must be set by the user. Binding a node to a public IP (as opposed to the default local host) is a good enough indication that a node will be part of a production cluster cluster and thus it's a good tradeoff to enforce the settings. Note that nothing prevent users from setting it to 1 in a single node cluster.

Closes #17288
2016-03-25 12:56:20 +01:00
Boaz Leskes fe43eef1b5 Port Primary Terms to master #17044
Primary terms is a way to make sure that operations replicated from stale primary are rejected by shards following a newly elected primary.

Original PRs adding this to the seq# feature branch #14062 , #14651 . Unlike those PR, here we take a different approach (based on newer code in master) where the primary terms are stored in the meta data only (and not in `ShardRouting` objects).

Relates to #17038

Closes #17044
2016-03-25 12:01:00 +01:00
Tal Levy cabc4b1636 add on_failure exception metadata to ingest document for verbose simulate 2016-03-24 16:11:47 -07:00
Nik Everett 584ba6133d Remove PROTOTYPE from RescorerBuilders
This changes the serialization order for QueryRescorerBuilder's but
that is ok because 5.0.0 doesn't need to be wire compatible with anything.
2016-03-24 13:04:37 -04:00
Nik Everett 5e8656aff0 Throw an exception if Writeable.Reader reads null
If a Writeable.Reader returns null it is always a bug, probably one that
will cause corruption in the StreamInput it was trying to read from. This
commit adds a check that attempts to catch these errors quickly including
the name of the reader.
2016-03-24 13:02:22 -04:00
Boaz Leskes 6dd164d0bd Include pings from client nodes in master election
We currently have a `discovery.zen.master_election.filter_client` setting that control whether their ping responses are ignored for master election (which is the current default). With the push to treat client nodes as normal nodes (and promote the transport/rest clients for client work), this should be changed. This commit remove this setting and it's companion `discovery.zen.master_election.filter_data` setting (currently defaulting to  false) in favor of singe `discovery.zen.master_election.ignore_non_master_pings` setting with more intuitive name (defaulting to false).

Resolves #17325
Closes #17329
2016-03-24 17:48:05 +01:00
Simon Willnauer d0413f0f0e Merge pull request #17327 from s1monw/harden_test
Improve test to not rely on thread slowness

We have to swap the second latch before we count it down otherwise
threads might be faster than the test. This has happend on a recent
CI failure: https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-os-compatibility/os=ubuntu/121/console

This commit also adds a synchronized on the close method since it's
canceling and modifying a member varialbe that is assigned under lock.
2016-03-24 16:51:48 +01:00
Simon Willnauer f81fb89ea5 simplify test to not use lambda at all 2016-03-24 16:48:50 +01:00
Simon Willnauer 49d868b491 Improve test to not rely on thread slowness
We have to swap the second latch before we count it down otherwise
threads might be faster than the test. This has happend on a recent
CI failure: https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+master+multijob-os-compatibility/os=ubuntu/121/console

This commit also adds a synchronized on the close method since it's
canceling and modifying a member varialbe that is assigned under lock.
2016-03-24 16:30:34 +01:00
Nik Everett 93ab4cfc99 Stop using PROTOTYPE in NamedWriteableRegistry
readFrom is confusing because it requires an instance of the type that it
is reading but it doesn't modify it. But we also have (deprecated) methods
named readFrom that *do* modify the instance. The "right" way to implement
the non-modifying readFrom is to delegate to a constructor that takes a
StreamInput so that the read object can be immutable. Now that we have
`@FunctionalInterface`s it is fairly easy to register things by referring
directly to the constructor.

This change modifying NamedWriteableRegistry so that it does that. It keeps
supporting `registerPrototype` which registers objects to be read by
readFrom but deprecates it and delegates it to a new `register` method
that allows passing a simple functional interface. It also cuts Task.Status
subclasses over to using that method.

The start of #17085
2016-03-24 11:26:44 -04:00
javanna ce86fc5647 Cluster Stats: remove mem section
The available memory metric was always set to `0` since 2.0.beta1 (bug).  was left behind but never set. Turns out the section wasn't that useful, as it would only output the total memory available throughout all nodes in the cluster. We decided to remove the section then.
2016-03-24 15:49:27 +01:00
Jason Tedor f522fa1df3 Settings loader local variables can be final 2016-03-24 10:25:46 -04:00
Jason Tedor ad5438a6a9 Use expectThrows in YamlSettingsLoaderTests
This commit refactors the unit tests in YamlSettingsLoaderTests to use
exceptThrows for simplification.
2016-03-24 10:14:04 -04:00
Jason Tedor 84a308db80 Fix line-length issues in YamlSettingsLoaderTests
This commit fixes a line-length checkstyle violation in
YamlSettingsLoaderTests.java and removes this file from the checkstyle
line-length suppressions.
2016-03-24 10:14:04 -04:00
Jason Tedor f9500b1d6a Use expectThrows in JsonSettingsLoaderTests
This commit refactors the unit tests in JsonSettingsLoaderTests to use
exceptThrows for simplification.
2016-03-24 10:14:03 -04:00
Jason Tedor 7841b439ec Fix line-length issue in JsonSettingsLoaderTests
This commit fixes a line-length checkstyle violation in
JsonSettingsLoaderTests.java and removes this file from the checkstyle
line-length suppressions.
2016-03-24 10:14:03 -04:00
Jason Tedor ca5e48d39a Test that NoDuplicatesProperties throws for null value
This commit adds a test that NoDuplicatesProperties throws a
NullPointerException if an attempt is made to put a key that corresponds
to a null value. This behavior ultimately comes from the super class
Properties but the test ensures that we retain this behavior.
2016-03-24 09:47:01 -04:00
Jason Tedor cf92151513 Fix line-length issue in PropertiesSettingsLoader
This commit fixes a line-length checkstyle violation in
PropertiesSettingsLoader.java and removes this file from the checkstyle
line-length suppressions.
2016-03-24 09:47:01 -04:00
Jason Tedor c0fa00a2fd Use expectThrows in PropertiesSettingsLoaderTests
This commit refactors the unit tests in PropertiesSettingsLoaderTests to
use exceptThrows for simplification.
2016-03-24 09:47:01 -04:00
Jason Tedor 7323c37339 Refactor PropertiesSettingsLoader
This commit refactors PropertiesSettingsLoader to remove some duplicate
code.
2016-03-24 09:44:21 -04:00
Jason Tedor bb364cc793 Merge pull request #17310 from jasontedor/null-valued-settings
Add guard against null-valued settings
2016-03-24 07:53:58 -04:00
Jason Tedor 0c1b15f617 Clarify Javadocs for SettingsLoaderFactory 2016-03-24 07:45:39 -04:00
Jason Tedor f4db2e2691 Mark two local variables as final in PSLT.java 2016-03-24 07:36:45 -04:00
Jason Tedor 4d27328a83 Reverse meaning of XContentSettingsLoader flag
The sole constructor of XContentSettingsLoader accepts a boolean flag
that indicates whether or not null values parsed from the source should
be rejected or not. Previously a true value for this flag meant that
null values should be rejected. With this commit, the meaning of this
flag is reversed so that a true value means that null values should be
accepted (note that this is needed due to the way that settings are
unset via the cluster update settings API). The name of this flag has
been changed from guardAgainstNullValuedSettings to allowNullValues, for
clarity.
2016-03-24 07:35:57 -04:00
Martijn van Groningen 9399f673d1 percolator: Add support to extract terms from TermsQuery 2016-03-24 10:25:30 +01:00
Adrien Grand e5074e2b1b Make `parseMultiField` part of `parseField`. #17313
All our fields are supposed to support multi fields, so we could put the logic in
`TypeParsers.parseField` instead of duplicating the logic in every type parser.
2016-03-24 10:15:04 +01:00
Jim Ferenczi da42f199bd Enforce isolated mode for all plugins
This commit removes the isolated option, each plugin have its own classloader.
2016-03-24 09:17:33 +01:00
Alexander Reelsen 69b71e66f3 Fix compilation error 2016-03-24 08:49:36 +01:00
Alexander Reelsen b2573858b6 Version: Set version to 5.0.0-alpha1
Change version, required a minor fix in the RPM building.
In case of a alpha/beta version, the release will contain alpha/beta
as the RPM version cannot contains dashes/tildes.
2016-03-24 08:36:08 +01:00
Igor Motov 8202bf212c Don't wait for completion of list tasks tasks when wait_for_completion flag is set
Waiting for completion of list tasks tasks can cause an infinite loop of a list tasks task waiting for its own completion or completion of its children. To reproduce run:

```
curl "localhost:9200/_tasks?wait_for_completion"
```
2016-03-23 23:00:15 -04:00
Jason Tedor 4aa5426361 Add guard against null-valued settings
This commit adds a guard against null-valued settings that are loaded
from yaml or json settings files, and also adds a test that ensures
the same remains true for settings loaded from properties files.
2016-03-23 22:35:50 -04:00