Commit Graph

977 Commits

Author SHA1 Message Date
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
Christoph Büscher 04cb09f44c [TEST] Add missing docs and tests for '_cat/segments'
The '_cat/segments' api was missing docs and a rest test which are added here.

Closes #5856
2015-01-09 12:29:11 +01:00
Martijn van Groningen ca4f27f40e Core: Added `_shards` header to all write responses.
The header indicates to how many shard copies (primary and replicas shards) a write was supposed to go to, to how many
shard copies to write succeeded and potentially captures shard failures if writing into a replica shard fails.

For async writes it also includes the number of shards a write is still pending.

Closes #7994
2015-01-08 18:10:08 +01:00
Colin Goodheart-Smithe ecfe72ebcc Indices API: Fix to make GET Index API consistent with docs
This fix ensures that calls to the GET alias/mappings/settings/warmers APIs return the aliases/mappings/settings/warmers object even if there is no content within them.. This make them consistent with the GET Index API docs and the breaking changes in 1.4 docs

Closes #9148
2015-01-08 08:48:44 +00:00
Martijn van Groningen 20f7be378b Removed parent parameter from update request, because it is just sets the routing.
The routing option should be used instead. The parent a child document points to can't be updated.

Closes #4538
2015-01-07 10:26:20 +01:00
Michael McCandless 242e631e95 Core: ignore known idle threads by default in /_nodes/hot_threads
Add a new ignore_idle_threads boolean option (default true) to
/_nodes/hot_threads, to filter out threads in known idle places like
waiting on a socket select or on pulling the next task from an empty
queue.

Closes #8985

Closes #8908
2014-12-17 11:59:31 -05:00
Alex Ksikes 86e1655e4b Term Vectors: support for version and version_type
This commit adds support for version and version_type to the Term Vectors API.
This could be useful in the following case whereby the user gets a document
and later wants to generate its TVs. With version, this would ensure that only
the TVs of that particular document are generated, and error out if the
document has been updated in between.

Closes #7480
2014-12-17 15:43:15 +01:00
Martijn Laarman bc76032fdd Documented the new terminate_after querystring option on search as implemented in #6885 2014-12-17 14:49:05 +01:00
Lee Hinman 9b18c44b67 Default _cat APIs to verbose
`?v=false` can be used if the headers are not desired.

Resolves #8922

Fixes #8927
2014-12-15 12:51:59 +00:00
Martijn Laarman bb6e539bc7 updated (m)termvectors api specs to reflect #7530 which made it into 1.4 2014-12-12 11:04:21 +01:00
Honza Král 750310cf94 [API] indices.upgrade's wait_for_completion param defaults to false 2014-12-11 17:29:14 +01:00
Sebastian Ziebell ab001cf8e3 API endpoint cluster.put_settings accepts timeout & master_timeout query parameters
Closes #8769
2014-12-04 09:14:20 +01:00
Alex Ksikes 256712640f MLT Query: Support for ignore docs
Adds a `ignore_like` parameter to the MLT Query, which simply tells the
algorithm to skip all the terms from the given documents. This could be useful
in order to better guide nearest neighbor search by telling the algorithm to
never explore the space spanned by the given `ignore_like` docs. In essence we
are interested about the characteristic of a given item, but not of the ones
provided by `ignore_like`, thereby forcing the algorithm to go deeper in its
selection of terms. Note that this is different than simply performing a must
not boolean query on the unliked items. The syntax is exactly the same as the
`like` parameter.

Closes #8674
2014-11-28 14:48:43 +01:00
Sebastian Ziebell 4dd228d02f Spec: Fixes URL links to documentation
Closes #8656
2014-11-25 19:23:59 +01:00
Karel Minarik d33f1d4bd8 [SPEC] Removed the utilities for generating REST specs/code
The utilities have been migrated to the elasticsearch/elasticsearch-ruby repository.

See: https://github.com/elasticsearch/elasticsearch-ruby/tree/master/elasticsearch-api/utils

Related: elasticsearch/elasticsearch-ruby@dfac51d

Closes #8606
2014-11-25 15:33:44 +01:00
Michael McCandless 856b294441 Core: let Lucene kick off merges
Today, Elasticsearch has a separate merge thread pool checking once
per second (by default) if any merges are necessary, but this is no
longer necessary since we can and do now tell Lucene's
ConcurrentMergeScheduler never to "hard pause" threads when merges
fall behind, since we do our own index throttling.

This change goes back to letting Lucene launch merges as needed, and
removes these two expert settings:

  index.merge.force_async_merge
  index.merge.async_interval

Now merges kick off immediately instead of waiting up to 1 second
before running.

Closes #8643
2014-11-25 04:13:57 -05:00
Sebastian Ziebell e0d6e0a6d3 Spec: Fixes a few locations of the params array in JSON specification
A few locations of the `params` object in the JSON specification were not located in the `url` block.

Closes #8607
2014-11-24 20:43:33 +01:00
Alex Ksikes 1959275622 Term Vectors: More consistent naming for term vector[s]
We speak of the term vectors of a document, where each field has an associated
stored term vector. Since by default we are requesting all the term vectors of
a document, the HTTP request endpoint should rather be called `_termvectors`
instead of `_termvector`. The usage of `_termvector` is now deprecated, as
well as the transport client call to termVector and prepareTermVector.

Closes #8484
2014-11-21 14:06:44 +01:00
nwarz e77f9720d2 Mapping: Fixes Merging of default analyzer
Fixed behaviour where two representations of the default index analyzer weren't being treated as equivalent. Added REST test to confirm fix.

Closes #2716
2014-11-14 09:58:26 +00:00
Clinton Gormley f9810e591e Rest API: indices.delete should have "index" as a required param 2014-11-10 17:06:43 +01:00
Chris Mattmann f47fb6b1cf fix mention of Apache License, version 2.
Closes #8400
2014-11-08 19:14:51 +01:00
Veres Lajos 4059e4ac86 typo fixes - https://github.com/vlajos/misspell_fixer
Closes #8323
2014-11-08 18:55:57 +01:00
javanna 3afe86d447 [TEST] fix term_vector realtime test to call wait for green and use no replicas
If a shard (e.g. replica) gets initialized after we indexed the document it gets refreshed internally and we find the doc and its term_vectors, thus the test fails
2014-11-07 20:05:14 +01:00
Adrien Grand 9ea25df649 Switch to murmurhash3 to route documents to shards.
We currently use the djb2 hash function in order to compute the shard a
document should go to. Unfortunately this hash function is not very
sophisticated and you can sometimes hit adversarial cases, such as numeric ids
on 33 shards.

Murmur3 generates hashes with a better distribution, which should avoid the
adversarial cases.

Here are some examples of how 100000 incremental ids are distributed to shards
using either djb2 or murmur3.

5 shards:
Murmur3: [19933, 19964, 19940, 20030, 20133]
DJB:     [20000, 20000, 20000, 20000, 20000]

3 shards:
Murmur3: [33185, 33347, 33468]
DJB:     [30100, 30000, 39900]

33 shards:
Murmur3: [2999, 3096, 2930, 2986, 3070, 3093, 3023, 3052, 3112, 2940, 3036, 2985, 3031, 3048, 3127, 2961, 2901, 3105, 3041, 3130, 3013, 3035, 3031, 3019, 3008, 3022, 3111, 3086, 3016, 2996, 3075, 2945, 2977]
DJB:     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 900, 900, 900, 900, 1000, 1000, 10000, 10000, 10000, 10000, 9100, 9100, 9100, 9100, 9000, 9000, 0, 0, 0, 0, 0, 0]

Even if djb2 looks ideal in some cases (5 shards), the fact that the
distribution of its hashes has some patterns can raise issues with some shard
counts (eg. 3, or even worse 33).

Some tests have been modified because they relied on implementation details of
the routing hash function.

Close #7954
2014-11-04 16:32:42 +01:00
Martijn Laarman 006acfe8bf Added missing percolate API parameters (percolate_routing, percolate_preference) to the REST API Spec
Closes #7173
2014-10-28 19:34:34 +01:00
Clinton Gormley b94b3b2bcd Tests: Refixed the put_alias tests
The missing/null index parameter is in the URL, not the body.
So it should be required, and throw a param error if not provided.

Relates #7863
2014-10-28 13:39:05 +01:00
Clinton Gormley f9b5906871 Test: Change missing/null alias test to catch a request error, not a param error
Relates: #7863
2014-10-28 11:43:10 +01:00
Spencer 055e766be7 Updated paths to be inline with #8240 2014-10-27 23:08:19 -07:00
tlrx 8c864cf3f6 Cat Recovery API: Reverting changes introduced with commit e1c75bae87
Adding these 2 headers to the CAT Recovery made the CI tests hanging for a loooong time.

Related to #8041
2014-10-27 20:49:58 +01:00
Zachary Tong f5b2dfd052 Aliases: Throw exception if index is null or missing when creating an alias
Fixes a bug where alias creation would allow `null` for index name, which thereby
applied the alias to _all_ indices.  This patch makes the validator throw an
exception if the index is null.

```bash
POST /_aliases
{
   "actions": [
      {
         "add": {
            "alias": "empty-alias",
            "index": null
         }
      }
   ]
}
```
```json
{
   "error": "ActionRequestValidationException[Validation Failed: 1: Alias action [add]: [index] may not be null;]",
   "status": 400
}
```

The reason this bug wasn't caught by the existing tests is because
the old test for nullness only validated against a cluster which had
zero indices.  The null index is translated into "_all", and since
there are no indices, this fails because the index doesn't exist.
 So the test passes.

However, as soon as you add an index, "_all" resolves and you get the
situation described in the original bug report:  null index is
accepted by the alias, resolves to "_all" and gets applied to everything.

The REST tests, otoh, explicitly tested this bug as a real feature and therefore
passed.  The REST tests were modified to change this behavior.

Fixes #7863
2014-10-27 14:39:01 -04:00
tlrx 96e62b3c1b [TESTS Fix wrong assertion in test introduced by #8128 2014-10-27 11:11:54 +01:00
tlrx e1c75bae87 Cat API: Add node name to _cat/recovery
Add source_node and target_node fields to the recovery cat API. Also fixed and updated the documentation which was not complete concerning fields names.

Closes #8041
2014-10-27 09:47:26 +01:00
Alex Ksikes c13f5f21de Term Vectors: support for distributed frequencies
Adds distributed frequencies support for the Term Vectors API. A new parameter
called `dfs` is introduced which defaults to `false`.

Closes #8144
2014-10-23 13:59:59 +02:00
Adrien Grand f4ee3f25e4 Mappings: Store _timestamp by default.
Storing `_timestamp` by default means that under the default configuration, you
would have all the information you need in order to reindex into a different
index.

Close #8139
2014-10-20 12:17:26 +02:00
Spencer 249a145a5c Update cat.nodes regex
Support for multi-word node names like 'Henry "Hank" McCoy'
2014-10-15 14:33:41 -07:00
Chris Earle 04926954e2 Updating test to support Windows file descriptor count (-1) 2014-10-15 14:02:32 -05:00
Chris Earle 29c5aaa1d3 Fixing test to allow decimal numbers for load. 2014-10-15 11:54:12 -05:00
Chris Earle 2d8a140ed8 Add file descriptor details to cat/nodes
cat/nodes currently does not report any details related to file descriptors. This adds the current number in use, the maximum number available as well as their ratio (percentage) to cat/nodes as hidden-by-default metrics. In addition, this also adds current heap usage (as a non-percentage of ts max) and ram usage (as a non-percerntage of its max) to allow tools to provide more granularity.

Closes #7652
2014-10-15 10:18:41 -05:00
Clinton Gormley dfcc0f97f0 Spec: Removed flush and max_num_segments from indices.upgrade 2014-10-11 17:19:06 +02:00
Clinton Gormley 1e47f02891 Rest: Added missing parameters to indices.upgrade 2014-10-11 16:40:45 +02:00
Clinton Gormley 20a901964c Spec: Added human flag to indices.get_upgrade 2014-10-10 17:26:36 +02:00
Karel Minarik b1d4cec7ab [SPEC] Separated the "Upgrade Index" API into two methods
* `get_upgrade` => `GET _upgrade`  -- Return the status
* `upgrade`     => `POST _upgrade` -- Perform the operation

Original specification part of c021f22523.

Related: #7884, #7922
2014-10-09 16:19:58 +02:00
Ryan Ernst c06c10bbb0 Remove deprecations from master (follow up to #7922) 2014-10-07 08:35:11 -07:00
Ryan Ernst c021f22523 Add Upgrade API
This commit does the following:
* Add the new API at the rest layer, being backed by the optimize API
  with upgrade flag, and segments api to find upgrade status.
* Add `upgrade` flag to optimize API, and deprecate `force` flag (will
  remove in master)
* Add test for both synchronous and async upgrade

closes #7884
closes #7922
2014-10-07 08:09:50 -07:00
Igor Motov 555bfcb02b [SNAPSHOT] Add repository validation
Fixes #7096
2014-10-07 10:50:16 -04:00
David Pilato f0052a58d6 Admin: show open and closed indices in _cat/indices
When asking for `GET /_cat/indices?v`, you can now retrieve closed indices in addition to opened ones.

```
health status index              pri rep docs.count docs.deleted store.size pri.store.size
yellow open   .marvel-2014.05.21   1   1       8792            0     21.7mb         21.7mb
       close  test
yellow open   .marvel-2014.05.22   1   1       3871            0     10.7mb         10.7mb
red    open   .marvel-2014.05.27   1   1
```

Closes #7907.
Closes #7936.
2014-10-03 13:16:14 +02:00
Alex Ksikes c4830cf862 Term Vectors: support for realtime
By default term vectors are now realtime, as opposed to previously near
realtime. If they are not found in the index, they will be generated on the
fly. The document is fetched from the transaction log and treated as an
artificial document. One can set `realtime` parameter to `false` in order to
disable this functionality. This consequently makes the MLT query realtime in
fetching documents, as it previsouly used to be before switching from using
the multi get API to the mtv API.

Closes #7846
2014-10-03 09:26:47 +02:00
Honza Král 3aa4ac9caa [TEST] Make mlt rest tests pass on a single node cluster 2014-09-30 22:42:51 +02:00
Alex Ksikes b118558962 MLT Query: Support for artificial documents
Previously, the only way to specify a document not present in the index was to
use `like_text`. This would usually lead to complex queries made of multiple
MLT queries per document field. This commit adds the ability to the MLT query
to directly specify documents not present in the index (artificial documents).
The syntax is similar to the Percolator API or to the Multi Term Vector API.

Closes #7725
2014-09-29 15:49:13 +02:00
Spencer 19f5a86c21 Update indices.get_mapping.json 2014-09-25 09:53:27 -07:00
javanna 07ca08dbed [TEST] improved regular scroll REST test
Added sort clause by field and checked docs returned each time
2014-09-25 13:02:16 +02:00
javanna dc1ef7e670 [TEST] improved regular scroll REST test
The intermediate document that gets indexed has now a non existing id, and we make sure it doesn't get returned.
2014-09-25 11:46:05 +02:00
javanna f52375198b [TEST] add regular scroll REST test
Closes #7860
2014-09-25 11:03:12 +02:00
Brian Murphy 8e742c2096 Indexed Scripts/Templates : Cleanup
This contains several cleanups to the indexed scripts.
Remove the unused FetchSourceContext from the Get request..
Add lang,_version,_id to the REST GET API.
Removes the routing from GetIndexedScriptRequest since the script index is a single shard that is replicated across all nodes.
Fix backward compatible template file reference
Before 1.3.0 on disk scripts could be referenced by requesting
````
_search/template

{
  "template" : "ondiskscript"
}
````
This was broken in 1.3.0 by requiring
````
{
  "template" :
  {
    "file" : "ondiskscript"
  }
}
````
This commit restores the previous behavior.
Remove support for preference, realtime and refresh
These parameters don't make sense anymore for indexed scripts as we always force the preference to _local and
always refresh after a Put to the indexed scripts index.

Closes #7568
Closes #7559
Closes #7647
Closes #7567
2014-09-19 11:59:08 +01:00
javanna 7e0481d906 More Like This API: remove unused search_query_hint parameter
Closes #7691
2014-09-11 17:34:54 +02:00
Clinton Gormley 269b91c688 Spec: Fixed the docs URL for indices.get and indices.exists 2014-09-11 16:39:46 +02:00
Honza Král 480b90cfd6 [API] Fix minor issues with indices.get definition and tests
mark index param as required
make body match json, not string containing json
2014-09-11 14:36:11 +02:00
Colin Goodheart-Smithe 5fe782b784 Indices API: Added GET Index API
Returns information about settings, aliases, warmers, and mappings. Basically returns the IndexMetadata. This new endpoint replaces the /{index}/_alias|_aliases|_mapping|_mappings|_settings|_warmer|_warmers and /_alias|_aliases|_mapping|_mappings|_settings|_warmer|_warmers endpoints whilst maintaining the same response formats.  The only exception to this is on the /_alias|_aliases|_warmer|_warmers endpoint which will now return a section for 'aliases' or 'warmers' even if no aliases or warmers exist. This backwards compatibility change is documented in the reference docs.

Closes #4069
2014-09-11 11:19:21 +01:00
Boaz Leskes 4f8ddd97bf [Rest] reroute API response didn't filter metadata
By default the reroute API should return the new cluster state, excluding the metadata. It was however it was wrongly using an old parameter (filter_metadata) and thus failed to do so. This commits restores but wiring it to the correct `metric` parameter. We also add an enum representing the possible metrics, to avoid similar future mistakes.

Closes #7520
Closes #7523
2014-09-10 14:48:06 +02:00
Martijn van Groningen 52f1ab6e16 Core: Added the `index.query.parse.allow_unmapped_fields` setting to fail queries if they refer to unmapped fields.
The percolator and filters in aliases by default enforce strict query parsing.

Closes #7335
2014-09-09 15:00:47 +02:00
javanna a857798e1c Indexed scripts: make sure headers are handed over to internal requests and streamline versioning support
The get, put and delete indexed script apis map to get, index and delete api and internally create those corresponding requests. We need to make sure that the original headers are handed over to the new request by passing the original request in the constructor when creating the new one.

Also streamlined the support for version and version_type in the REST layer since the parameters were not consistently parsed and set to the internal java API requests.

Modified the REST delete template and delete script actions to make use of a client instead of using the `ScriptService` directly.

Closes #7569
2014-09-04 16:00:32 +02:00
Boaz Leskes 0e6bb1f28b [Rest] Add the cluster name to the "/" endpoint
The root endpoint returns basic information about this node, like it's name and ES version etc. The cluster name is an important information that belongs in that list.

Closes #7524
2014-09-01 10:05:11 +02:00
Simon Willnauer 91b8498cec [TEST] Port can have more or less than 4 digits 2014-08-29 08:57:35 +02:00
Clinton Gormley ce0b2ade9c Test: Fixed the regex in cat.indices/10_basic.yaml
And renamed the file from .yml to .yaml
2014-08-25 16:13:16 +02:00
Simon Willnauer 6950c38a04 Tests: Improve test coverage.
Close #7428
2014-08-25 11:56:38 +02:00
Alex Ksikes 62ef4a30dc Term vector API: return 'found: false' for docs between index and refresh
Closes #7121
2014-08-21 09:58:49 +02:00
Colin Goodheart-Smithe fb651f7755 [TEST] fix for wildcard_expansion REST tests
removed timeout from wait_for_green and set number of replicas to 0 so client tests can pass on single node.
2014-08-18 14:36:43 +01:00
Colin Goodheart-Smithe 925a4ba28b [TEST] fix to wildcard_expansion tests to wait for green status 2014-08-18 10:18:12 +01:00
Colin Goodheart-Smithe f4d75f0212 REST API: Allows all options for expand_wildcards parameter
This change means that the default settings for expand_wildcards are only applied if the expand_wildcards parameter is not specified rather than being set upfront. It also adds the none and all options to the parameter to allow the user to specify no expansion and expansion to all indexes (equivalent to 'open,closed')

Closes #7258
2014-08-15 12:50:11 +01:00
javanna 6d3bcc4451 Java API: add index, type and id to ExplainResponse
Index, type and id were returned as part of the REST explain api response, but not through java api. That info was read out of the request, relying on the fact that the index would get overridden with the concrete one within that same request.

Closes #7201
2014-08-08 12:52:03 +02:00
Clinton Gormley 9d65db4dba Test: Trimmed trailing whitespace to make valid YAML 2014-08-06 15:05:46 +02:00
Clinton Gormley 11f8edd74a REST spec: Added missing query_cache param to clear_cache, nodes.stats and indices.stats
Relates to #7167 and #7161
2014-08-06 13:32:33 +02:00
Shay Banon e6e2781ee7 [Query Cache] Add a request level flag to control query cache
A request level flag, defaults to be unset, to control the query cache. When not set, it defaults to the index level settings, when explicitly set, will override the index level setting
closes #7167
2014-08-05 18:28:49 +02:00
markharwood e6b459cb9f Update API enhancement - add support for scripted upserts.
In the case of inserts the UpdateHelper class will now allow the script used to apply updates to run on the upsert doc provided by clients. This allows the logic for managing the internal state of the data item to be managed by the script and is not reliant on clients performing the initialisation of data structures managed by the script.

Closes #7143
2014-08-05 16:52:44 +01:00
Areek Zillur 1d581e6286 Search Exists API: Checks if any matching documents exist for a given query
Implements a new Exists API allowing users to do fast exists check on any matched documents for a given query.
This API should be faster then using the Count API as it will:
 - early terminate the search execution once any document is found to exist
 - return the response as soon as the first shard reports matched documents

closes #6995
2014-07-31 15:42:30 -04:00
Spencer Alger a848b658e8 [TEST] Rest API: cat.count regexp matchers now explicitely test for newline 2014-07-30 10:19:24 -07:00
Simon Willnauer bd51d7a07f Add `wait_if_ongoing` option to _flush requests
This commit adds the ability to force blocking on the flush operaition
to make sure all files have been written and synced to disk. Without
this option a flush might be executing at the same time causing the
current flush to fail and return before all files being synced.

Closes #6996
2014-07-24 15:34:53 +02:00
Lee Hinman 6e25a6a7aa [DOCS] clarify /_cat/fielddata REST api documentation 2014-07-23 16:18:37 +02:00
Clinton Gormley 7bf9d7271a Test: Set number_of_replicas to zero so that wait_for_green succeeds in search.aggregations 2014-07-21 22:41:15 +02:00
Colin Goodheart-Smithe 7223e9959d [TEST] Fixed intermittent failure due to lack of mapping 2014-07-17 09:05:58 +01:00
Clinton Gormley cccc8867b9 REST: Fixed indexed script/template tests
The clients don't have access to the error message
for matching purposes.  Rewritten tests to work
with the clients
2014-07-16 17:31:31 +02:00
Clinton Gormley 65b85566a0 REST: Renamed indexed_script and indexed_template specs
The file name of the REST specs should be the same as
the endpoint which it documents.
2014-07-16 17:31:26 +02:00
Colin Goodheart-Smithe 8260138e59 Aggregations: Fixed Histogram key_as_string bug
The key as string field in the response for the histogram aggregation will now only show if format is specified on the request.

Closes #6655
2014-07-16 11:36:48 +01:00
Brian Murphy cbd2a97abd [DOCS] : Indexed scripts/templates
These are the docs for the indexed scripts/templates feature.
Also moved the namespace for the REST endpoints.

Closes #6851
2014-07-16 10:49:02 +01:00
Brian Murphy f68a06ff99 [TEST] Fix test relying on order of json for matching 2014-07-14 17:06:23 +01:00
Brian Murphy e79b7086de Indexed Scripts/Templates: Add support for storing/deleting/getting scripts/template from an index.
This change allow elasticsearch users to store scripts and templates in an index for use at search time.
Scripts/Templates are stored in the .scripts index. The type of the events is set to the script language.
Templates use the mustache language so their type is be "mustache".
Adds the concept of a script type to calls to the ScriptService types are INDEXED,INLINE,FILE.
If a script type of INDEXED is supplied the script will be attempted to be loaded from the indexed, FILE will
look in the file cache and INLINE will treat the supplied script argument as the literal script.
REST endpoints are provided to do CRUD operations as is a java client library.
All query dsl points have been upgraded to allow passing in of explicit script ids and script file names.
Backwards compatible behavior has been preserved so this shouldn't break any existing querys that expect to
pass in a filename as the script/template name. The ScriptService will check the disk cache before parsing the
script.

Closes #5921 #5637 #5484
2014-07-14 14:37:55 +01:00
Spencer Alger c268e2d0ef [API SPEC] Update indicies.stats group param 2014-07-08 11:25:13 -07:00
javanna 8dedbd01df Core: don't replace indices within the ActionRequest with the concrete ones, and make sure check blocks is executed on concrete indices
Concrete indices is now called multiple times when needed instead of changing what's inside the incoming request with the concrete indices. Ideally we want to keep the original aliases or indices or wildcard expressions in the request.

Also made sure that the check blocks is done against the concrete indices, which wasn't the case for delete index, delete mapping, open index, close index, types exists and indices exists.

Closes #6694
Closes #6777
2014-07-08 14:18:26 +02:00
Boaz Leskes 83770c2583 [Test] Revert temporary fixes for update mapping on recovery issue
This reverts:
"Test: Temporarily change delete/put_mapping to wait for green": commit e408f8f638c2dd97a3ec86c8a9ac940f43ab37a0.
"[TEST] wait for green to update mapping": commit b3641a2ee6eb23318d49f5f04b39149e70c2b65b.
2014-07-07 22:27:25 +02:00
Clinton Gormley 34893c0570 Test: Temporarily change delete/put_mapping to wait for green
Delete and update mapping execution order has changed with #6762
2014-07-07 19:02:36 +02:00
Adrien Grand a96f9a7c83 Templates: GET templates doesn't honor the `flat_settings` parameter.
Close #6671
2014-07-02 08:42:31 +02:00
Lee Hinman 5c6d28240f Switch to Groovy as the default scripting language
This is a breaking change to move from MVEL -> Groovy
2014-06-25 12:15:12 +02:00
Britta Weber 1cbeaf6c45 significant terms: fix json response
Commit fbd7c9aa5d introduced a regression that caused
the min_doc_count to be equal to the number of documents in the
background set. As a result no buckets were built when the
response for significant terms was created.
This only affected the final XContent response.

closes #6535
2014-06-18 18:51:34 +02:00
Zachary Tong ed62f90620 [TEST] Remove indentation on indices.stats test setups
The new indices.stats tests have the setup section indented, which
can cause problems for some yaml parsers.
2014-06-18 11:59:40 -04:00
Clinton Gormley eabd4abf57 Rest-Spec: search was missing the track_scores param 2014-06-12 18:25:20 +02:00
Honza Král 681e9fa522 [TEST] remove accidental double escape in yaml tests 2014-06-12 01:03:36 +02:00
Clinton Gormley 0859f2e588 Tests: Java test runner can't handle array responses 2014-06-10 20:33:04 +02:00
Clinton Gormley eb3e0fb931 Tests: Fixed indices.stats types test when run with replicas 2014-06-10 19:10:18 +02:00
Clinton Gormley bb15def36e Stats: Bugfixes and enhancements to indices stats API
Bugs:
* "groups" and "types" were being ignored
* "completion_fields" as wildcards were not being resolved to fieldnames

Enhancements:
* Made "groups" and "types" support wildcards
* Added missing tests

Closes #6390
2014-06-10 17:35:49 +02:00
javanna 11f7c31852 Put index template api: unified PUT/POST behaviour in relation to create parameter
The put index template api supports the create parameter (defaults to false), which tells whether the template can replace an existing one with same name or not. Unified its behaviour between PUT and POST method, whereas the POST would previously force create to true.

Added create parameter to the rest spec (was missing before) and a REST test for create true scenario.
2014-06-06 15:45:05 +02:00
javanna 4a2410135f [TEST] added wait for relocationg shards to cat.shards REST test
Adding the second index might cause relocation of existing shards depending on the number of nodes available, let's wait for relocation to be finished before going ahead and checking the cat shards outpu
2014-06-03 10:48:11 +02:00
Clinton Gormley bec51a618f Test: Python doesn't support atomic groups in regexes. Removing from cat.recovery 2014-05-29 16:57:09 +02:00
Karel Minarik 0e920c17dd [SPEC] Added the `percolator_format` URL parameter to the "Percolate" API spec 2014-05-23 18:26:17 +02:00
Karel Minarik 81cddacffa [SPEC] Removed the URL parameter `indices_boost` from the "Search" API
Related: elasticsearch/elasticsearch-ruby#29
2014-05-22 15:29:46 +02:00
javanna de9fca9cb2 [TEST] indices.open REST tests need 0 replicas
With replicas the search requests might go to shards that are not ready, since we have a wait for yellow. We can now switch to wait for green as well.
2014-05-22 11:04:28 +02:00
javanna 1b996defcf [TEST] cat.allocation/One index: allow leading spaces in unassigned shards lines 2014-05-22 10:10:50 +02:00
Boaz Leskes 9f10547f4b Allow 0 as a valid external version
Until now all version types have officially required the version to be a positive long number. Despite of this has being documented, ES versions <=1.0 did not enforce it when using the `external` version type. As a result people have succesfully indexed documents with 0 as a version. In 1.1. we introduced validation checks on incoming version values and causing indexing request to fail if the version was set to 0. While this is strictly speaking OK, we effectively have a situation where data already indexed does not match the version invariant.

To be lenient and adhere to spirit of our data backward compatibility policy, we have decided to allow 0 as a valid external version type. This is somewhat complicated as 0 is also the internal value of `MATCH_ANY`, which indicates requests should succeed regardles off the current doc version. To keep things simple, this commit changes the internal value of `MATCH_ANY` to `-3` for all version types.

Since we're doing this in a minor release (and because versions are stored in the transaction log), the default `internal` version type still accepts 0 as a `MATCH_ANY` value. This is not a problem for other version types as `MATCH_ANY` doesn't make sense in that context.

Closes #5662
2014-05-16 22:10:16 +02:00
Clinton Gormley a7362d9ac7 [TEST] Changed the possessive matching syntax in cat.recovery
regex to use an independent subexpression. Possessive
modifiers not supported on older Perl
2014-05-13 11:02:36 +02:00
Clinton Gormley 29ab31b351 [TEST] cat.recovery regex still causing occasional JVM regex stackoverflows.
Try making the capture possessive to prevent recursion
2014-05-12 15:47:51 +02:00
javanna 3d63bac51d Fixed validate query parsing issues
Made sure that a match_all query is used when no query is specified and ensure no NPE is thrown either.
Also used the same code path as the search api to ensure that alias filters are taken into account, same for type filters.

Closes #6111 Closes #6112 Closes #6116
2014-05-12 12:49:25 +02:00
Martijn van Groningen 145efbf6ea Return missing (404) is a scroll_id is cleared that no longer exists.
Closes #5730
2014-05-12 09:43:56 +02:00
Clinton Gormley 4fefe628b0 [TEST] Aborting a non-existent benchmark throws a missing request 2014-05-10 13:09:30 +02:00
Lee Hinman 90e019b4a4 [TEST] Add test specifying fields field /_cat/fielddata REST test 2014-05-09 23:57:23 +02:00
javanna 6678da8c28 [TEST] randomly added node.bench=true to client node in test cluster and re-enabled REST benchmark tests based on number of bench nodes available
In our REST tests we already have support for features and skip sections that allow to skip tests if a feature is not supported.
We can then add a skip section based on the benchmark feature to the benchmark tests and execute them only when they are supported, knowing that they need at least a node with node.bench settings within the cluster. We can check that this requirement is met by calling the nodes info api.

This way we can dynamically decide whether to execute those tests or not and we don't need to have a node.bench around all the time. In fact, given that the REST tests use the GLOBAL cluster, we want to be able to randomize settings as much as possible and run tests against default settings as well. Also, this mechanism can be easily supported by the external cluster implementation that is used during the release process.

Introduced ability to disable benchmark nodes which is needed by BenchmarkNegativeTest.
2014-05-09 23:36:00 +02:00
Lee Hinman 7847ec0a6c Fix typo in path specification for /_cat/fielddata 2014-05-09 15:03:51 +02:00
Lee Hinman e7e4ef859a Add /_cat/fielddata to display fielddata usage
Closes #4593
2014-05-09 13:18:02 +02:00
Clinton Gormley a972aaa7ae [TEST] Temporarily added a wait-for-yellow to delete_mapping tests
Should be removed once #5997 is fixed
2014-05-09 12:04:34 +02:00
Clinton Gormley e0a45459a4 [TEST] cat.recovery with replicas can have 100.0% 2014-05-08 15:40:28 +02:00
Clinton Gormley eb6d3e3eb3 [TEST] Fixed pathological regex in cat.recovery
Fixes #6070
2014-05-08 14:15:47 +02:00
Andrew Selden f739abe89e Fix stack overflow in _cat/recovery test.
This fixes a stack overflow in the test for the _cat/recovery API.
The regular expression that tests the response body was modified to
handle large responses properly.
2014-05-07 13:58:00 -07:00
Andrew Selden 35f046e24f Fix _cat/allocation rest test
The rest test for _cat/allocation was failing due to a regular
expression not accounting for space-padded right-justified text.

Also added Improvements to regular expressions to be smarter about optional values
and to use '+' instead of '*' where applicable.
2014-05-07 13:10:31 -07:00
Clinton Gormley 5937cefd85 Added char_filters param to indices.analyze spec 2014-05-05 18:07:50 +02:00
Alexander Reelsen d356881664 [REST] Missing scroll id now returns 404
A bad/non-existing scroll ID used to return a 200, however a 404 might be more useful.
Also, this PR returns the right Exception (SearchContextMissingException) in the Java API.

Additionally: Added StatusToXContent interface and RestStatusToXContentListener listener, so
the appropriate RestStatus can be returned

Closes #5729
2014-05-05 17:37:26 +02:00
Alexander Reelsen d4fcf23057 Cluster State API: Remove index template filtering
The possibility of filtering for index templates in the cluster state API
had been introduced before there was a dedicated index templates API. This
commit removes this support from the cluster state API, as it was not really
clean, requiring you to specify the metadata and the index templates.

Closes #4954
2014-05-05 14:54:14 +02:00
javanna e96e634d10 [TEST] fixed _cat/thread_pool REST tests with local transport, in case the transport port is not available and gets returned as '-'
Re-enabled REST tests suite

Closes #6033
2014-05-04 22:10:03 +02:00
Zachary Tong f4c5cde8af [TEST] Replace folded blocks with literal blocks
The regex tests are formatted with blocks for readability.  Previously,
they were formatted using folded style blocks (e.g. using `>`). Folded
blocks convert newlines into spaces.  This is problematic for our regex,
since comments can only be terminated with a newline.

Effectively, anything after a comment will be commented out, making many
of the regex "silently pass".

This commit replaces them with scalar-style blocks (e.g. using `|`), which
treats newlines as significant, and thus correctly terminates comments
inside the regex.

Also fixes a regex test (`cat.thread_pool/10_basic.yaml`) that started
to fail after the block was fixed.  The test was missing a `\s+` before
the closing newline.
2014-05-02 18:30:48 -04:00
Spencer Alger 9038db7bfc [REST-SPEC] update to update test, to check for es-js error messages 2014-04-29 14:18:20 -07:00
javanna a414e4f2f3 [TEST] randomly introduced a client node within test cluster
The default number of clients nodes is randomized between 0 and 1, applied to all cluster scopes (global, suite and test). Can be changed through the newly added `@ClusterScope#numClientNodes`.

In our tests we currently refer to nodes in a generic way. All the tests that either stop or start nodes rely on the fact that those nodes hold data though. Made that clearer as that becomes more important when introducing other types of nodes within the test cluster. Reflected this by adapting and renaming the following methods in `TestCluster`:

- ensureAtLeastNumNodes to ensureAtLeastNumDataNodes
- ensureAtMostNumNodes to ensureAtMostNumDataNodes
- stopRandomNode to stopRandomDataNode

and the following ones in `ElasticsearchIntegrationTest`:

- allowNodes to allowDataNodes
- dataNodes to numDataNodes.
- @ClusterScope#numNodes to numDataNodes
- @ClusterScope#minNumNodes to minNumDataNodes
- @ClusterScope#maxNumNodes to maxNumDataNodes

Added facilities to be able to deal with data nodes specifically, like for instance retrieve a client to a data node, or retrieve an instance of a class through guice only from data nodes.

Adapted existing tests to successfully run although there's a node client around.

Fixed _cat/allocation REST tests to make disk.total, disk.avail and disk.percent optional as client nodes won't return that info.

Closes #5949
2014-04-28 16:31:36 +02:00
Clinton Gormley 2dfc77a4ed Removed spec and YAML tests for indices.status
Related #4854
2014-04-28 13:00:08 +02:00
Chris Earle 5528370e24 Added type, max, min, queueSize & keepAlive to _cat/thread_pool
Closes #5366
2014-04-28 12:00:27 +02:00
Boaz Leskes 051beb51a3 Version types `EXTERNAL` & `EXTERNAL_GTE` test for version equality in read operation & disallow them in the Update API
Separate version check logic for reads and writes for all version types, which allows different behavior in these cases.
Change `VersionType.EXTERNAL` & `VersionType.EXTERNAL_GTE` to behave the same as `VersionType.INTERNAL` for read operations.
The previous behavior was fit for writes but is useless in reads.

This commit also makes the usage of `EXTERNAL` & `EXTERNAL_GTE` in the update api raise a validation error as it make cause data to
be lost.

Closes #5663 , Closes #5661, Closes #5929
2014-04-25 23:06:12 +02:00
Britta Weber 8076a31ac1 Throw exception if an additional field was placed inside the "query" body
Currently the parser accepts queries like

```
"query" : {
     "any_query": {
         ...
     },
     "any_field_name":...
}
```

The "any_field_name" is silently ignored. However, this also causes the parser
not to move to the next closing bracket which in turn can lead to additional query
paremters being ignored such as "fields", "highlight",...
This was the case in issue #4895

closes issue #4895
2014-04-25 08:57:06 +02:00
Lee Hinman 54612ee2b5 Add REST API spec for /_search_shards endpoint
Also adds REST test for /_search_shards

Closes #5907
2014-04-23 13:29:29 -06:00
Clinton Gormley 640085c45d Disable benchmark tests until nodes set to run with
-Des.node.bench=true
2014-04-22 21:16:46 +02:00
Clinton Gormley eccbd911de [SPEC] Added path without scroll_id to clear_scroll 2014-04-22 19:38:55 +02:00
Clinton Gormley e2b4fbd1b1 [SPEC] The scroll_id is no longer a required qs param
Can be passed in the body instead
2014-04-22 19:30:51 +02:00
Clinton Gormley 2423c8c57a [SPEC] Added missing list_benchmarks test 2014-04-22 19:27:37 +02:00
Clinton Gormley 5d7263b69e [SPEC] Renamed benchmark endpoints
benchmark.submit -> benchmark
benchmark.list   -> list_benchmarks
benchmark.abort  -> abort_benchmark

And fixed the related tests
2014-04-22 19:14:26 +02:00
Andrew Selden 1f7f72135a Bug fix for hung clients on cluster without benchmark nodes
This is a fix for a bug whereby a cluster that has no nodes started with
-Des.node.bench=true will cause clients to hang if they attempt to
submit a benchmark.

Also adds REST tests to validate fix

Closes #5754
2014-04-21 15:08:50 -07:00
Andrew Selden 7ef36d9d52 Separate benchmark API endpoints
Separates benchmark API endpoints into separate files according to API
funtionality. This makes it easier for our tests and clients.

Closes #5787
2014-04-14 17:36:43 -07:00
Martijn van Groningen 45a1b44759 Each search request should use a new InternalSearchResponse instance even in case when all shards return no hits.
The InternalSearchResponse may get modified afterwards, so a new instance required at all times.
2014-04-11 17:44:21 +07:00
Martijn van Groningen 01794bf8ea Ignored clear scroll rest test 2014-04-11 13:47:41 +07:00
Martijn van Groningen b400129597 The clear scroll apis now optionally accepts a scroll_id in it body.
Closes #5726
2014-04-11 10:39:59 +07:00
Simon Willnauer bceac036af Fix _bench endpoint specs to have the body on the right level in the json object 2014-04-09 23:16:52 +02:00
Andrew Selden e2c8ff92ba Benchmark API
Add an API endpoint at /_bench for submitting, listing, and aborting
search benchmarks. This API can be used for timing search requests,
subject to various user-defined settings.

Benchmark results provide summary and detailed statistics on such
values as min, max, and mean time. Values are reported per-node so that
it is easy to spot outliers. Slow requests are also reported.

Long running benchmarks can be viewed with a GET request, or aborted
with a POST request.

Benchmark results are optionally stored in an index for subsequent
analysis.

Closes #5407
2014-04-09 13:06:55 -07:00
Simon Willnauer a9c8624c67 [TEST] MLT Rest test needs a mapping since we randomized number of nodes/shards 2014-04-09 11:45:55 +02:00
Simon Willnauer b4c506b952 [TEST] use no replicas in MLT tests - doc mappers need to be present on all nodes 2014-04-08 10:07:53 +02:00
javanna f283a9f3a5 [TEST] specified number_of_shards 5 to make sure the two docs end up in different shards that can be refreshed separately 2014-04-07 19:01:19 +02:00
javanna 1ec4f8f04b [TEST] Replaced RestTestSuiteRunner with parametrized test that uses RandomizedRunner directly
ElasticsearchRestTests extends now ElasticsearchIntegrationTest and makes use of our ordinary test infrastructure, in particular all randomized aspects now come for free instead of having to maintain a separate (custom) tests runner

We previously parsed only the tests that needed to be run given the version of the cluster the tests are running against. This doesn't happen anymore as it didn't buy much and it would be harder to support as the tests get now parsed before the test cluster gets started. Thus all the tests are now parsed regardless of their skip sections, afterwards the ones that don't need to be run will be skipped through assume directives.

Fixed REST tests that rely on a specific number of shards as this change introduces also random number of shards and replicas (through randomIndexTemplate)

Closes #5654
2014-04-07 17:08:05 +02:00
Alexander Reelsen f0ae43bbea Made template endpoint compatible with search endpoint
Before this the from/size parameters did not work.
Also updated the rest api spec definition file with all the query_string
parameters.

Fixes #5550
2014-04-03 00:01:30 +02:00
Alexander Reelsen e547e113e1 Geo context suggester: Require precision in mapping
The default precision was way too exact and could lead people to
think that geo context suggestions are not working. This patch now
requires you to set the precision in the mapping, as elasticsearch itself
can never tell exactly, what the required precision for the users
suggestions are.

Closes #5621
2014-04-02 23:51:14 +02:00
Alexander Reelsen 0ff30ade69 ContextSuggester: Adding couple of tests to catch more bugs
A bunch of minor fixes have been included here, especially due
to wrongly parsed mappings. Also using assertions resulted in an
NPE because they were disabled in the distribution.

Closes #5525
2014-03-31 16:16:21 +02:00
Clinton Gormley a809bfbcb2 [TEST] Fixed TTL tests for create, index, update
Were failing on faster boxes
2014-03-31 15:13:14 +02:00
javanna 84770c7d33 [TEST] decreased number of replicas to 0 in refresh tests
Some tests disable refresh and verify that documents cannot be found without an explicit refresh. With at least one replica and waiting for yellow though, it can happen that we start indexing docs when the replicas are not ready yet, and as soon as they become ready they get refreshed, causing the newly added docs to be unexpectedly found. Solution is to disable replicas for these specific tests.
2014-03-31 11:28:34 +02:00
Clinton Gormley 73547648ef [TEST] Update TTL test can fail on faster boxes - improve range of valid vals 2014-03-28 17:23:17 +01:00
javanna 34e9f8e83b [TEST] Removed skip regex sections as all the runners implemented the feature 2014-03-28 12:19:46 +01:00
Kevin Wang ceed22fe00 Add suggest stats
closes #4032
2014-03-28 11:13:54 +01:00
Igor Motov 3ffd0a1dfa Remove deprecated gateways
Closes #5422
2014-03-26 18:10:51 -04:00
Simon Willnauer 09e5ac98fa [TEST] Don't use replicas if only primaries are expected or the first shard in the list shoudl be a primary 2014-03-22 18:36:34 +01:00
Clinton Gormley ec8f404ac7 Renamed spec search.template.json to search_template.json
to match the name of the method.
2014-03-21 13:42:52 +01:00
javanna 70c9d6f3bd [TEST] added missing wait for yellow to indices recovery REST test 2014-03-21 10:24:07 +01:00
Honza Král ed842a88da [API] renaming search-template to search_template.
Name of the API should be a valid identifier.
2014-03-20 21:58:08 +01:00
Simon Willnauer bea0dd7c75 [TEST] Fix cat.recovery/10_basic.yaml to allow '-' in the hostname 2014-03-20 20:58:58 +01:00
Simon Willnauer 30532410bf [TEST] disable cat.recovery/10_basic.yaml 2014-03-20 20:43:17 +01:00
Simon Willnauer 6b5001891f [TEST] Added skip clause for regexp feature 2014-03-20 20:41:20 +01:00
Simon Willnauer 9cd3e850af Add simple escape method for special characters to template query
The default mustache engine was using HTML escaping which breaks queries
if used with JSON etc. This commit adds escaping for:

```
\b  Backspace (ascii code 08)
\f  Form feed (ascii code 0C)
\n  New line
\r  Carriage return
\t  Tab
\v  Vertical tab
\"  Double quote
\\  Backslash
```

Closes #5473
2014-03-20 18:48:14 +01:00
Andrew Selden 89e45fde9c Recovery API
Adds a new API endpoint at /_recovery as well as to the Java API. The
recovery API allows one to see the recovery status of all shards in the
cluster. It will report on percent complete, recovery type, and which
files are copied.

Closes #4637
2014-03-20 10:13:30 -07:00
Alexander Reelsen 8f6e1d4720 Query Templates: Adding dedicated /_search/template endpoint
In order to simplify query template execution an own endpoint has been added

Closes #5353
2014-03-20 17:43:40 +01:00
Clinton Gormley 96655d2505 PUT /_aliases should accept a numeric routing value
Also added REST tests for setting index/search/routing
via the PUT /_aliases endpoint

Fixes #5465
2014-03-20 10:38:32 +01:00
Igor Motov a1192044f2 Add ability to get snapshot status for running snapshots
Closes #4946
2014-03-17 20:13:49 -04:00
David Pilato f54e9246c1 Add _cat/plugins endpoint
If we want to have a full picture of versions running in a cluster, we need to add a `_cat/plugins` endpoint.

Response could look like:

```sh
% curl es2:9200/_cat/plugins?v
node component                        version   type url                                   desc
es1  mapper-attachments               1.7.0       j                                        Adds the attachment type allowing to parse difference attachment formats
es1  lang-javascript                  1.4.0       j                                        JavaScript plugin allowing to add javascript scripting support
es1  analysis-smartcn                 1.9.0       j                                        Smart Chinese analysis support
es1  marvel                           1.1.0      j/s http://localhost:9200/_plugins/marvel Elasticsearch Management & Monitoring
es1  kopf                             0.5.3       s  http://localhost:9200/_plugins/kopf   kopf - simple web administration tool for ElasticSearch
es2  mapper-attachments               2.0.0.RC1   j                                        Adds the attachment type allowing to parse difference attachment formats
es2  lang-javascript                  2.0.0.RC1   j                                        JavaScript plugin allowing to add javascript scripting support
es2  analysis-smartcn                 2.0.0.RC1   j                                        Smart Chinese analysis support
```

Closes #4824.
2014-03-16 12:16:09 +01:00
Adrien Grand 65d3b61b97 Add an option to force _optimize operations.
When forced, the index will be merged even if it contains a single segment with
no deletions.

Close #5243
2014-03-14 18:21:56 +01:00
Andrew Selden 673c282abd REST Testing framework enhancement
Adding operators 'lte' and 'gte' to our REST test framework. These
operators test for, respectively, less-than-or-equal and
greater-than-or-equal.
2014-03-10 15:08:43 -07:00
Boaz Leskes b7a95d11a7 Introduced VersionType.FORCE & VersionType.EXTERNAL_GTE
Also added "external_gt" as an alias name for VersionType.EXTERNAL , accessible for the rest layer.

Closes #4213 , Closes #2946
2014-03-10 21:07:17 +01:00
Clinton Gormley f4c0c3dae6 [TESTS] Fixed YAML in put_templates test 2014-03-06 12:16:01 +01:00
James Brook a93d6d55a5 Added support for aliases to index templates
Adapted existing PR (#2739) to updated code (post #4920), added tests and docs (@javanna)

Closes #1825
2014-03-06 11:11:07 +01:00
javanna 7d3cd89207 [TEST] added support for replacing stashed values within objects and lists in our REST tests 2014-03-03 13:34:22 +01:00
Lee Hinman f1f3aa3ac7 [TEST] skip explain reroute REST test until param substitution is implemented 2014-02-28 10:39:07 -07:00
Zachary Tong 0b6c404c51 [TEST] Dynamically extract node ID for test 2014-02-28 08:41:01 -05:00
Zachary Tong 4fe69528d2 [TEST] Add version and master_node parameter to _cluster/state 2014-02-28 08:27:17 -05:00
Lee Hinman e53a43800e Add `explain` flag support to the reroute API
By specifying the `explain` flag, an explanation for the reason a
command can or cannot be executed is returned. No allocation commands
are actually performed.

Returns a response similar to:

{
  "state": {...cluster state...},
  "acknowledged": true,
  "explanations" : [ {
    "command" : "cancel",
      "parameters" : {
        "index" : "decide",
        "shard" : 0,
        "node" : "IvpoKRdtRiGrQ_WKtt4_4w",
        "allow_primary" : false
      },
      "decisions" : [ {
        "decider" : "cancel_allocation_command",
        "decision" : "YES",
        "explanation" : "..."
        } ]
     }, {
      "command" : "move",
      "parameters" : {
        "index" : "decide",
        "shard" : 0,
        "from_node" : "IvpoKRdtRiGrQ_WKtt4_4w",
        "to_node" : "IvpoKRdtRiGrQ_WKtt4_4w"
       },
       "decisions" : [ {
         "decider" : "same_shard",
         "decision" : "NO",
         "explanation" : "shard cannot be allocated on same node [IvpoKRdtRiGrQ_WKtt4_4w] it already exists on"
       },
       etc
       ]
  }]
}

also removes AllocationExplanation from cluster state

Closes #2483
Closes #5169
2014-02-27 09:48:51 -07:00
javanna c2bb3981ba [TEST] removed REST test that checks for delete by query shard failures
The clients return an exception in case of failure and not the whole json response containing failures, thus this tests can only work with the Java REST tests runner
2014-02-26 14:11:40 +01:00
javanna e967400522 Expose delete by query shard failures follow-up
- Removed if conditions on index name and shard_id
- Added REST test
2014-02-26 13:14:52 +01:00
Martijn van Groningen 7064056d13 Added TransportGetFieldMappingsIndexAction that uses TransportSingleCustomOperationAction as base class, with the goal to reuse common logic (like: retry on failures, shard picking, connecting to nodes) 2014-02-24 15:54:24 +01:00
Martijn van Groningen a665d514a8 [TEST] Removed whitespace between } and , 2014-02-20 17:45:49 +01:00
Martijn van Groningen 57f40fe691 [TEST] Added whitespaces after brackets, colons and commas in nested percolator test. 2014-02-20 16:00:27 +01:00
Isabel Drost-Fromm 48004ff8a5 Add mustache templating to query execution.
Adds support for storing mustache based query templates that can later be filled
with query parameter values at execution time. Templates may be both quoted,
non-quoted and referencing templates stored in config/scripts/*.mustache by file
name.

See docs/reference/query-dsl/queries/template-query.asciidoc for templating
examples.

Implementation detail: mustache itself is being shaded as it depends directly on
guava - so having it marked optional but included in the final distribution
raises chances of version conflicts downstream.

Fixes #4879
2014-02-20 12:21:59 +01:00
Luca Cavanna 3afdf4a872 Added support for aliases to create index api
It is now possible to specify aliases during index creation:

curl -XPUT 'http://localhost:9200/test' -d '
{
    "aliases" : {
        "alias1" : {},
        "alias2" : {
            "filter" : { "term" : {"field":"value"}}
        }
    }
}'

Closes #4920
2014-02-17 14:54:21 +01:00
Britta Weber db3c6c2a8e Enable percolation for nested documents
closes #5082
2014-02-14 22:42:33 +01:00
Luca Cavanna ac9e2cd46f [TEST] added missing wait for yellow in put warmer REST test 2014-02-14 11:35:40 +01:00
Martijn van Groningen d005a105ac Made highlight query also work in the percolate api. 2014-02-12 10:13:35 -05:00
Luca Cavanna 87a2188ae3 [TEST] disabled replicas in validate query test 2014-02-11 17:16:43 +01:00
Alexander Reelsen b02e6dc996 Migrating NodesInfo API to use plugins instead of singular plugin
In order to be consistent (and because in 1.0 we switched from
parameter driven information to specifzing the metrics as part of the URI)
this patch moves from 'plugin' to 'plugins' in the Nodes Info API.
2014-02-11 10:05:10 +01:00
Luca Cavanna f996b04a9f [TEST] Made cat.count REST test more readable 2014-02-10 16:22:38 +01:00
Luca Cavanna dbc2ba22a8 [TEST] Added REST tests for _cat/thread_pool endpoint 2014-02-10 16:20:03 +01:00
Luca Cavanna 63eccce8f9 [TEST] moved routing REST tests to 0 replicas
REST tests get run against either 1 node or multiple nodes. Wait for yellow with replicas>0 is not enough when running against multiple nodes as replicas shard might get initialized  during testing, which can cause timing issues.
2014-02-10 12:32:34 +01:00
Luca Cavanna a3ad592198 [TEST] Fixed get_source/60_realtime_refresh REST test to work against multiple nodes
Replaced also wait for yellow with wait for green when using no replicas.

get_source/60_realtime_refresh tests per shard refresh using refresh:true and realtime:true in get api. We might run into troubles though if we have a replica that gets initialized after a doc was indexed without a refresh, as that doc will be found when searching against that specific replica shard (as a refresh happens automatically before a replica gets exposed as started).
2014-02-10 12:32:34 +01:00
Simon Willnauer dc308db4fe [TEST] Add basic test for /cat/shards/{index}
Basic REST test for rendering the cat/shards endpoint.
2014-02-10 12:23:01 +01:00
Luca Cavanna e02635e9c2 [TEST] Fixed delete/50_refresh REST test to work against multiple nodes
delete/50_refresh tests per shard refresh using refresh:true in delete api. We might run into troubles though if we have a replica that gets initialized after a doc was indexed and deleted, without a refresh, as that doc won't be found when searching against that specific replica shard (as a refresh happens automatically before a replica gets exposed as started).
2014-02-10 10:58:13 +01:00
Clinton Gormley 8bf302f6e2 [TEST] Removed nested quantifier in cat.allocation regex and made node name regex more liberal 2014-02-09 14:19:59 +01:00
Simon Willnauer f9c19dba56 Wait for green in mlt tests 2014-02-07 19:20:36 +01:00
Clinton Gormley cd679b9e57 [TESTS] Looks like Java character classes require explicit \s 2014-02-07 18:28:00 +01:00
Luca Cavanna 8ef82f9bdf [TEST] fixed cat/allocation REST tests 2014-02-07 18:22:07 +01:00
Clinton Gormley 8d98dbead0 [TESTS] Make cat.allocation tests handle different disk sizes 2014-02-07 17:54:38 +01:00
Clinton Gormley 027a418930 [TESTS] Fixed cat.allocation tests to work with one node cluster 2014-02-07 17:44:41 +01:00
Clinton Gormley 3bd0f6cb63 [TEST] Added cat.allocation and cat.aliases tests 2014-02-07 17:36:01 +01:00
Luca Cavanna c82b231ad8 [TEST] disabled refresh for get_source realtime test 2014-02-07 13:52:49 +01:00
Luca Cavanna 05cc67c872 [TEST] slightly sped up warmer tests by providing warmers during index creation 2014-02-07 13:52:49 +01:00
Luca Cavanna acaa5c7519 [TEST] removed leftover delete alias test in delete mapping 2014-02-07 13:52:49 +01:00
Luca Cavanna 63f9281bbf [TEST] added missing put warmer body 2014-02-03 15:30:58 +01:00
Luca Cavanna c72e1de1c4 [TEST] fixed typo s/mising/missing 2014-02-03 15:30:58 +01:00
Luca Cavanna 88771fdf99 [TEST] Added ability to test apis that don't return json
The last response body gets now always stashed in the REST tests and can be retrieved via `$body`. This implies that not only expected values can be retrieved from the stashed values, but actual values as well.

Added support for regular expressions to `match` assertion, using `Pattern.COMMENTS` flag for better readability through new custom hamcrest matcher (adopted in do section as well). Functionality added through new feature called `regex` that needs to be mentioned in the skip sections whenever needed till all the runners support it.

Added also example tests for cat count api
2014-02-03 11:26:38 +01:00
Luca Cavanna d68d8fbf11 [TEST] clarified skip features usage 2014-01-31 18:03:24 +01:00
Luca Cavanna 33d5a722b3 [TEST] Added ability to skip REST test suite/sections based on their required features
As we have different runners for the REST tests we need a mechanism that allows us to add features to any of them without breaking all others builds.
The idea is to name a feature and temporarily use skip sections that mention the required new features, so that runners that don't support it will skip the test.

Added support for `features` field in skip section.
Added `Features` class that contains a static list of the features supported by the runner. If a feature mentioned in a skip section is not listed here, the test will be skipped.
2014-01-31 16:47:40 +01:00
Clinton Gormley c900ec2152 [TEST] Fixed whitespace in cluster.state/20_filtering.yaml 2014-01-29 13:33:29 +01:00
Alexander Reelsen 5e58f4066e REST API: Consistent get field mapping response
If a get field mapping request is issued, and all but the field can be
found, the response should return an empty JSON object instead of a 404.

Closes #4738
2014-01-28 08:12:53 +01:00
Martijn van Groningen f38296da61 Percolator response now always returns the `matches` key.
Closes #4881
2014-01-27 16:37:09 +01:00
Luca Cavanna da1e3ed8fc [TEST] Added REST tests for create index api 2014-01-27 14:50:04 +01:00
Alexander Reelsen 24abb6cf3f Cluster state toXContent serialization only returns needed data
In order to make sure, that only the requested data is returned to the client,
a couple of fixes have been applied in the ClusterState.toXContent() method.
Also some tests were added to the yaml test suite

Closes #4885
2014-01-27 12:04:57 +01:00
David Pilato 09575eb95f Revert mget yaml test changes
Relative to #4892
2014-01-27 11:28:32 +01:00
David Pilato fdbdb705b9 Revert mget yaml test changes
Relative to #4892
2014-01-27 11:25:39 +01:00
David Pilato 4c50770a89 mget REST API should support source parameter
As stated in documentation, we should support `?source=` parameter in mget REST operations.

This is how to reproduce it:

```sh
curl -XDELETE "http://localhost:9200/test"

curl -XPOST "http://localhost:9200/test/type/1?refresh" -d'{
    "foo": "bar"
}'

curl -XPOST "http://localhost:9200/test/type/_mget" -d'{
    "ids": ["1"]
}'

curl -XGET "http://localhost:9200/test/type/_mget?source=%7B%22ids%22%3A%20%5B%221%22%5D%7D"
```

Closes #4892.
2014-01-27 11:05:50 +01:00
Clinton Gormley d70e6c4730 [SPEC] Updated docs URLs to point to master 2014-01-22 14:40:31 +01:00
Clinton Gormley 882fbb72fd [SPEC] Specify bulk format for body in bulk, msearch, mpercolate 2014-01-21 16:31:51 +01:00
Clinton Gormley 5800209a1e [TEST] Added newline at end of percolate tests 2014-01-21 16:31:50 +01:00
Clinton Gormley acdf2a5825 [SPEC] Renamed termvectors.* to termvector and mtermvectors
and fixed the YAML syntax errors
2014-01-21 16:31:50 +01:00
Britta Weber cae5eb479a [SPEC,TEST,FIX] add spec and tests for termvector api and fix inconsistencies
- index and type were not read from the uri with the _mtermvectors api
- ids were not read from the uri parameters with the _mtermvectors api
2014-01-21 10:03:25 +01:00
Igor Motov 749e4d7944 [SPEC] Fix cardinality of the repository parameter in get snapshot action 2014-01-20 12:56:32 -05:00
Martijn van Groningen efebb8d515 [TESTS] Added percolator rest tests. 2014-01-20 18:18:27 +01:00
Martijn van Groningen 9bc3d996ff [SPECS] Updated percolator specs. 2014-01-20 18:18:27 +01:00
Spencer Alger 8c7bbbcc8f Added setup task that clears the test template before running exists_* tests 2014-01-20 09:52:25 -07:00
Clinton Gormley 7129b9e6e6 [TEST] Added missing \n at end of YAML files, quoted * and fixed indentation 2014-01-20 13:25:16 +01:00
Clinton Gormley a313328777 [TEST] Added missing newline at end of YAML test file 2014-01-20 13:16:04 +01:00
Luca Cavanna 55a247e257 master_timeout parameter is now taken into account when calling cluster pending tasks api through the REST layer
Closes #4806
2014-01-20 12:53:55 +01:00
Luca Cavanna 3a558972b2 Added base Request class for read operations that usually happen on the master but can be executed locally.
Added base TransportAction class for master read operations that execute locally or not depending on the request class (local flag).

Added support for local flag where missing, in a backwards compatible manner:
     - IndicesExistsRequest
     - GetAliasesRequest (get alias api, aliases exist api)
     - TypesExistsRequest
     - GetIndexTemplatesRequest (get template, template exists)
     - GetSettingsRequest
     - GetRepositoriesRequest
     - PendingClusterTasks

 Added parsing of the local flag where missing in Rest*Action.

 Updated SPEC adding local flag param where missing and added REST tests that contain use of the local flag where it was just added.

Closes #3345
2014-01-20 12:35:48 +01:00
Clinton Gormley 67ec840d00 [SPEC] Various API fixes
Including:
* change some string params to list
* make some params or bodies required
* removed incorrect URLs
* removed incorrect params
* Fixed name of pending_tasks
2014-01-20 11:14:11 +01:00
Clinton Gormley 20b37416e3 [SPEC] Removed create.json
Create is a special API that is most simply and safely
implemented by calling the index() api with op_type
set to true.
2014-01-20 11:14:11 +01:00
Luca Cavanna 619c46a2a3 [SPEC] Removed empty paths from close and delete index apis
Although the empty paths are still registered in the java RestActions, that is only to return a meaningful error in case the index is not provided.
Index/indices are now mandatory.
2014-01-18 10:40:46 +01:00
Honza Král fe60cca038 [SPEC] path without {index} is not allowed for indices.open api 2014-01-17 22:54:07 +01:00
Luca Cavanna de893d80de [SPEC] Removed _source endpoint from get api spec, as the get_source is a different api already
Also removed custom code that was required in the REST tests due to this.
2014-01-17 18:05:07 +01:00
Honza Král 13e6f1933b [SPEC] removing deprecated include/exclude for get_source
_source_include/_source_exclude should be used instead
2014-01-17 15:38:25 +01:00
Luca Cavanna 1fba68a634 [SPEC] Added missing body object in snapshot apis 2014-01-17 15:34:42 +01:00
Clinton Gormley 53359c0d3d [SPEC] Created snapshot.* and nodes.* namespaces
Moved node_info, node_stats, shutdown and hot_threads into nodes.*
Moved snapshot and repository APIs into snapshot.*
2014-01-17 11:58:44 +01:00
Clinton Gormley 612044b386 [SPEC] Added missing cat endpoints. count and recovery
And added missing qs params to health and indices.
2014-01-16 22:09:48 +01:00
Luca Cavanna 06057c6c39 [TEST] Added check: test section names must be unique in the same REST test suite
Fixed also three duplicates found
2014-01-16 21:09:55 +01:00
Clinton Gormley 258c49ea23 [SPEC] Fixed bad name in ping.json 2014-01-16 19:54:25 +01:00
Clinton Gormley 1ca11b11e4 [SPEC] Fixed cluster.get_repository spec
Badly named endpoint
2014-01-16 19:43:58 +01:00
Clinton Gormley fa6e8abf48 [SPEC] Fixed cat.* spec files - were missing the endpoints 2014-01-16 19:43:58 +01:00
Clinton Gormley c5942a4ff8 [TEST] Fixed mget test which used deprecated refresh flag 2014-01-16 19:43:58 +01:00
Clinton Gormley 64f0361f5e [SPEC] Fixed file name, missing .json 2014-01-16 17:12:39 +01:00
Clinton Gormley e9b14ff636 [SPEC] Separated info.json into info and ping.json (GET vs HEAD) 2014-01-16 17:07:47 +01:00
Clinton Gormley 04b6dd9d0c [SPEC] Moved the cat API into its own namespace and added missing qs params 2014-01-16 17:06:03 +01:00
Clinton Gormley 84e2e1c177 [SPEC] Renamed snapshot/restore apis 2014-01-16 16:32:39 +01:00
Clinton Gormley 23a1fd795b [SPEC] Fixed bad JSON in indices.open 2014-01-16 15:33:09 +01:00
Clinton Gormley b7d4b30ad7 [SPEC] Added indices.exists_template.json 2014-01-16 15:29:50 +01:00
Clinton Gormley 5856378866 [SPEC] Added local to indices.get_mapping and indices.get_field_mapping 2014-01-16 15:29:50 +01:00
Clinton Gormley 555dbfd4b3 [SPEC] Added force to indices.refresh 2014-01-16 15:29:50 +01:00
Clinton Gormley ec3b19a866 [SPEC] Removed refresh from indices.flush and indices.optimize 2014-01-16 15:29:50 +01:00
Clinton Gormley c3813ceb71 [SPEC] Added empty path to indices.open and indices.close 2014-01-16 15:29:50 +01:00
Clinton Gormley d24994e4b4 [SPEC] Removed percolate from update 2014-01-16 15:29:50 +01:00
Clinton Gormley 056609b46c [SPEC] Added timeout, master_timeout to cluster.get_settings and cluster.reroute 2014-01-16 15:29:50 +01:00
Clinton Gormley e86bfdae46 [SPEC] Removed percolate from index.json 2014-01-16 15:29:49 +01:00
Clinton Gormley 93cd53b8cf [SPEC] Added _source, _source_include, _source_exclude to get_source 2014-01-16 15:29:49 +01:00
Clinton Gormley 8d3eba3035 [SPEC] Added version, version_type to get and get_source 2014-01-16 15:29:49 +01:00
Clinton Gormley c66c9ff379 [SPEC] Added cluster.pending_tasks.json 2014-01-16 15:29:49 +01:00
Clinton Gormley 3bbab4c106 [SPEC] Added cluster.stats.json 2014-01-16 15:29:49 +01:00
Clinton Gormley 00ed78f3d6 [SPEC] Added cluster.repositories.* and cluster.snapshots.* 2014-01-16 15:29:49 +01:00
Clinton Gormley 500d6f7098 [SPEC] Added cat.json 2014-01-16 15:29:49 +01:00
Clinton Gormley e613ecf9b4 [SPEC] Added the routing and timeout params to bulk 2014-01-16 15:29:49 +01:00
Clinton Gormley c4713b1022 [SPEC] Added human flag to:
* cluster.node_info
* cluster.node_stats
* indices.segments
* indices.stats
* indices.status
2014-01-16 12:42:02 +01:00
Alexander Reelsen 4d68d722a1 Added waiting for yellow cluster state in rest test
In order to prevent rare timing issue, where the creation
of an index happens in the cluster state too late and thus
results in empty mappings.
2014-01-15 17:03:30 +01:00
Britta Weber 2f115b8103 update rest spec to be consistent with recent changes
see issue #4071
2014-01-15 00:56:52 +01:00
Alexander Reelsen a3abcdc93a Consistent APIs: Get field mapping API includes 'mappings'
The get field mapping API now includes a mappings element after the index in its JSON

Added more consistent endpoint /{index}/_mapping/{type}/field/{fields}
and added endpoint /_mapping/{type}/field/{fields}
which are also used in tests

Added rest spec tests for wildcards and _all

Relates #4071

NOTE: This is not yet complete for 1.0. We need to return an empty JSON document instead
of a 404 if the field of an existing index and type is not found. However this is not
possible with the current data structure being returned. Needs to be finished for 1.0.
2014-01-14 22:42:27 +01:00
Alexander Reelsen 349a8be4fd Consistent REST API changes for GETting data
* Made GET mappings consistent, supporting
  * /{index}/_mappings/{type}
  * /{index}/_mapping/{type}
  * /_mapping/{type}
  * Added "mappings" in the JSON response to align it with other responses
* Made GET warmers consistent, support /{index}/_warmers/{type} and /_warmer, /_warner/{name}
  as well as wildcards and _all notation
* Made GET aliases consistent, support /{index}/_aliases/{name} and /_alias, /_aliases/{name}
  as well as wildcards and _all notation
* Made GET settings consistent, added /{index}/_setting/{name}, /_settings/{name}
  as well as supportings wildcards in settings name
* Returning empty JSON instead of a 404, if a specific warmer/
  setting/alias/type is missing
* Added a ton of spec tests for all of the above
* Added a couple of more integration tests for several features

Relates #4071
2014-01-14 22:33:52 +01:00
Britta Weber 411739fe3b Make PUT and DELETE consistent for _mapping, _alias and _warmer
See issue #4071

PUT options for _mapping:

Single type can now be added with

`[PUT|POST] {index|_all|*|regex|blank}/[_mapping|_mappings]/type`

and

`[PUT|POST] {index|_all|*|regex|blank}/type/[_mapping|_mappings]`

PUT options for _warmer:

PUT with a single warmer can now be done with

`[PUT|POST] {index|_all|*|prefix*|blank}/{type|_all|*|prefix*|blank}/[_warmer|_warmers]/warmer_name`

PUT options for _alias:

Single alias can now be PUT with

`[PUT|POST] {index|_all|*|prefix*|blank}/[_alias|_aliases]/alias`

DELETE options _mapping:

Several mappings can be deleted at once by defining several indices and types with

`[DELETE] /{index}/{type}`

`[DELETE] /{index}/{type}/_mapping`

`[DELETE] /{index}/_mapping/{type}`

where

`index= * | _all | glob pattern | name1, name2, …`

`type= * | _all | glob pattern | name1, name2, …`

Alternatively, the keyword `_mapings` can be used.

DELETE options for  _warmer:

Several warmers can be deleted at once by defining several indices and names with

`[DELETE] /{index}/_warmer/{type}`

where

`index= * | _all | glob pattern | name1, name2, …`

`type= * | _all | glob pattern | name1, name2, …`

Alternatively, the keyword `_warmers` can be used.

DELETE options for _alias:

Several aliases can be deleted at once by defining several indices and names with

`[DELETE] /{index}/_alias/{type}`

where

`index= * | _all | glob pattern | name1, name2, …`

`type= * | _all | glob pattern | name1, name2, …`

Alternatively, the keyword `_aliases` can be used.
2014-01-14 20:02:43 +01:00
Clinton Gormley 2c647b3a82 Revert "[SPEC] Added level param to cluster.state"
This reverts commit 06e5f3dd6f.
2014-01-13 18:07:12 +01:00
Clinton Gormley 06e5f3dd6f [SPEC] Added level param to cluster.state 2014-01-13 18:05:38 +01:00
Clinton Gormley 7779196c8a [SPEC] Updated cluster.state spec 2014-01-13 18:02:15 +01:00
Clinton Gormley b7cddea495 [SPEC] Added level param to cluster.node_stats and indices.stats 2014-01-13 17:40:27 +01:00
Simon Willnauer f2f4b72a12 Add missing closing '}' to indices.stats.json 2014-01-13 17:19:13 +01:00
Clinton Gormley b866c381d5 [TEST] Updated cluster.node_stats test 2014-01-13 17:06:29 +01:00
markharwood 2795f4e55d Standardized use of “*_length” for parameter names rather than “*_len”.
Java Builder apis drop old “len” methods in favour of new “length”
Rest APIs support both old “len: and new “length” forms using new ParseField class to a) provide compiler-checked consistency between Builder and Parser classes and
b) a common means of handling deprecated syntax in the DSL.
Documentation and rest specs only document the new “*length” forms
Closes #4083
2014-01-13 15:59:15 +00:00
Clinton Gormley ed254b56e0 [SPEC] Updated cluster.node_stats and indices.stats 2014-01-13 16:54:51 +01:00
Clinton Gormley 0916372520 Fix YAML in test/indices.open/20_multiple_indices.yaml 2014-01-13 13:17:30 +01:00
Martijn van Groningen 943b62634c Replaced the multi-field type in favour for the multi fields option that can be set on any core field.
When upgrading to ES 1.0 the existing mappings with a multi-field type automatically get replaced to a core field with the new `fields` option.

If a `multi_field` type-ed field doesn't have a main / default field, a default field will be chosen for the multi fields syntax. The new main field type
will be equal to the first `multi_field` fields' field or type string if no fields have been configured for the `multi_field` field and in both cases
the default index will not be indexed (`index=no` is set on the default field).

If a `multi_field` typed field has a default field, that field will replace the `multi_field` typed field.

Closes to #4521
2014-01-13 09:21:53 +01:00
Spencer Alger 71d77d17e1 Updated the documentation urls in the rest api spec. 2014-01-09 14:44:14 -07:00
Martijn van Groningen eb63bb259d Added `action.destructive_requires_name` that controls whether wildcard expressions and `_all` is allowed to be used for destructive operat Also the delete index api requires always an index to be specified (either concrete index, alias or wildcard expression)
Closes #4549 #4481
2014-01-09 11:36:50 +01:00
Britta Weber 216c814a7f remove default `_all` for `type` and `index` if these are missing in REST tests
If a type or path is missing in the REST test yaml file, it is
automatically replaced with _all. This makes it hard to test changes
in the api, for example adding the possibility to leave the index
blank in addition to _all and * in the uri.

closes #4657
2014-01-09 10:17:42 +01:00
Martijn van Groningen 0973b2863c Added extra rest endpoint for get settings api.
Added rest test to also test the get settings' prefix option.
2014-01-09 09:44:40 +01:00
Luca Cavanna cb3b653a55 [SPEC] added nmissing comma in cluster.node_stats api spec 2014-01-08 21:24:23 +01:00
Honza Král 6e4586fd6b [SPEC] Clarify cluster.node_stats api 2014-01-08 21:03:06 +01:00
Honza Král fe1344107c [SPEC] refactor cluster.node_info json spec to reflect clients' apis 2014-01-08 20:19:29 +01:00
Igor Motov bec6527312 Add support for flat_settings flag to all REST APIs that output settings
Closes #4140
2014-01-08 10:36:36 -05:00
Luca Cavanna 6c23ace68f Fixed open/close index api when using wildcard only
Named wildcards were not always properly replaced with proper values by PathTrie.
Delete index (curl -XDELETE localhost:9200/*) worked anyway as the named wildcard is the last path element (and even if {index} didn't get replaced with '*', the empty string would have mapped to all indices anyway). When the named wildcard wasn't the last path element (e.g. curl -XPOST localhost:29200/*/_close), the variable didn't get replaced with the current '*' value, but with the empty string, which leads to an error as empty index is not allowed by open/close index.

Closes #4564
2014-01-08 15:01:49 +01:00
Martijn van Groningen 6dc434822c Changed get index settings api to use new internal get index settings api instead of relying on the cluster state api.
The new internal get index settings api is more efficient when it comes to sending the index settings from the master to the client via the
Also the get index settings support now all the indices options.

Closes #4620
2014-01-08 13:18:57 +01:00
Alexander Reelsen ad50afbec8 Simplify usage of nodes info API
Important: This breaks backwards compatibility with 0.90

* Removed endpoints: /_cluster/nodes, /_cluster/nodes/nodeId1,nodeId2
* Disallow usage of parameters, but make required metrics part of URI
* Changed NodesInfoRequest to return everything by default
* Fixed NPE in NodesInfoResponse

Closes #4055
2014-01-08 09:46:04 +01:00
Lee Hinman 2cb40fcb17 Rename "exists" to "found" in TermVector and Get responses
- Adds the "created" field to the index action response
- Reverses Delete class' notFound to Found to avoid double negative
2014-01-07 09:47:07 -07:00
Lee Hinman d23f640cd1 Remove hard-coded "ok": true from REST responses 2014-01-07 09:27:07 -07:00
Honza Král 623e4a0fc8 [TEST] remove old tests from yaml test suite 2014-01-07 16:19:06 +01:00
Honza Král 4aeaa3bac4 [TEST] Fix yaml tests after #4542 2014-01-07 16:06:25 +01:00
Simon Willnauer 3240cc8145 Clarify options for flush request 2014-01-06 17:44:56 +01:00
Honza Král aacb51bae7 [SPEC] Bringing back the specs for _aliases 2014-01-06 17:25:15 +01:00
Martijn van Groningen 3024cc24a6 Added missing indices options to rest spec and rest actions. 2014-01-05 23:32:44 +01:00
Honza Král 8517d8954e [TEST] add name parameter to get_alias in update_alias tests
to avoid failure on older es versions since get_alias without name has been
only introduced in #4539
2014-01-02 20:04:24 +01:00
Honza Král 076a24af14 [TEST] split tests with parent to pre/post 1.0 in the yaml test suite
See #4506 for details
2014-01-02 20:04:24 +01:00
Honza Král d5efb54785 [TEST] Split delete by query tests pre-1.0 and post-1.0
See #4074 for details
2014-01-02 20:04:24 +01:00
Martijn van Groningen aa548f5148 Remove GET `_aliases` api in favour for GET `_alias` api
Currently there are two get aliases apis that both have the same functionality, but have a different response structure. The reason for having 2 apis is historic.

The GET _alias api was added in 0.90.x and is more efficient since it only sends the needed alias data from the cluster state between the master node and the node that received the request. In the GET _aliases api the complete cluster state is send to the node that received the request and then the right information is filtered out and send back to the client.

The GET _aliases api should be removed in favour for the alias api

Closes to #4539
2014-01-02 13:56:11 +01:00
Martijn van Groningen f4bf0d5112 Replaced `ignore_indices` with `ignore_unavailable`, `expand_wildcards` and `allow_no_indices`.
* `ignore_unavailable` - Controls whether to ignore if any specified indices are unavailable, this includes indices that don't exist or closed indices. Either `true` or `false` can be specified.
* `allow_no_indices` - Controls whether to fail if a wildcard indices expressions results into no concrete indices. Either `true` or `false` can be specified. For example if the wildcard expression `foo*` is specified and no indices are available that start with `foo` then depending on this setting the request will fail. This setting is also applicable when `_all`, `*` or no index has been specified.
* `expand_wildcards` - Controls to what kind of concrete indices wildcard indices expression expand to. If `open` is specified then the wildcard expression if expanded to only open indices and if `closed` is specified then the wildcard expression if expanded only to closed indices. Also both values (`open,closed`) can be specified to expand to all indices.

Closes to #4436
2014-01-02 12:19:45 +01:00
Martijn van Groningen a7bb28c0e7 Made single shards APIs fail if routing is configured to be required in the mapping.
This change make single shard requests fail when no routing is specified and routing has been configured to be required in the mapping. Thi

 Closes #4506
2014-01-02 10:47:53 +01:00
Martijn van Groningen bb01995722 Made APIs consistently accept a query in the request body's `query` field.
The following APIs now accept the query in a top level `query` field like:
* delete_by_query
* validate_query
* count

These APIs used to accept the query directly in the request body which was inconsistent with the search and explain APIs. For this reason t

Closes #4074
2014-01-02 10:06:01 +01:00
Simon Willnauer fa4315005b Allow for version >= 0.90.10 2013-12-23 12:07:05 +01:00
Clinton Gormley b8aba737f4 [TEST] Added skip clause to analyze API with text format.
No longer supported in 1.0.0.RC1
2013-12-11 22:43:18 +00:00
Clinton Gormley 13d9d17155 Update README with full command to generate spec 2013-12-11 18:33:45 +00:00
Boaz Leskes ea4a908bdb Added field mapping API tests which use wild cards
See: https://github.com/elasticsearch/elasticsearch/issues/4367
2013-12-11 15:00:33 +01:00
Karel Minarik ccbb0e5c97 [UTIL] Fixed an error for the `--output` parameter in `thor api:spec:generate` 2013-12-05 17:36:54 +01:00
Honza Král 2d29bb7a63 [API] bulk request now supports timeout, see #4220 2013-11-25 11:53:32 +01:00
Clinton Gormley 381436843d [TEST] Fixed suggestion tests for 1.0.0.Beta1
Results order has changed because the standard analyzer no
longer removes stopwords
2013-11-07 14:26:22 +01:00
Clinton Gormley 602c3b6782 [TEST] Renamed _percolator to .percolator 2013-11-07 14:25:24 +01:00
Clinton Gormley c579164a88 [TEST] Fixed bad indentation on realtime_refresh tests 2013-11-05 13:28:47 +01:00
Karel Minarik e051c8a663 [TEST] Create the index with `number_of_replicas: 0` for "Realtime Refresh" tests 2013-11-05 11:24:31 +01:00
Karel Minarik afcc9d52ab [API] Changed `fields` parameter to required in "Get Field Mapping" API
Also reworded `include_defaults` description.
2013-11-05 11:17:59 +01:00
Karel Minarik da9da0c7a2 [TEST] Removed the `skip` in the common test "setup" definition
Until the issue with skipping tests en masse is resolved, let's use individual `skip` statements,
as supported in current YAML runners.
2013-11-05 10:05:34 +01:00
Karel Minarik e49683a5ee [TEST] Fixed incorrect `skip` behaviour in the "Get Field Mapping" API tests 2013-11-05 09:47:02 +01:00
Clinton Gormley 57894b70f4 [TEST] Test for get_field_mapping was calling get_mapping 2013-11-02 13:21:06 +01:00
spenceralger 5ef83b6c9a Updated "version_type" to match delete.json 2013-10-30 17:26:32 -07:00
spenceralger d85e264d03 Fixed method name, and the doc url 2013-10-30 14:16:55 -07:00
Boaz Leskes ebdde4ea46 Added spec + tests for the GetFieldMapping API
Introduced in https://github.com/elasticsearch/elasticsearch/issues/3941
2013-10-30 19:19:35 +01:00
Clinton Gormley cf795cfe4c [TEST] Corrected YAML syntax in mget/70_source_filtering
and broke it up into multiple tests which are easier to debug
2013-10-26 13:09:37 +02:00
Zachary Tong e5daab0b6b Remove unescessary newline continuation
Newline continuation causes some yaml parsers to interpret the
hash as a string instead of a proper hash
2013-10-25 14:14:12 -04:00
spenceralger 1cfe0f32c6 Added URL to indices.get_template to match previous change
Since the name is no longer required, added a supporting path to the paths array.
2013-10-23 21:14:02 -07:00
Boaz Leskes d202d3386a Added brackets to a do command. 2013-10-11 12:29:44 +02:00
Boaz Leskes 4a91a243b1 Normalizing the source filtering params of get_source with the rest of the API 2013-10-11 12:29:17 +02:00
Zachary Tong 6e2deaa4b7 Get all templates not available before 0.90.3 2013-10-09 13:11:00 +02:00
Boaz Leskes 87df522786 updated source filtering tests and spec
Fixed id tests to be strings.
Changed the _source_* param of get_source as they have changed in core.
2013-10-08 18:18:20 +02:00
Boaz Leskes a04bce96c7 The name parameter of indices.get_template is not required. 2013-10-08 18:16:27 +02:00
Clinton Gormley e791f463b1 [API] cluster.health wait_for_nodes is a string, not a number 2013-10-01 19:28:46 +02:00
spenceralger a6c9150427 Reverse course
See comment [here](2dd7f4f652 (commitcomment-4189612))
2013-09-26 09:52:23 -07:00
spenceralger e7465fee87 Added path to exist, supporting optional "type" part
Since the type is an optional part, there needs to be a path that can be used without it.
2013-09-25 20:03:28 -07:00
Clinton Gormley a958d5a63d [TEST] In the open indices test, wait for yellow after opening 2013-09-25 19:29:16 +02:00
Clinton Gormley 7d6869e149 [TEST] single alias APIs not supported before 0.90.1 2013-09-25 18:59:12 +02:00
Clinton Gormley 8e9a71341e [TEST] get_source not supported before 0.90.1 2013-09-25 18:59:12 +02:00
Honza Kral 559d284f41 [API] formatting issues 2013-09-25 14:08:18 +02:00
Clinton Gormley e283e0dc38 [TEST] Fixed the delete_template test so that it works for 0.90.* 2013-09-25 13:54:08 +02:00
Clinton Gormley 766d6e60ea [TEST] The get_mapping change in format is in master, not 0.90.* 2013-09-25 13:39:58 +02:00
Clinton Gormley 8a4d668227 Percolation results have changed in master 2013-09-23 13:53:45 +02:00
Clinton Gormley be8fad31cf The get_mapping tests were the wrong way around 2013-09-23 13:53:32 +02:00
Clinton Gormley a78781cdc6 [API] Added _source,_source_include,_source_exclude to
* explain
* get
* mget
* search
* get_source
2013-09-23 13:23:25 +02:00
Clinton Gormley 653ae20603 Added the clear_scroll spec 2013-09-20 22:21:26 +02:00
Clinton Gormley e0adae6497 completion_fields and field_data fields not support in node stats yet.
See https://github.com/elasticsearch/elasticsearch/issues/3746
2013-09-20 14:15:08 +02:00
Clinton Gormley 36b489cbc2 Added completion stats to cluster.node_stats and indices.stats 2013-09-20 13:26:04 +02:00
Spencer Alger 13719a4c2e removed some spaces that cause my yaml parser to choke 2013-09-18 08:54:17 -07:00
Clinton Gormley 5a31353fb0 Updated the test README to allow multiple test sections and an initial setup section 2013-09-18 15:54:58 +02:00
Clinton Gormley e957aa3364 Changed the get_mapping test to handle versions correctly 2013-09-18 15:29:40 +02:00
Clinton Gormley 1eed74c9be Moved get-missing template tests into their own file 2013-09-18 15:29:21 +02:00
Clinton Gormley 853b661789 Removed the regression tests for aliases - missing index etc
should be caught by the client before it hits ES
2013-09-18 15:28:51 +02:00
Clinton Gormley 0ff03b5652 Fixed the skip range on percolator tests 2013-09-17 14:28:26 +02:00
Clinton Gormley f3e69a150d Fixed put_template test to work with 0.90.3 onwards, where
a missing template now throws a 404
2013-09-17 14:28:14 +02:00
Clinton Gormley 59ca459b1c Fixed indices.open test - need to wait for shards to be allocated
before trying to close the index
2013-09-17 14:16:18 +02:00
Clinton Gormley 1279a29ee3 Explain returns a 1, not 1.0 2013-09-16 20:56:59 +02:00
Clinton Gormley e0e4b6b4dc Rename weird-index to start with test- so that it gets cleaned up 2013-09-16 20:56:48 +02:00
Clinton Gormley de4a84ccee Scroll test was missing an index - fails when other indices present 2013-09-16 20:56:32 +02:00
Clinton Gormley 3011201a51 Fixed indentation on an analyzer test 2013-09-16 20:56:12 +02:00
Karel Minarik 81ffa94937 Added an example of test `setup` into the `indices.analyze` API 2013-09-12 10:27:46 +02:00
Karel Minarik 397235e2f2 Changed the `ignore_missing` client parameter to `ignore: 404`
This should make easier any potential expansion such as:

    client.update('index', 'type', 41, {...}, ignore: 409

Also restructured and renamed the test suite a bit as part of the commit.

---

This reverts commit 0b142cc8812d8d090e48ea0ad89c007767870b91, "Removed client-specific `ignore_missing` parameter".
2013-09-09 23:36:45 +02:00
Karel Minarik 6cfbd2f7c4 Removed the incorrect info about `_all` default for index in `indices.get_mapping` API 2013-09-09 23:36:45 +02:00
Karel Minarik cb4b04e49f Added tests for default document type in `get` and `get_source` APIs 2013-09-09 23:36:45 +02:00
Karel Minarik e784cff1b0 Revert "Changed the missing `type` to `_all` in "Get Source" test"
This reverts commit f834a8b9a18739ba97eba592be98ce6804082d37.
2013-09-09 23:36:45 +02:00
Karel Minarik bd9befbc80 Revert "Changed the missing `type` to `_all` in "Get" test"
This reverts commit c7b376a4222d68788c59ffefbaaeae33d70536b8.
2013-09-09 23:36:45 +02:00
Karel Minarik d0a282727f Renamed the "All indices" test for `_search` API to "Default index"
This reverts commit 51713399e943412866e95cf94f341cb4625ef831.
2013-09-09 23:36:44 +02:00
Karel Minarik 62a489b07b Added test for client-side default document type in `exists` API
This reverts commit f6f037e6b15b51023c6ca45adbd394fd16e714f1.
2013-09-09 23:36:44 +02:00
Karel Minarik 4e0396768b Improved and fixed "Get Mapping" tests
* Fixed error in `skip` explanation for "get type" test
* Separated the tests for getting index/type mapping

I vote for removing the "get type" test entirely, since it just tests ancient versions.
2013-09-09 23:36:44 +02:00
Karel Minarik 690151516d Fixed incorrect test names in "Update" fields / meta-fields tests 2013-09-09 23:36:44 +02:00
Karel Minarik ad3bf79c6a Changed the "Indices Analyze" test to better correspond with the new test structure
1. Move the "text format" test into separate file
2. Remove the "JSON format" from test names
2013-09-09 23:36:44 +02:00
Karel Minarik 1300982e22 Removed test "setup" in "Indices Analyze" test
When the runner contract is specified as "run all the tests in the file in sequence,
resetting cluster after each file", it makes is hard to translate the concept into
regular Test::Unit environment.

Changed the "Analyze API JSON format - index and field" test to perform the necessary
setup as part of the test code.
2013-09-09 23:36:44 +02:00
Karel Minarik 46059673ef Changed the missing `type` to `_all` in "Get" test 2013-09-09 23:36:44 +02:00
Karel Minarik 7933dbe205 Corrected test names for "Bulk" test suite 2013-09-09 23:36:43 +02:00
Karel Minarik e1bfc0aa27 Changed the missing `type` to `_all` in "Get Source" test 2013-09-09 23:36:43 +02:00
Karel Minarik a4228bf2bc Changed the "default index/type" to use `index: _all` and renamed to "All indices" 2013-09-09 23:36:43 +02:00
Karel Minarik 0949195f90 Removed test for client-side default type in `exists` API 2013-09-09 23:36:43 +02:00
Karel Minarik 081b3e3982 Removed client-specific `ignore_missing` parameter
This parameter can introduce confusion, since people might think this is something
working on Elasticsearch level, eg. passing it to `curl`
2013-09-09 23:36:43 +02:00
Karel Minarik 5b8df7eba6 Fixed incorrect default JSON spec for `get_source` API 2013-09-09 20:59:47 +02:00
Karel Minarik 6196efa553 Fixed a typo on the `get` API spec 2013-09-09 17:04:50 +02:00
Karel Minarik 746bdb12b3 Added the default `_all` value for document type in `get_source` API 2013-09-09 14:00:40 +02:00
Karel Minarik dc10b9b19a Added the default `_all` value for document type in `get` API 2013-09-09 13:36:31 +02:00
Karel Minarik 44c56b0888 Added the default index value to the `search` API spec 2013-09-09 13:33:46 +02:00
Karel Minarik 46c8bd186c Changed the JSON spec to include the default document API in the `exists` API 2013-09-09 11:56:09 +02:00
Boaz Leskes dbc0823a77 Added version skip commands for source filtering tests 2013-07-30 14:00:23 +02:00
Boaz Leskes 495667facb Added source filtering to tests 2013-07-30 13:30:45 +02:00
Zachary Tong b6d90d52bd Replace refresh with cluster.health check
Possible to fail this test with a 500 NoShardsAvailable error, due
to the index not being fully allocated before the analyze call is
executed.

Changing for a wait_for_status: yellow fixes the occasional problem.
2013-07-26 07:40:11 +02:00
Zachary Tong 4274e9df4f Change script language to something guaranteed to never exist 2013-07-26 07:40:06 +02:00
Honza Kral f4cce2c634 cluster.node_info 2013-07-24 17:13:03 +02:00
Honza Kral ee1db9781f cluster state 2013-07-24 17:08:54 +02:00
Honza Kral 35deed9bc3 indices.clear_cache 2013-07-24 16:51:55 +02:00
Honza Kral 1d1dc72e23 cluster.node_stats 2013-07-24 16:51:38 +02:00
Honza Kral 8490bf32b7 indices.snapshot_index 2013-07-24 16:05:38 +02:00
Honza Kral 76912f4a6f indices.segments 2013-07-24 16:05:21 +02:00
Honza Kral cf95ee9888 sanity check for stats 2013-07-24 15:59:08 +02:00
Honza Kral e925ea3b78 validate query 2013-07-24 04:12:03 +02:00
Honza Kral 12597309c6 Optimize tests 2013-07-24 03:57:58 +02:00