Commit Graph

5974 Commits

Author SHA1 Message Date
javanna 297b2d6739 remove unused methods from SuggestUtils
Parsing code was moved to the builder objects, these methods were left behind unused
2016-08-10 12:28:06 +02:00
javanna 2c44278ce8 [TEST] use ParseField instead of plain strings in query tests 2016-08-10 12:21:25 +02:00
javanna 0a98b5e56e [TEST] make AbstractQueryTestCase#testUnknownObjectException more accurate
testUnknownObjectException used to generate malformed json objects in some cases, due to the existence of arrays as it was not closing the injected object correctly. That is why the test was catching JsonParseException among the exception that are expected to be thrown. That is fixed by tracking where the new object is placed and placing its end object marker to the right level rather than always at the end.

Also introduced a mechanism to explicitly declare objects that won't cause any exception when they get additional objects injected, so that there is no need to override the method anymore as that caused copy pasting of the whole test method. This also makes sure that changes are reflected in tests, as those inner objects are not skipped but we actually check that what is declared is true (no exceptions get thrown when an additional object is added within them.
2016-08-10 11:48:51 +02:00
javanna f221b0ce52 [TEST] inner_hits is now parsed on the coord node, no need to skip such objects in testUnknownObjectException 2016-08-10 11:48:51 +02:00
javanna 57b90cb6ce rename local loop variable ingore->ignore 2016-08-10 10:17:54 +02:00
Adrien Grand 42725e9339 Fix expectations of GeoPointFieldMapperTests.
Closes #19895
2016-08-10 09:30:39 +02:00
Ryan Ernst 6efbe54255 Remove alpha5 bwc indexes
We don't have bwc indexes for alpha releases.
2016-08-09 13:25:16 -07:00
Ali Beyad 601602b364 Check restores in progress before deleting a snapshot (#19853)
Currently, when attempting to delete a snapshot, we check
if a snapshot is in progress before proceeding with the
delete. However, we do not check if a restore is taking
place before deleting. This can lead to concurrency issues
where a restore is in progress but the snapshotted files
for the restore are being deleted underneath.

This commit first checks if a restore is in progress and
if so, it prevents the deletion of a snapshot with an
exception.

Note that this is not a complete solution because it is
still possible that a restore of the same snapshot is
started after the deletion commenced but before the
deletion finished. But there is a much smaller window
for this to occur and this commit is a quick way to
check for the common case.
2016-08-09 15:07:09 -05:00
Areek Zillur 16d93e5a53 Merge pull request #19877 from areek/fix/remove_completion_payload
Remove payload option from completion suggester
2016-08-09 15:27:29 -04:00
David Pilato 90dbce9682 Merge branch 'fix/19772-toString' 2016-08-09 20:37:27 +02:00
Lee Hinman 5849c488b5 Merge remote-tracking branch 'dakrone/compliation-breaker' 2016-08-09 11:57:26 -06:00
David Pilato 8bc15039cd Fix after review 2016-08-09 19:44:42 +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
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
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
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
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
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
Christoph Büscher 6ccb70e1ab Avoid using injector and more test to TransportClientTests 2016-08-05 21:39:44 +02: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 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
Britta Weber 981478e4a9 mute test 2016-08-05 19:10:13 +02:00
Britta Weber 899cddefb6 make ctors protected (#19831)
This is useful if we need an acknowledged instance in a test
2016-08-05 17:13:26 +02:00