Commit Graph

23880 Commits

Author SHA1 Message Date
David Pilato 8bc15039cd Fix after review 2016-08-09 19:44:42 +02:00
Clinton Gormley 0dd6f63c49 Fixed missing changes in the version bump to alpha6 2016-08-09 18:52:03 +02:00
Clinton Gormley eac14f6e3d Bumped version to 5.0.0-alpha6 and added bwc indices for alpha5 2016-08-09 18:31:27 +02:00
Lee Hinman 2be52eff09 Circuit break the number of inline scripts compiled per minute
When compiling many dynamically changing scripts, parameterized
scripts (<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting-using.html#prefer-params>)
should be preferred. This enforces a limit to the number of scripts that
can be compiled within a minute. A new dynamic setting is added -
`script.max_compilations_per_minute`, which defaults to 15.

If more dynamic scripts are sent, a user will get the following
exception:

```json
{
  "error" : {
    "root_cause" : [
      {
        "type" : "circuit_breaking_exception",
        "reason" : "[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead",
        "bytes_wanted" : 0,
        "bytes_limit" : 0
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "i",
        "node" : "a5V1eXcZRYiIk8lecjZ4Jw",
        "reason" : {
          "type" : "general_script_exception",
          "reason" : "Failed to compile inline script [\"aaaaaaaaaaaaaaaa\"] using lang [painless]",
          "caused_by" : {
            "type" : "circuit_breaking_exception",
            "reason" : "[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead",
            "bytes_wanted" : 0,
            "bytes_limit" : 0
          }
        }
      }
    ],
    "caused_by" : {
      "type" : "general_script_exception",
      "reason" : "Failed to compile inline script [\"aaaaaaaaaaaaaaaa\"] using lang [painless]",
      "caused_by" : {
        "type" : "circuit_breaking_exception",
        "reason" : "[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead",
        "bytes_wanted" : 0,
        "bytes_limit" : 0
      }
    }
  },
  "status" : 500
}
```

This also fixes a bug in `ScriptService` where requests being executed
concurrently on a single node could cause a script to be compiled
multiple times (many in the case of a powerful node with many shards)
due to no synchronization between checking the cache and compiling the
script. There is now synchronization so that a script being compiled
will only be compiled once regardless of the number of concurrent
searches on a node.

Relates to #19396
2016-08-09 10:26:27 -06:00
Lee Hinman 2f8e3db1e8 Add quotes to prevent shell globbing in TESTING.asciidoc 2016-08-09 09:11:45 -06:00
Yannick Welsch 6abcd42a05 Simplify RoutingNodes interface (#19870)
Slims the public interface of RoutingNodes down to 4 methods to update routing entries:
- initializeShard() -> initializes an unassigned shard
- startShard() -> starts an initializing shard / completes relocation of a shard
- relocateShard() -> starts relocation of a started shard
- failShard() -> fails/cancels an assigned shard

In the spirit of PR #19743, where deassociateDeadNodes was moved to its own public method to be only called when nodes have actually left the cluster and not on every reroute step, this commit also removes electPrimariesAndUnassignedDanglingReplicas from AllocationService and folds it into the shard failure logic. This means that an active replica is promoted to primary in the same method where the primary was failed. Previously we would scan in each reroute iteration for active replicas to be promoted to primary.
2016-08-09 17:07:13 +02:00
David Pilato 9b10bb7693 Fix toString method
See https://github.com/elastic/elasticsearch/pull/19773#issuecomment-238564524

Was introduced with #18939
2016-08-09 16:32:05 +02:00
Clinton Gormley 1760e00489 Bumped version in docs 2016-08-09 15:57:35 +02:00
David Pilato d28cc73046 Fix after merge 2016-08-09 12:34:52 +02:00
David Pilato 2a05030e22 Fix after merge 2016-08-09 12:14:50 +02:00
David Pilato 4d272cc9b2 Merge branch 'master' into fix/19772-toString
# Conflicts:
#	core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TransportTasksActionTests.java
2016-08-09 11:53:29 +02:00
Luca Cavanna af5fbcddfc Merge pull request #19871 from javanna/fix/short_query_multiple_fields
Throw exception when multiple field names are provided as part of query short syntax
2016-08-09 11:15:36 +02:00
Adrien Grand c44679d952 Save one utf8 conversion in KeywordFieldMapper. #19867
If a `keyword` field is both indexed and doc-valued, then we will convert the
input string to utf8 bytes twice: once for indexing/storing, and once for doc
values. This commit changes `keyword` fields to compute the utf8 representation
up-front and then feed both the inverted index and doc values with it.

Rather than adding version-based bw compat logic, I broke the `keyword` field
(they are now indexed/stored as a binary field rather than string), which is
fine since we are still on alpha releases for 5.0.
2016-08-09 10:06:30 +02:00
javanna f9a40344b2 Modify term query error when multiple fields are provided to comply with all other queries 2016-08-09 10:01:56 +02:00
javanna 0f54cb69ab Throw parsing error if span term query contains multiple fields in its short version 2016-08-09 09:53:03 +02:00
javanna d4db987825 Add common method that throws exception whenever multiple fields are provided in a query that support one field only
This makes sure that error messages are unified, and makes us save a few lines of code too.
2016-08-09 09:52:28 +02:00
javanna bbf40ca0cf [TEST] test that term query short syntax throws error when multiple fields are provided 2016-08-09 09:50:12 +02:00
Jason Tedor 1aba907ea2 Remove dead OOM handling in engine
Previously, the engine would catch an out of memory error and would try
to handle the error (it would try to fail the engine, and then it would
swallow the out of memory error). Catching the out of memory errors was
removed in 3343ceeae4 so this code path is
not effectively dead. This commit removes this dead code from the
engine.

Relates #19881
2016-08-08 21:59:49 -04:00
Areek Zillur d107141bf6 Remove payload option from completion suggester
The payload option was introduced with the new completion
suggester implementation in v5, as a stop gap solution
to return additional metadata with suggestions.

Now we can return associated documents with suggestions
(#19536) through fetch phase using stored field (_source).
The additional fetch phase ensures that we only fetch
the _source for the global top-N suggestions instead of
fetching _source of top results for each shard.
2016-08-08 16:04:06 -04:00
javanna f547886a9b [TEST] remove AwaitsFix that was fixed with #16615 2016-08-08 20:39:55 +02:00
javanna 9beb82b036 [TEST] remove unused argument from GeoPolygonQueryBuilderTests#randomPolygon 2016-08-08 20:39:55 +02:00
Ryan Ernst a73c7e3bf0 Merge pull request #19873 from rjernst/norelease_check
Add back norelease check when building a release
2016-08-08 11:22:36 -07:00
Ryan Ernst 6c34a8f4ee Add back norelease check when building a release
This was lost around 2.1. This change adds it back.

closes #19246
2016-08-08 11:20:36 -07:00
javanna 27a6983646 Throw parsing error if wildcard query contains multiple fields in its short version 2016-08-08 19:42:48 +02:00
javanna 796bc74163 Throw parsing error if regexp query contains multiple fields in its short version 2016-08-08 19:42:37 +02:00
javanna 8f485b3614 Throw parsing error if prefix query contains multiple fields in its short version 2016-08-08 19:42:26 +02:00
javanna 040f9c6be6 Throw parsing error if match query contains multiple fields in its short version 2016-08-08 19:42:14 +02:00
javanna d5316b2783 Throw parsing error if match phrase query contains multiple fields in its short version 2016-08-08 19:42:01 +02:00
javanna cb41f304f2 Throw parsing error if match phrase prefix query contains multiple fields in its short version 2016-08-08 19:41:45 +02:00
javanna 5d238e86f6 Throw parsing error if fuzzy query contains multiple fields in its short version 2016-08-08 19:40:54 +02:00
javanna 1db3c67e31 Throw parsing error if common terms query contains multiple fields in its short version 2016-08-08 19:40:23 +02:00
javanna 329eaaea65 [TEST] expand AbstractQueryTestCase#testQueryWrappedInArray to run against query alternate versions 2016-08-08 19:09:43 +02:00
Colin Goodheart-Smithe bf0e42aaeb #19855 Throw exception when maxBounds greater than minBounds
Throw exception when maxBounds greater than minBounds
2016-08-08 13:17:25 +01:00
Colin Goodheart-Smithe 4735e0a9d3 Throw exception when maxBounds greater than minBounds
The recent changes to the Histogram Aggregator introduced a bug where
an exception would not be thrown if the maxBound of the extended bounds
is less that the minBound. This change fixes that bug.

Closes #19833
2016-08-08 12:09:43 +01:00
Yannick Welsch 180eff14dd Fix issue when relocation source and target routings are failed in same batch update
PR #19715 made AllocationService less lenient, requiring ShardRouting instances that are passed to its applyStartedShards and
applyFailedShards methods to exist in the routing table. As primary shard failures also fail initializing replica shards,
concurrent replica shard failures that are treated in the same cluster state update might not reference existing replica entries
in the routing table anymore. To solve this, PR #19715 ordered the failures by first handling replica before
primary failures. There are other failures that influence more than one routing entry, however. When we have a failed shard entry
for both a relocation source and target, then, depending on the order, either one or the other might point to an out-dated shard
entry. As finding a good order is more difficult than applying the failures, this commit re-adds parts of the ShardRouting
re-resolve logic so that the applyFailedShards method can properly treat shard failure batches.
2016-08-08 11:46:48 +02:00
David Pilato 97dfa2ba40 Fix typo
Reported at https://discuss.elastic.co/t/little-error-in-documentation-page-mapping-parameters-format/57424
2016-08-08 10:52:09 +02:00
javanna 73d0a1b777 [DOCS] clarify behaviour when routing is required and no routing value is specified
This note in the delete api about broadcasting to all shards is a leftover that should have been removed when the broadcasting feature was removed

Relates to #10136
2016-08-08 10:41:59 +02:00
Jason Tedor 920a21e55c Fix parsing in test set max number of threads
This commit fixes a test bug in
EvilJNANativesTests#testSetMaximumNumberOfThreads. Namely, the test was
not checking whether or not the value from /proc/self/limits was equal
to "unlimited" before attempting to parse as a long. This commit fixes
that error.
2016-08-07 13:05:07 -04:00
Nicholas Knize ab0a0cd4d4 fix rogue license header 2016-08-05 23:21:16 -05:00
Nicholas Knize 2d590af593 Deprecate GeoDistance enumerators and remove geo distance script helpers
GeoDistance is implemented using a crazy enum that causes issues with the scripting modules. This commit moves all distance calculations to arcDistance and planeDistance static methods in GeoUtils. It also removes unnecessary distance helper methods from ScriptDocValues.GeoPoints.
2016-08-05 18:42:06 -05:00
Areek Zillur 469eb2546d Merge pull request #19536 from areek/enhancement/completion_suggester_documents
Add support for returning documents with completion suggester
2016-08-05 18:55:08 -04:00
Areek Zillur fee013c07c Add support for returning documents with completion suggester
This commit enables completion suggester to return documents
associated with suggestions. Now the document source is returned
with every suggestion, which respects source filtering options.

In case of suggest queries spanning more than one shard, the
suggest is executed in two phases, where the last phase fetches
the relevant documents from shards, implying executing suggest
requests against a single shard is more performant due to the
document fetch overhead when the suggest spans multiple shards.
2016-08-05 17:51:45 -04:00
Christoph Büscher fbbb633d81 Merge pull request #19825 from cbuescher/register-namedWritables-transportClient
Add NamedWriteables from plugins to TransportClient
2016-08-05 22:51:04 +02:00
javanna 2437226802 [TEST] restore tests repeatability in AbstractQueryTestCase
Some random operations were conditionally performed in the before test, which made tests not repeatable. For instance take the seed chain to repeat a specific iteration and try to reproduce it, this conditional code would get executed in both cases when trying to isolate the failure, but not among the different iterations (as only the first method/iteration executes it), hence the failure will not reproduce.

Moved the random operations to beforeClass and left the non random part in the before method, which is needed as it depends on some method that can be overridden by subclasses.
2016-08-05 22:38:31 +02:00
Christoph Büscher 6ccb70e1ab Avoid using injector and more test to TransportClientTests 2016-08-05 21:39:44 +02:00
Jason Tedor 64c7ba96d9 Add field for plugins installed on issue template
This commit adds a field to the GitHub issue template for a list of the
plugins that are installed on the Elasticsearch installation. This is a
common enough ask that it is better to just collect this information up
front.

Relates #19840
2016-08-05 15:31:03 -04:00
Jason Tedor a62740bbd2 Avoid early initializing Netty
Today when we load the Netty plugins, we indirectly cause several Netty
classes to initialize. This is because we attempt to load some classes
by name, and loading these classes is done in a way that triggers a long
chain of class initializers within Netty. We should not do this, this
can lead to log messages before the logger is loader, and it leads to
initialization in cases when the classes would never be needed (for
example, Netty 3 class initialization is never needed if Netty 4 is
used, and vice versa). This commit avoids this early initialization of
these classes by removing the need for the early loading.

Relates #19819
2016-08-05 14:58:33 -04:00
Christoph Büscher 37c433aace Merge pull request #19837
Ensure PutMappingRequest.buildFromSimplifiedDef input are pairs
2016-08-05 20:31:49 +02:00
Christoph Büscher 10d64eb43a Remove unneeded 140 character line suppresions 2016-08-05 19:42:52 +02:00
Christoph Büscher e57f76aa2d Ensure PutMappingRequest.buildFromSimplifiedDef fails when input isn't pairs
The method requires pairs of fieldnames and property arguments and will fail if
the varargs input is an uneven number. We should check this and fail with an
appropriate IllegalArgumentException instead.
2016-08-05 19:25:20 +02:00