Commit Graph

5824 Commits

Author SHA1 Message Date
Michael McCandless 71166c020a Merge pull request #19554 from mikemccand/negative_usable_space
Guard against negative result from FileStore.getUsableSpace when picking data path for a new shard
2016-07-29 20:26:30 -04:00
Mike McCandless 59181c8a66 use mockito instead 2016-07-29 17:13:01 -04:00
Nik Everett bdebd02d8c Only write forced_refresh if we forced a refresh
Otherwise it just adds noise to the response.

Closes #19629
2016-07-29 15:00:30 -04:00
Alexander Lin 119026b4fb Remove isCreated and isFound from the Java API
This is cleanup work from #19566, where @nik9000 suggested trying to nuke the isCreated and isFound methods. I've combined nuking the two methods with removing UpdateHelper.Operation in favor of DocWriteResponse.Operation here.

Closes #19631.
2016-07-29 14:21:43 -04:00
Martijn van Groningen a91bb29585 ingest: Made the response format of the get pipeline api match with the response format of the index template api
Closes #19585
2016-07-29 17:58:30 +02:00
Mike McCandless 37e0e63a65 add defense to selectNewPathForShard 2016-07-29 11:51:33 -04:00
Nik Everett ad028f3f9c Squash o.e.rest.action.admin.indices
In an effort to reduce the number of tiny packages we have in the
code base this moves all the files that were in subdirectories of
`org.elasticsearch.rest.action.admin.indices` into
`org.elasticsearch.rest.action.admin.indices`.

It also adds a `package-info.java` file explaining what the files in
the package *do*.

Also fixes line length in these packages. It makes a single non-checkstyle
change: implementing `ToXContent` on `GetIndexTemplatesResponse`. I did
this because it was the right thing to do and it fixed a line length
violation.
2016-07-29 10:08:03 -04:00
Martijn van Groningen 81112508ea test: fix type in test name 2016-07-29 14:52:24 +02:00
Martijn van Groningen 72e0d422e9 Plain highlighter should ignore parent/child queries.
The plain highligher fails when it tries to select the fragments based on a query containing either a `has_child` or `has_parent` query.

The plain highligher should just ignore parent/child queries as it makes no sense to highligh a parent match with a has_child as the child documents are not available at highlight time. Instead if child document should be highlighed inner hits should be used.

Parent/child queries already have no effect when the `fvh` or `postings` highligher is used. The test added in this commit verifies that.

Closes #14999
2016-07-29 12:41:11 +02:00
Colin Goodheart-Smithe f1257bfb86 Added JavaDocs and comments to ParseField 2016-07-29 09:39:38 +01:00
Colin Goodheart-Smithe cd88b7724e Undeprecates `aggs` in the search request
This change adds a second ParseField for the `aggs` field in the search
request so both `aggregations` and `aggs` are undeprecated allowed
fields in the search request

Closes #19504
2016-07-29 09:14:32 +01:00
Adrien Grand dcc598c414 Make the heuristic to compute the default shard size less aggressive.
The current heuristic to compute a default shard size is pretty aggressive,
it returns `max(10, number_of_shards * size)` as a value for the shard size.
I think making it less aggressive has the benefit that it would reduce the
likelyness of running into OOME when there are many shards (yearly
aggregations with time-based indices can make numbers of shards in the
thousands) and make the use of breadth-first more likely/efficient.

This commit replaces the heuristic with `size * 1.5 + 10`, which is enough
to have good accuracy on zipfian distributions.
2016-07-29 09:59:29 +02:00
Nik Everett e04f06258f Assert we return Location header with 201 CREATED
Add an assertion to the most popular way of turning the response object
into the actual http response. As it stands all places we return
`201 CREATED` we return the `Location` header. This will help to keep it
that way, though it won't catch all uses.

Followup to #19509
2016-07-28 16:13:58 -04:00
Mike McCandless ed5e5db188 merge master 2016-07-28 11:55:16 -04:00
Areek Zillur 69941931c7 Merge pull request #19610 from areek/enhancement/19484
Add zero-padding to auto-generated rollover index name increment
2016-07-28 11:44:50 -04:00
Mike McCandless ef15e1b91f work around JDK bug: if FileStore.getXXXSpace APIs return negative value, change that to Long.MAX_VALUE instead 2016-07-28 11:31:16 -04:00
David Pilato 0d2ccf0989 Merge branch 'pr/15724-gce-network-host-master' 2016-07-28 16:59:18 +02:00
David Pilato 7b9ce1212f Merge branch 'fix/npe-simulate-pipeline-no-id' 2016-07-28 14:55:07 +02:00
Colin Goodheart-Smithe bab3e766c7 #19649 Makes `m` case sensitive in TimeValue
Makes `m` case sensitive in TimeValue
2016-07-28 13:00:57 +01:00
David Pilato d406b88857 Fix NPE when simulating a pipeline with no id
When you simulate a pipeline without specifying an id against a node where the request is redirected to a master node,
the request and the response is throwing a NPE:

```
java.lang.NullPointerException
    at __randomizedtesting.SeedInfo.seed([3B9536AC6AA23C06:DD62280CF765DA1F]:0)
    at org.elasticsearch.common.io.stream.StreamOutput.writeString(StreamOutput.java:300)
    at org.elasticsearch.action.ingest.SimulatePipelineRequest.writeTo(SimulatePipelineRequest.java:92)
    at org.elasticsearch.transport.local.LocalTransport.sendRequest(LocalTransport.java:222)
    at org.elasticsearch.test.transport.AssertingLocalTransport.sendRequest(AssertingLocalTransport.java:95)
    at org.elasticsearch.transport.TransportService.sendRequest(TransportService.java:470)
    at org.elasticsearch.action.TransportActionNodeProxy.execute(TransportActionNodeProxy.java:51)
    at org.elasticsearch.client.transport.support.TransportProxyClient.lambda$execute$441(TransportProxyClient.java:63)
    at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:233)
    at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:63)
    at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:309)
    at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
    at org.elasticsearch.client.FilterClient.doExecute(FilterClient.java:67)
    at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
    at org.elasticsearch.client.support.AbstractClient$ClusterAdmin.execute(AbstractClient.java:710)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
    at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
    at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:62)
    at org.elasticsearch.ingest.bano.BanoProcessorIntegrationTest.testSimulateProcessorConfigTarget(BanoProcessorIntegrationTest.java:139)
```

This patch fixes this and adds some random tests.
2016-07-28 13:28:24 +02:00
Britta Weber 105dce0e07 fix explain in function_score if no function filter matches (#19185)
* fix explain in function_score if no function filter matches

When each function in function_score has a filter but none of them matches
we always assume 1 for the combined functions and then combine that with the
sub query score.
But the explanation did not reflect that because in case no function matched
we did not even use the actual score that was computed in the explanation.
2016-07-28 13:14:08 +02:00
Colin Goodheart-Smithe eab5ceb9de Makes `m` case sensitive in TimeValue
The reason for this change is that currently if a user specifies e.g.`2M`
meaning 2 months as a time value instead of throwing an exception
explaining that time units in months are not supported (due to months
having variable time spans) we instead will parse this to 2 minutes.
This could be surprising to a user and could mean put a lot of load on
the cluster performing a task that was never intended and whose results
will be useless anyway.

It is generally accepted that `m` indicates minutes and `M` indicates
months with time values so this is consistent with the expectations a
user might have around specifying time units.

A concrete example of where this causes issues is in the decay score
function which uses TimeValue to parse the scale and offset parameters
of the decay into millisecond values to use in the calculation.

Relates to #19619
2016-07-28 11:27:24 +01:00
Lee Hinman 9fa33b6d07 [TEST] throw correct error within assertBusy in TruncateTranslogIT 2016-07-27 16:40:49 -06:00
Ryan Ernst dcf42b8d64 Merge pull request #19638 from rjernst/filewatcher_interface
Change file changes listener for resource watcher to an interface
2016-07-27 15:33:14 -07:00
Nik Everett 56ee49255b Only log running out of slots when out of slots (#19637)
We were logging on every `refresh=wait_for`.
2016-07-27 18:26:09 -04:00
Ryan Ernst 95499c45a5 Change file changes listener for resource watcher to an interface
Currently to use the ResourceWatcherService to watch files, you
implement a FileChangesListener. However, this is a class, not an
interface, even though it has no base state or anything like that, just
defining a few methods. This change converts FileChangesListener to an
interface.
2016-07-27 15:25:24 -07:00
Nik Everett fb45f6a8a8 Add authentication to reindex-from-remote
The tests for authentication extend ESIntegTestCase and use a mock
authentication plugin. This way the clients don't have to worry about
running it. Sadly, that means we don't really have good coverage on the
REST portion of the authentication.

This also adds ElasticsearchStatusException, and exception on which you
can set an explicit status. The nice thing about it is that you can
set the RestStatus that it returns to whatever arbitrary status you like
based on the status that comes back from the remote system.
reindex-from-remote then uses it to wrap all remote failures, preserving
the status from the remote Elasticsearch or whatever proxy is between us
and the remove Elasticsearch.
2016-07-27 14:17:41 -04:00
Areek Zillur 4e3602a790 Add zero-padding to auto-generated rollover index name increment
closes #19484
2016-07-27 10:50:47 -04:00
David Pilato 9cb1e79e84 Fix comments and method name 2016-07-27 13:35:58 +02:00
David Pilato 3d9f2bf531 Revert last change and make generateCustomNameResolvers private in Node class 2016-07-27 12:19:08 +02:00
David Pilato e949101cc7 Move generateCustomNameResolvers to DiscoveryPlugin interface 2016-07-27 11:36:06 +02:00
David Pilato e9339a1960 Merge branch 'master' into pr/15724-gce-network-host-master 2016-07-27 11:24:53 +02:00
David Pilato b62bb47663 Move registerCustomNameResolvers to Node class and rename it 2016-07-27 11:23:25 +02:00
Martijn van Groningen 24d7fa6d54 ingest: Change the `foreach` processor to use the `_ingest._value` ingest metadata attribute to store the current array element being processed.
Closes #19592
2016-07-27 09:35:09 +02:00
Ali Beyad 21ff90fed3 Fixes debug logging on index creation waiting for shards to be started (#19612) 2016-07-26 19:17:02 -04:00
Lee Hinman 0876247bca [TEST] Assert that shard has been released before running truncate tool
It's possible that the shard has been closed but the resources
associated with it have not yet been released. This waits until the
index lock can be obtained before running the tool.
2016-07-26 14:14:04 -06:00
Igor Motov 7275291f35 Tests: add more logging to testCorruptFileThenSnapshotAndRestore
This test fails because of an unknown exceptions in FsService.stats() method, which causes no stats to be returned. With this change the exception that is causing this issue is going to be logged.

Related to #19591 and #17964
2016-07-26 15:08:19 -04:00
Nik Everett 9270e8b22b Rename client yaml test infrastructure
This makes it obvious that these tests are for running the client yaml
suites. Now that there are other ways of running tests using the REST
client against a running cluster we can't go on calling the shared
client yaml tests "REST tests". They are rest tests, but they aren't
**the** rest tests.
2016-07-26 13:53:44 -04:00
Chris Earle 0553ba9151 [Ingest] Add REST _ingest/pipeline to get all pipelines
This adds an extra REST handler for "_ingest/pipeline" so that users do not need to supply "_ingest/pipeline/*" to get all of them.

- Also adds a teardown section to related REST-tests for ingest.
2016-07-26 13:48:15 -04:00
David Pilato 0d3edee928 Merge branch 'master' into pr/15724-gce-network-host-master 2016-07-26 18:51:01 +02:00
David Pilato fde15ae470 Move custom name resolvers to NetworkService CTOR
Instead of using NetworkModule we can directly inject them in NetworkService CTOR.

See https://github.com/elastic/elasticsearch/pull/15765#issuecomment-235307974
2016-07-26 18:26:30 +02:00
Christoph Büscher e1415d6519 Merge pull request #19595 from cbuescher/fix-19422
Allow empty json object in request body in `_count` API.
2016-07-26 18:17:52 +02:00
Boaz Leskes 8151224883 add `Socket closed` variant to NetworkExceptionHelper.isCloseConnectionException 2016-07-26 18:01:57 +02:00
Lee Hinman e538c1c6d6 Merge remote-tracking branch 'dakrone/translog-cli' 2016-07-26 09:39:11 -06:00
Nik Everett a182e356d3 Fix unit test build failure
We didn't catch the failure because we tested against the fork instead
of master. I think.
2016-07-26 11:35:17 -04:00
Alexander Lin 8f2882a442 Add _operation field to index, update, delete responses
Performing the bulk request shown in #19267 now results in the following:
```
{"_index":"test","_type":"test","_id":"1","_version":1,"_operation":"create","forced_refresh":false,"_shards":{"total":2,"successful":1,"failed":0},"status":201}
{"_index":"test","_type":"test","_id":"1","_version":1,"_operation":"noop","forced_refresh":false,"_shards":{"total":2,"successful":1,"failed":0},"status":200}
```
2016-07-26 11:16:19 -04:00
Lee Hinman ac53c90ff4 Add 'elasticsearch-translog' CLI tool with 'translog' command
This adds the `bin/elasticsearch-translate` bin file that will be used
for CLI tasks pertaining to Elasticsearch. Currently it implements only
a single sub-command, `truncate-translog`, that creates a truncated
translog for a given folder.

Here's what running the tool looks like:

```
λ bin/elasticsearch-translog truncate -d data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/
Checking existing translog files
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!   WARNING: Elasticsearch MUST be stopped before running this tool   !
!                                                                     !
!   WARNING:    Documents inside of translog files will be lost       !
!                                                                     !
!   WARNING:          The following files will be DELETED!            !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-10.tlog
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-18.tlog
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-21.tlog
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-12.ckp
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-25.ckp
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-29.tlog
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-2.tlog
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-5.tlog
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-41.ckp
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-6.ckp
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-37.ckp
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-24.ckp
--> data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-11.ckp

Continue and DELETE files? [y/N] y
Reading translog UUID information from Lucene commit from shard at [data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/index]
Translog Generation: 3
Translog UUID      : AxqC4rocTC6e0fwsljAh-Q
Removing existing translog files
Creating new empty checkpoint at [data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog.ckp]
Creating new empty translog at [data/nodes/0/indices/P45vf_YQRhqjfwLMUvSqDw/0/translog/translog-3.tlog]
Done.
```

It also includes a `-b` batch operation that can be used to skip the
confirmation diaglog.

Resolves #19123
2016-07-26 08:34:07 -06:00
Christoph Büscher 4bac61425c Adding unit tests for QueryParseContext 2016-07-26 15:27:25 +02:00
Colin Goodheart-Smithe 2c12c3e628 Add _bucket_count option to buckets_path
This change adds a new special path to the buckets_path syntax
`_bucket_count`. This new option will return the number of buckets for a
multi-bucket aggregation, which can then be used in pipeline
aggregations.

Closes #19553
2016-07-26 09:28:21 +01:00
Christoph Büscher b861ec1cc0 Allow empty json object in request body in `_count` API
When the request body is missing, all documents in the target index are counted.
As mentioned in #19422, the same should happen when the request body is an empty
json object. This is also the behaviour for the `_search` endpoint and the two
APIs should behave in the same way.
2016-07-26 09:54:05 +02:00