merged rest-api-spec repo into es core

Closes #4540
Relates to #4376
This commit is contained in:
Luca Cavanna 2013-12-27 20:38:51 +01:00
commit 63a9ae4e2b
216 changed files with 8835 additions and 0 deletions

4
rest-api-spec/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.DS_Store
Gemfile.lock
*.swp
tmp/

13
rest-api-spec/LICENSE.txt Normal file
View File

@ -0,0 +1,13 @@
Copyright (c) 2013 Elasticsearch
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,65 @@
# Elasticsearch REST API JSON specification
This repository contains a collection of JSON files which describe the [Elasticsearch](http://elasticsearch.org) HTTP API.
Their purpose is to formalize and standardize the API, to facilitate development of libraries and integrations.
Example for the ["Create Index"](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/) API:
```json
{
"indices.create": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/",
"methods": ["PUT", "POST"],
"url": {
"path": "/{index}",
"paths": ["/{index}"],
"parts": {
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
}
}
},
"body": {
"description" : "The configuration for the index (`settings` and `mappings`)"
}
}
}
```
The specification contains:
* The _name_ of the API (`indices.create`), which usually corresponds to the client calls
* Link to the documentation at <http://elasticsearch.org>
* List of HTTP methods for the endpoint
* URL specification: path, parts, parameters
* Whether body is allowed for the endpoint or not and its description
The `methods` and `url.paths` elements list all possible HTTP methods and URLs for the endpoint;
it is the responsibility of the developer to use this information for a sensible API on the target platform.
# Utilities
The repository contains some utilities in the `utils` directory:
* The `thor api:generate:spec` will generate the basic JSON specification from Java source code
* The `thor api:generate:code` generates Ruby source code and tests from the specs, and can be extended
to generate assets in another programming language
Run `bundle install` and then `thor list` in the _utils_ folder.
The full command to generate the api spec is:
thor api:spec:generate --output=myfolder --elasticsearch=/path/to/es
## License
This software is licensed under the Apache 2 license.

View File

@ -0,0 +1,48 @@
{
"bulk": {
"documentation": "http://elasticsearch.org/guide/reference/api/bulk/",
"methods": ["POST", "PUT"],
"url": {
"path": "/_bulk",
"paths": ["/_bulk", "/{index}/_bulk", "/{index}/{type}/_bulk"],
"parts": {
"index": {
"type" : "string",
"description" : "Default index for items which don't provide one"
},
"type": {
"type" : "string",
"description" : "Default document type for items which don't provide one"
}
},
"params": {
"consistency": {
"type" : "enum",
"options" : ["one", "quorum", "all"],
"description" : "Explicit write consistency setting for the operation"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the index after performing the operation"
},
"replication": {
"type" : "enum",
"options" : ["sync","async"],
"default" : "sync",
"description" : "Explicitely set the replication type"
},
"type": {
"type" : "string",
"description" : "Default document type for items which don't provide one"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
}
}
},
"body": {
"description" : "The operation definition and data (action-data pairs), separated by newlines"
}
}
}

View File

@ -0,0 +1,18 @@
{
"clear_scroll": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/search/scroll/",
"methods": ["DELETE"],
"url": {
"path": "/_search/scroll/{scroll_id}",
"paths": ["/_search/scroll/{scroll_id}"],
"parts": {
"scroll_id": {
"type" : "list",
"description" : "A comma-separated list of scroll IDs to clear"
}
},
"params": {}
},
"body": null
}
}

View File

@ -0,0 +1,15 @@
{
"cluster.get_settings": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-update-settings/",
"methods": ["GET"],
"url": {
"path": "/_cluster/settings",
"paths": ["/_cluster/settings"],
"parts": {
},
"params": {
}
},
"body": null
}
}

View File

@ -0,0 +1,55 @@
{
"cluster.health": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-health/",
"methods": ["GET"],
"url": {
"path": "/_cluster/health",
"paths": ["/_cluster/health", "/_cluster/health/{index}"],
"parts": {
"index": {
"type" : "string",
"description" : "Limit the information returned to a specific index"
}
},
"params": {
"level": {
"type" : "enum",
"options" : ["cluster","indices","shards"],
"default" : "cluster",
"description" : "Specify the level of detail for returned information"
},
"local": {
"type" : "boolean",
"description" : "Return local information, do not retrieve the state from master node (default: false)"
},
"master_timeout": {
"type" : "time",
"description" : "Explicit operation timeout for connection to master node"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"wait_for_active_shards": {
"type" : "number",
"description" : "Wait until the specified number of shards is active"
},
"wait_for_nodes": {
"type" : "string",
"description" : "Wait until the specified number of nodes is available"
},
"wait_for_relocating_shards": {
"type" : "number",
"description" : "Wait until the specified number of relocating shards is finished"
},
"wait_for_status": {
"type" : "enum",
"options" : ["green","yellow","red"],
"default" : null,
"description" : "Wait until cluster is in a specific state"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,36 @@
{
"cluster.node_hot_threads": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-hot-threads/",
"methods": ["GET"],
"url": {
"path": "/_cluster/nodes/hot_threads",
"paths": ["/_cluster/nodes/hotthreads", "/_cluster/nodes/hot_threads", "/_cluster/nodes/{node_id}/hotthreads", "/_cluster/nodes/{node_id}/hot_threads", "/_nodes/hotthreads", "/_nodes/hot_threads", "/_nodes/{node_id}/hotthreads", "/_nodes/{node_id}/hot_threads"],
"parts": {
"node_id": {
"type" : "list",
"description" : "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes"
}
},
"params": {
"interval": {
"type" : "time",
"description" : "The interval for the second sampling of threads"
},
"snapshots": {
"type" : "number",
"description" : "Number of samples of thread stacktrace (default: 10)"
},
"threads": {
"type" : "number",
"description" : "Specify the number of threads to provide information for (default: 3)"
},
"type": {
"type" : "enum",
"options" : ["cpu", "wait", "block"],
"description" : "The type to sample (default: cpu)"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,67 @@
{
"cluster.node_info": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/",
"methods": ["GET"],
"url": {
"path": "/_cluster/nodes",
"paths": ["/_cluster/nodes", "/_cluster/nodes/{node_id}", "/_nodes", "/_nodes/{node_id}", "/_nodes/settings", "/_nodes/{node_id}/settings", "/_nodes/os", "/_nodes/{node_id}/os", "/_nodes/process", "/_nodes/{node_id}/process", "/_nodes/jvm", "/_nodes/{node_id}/jvm", "/_nodes/thread_pool", "/_nodes/{node_id}/thread_pool", "/_nodes/network", "/_nodes/{node_id}/network", "/_nodes/transport", "/_nodes/{node_id}/transport", "/_nodes/http", "/_nodes/{node_id}/http", "/_nodes/plugin", "/_nodes/{node_id}/plugin"],
"parts": {
"node_id": {
"type" : "list",
"description" : "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes"
}
},
"params": {
"all": {
"type" : "boolean",
"description" : "Return all available information"
},
"clear": {
"type" : "boolean",
"description" : "Reset the default settings"
},
"http": {
"type" : "boolean",
"description" : "Return information about HTTP"
},
"jvm": {
"type" : "boolean",
"description" : "Return information about the JVM"
},
"network": {
"type" : "boolean",
"description" : "Return information about network"
},
"os": {
"type" : "boolean",
"description" : "Return information about the operating system"
},
"plugin": {
"type" : "boolean",
"description" : "Return information about plugins"
},
"process": {
"type" : "boolean",
"description" : "Return information about the Elasticsearch process"
},
"settings": {
"type" : "boolean",
"description" : "Return information about node settings"
},
"thread_pool": {
"type" : "boolean",
"description" : "Return information about the thread pool"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"transport": {
"type" : "boolean",
"description" : "Return information about transport"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,27 @@
{
"cluster.node_shutdown": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/",
"methods": ["POST"],
"url": {
"path": "/_shutdown",
"paths": ["/_shutdown", "/_cluster/nodes/_shutdown", "/_cluster/nodes/{node_id}/_shutdown"],
"parts": {
"node_id": {
"type" : "list",
"description" : "A comma-separated list of node IDs or names to perform the operation on; use `_local` to perform the operation on the node you're connected to, leave empty to perform the operation on all nodes"
}
},
"params": {
"delay": {
"type" : "time",
"description" : "Set the delay for the operation (default: 1s)"
},
"exit": {
"type" : "boolean",
"description" : "Exit the JVM as well (default: true)"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,90 @@
{
"cluster.node_stats": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/",
"methods": ["GET"],
"url": {
"path": "/_cluster/nodes/stats",
"paths": [
"/_cluster/nodes/stats",
"/_cluster/nodes/{node_id}/stats",
"/_nodes/stats",
"/_nodes/{node_id}/stats",
"/_nodes/stats/{metric_family}",
"/_nodes/{node_id}/stats/{metric_family}",
"/_nodes/stats/indices/{metric}/{fields}",
"/_nodes/{node_id}/stats/indices/{metric}/{fields}"
],
"parts": {
"fields" : {
"type" : "list",
"description" : "A comma-separated list of fields to return detailed information for, when returning the `indices` metric family (supports wildcards)"
},
"metric_family" : {
"type" : "enum",
"options" : ["all","fs","http","indices","jvm","network","os","process","thread_pool","transport"],
"description" : "Limit the information returned to a certain metric family"
},
"metric" : {
"type" : "enum",
"options" : ["completion","docs", "fielddata", "filter_cache", "flush", "get", "id_cache", "indexing", "merges", "refresh", "search", "store", "warmer"],
"description" : "Limit the information returned for `indices` family to a specific metric"
},
"node_id": {
"type" : "list",
"description" : "A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes"
}
},
"params": {
"all": {
"type" : "boolean",
"description" : "Return all available information"
},
"clear": {
"type" : "boolean",
"description" : "Reset the default level of detail"
},
"fields": {
"type" : "list",
"description" : "A comma-separated list of fields for `fielddata` metric (supports wildcards)"
},
"fs": {
"type" : "boolean",
"description" : "Return information about the filesystem"
},
"http": {
"type" : "boolean",
"description" : "Return information about HTTP"
},
"indices": {
"type" : "boolean",
"description" : "Return information about indices"
},
"jvm": {
"type" : "boolean",
"description" : "Return information about the JVM"
},
"network": {
"type" : "boolean",
"description" : "Return information about network"
},
"os": {
"type" : "boolean",
"description" : "Return information about the operating system"
},
"process": {
"type" : "boolean",
"description" : "Return information about the Elasticsearch process"
},
"thread_pool": {
"type" : "boolean",
"description" : "Return information about the thread pool"
},
"transport": {
"type" : "boolean",
"description" : "Return information about transport"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,17 @@
{
"cluster.put_settings": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-update-settings/",
"methods": ["PUT"],
"url": {
"path": "/_cluster/settings",
"paths": ["/_cluster/settings"],
"parts": {
},
"params": {
}
},
"body": {
"description" : "The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart)."
}
}
}

View File

@ -0,0 +1,25 @@
{
"cluster.reroute": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-reroute/",
"methods": ["POST"],
"url": {
"path": "/_cluster/reroute",
"paths": ["/_cluster/reroute"],
"parts": {
},
"params": {
"dry_run": {
"type" : "boolean",
"description" : "Simulate the operation only and return the resulting state"
},
"filter_metadata": {
"type" : "boolean",
"description" : "Don't return cluster state metadata (default: false)"
}
}
},
"body": {
"description" : "The definition of `commands` to perform (`move`, `cancel`, `allocate`)"
}
}
}

View File

@ -0,0 +1,47 @@
{
"cluster.state": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-cluster-state/",
"methods": ["GET"],
"url": {
"path": "/_cluster/state",
"paths": ["/_cluster/state"],
"parts": {
},
"params": {
"filter_blocks": {
"type" : "boolean",
"description" : "Do not return information about blocks"
},
"filter_index_templates": {
"type" : "boolean",
"description" : "Do not return information about index templates"
},
"filter_indices": {
"type" : "list",
"description" : "Limit returned metadata information to specific indices"
},
"filter_metadata": {
"type" : "boolean",
"description" : "Do not return information about indices metadata"
},
"filter_nodes": {
"type" : "boolean",
"description" : "Do not return information about nodes"
},
"filter_routing_table": {
"type" : "boolean",
"description" : "Do not return information about shard allocation (`routing_table` and `routing_nodes`)"
},
"local": {
"type" : "boolean",
"description" : "Return local information, do not retrieve the state from master node (default: false)"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,47 @@
{
"count": {
"documentation": "http://elasticsearch.org/guide/reference/api/count/",
"methods": ["POST", "GET"],
"url": {
"path": "/_count",
"paths": ["/_count", "/{index}/_count", "/{index}/{type}/_count"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of indices to restrict the results"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of types to restrict the results"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"min_score": {
"type" : "number",
"description" : "Include only documents with a specific `_score` value in the result"
},
"preference": {
"type" : "string",
"description" : "Specify the node or shard the operation should be performed on (default: random)"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"source": {
"type" : "string",
"description" : "The URL-encoded query definition (instead of using the request body)"
}
}
},
"body": {
"description" : "A query to restrict the results (optional)"
}
}
}

View File

@ -0,0 +1,84 @@
{
"create": {
"documentation": "http://elasticsearch.org/guide/reference/api/index_/",
"methods": ["POST", "PUT"],
"url": {
"path": "/{index}/{type}",
"paths": ["/{index}/{type}", "/{index}/{type}/{id}/_create"],
"parts": {
"id": {
"type" : "string",
"description" : "Document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The type of the document"
}
},
"params": {
"consistency": {
"type" : "enum",
"options" : ["one", "quorum", "all"],
"description" : "Explicit write consistency setting for the operation"
},
"id": {
"type" : "string",
"description" : "Specific document ID (when the POST method is used)"
},
"parent": {
"type" : "string",
"description" : "ID of the parent document"
},
"percolate": {
"type" : "string",
"description" : "Percolator queries to execute while indexing the document"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the index after performing the operation"
},
"replication": {
"type" : "enum",
"options" : ["sync","async"],
"default" : "sync",
"description" : "Specific replication type"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"timestamp": {
"type" : "time",
"description" : "Explicit timestamp for the document"
},
"ttl": {
"type" : "duration",
"description" : "Expiration time for the document"
},
"version" : {
"type" : "number",
"description" : "Explicit version number for concurrency control"
},
"version_type": {
"type" : "enum",
"options" : ["internal","external"],
"description" : "Specific version type"
}
}
},
"body": {
"description" : "The document",
"required" : true
}
}
}

View File

@ -0,0 +1,66 @@
{
"delete": {
"documentation": "http://elasticsearch.org/guide/reference/api/delete/",
"methods": ["DELETE"],
"url": {
"path": "/{index}/{type}/{id}",
"paths": ["/{index}/{type}/{id}"],
"parts": {
"id": {
"type" : "string",
"required" : true,
"description" : "The document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The type of the document"
}
},
"params": {
"consistency": {
"type" : "enum",
"options" : ["one", "quorum", "all"],
"description" : "Specific write consistency setting for the operation"
},
"parent": {
"type" : "string",
"description" : "ID of parent document"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the index after performing the operation"
},
"replication": {
"type" : "enum",
"options" : ["sync","async"],
"default" : "sync",
"description" : "Specific replication type"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"version" : {
"type" : "number",
"description" : "Explicit version number for concurrency control"
},
"version_type": {
"type" : "enum",
"options" : ["internal","external"],
"description" : "Specific version type"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,73 @@
{
"delete_by_query": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/delete-by-query/",
"methods": ["DELETE"],
"url": {
"path": "/{index}/_query",
"paths": ["/{index}/_query", "/{index}/{type}/_query"],
"parts": {
"index": {
"type" : "list",
"required": true,
"description" : "A comma-separated list of indices to restrict the operation; use `_all` to perform the operation on all indices"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of types to restrict the operation"
}
},
"params": {
"analyzer": {
"type" : "string",
"description" : "The analyzer to use for the query string"
},
"consistency": {
"type" : "enum",
"options" : ["one", "quorum", "all"],
"description" : "Specific write consistency setting for the operation"
},
"default_operator": {
"type" : "enum",
"options" : ["AND","OR"],
"default" : "OR",
"description" : "The default operator for query string query (AND or OR)"
},
"df": {
"type" : "string",
"description" : "The field to use as default where no field prefix is given in the query string"
},
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"replication": {
"type" : "enum",
"options" : ["sync","async"],
"default" : "sync",
"description" : "Specific replication type"
},
"q": {
"type" : "string",
"description" : "Query in the Lucene query string syntax"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"source": {
"type" : "string",
"description" : "The URL-encoded query definition (instead of using the request body)"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
}
}
},
"body": {
"description" : "A query to restrict the operation"
}
}
}

View File

@ -0,0 +1,51 @@
{
"exists": {
"documentation": "http://elasticsearch.org/guide/reference/api/get/",
"methods": ["HEAD"],
"url": {
"path": "/{index}/{type}/{id}",
"paths": ["/{index}/{type}/{id}"],
"parts": {
"id": {
"type" : "string",
"required" : true,
"description" : "The document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : false,
"default" : "_all",
"description" : "The type of the document (use `_all` to fetch the first document matching the ID across all types)"
}
},
"params": {
"parent": {
"type" : "string",
"description" : "The ID of the parent document"
},
"preference": {
"type" : "string",
"description" : "Specify the node or shard the operation should be performed on (default: random)"
},
"realtime": {
"type" : "boolean",
"description" : "Specify whether to perform the operation in realtime or search mode"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the shard containing the document before performing the operation"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,94 @@
{
"explain": {
"documentation": "http://elasticsearch.org/guide/reference/api/explain/",
"methods": ["GET", "POST"],
"url": {
"path": "/{index}/{type}/{id}/_explain",
"paths": ["/{index}/{type}/{id}/_explain"],
"parts": {
"id": {
"type" : "string",
"required" : true,
"description" : "The document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The type of the document"
}
},
"params": {
"analyze_wildcard": {
"type" : "boolean",
"description" : "Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false)"
},
"analyzer": {
"type" : "string",
"description" : "The analyzer for the query string query"
},
"default_operator": {
"type" : "enum",
"options" : ["AND","OR"],
"default" : "OR",
"description" : "The default operator for query string query (AND or OR)"
},
"df": {
"type" : "string",
"description" : "The default field for query string query (default: _all)"
},
"fields": {
"type": "list",
"description" : "A comma-separated list of fields to return in the response"
},
"lenient": {
"type" : "boolean",
"description" : "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored"
},
"lowercase_expanded_terms": {
"type" : "boolean",
"description" : "Specify whether query terms should be lowercased"
},
"parent": {
"type" : "string",
"description" : "The ID of the parent document"
},
"preference": {
"type" : "string",
"description" : "Specify the node or shard the operation should be performed on (default: random)"
},
"q": {
"type" : "string",
"description" : "Query in the Lucene query string syntax"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"source": {
"type" : "string",
"description" : "The URL-encoded query definition (instead of using the request body)"
},
"_source": {
"type" : "list",
"description" : "True or false to return the _source field or not, or a list of fields to return"
},
"_source_exclude": {
"type" : "list",
"description" : "A list of fields to exclude from the returned _source field"
},
"_source_include": {
"type" : "list",
"description" : "A list of fields to extract and return from the _source field"
}
}
},
"body": {
"description" : "The query definition using the Query DSL"
}
}
}

View File

@ -0,0 +1,67 @@
{
"get": {
"documentation": "http://elasticsearch.org/guide/reference/api/get/",
"methods": ["GET"],
"url": {
"path": "/{index}/{type}/{id}",
"paths": ["/{index}/{type}/{id}", "/{index}/{type}/{id}/_source"],
"parts": {
"id": {
"type" : "string",
"required" : true,
"description" : "The document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : false,
"default" : "_all",
"description" : "The type of the document (use `_all` to fetch the first document matching the ID across all types)"
}
},
"params": {
"fields": {
"type": "list",
"description" : "A comma-separated list of fields to return in the response"
},
"parent": {
"type" : "string",
"description" : "The ID of the parent document"
},
"preference": {
"type" : "string",
"description" : "Specify the node or shard the operation should be performed on (default: random)"
},
"realtime": {
"type" : "boolean",
"description" : "Specify whether to perform the operation in realtime or search mode"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the shard containing the document before performing the operation"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"_source": {
"type" : "list",
"description" : "True or false to return the _source field or not, or a list of fields to return"
},
"_source_exclude": {
"type" : "list",
"description" : "A list of fields to exclude from the returned _source field"
},
"_source_include": {
"type" : "list",
"description" : "A list of fields to extract and return from the _source field"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,59 @@
{
"get_source": {
"documentation": "http://elasticsearch.org/guide/reference/api/get/",
"methods": ["GET"],
"url": {
"path": "/{index}/{type}/{id}/_source",
"paths": ["/{index}/{type}/{id}/_source"],
"parts": {
"id": {
"type" : "string",
"required" : true,
"description" : "The document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : false,
"default" : "_all",
"description" : "The type of the document; use `_all` to fetch the first document matching the ID across all types"
}
},
"params": {
"exclude": {
"type" : "list",
"description" : "A list of fields to exclude from the returned _source field"
},
"include": {
"type" : "list",
"description" : "A list of fields to extract and return from the _source field"
},
"parent": {
"type" : "string",
"description" : "The ID of the parent document"
},
"preference": {
"type" : "string",
"description" : "Specify the node or shard the operation should be performed on (default: random)"
},
"realtime": {
"type" : "boolean",
"description" : "Specify whether to perform the operation in realtime or search mode"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the shard containing the document before performing the operation"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,86 @@
{
"index": {
"documentation": "http://elasticsearch.org/guide/reference/api/index_/",
"methods": ["POST", "PUT"],
"url": {
"path": "/{index}/{type}",
"paths": ["/{index}/{type}", "/{index}/{type}/{id}"],
"parts": {
"id": {
"type" : "string",
"description" : "Document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The type of the document"
}
},
"params": {
"consistency": {
"type" : "enum",
"options" : ["one", "quorum", "all"],
"description" : "Explicit write consistency setting for the operation"
},
"op_type": {
"type" : "enum",
"options" : ["index", "create"],
"default" : "index",
"description" : "Explicit operation type"
},
"parent": {
"type" : "string",
"description" : "ID of the parent document"
},
"percolate": {
"type" : "string",
"description" : "Percolator queries to execute while indexing the document"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the index after performing the operation"
},
"replication": {
"type" : "enum",
"options" : ["sync","async"],
"default" : "sync",
"description" : "Specific replication type"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"timestamp": {
"type" : "time",
"description" : "Explicit timestamp for the document"
},
"ttl": {
"type" : "duration",
"description" : "Expiration time for the document"
},
"version" : {
"type" : "number",
"description" : "Explicit version number for concurrency control"
},
"version_type": {
"type" : "enum",
"options" : ["internal","external"],
"description" : "Specific version type"
}
}
},
"body": {
"description" : "The document",
"required" : true
}
}
}

View File

@ -0,0 +1,55 @@
{
"indices.analyze": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze/",
"methods": ["GET", "POST"],
"url": {
"path": "/_analyze",
"paths": ["/_analyze", "/{index}/_analyze"],
"parts": {
"index": {
"type" : "string",
"description" : "The name of the index to scope the operation"
}
},
"params": {
"analyzer": {
"type" : "string",
"description" : "The name of the analyzer to use"
},
"field": {
"type" : "string",
"description" : "Use the analyzer configured for this field (instead of passing the analyzer name)"
},
"filters": {
"type" : "list",
"description" : "A comma-separated list of filters to use for the analysis"
},
"index": {
"type" : "string",
"description" : "The name of the index to scope the operation"
},
"prefer_local": {
"type" : "boolean",
"description" : "With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true)"
},
"text": {
"type" : "string",
"description" : "The text on which the analysis should be performed (when request body is not used)"
},
"tokenizer": {
"type" : "string",
"description" : "The name of the tokenizer to use for the analysis"
},
"format": {
"type": "enum",
"options" : ["detailed","text"],
"default": "detailed",
"description": "Format of the output"
}
}
},
"body": {
"description" : "The text on which the analysis should be performed"
}
}
}

View File

@ -0,0 +1,65 @@
{
"indices.clear_cache": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-clearcache/",
"methods": ["POST", "GET"],
"url": {
"path": "/_cache/clear",
"paths": ["/_cache/clear", "/{index}/_cache/clear"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index name to limit the operation"
}
},
"params": {
"field_data": {
"type" : "boolean",
"description" : "Clear field data"
},
"fielddata": {
"type" : "boolean",
"description" : "Clear field data"
},
"fields": {
"type" : "list",
"description" : "A comma-separated list of fields to clear when using the `field_data` parameter (default: all)"
},
"filter": {
"type" : "boolean",
"description" : "Clear filter caches"
},
"filter_cache": {
"type" : "boolean",
"description" : "Clear filter caches"
},
"filter_keys": {
"type" : "boolean",
"description" : "A comma-separated list of keys to clear when using the `filter_cache` parameter (default: all)"
},
"id": {
"type" : "boolean",
"description" : "Clear ID caches for parent/child"
},
"id_cache": {
"type" : "boolean",
"description" : "Clear ID caches for parent/child"
},
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"index": {
"type" : "list",
"description" : "A comma-separated list of index name to limit the operation"
},
"recycler": {
"type" : "boolean",
"description" : "Clear the recycler cache"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,28 @@
{
"indices.close": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close/",
"methods": ["POST"],
"url": {
"path": "/{index}/_close",
"paths": ["/{index}/_close"],
"parts": {
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,30 @@
{
"indices.create": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/",
"methods": ["PUT", "POST"],
"url": {
"path": "/{index}",
"paths": ["/{index}"],
"parts": {
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": {
"description" : "The configuration for the index (`settings` and `mappings`)"
}
}
}

View File

@ -0,0 +1,27 @@
{
"indices.delete": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-index/",
"methods": ["DELETE"],
"url": {
"path": "/",
"paths": ["/", "/{index}"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of indices to delete; use `_all` or empty string to delete all indices"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,33 @@
{
"indices.delete_alias": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/",
"methods": ["DELETE"],
"url": {
"path": "/{index}/_alias/{name}",
"paths": ["/{index}/_alias/{name}"],
"parts": {
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index with an alias"
},
"name": {
"type" : "string",
"required" : true,
"description" : "The name of the alias to be deleted"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit timestamp for the document"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,29 @@
{
"indices.delete_mapping": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-mapping/",
"methods": ["DELETE"],
"url": {
"path": "/{index}/{type}/_mapping",
"paths": ["/{index}/{type}/_mapping", "/{index}/{type}"],
"parts": {
"index": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of index names; use `_all` for all indices"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The name of the document type to delete"
}
},
"params": {
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,28 @@
{
"indices.delete_template": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/",
"methods": ["DELETE"],
"url": {
"path": "/_template/{name}",
"paths": ["/_template/{name}"],
"parts": {
"name": {
"type" : "string",
"required" : true,
"description" : "The name of the template"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,32 @@
{
"indices.delete_warmer": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/",
"methods": ["DELETE"],
"url": {
"path": "/{index}/_warmer",
"paths": ["/{index}/_warmer", "/{index}/_warmer/{name}", "/{index}/{type}/_warmer/{name}"],
"parts": {
"index": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of index names to register warmer for; use `_all` or empty string to perform the operation on all indices"
},
"name" : {
"type" : "string",
"description" : "The name of the warmer (supports wildcards); leave empty to delete all warmers"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types to register warmer for; use `_all` or empty string to perform the operation on all types"
}
},
"params": {
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,20 @@
{
"indices.exists": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-indices-exists/",
"methods": ["HEAD"],
"url": {
"path": "/{index}",
"paths": ["/{index}"],
"parts": {
"index": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of indices to check"
}
},
"params": {
}
},
"body": null
}
}

View File

@ -0,0 +1,30 @@
{
"indices.exists_alias": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/",
"methods": ["HEAD"],
"url": {
"path": "/_alias/{name}",
"paths": ["/_alias/{name}", "/{index}/_alias/{name}"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to filter aliases"
},
"name": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of alias names to return"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,31 @@
{
"indices.exists_type": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-types-exists/",
"methods": ["HEAD"],
"url": {
"path": "/{index}/{type}",
"paths": ["/{index}/{type}"],
"parts": {
"index": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of index names; use `_all` to check the types across all indices"
},
"type": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of document types to check"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,37 @@
{
"indices.flush": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-flush/",
"methods": ["POST", "GET"],
"url": {
"path": "/_flush",
"paths": ["/_flush", "/{index}/_flush"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string for all indices"
}
},
"params": {
"force": {
"type" : "boolean",
"description" : "TODO: ?"
},
"full": {
"type" : "boolean",
"description" : "TODO: ?"
},
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the index after performing the operation"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,30 @@
{
"indices.get_alias": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/",
"methods": ["GET"],
"url": {
"path": "/_alias/{name}",
"paths": ["/_alias/{name}", "/{index}/_alias/{name}"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to filter aliases"
},
"name": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of alias names to return"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,23 @@
{
"indices.get_aliases": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/",
"methods": ["GET"],
"url": {
"path": "/_aliases",
"paths": ["/_aliases", "/{index}/_aliases"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to filter aliases"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,32 @@
{
"indices.get_field_mapping": {
"documentation": "http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html",
"methods": ["GET"],
"url": {
"path": "/_mapping/field/{field}",
"paths": ["/_mapping/field/{field}", "/{index}/_mapping/field/{field}", "/{index}/{type}/_mapping/field/{field}"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types"
},
"field": {
"type" : "list",
"description" : "A comma-separated list of fields",
"required" : true
}
},
"params": {
"include_defaults": {
"type" : "boolean",
"description" : "Whether the default mapping values should be returned as well"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,23 @@
{
"indices.get_mapping": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-get-mapping/",
"methods": ["GET"],
"url": {
"path": "/_mapping",
"paths": ["/_mapping", "/{index}/_mapping", "/{index}/{type}/_mapping"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types"
}
},
"params": {
}
},
"body": null
}
}

View File

@ -0,0 +1,19 @@
{
"indices.get_settings": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/",
"methods": ["GET"],
"url": {
"path": "/_settings",
"paths": ["/_settings", "/{index}/_settings"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
}
},
"params": {
}
},
"body": null
}
}

View File

@ -0,0 +1,20 @@
{
"indices.get_template": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/",
"methods": ["GET"],
"url": {
"path": "/_template/{name}",
"paths": ["/_template", "/_template/{name}"],
"parts": {
"name": {
"type" : "string",
"required" : false,
"description" : "The name of the template"
}
},
"params": {
}
},
"body": null
}
}

View File

@ -0,0 +1,28 @@
{
"indices.get_warmer": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/",
"methods": ["GET"],
"url": {
"path": "/{index}/_warmer",
"paths": ["/{index}/_warmer", "/{index}/_warmer/{name}", "/{index}/{type}/_warmer/{name}"],
"parts": {
"index": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of index names to restrict the operation; use `_all` to perform the operation on all indices"
},
"name": {
"type" : "string",
"description" : "The name of the warmer (supports wildcards); leave empty to get all warmers"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types"
}
},
"params": {
}
},
"body": null
}
}

View File

@ -0,0 +1,28 @@
{
"indices.open": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close/",
"methods": ["POST"],
"url": {
"path": "/{index}/_open",
"paths": ["/{index}/_open"],
"parts": {
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,48 @@
{
"indices.optimize": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-optimize/",
"methods": ["POST", "GET"],
"url": {
"path": "/_optimize",
"paths": ["/_optimize", "/{index}/_optimize"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
}
},
"params": {
"flush": {
"type" : "boolean",
"description" : "Specify whether the index should be flushed after performing the operation (default: true)"
},
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"max_num_segments": {
"type" : "number",
"description" : "The number of segments the index should be merged into (default: dynamic)"
},
"only_expunge_deletes": {
"type" : "boolean",
"description" : "Specify whether the operation should only expunge deleted documents"
},
"operation_threading": {
"description" : "TODO: ?"
},
"refresh": {
"type" : "boolean",
"description" : "Specify whether the index should be refreshed after performing the operation (default: true)"
},
"wait_for_merge": {
"type" : "boolean",
"description" : "Specify whether the request should block until the merge process is finished (default: true)"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,36 @@
{
"indices.put_alias": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/",
"methods": ["PUT"],
"url": {
"path": "/{index}/_alias/{name}",
"paths": ["/{index}/_alias/{name}", "/_alias/{name}", "/{index}/_alias", "/_alias"],
"parts": {
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index with an alias"
},
"name": {
"type" : "string",
"required" : true,
"description" : "The name of the alias to be created or updated"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Explicit timestamp for the document"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": {
"description" : "The settings for the alias, such as `routing` or `filter`",
"required" : false
}
}
}

View File

@ -0,0 +1,40 @@
{
"indices.put_mapping": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping/",
"methods": ["PUT", "POST"],
"url": {
"path": "/{index}/{type}/_mapping",
"paths": ["/{index}/{type}/_mapping"],
"parts": {
"index": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of index names; use `_all` to perform the operation on all indices"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The name of the document type"
}
},
"params": {
"ignore_conflicts": {
"type" : "boolean",
"description" : "Specify whether to ignore conflicts while updating the mapping (default: false)"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": {
"description" : "The mapping definition",
"required" : true
}
}
}

View File

@ -0,0 +1,26 @@
{
"indices.put_settings": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings/",
"methods": ["PUT"],
"url": {
"path": "/_settings",
"paths": ["/_settings", "/{index}/_settings"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
}
},
"params": {
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": {
"description" : "The index settings to be updated",
"required" : true
}
}
}

View File

@ -0,0 +1,35 @@
{
"indices.put_template": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/",
"methods": ["PUT", "POST"],
"url": {
"path": "/_template/{name}",
"paths": ["/_template/{name}"],
"parts": {
"name": {
"type" : "string",
"required" : true,
"description" : "The name of the template"
}
},
"params": {
"order": {
"type" : "number",
"description" : "The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": {
"description" : "The template definition",
"required" : true
}
}
}

View File

@ -0,0 +1,36 @@
{
"indices.put_warmer": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/",
"methods": ["PUT"],
"url": {
"path": "/{index}/_warmer/{name}",
"paths": ["/{index}/_warmer/{name}", "/{index}/{type}/_warmer/{name}"],
"parts": {
"index": {
"type" : "list",
"required" : true,
"description" : "A comma-separated list of index names to register the warmer for; use `_all` or empty string to perform the operation on all indices"
},
"name": {
"type" : "string",
"required" : true,
"description" : "The name of the warmer"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types to register the warmer for; leave empty to perform the operation on all types"
}
},
"params": {
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": {
"description" : "The search request definition for the warmer (query, filters, facets, sorting, etc)",
"required" : true
}
}
}

View File

@ -0,0 +1,28 @@
{
"indices.refresh": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh/",
"methods": ["POST", "GET"],
"url": {
"path": "/_refresh",
"paths": ["/_refresh", "/{index}/_refresh"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"operation_threading": {
"description" : "TODO: ?"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,28 @@
{
"indices.segments": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-indices-segments/",
"methods": ["GET"],
"url": {
"path": "/_segments",
"paths": ["/_segments", "/{index}/_segments"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"operation_threading": {
"description" : "TODO: ?"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,25 @@
{
"indices.snapshot_index": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-gateway-snapshot/",
"methods": ["POST"],
"url": {
"path": "/_gateway/snapshot",
"paths": ["/_gateway/snapshot", "/{index}/_gateway/snapshot"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string for all indices"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,130 @@
{
"indices.stats": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-indices-stats/",
"methods": ["GET"],
"url": {
"path": "/_stats",
"paths": [
"/_stats",
"/{index}/_stats",
"_stats/{metric_family}",
"/{index}/_stats/{metric_family}",
"/_stats/indexing",
"/{index}/_stats/indexing",
"/_stats/indexing/{indexing_types}",
"/_stats/search/{search_groups}",
"/{index}/_stats/search/{search_groups}",
"/_stats/fielddata/{fields}",
"/{index}/_stats/fielddata/{fields}"
],
"parts": {
"fields": {
"type" : "list",
"description" : "A comma-separated list of fields to return detailed information for, when returning the `search` statistics"
},
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
},
"indexing_types" : {
"type" : "list",
"description" : "A comma-separated list of document types to include in the `indexing` statistics"
},
"metric_family" : {
"type" : "enum",
"options" : ["completion","docs", "fielddata", "filter_cache", "flush", "get", "groups", "id_cache", "ignore_indices", "indexing", "merge", "refresh", "search", "store", "warmer"],
"description" : "Limit the information returned to a specific metric"
},
"search_groups" : {
"type" : "list",
"description" : "A comma-separated list of search groups to include in the `search` statistics"
}
},
"params": {
"all": {
"type" : "boolean",
"description" : "Return all available information"
},
"clear": {
"type" : "boolean",
"description" : "Reset the default level of detail"
},
"completion": {
"type" : "boolean",
"description" : "Return information about completion suggester stats"
},
"completion_fields": {
"type" : "list",
"description" : "A comma-separated list of fields for `completion` metric (supports wildcards)"
},
"docs": {
"type" : "boolean",
"description" : "Return information about indexed and deleted documents"
},
"fielddata": {
"type" : "boolean",
"description" : "Return information about field data"
},
"fielddata_fields": {
"type" : "list",
"description" : "A comma-separated list of fields for `fielddata` metric (supports wildcards)"
},
"fields": {
"type" : "list",
"description" : "A comma-separated list of fields for `fielddata` and `completion` metric (supports wildcards)"
},
"filter_cache": {
"type" : "boolean",
"description" : "Return information about filter cache"
},
"flush": {
"type" : "boolean",
"description" : "Return information about flush operations"
},
"get": {
"type" : "boolean",
"description" : "Return information about get operations"
},
"groups": {
"type" : "boolean",
"description" : "A comma-separated list of search groups for `search` statistics"
},
"id_cache": {
"type" : "boolean",
"description" : "Return information about ID cache"
},
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"indexing": {
"type" : "boolean",
"description" : "Return information about indexing operations"
},
"merge": {
"type" : "boolean",
"description" : "Return information about merge operations"
},
"refresh": {
"type" : "boolean",
"description" : "Return information about refresh operations"
},
"search": {
"type" : "boolean",
"description" : "Return information about search operations; use the `groups` parameter to include information for specific search groups"
},
"store": {
"type" : "boolean",
"description" : "Return information about the size of the index"
},
"warmer": {
"type" : "boolean",
"description" : "Return information about warmers"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,36 @@
{
"indices.status": {
"documentation": "http://elasticsearch.org/guide/reference/api/admin-indices-status/",
"methods": ["GET"],
"url": {
"path": "/_status",
"paths": ["/_status", "/{index}/_status"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"operation_threading": {
"description" : "TODO: ?"
},
"recovery": {
"type" : "boolean",
"description" : "Return information about shard recovery"
},
"snapshot": {
"type" : "boolean",
"description" : "TODO: ?"
}
}
},
"body": null
}
}

View File

@ -0,0 +1,30 @@
{
"indices.update_aliases": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/",
"methods": ["POST"],
"url": {
"path": "/_aliases",
"paths": ["/_aliases"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to filter aliases"
}
},
"params": {
"timeout": {
"type" : "time",
"description" : "Request timeout"
},
"master_timeout": {
"type" : "time",
"description" : "Specify timeout for connection to master"
}
}
},
"body": {
"description" : "The definition of `actions` to perform",
"required" : true
}
}
}

View File

@ -0,0 +1,46 @@
{
"indices.validate_query": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/validate/",
"methods": ["GET", "POST"],
"url": {
"path": "/_validate/query",
"paths": ["/_validate/query", "/{index}/_validate/query", "/{index}/{type}/_validate/query"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types"
}
},
"params": {
"explain": {
"type" : "boolean",
"description" : "Return detailed information about the error"
},
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"operation_threading": {
"description" : "TODO: ?"
},
"source": {
"type" : "string",
"description" : "The URL-encoded query definition (instead of using the request body)"
},
"q": {
"type" : "string",
"description" : "Query in the Lucene query string syntax"
}
}
},
"body": {
"description" : "The query definition"
}
}
}

View File

@ -0,0 +1,15 @@
{
"info": {
"documentation": "http://elasticsearch.org/guide/",
"methods": ["GET", "HEAD"],
"url": {
"path": "/",
"paths": ["/"],
"parts": {
},
"params": {
}
},
"body": null
}
}

View File

@ -0,0 +1,54 @@
{
"mget": {
"documentation": "http://elasticsearch.org/guide/reference/api/multi-get/",
"methods": ["GET", "POST"],
"url": {
"path": "/_mget",
"paths": ["/_mget", "/{index}/_mget", "/{index}/{type}/_mget"],
"parts": {
"index": {
"type" : "string",
"description" : "The name of the index"
},
"type": {
"type" : "string",
"description" : "The type of the document"
}
},
"params": {
"fields": {
"type": "list",
"description" : "A comma-separated list of fields to return in the response"
},
"preference": {
"type" : "string",
"description" : "Specify the node or shard the operation should be performed on (default: random)"
},
"realtime": {
"type" : "boolean",
"description" : "Specify whether to perform the operation in realtime or search mode"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the shard containing the document before performing the operation"
},
"_source": {
"type" : "list",
"description" : "True or false to return the _source field or not, or a list of fields to return"
},
"_source_exclude": {
"type" : "list",
"description" : "A list of fields to exclude from the returned _source field"
},
"_source_include": {
"type" : "list",
"description" : "A list of fields to extract and return from the _source field"
}
}
},
"body": {
"description" : "Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL.",
"required" : true
}
}
}

108
rest-api-spec/api/mlt.json Normal file
View File

@ -0,0 +1,108 @@
{
"mlt": {
"documentation": "http://elasticsearch.org/guide/reference/api/more-like-this/",
"methods": ["GET", "POST"],
"url": {
"path": "/{index}/{type}/{id}/_mlt",
"paths": ["/{index}/{type}/{id}/_mlt"],
"parts": {
"id": {
"type" : "string",
"required" : true,
"description" : "The document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The type of the document (use `_all` to fetch the first document matching the ID across all types)"
}
},
"params": {
"boost_terms": {
"type" : "number",
"description" : "The boost factor"
},
"max_doc_freq": {
"type" : "number",
"description" : "The word occurrence frequency as count: words with higher occurrence in the corpus will be ignored"
},
"max_query_terms": {
"type" : "number",
"description" : "The maximum query terms to be included in the generated query"
},
"max_word_len": {
"type" : "number",
"description" : "The minimum length of the word: longer words will be ignored"
},
"min_doc_freq": {
"type" : "number",
"description" : "The word occurrence frequency as count: words with lower occurrence in the corpus will be ignored"
},
"min_term_freq": {
"type" : "number",
"description" : "The term frequency as percent: terms with lower occurence in the source document will be ignored"
},
"min_word_len": {
"type" : "number",
"description" : "The minimum length of the word: shorter words will be ignored"
},
"mlt_fields": {
"type" : "list",
"description" : "Specific fields to perform the query against"
},
"percent_terms_to_match": {
"type" : "number",
"description" : "How many terms have to match in order to consider the document a match (default: 0.3)"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"search_from": {
"type" : "number",
"description" : "The offset from which to return results"
},
"search_indices": {
"type" : "list",
"description" : "A comma-separated list of indices to perform the query against (default: the index containing the document)"
},
"search_query_hint": {
"type" : "string",
"description" : "The search query hint"
},
"search_scroll": {
"type" : "string",
"description" : "A scroll search request definition"
},
"search_size": {
"type" : "number",
"description" : "The number of documents to return (default: 10)"
},
"search_source": {
"type" : "string",
"description" : "A specific search request definition (instead of using the request body)"
},
"search_type": {
"type" : "string",
"description" : "Specific search type (eg. `dfs_then_fetch`, `count`, etc)"
},
"search_types": {
"type" : "list",
"description" : "A comma-separated list of types to perform the query against (default: the same type as the document)"
},
"stop_words": {
"type" : "list",
"description" : "A list of stop words to be ignored"
}
}
},
"body": {
"description" : "A specific search request definition"
}
}
}

View File

@ -0,0 +1,31 @@
{
"msearch": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/multi-search/",
"methods": ["GET", "POST"],
"url": {
"path": "/_msearch",
"paths": ["/_msearch", "/{index}/_msearch", "/{index}/{type}/_msearch"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to use as default"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types to use as default"
}
},
"params": {
"search_type": {
"type" : "enum",
"options" : ["query_then_fetch", "query_and_fetch", "dfs_query_then_fetch", "dfs_query_and_fetch", "count", "scan"],
"description" : "Search operation type"
}
}
},
"body": {
"description": "The request definitions (metadata-search request definition pairs), separated by newlines",
"required" : true
}
}
}

View File

@ -0,0 +1,32 @@
{
"percolate": {
"documentation": "http://elasticsearch.org/guide/reference/api/percolate/",
"methods": ["GET", "POST"],
"url": {
"path": "/{index}/{type}/_percolate",
"paths": ["/{index}/{type}/_percolate"],
"parts": {
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index with a registered percolator query"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The document type"
}
},
"params": {
"prefer_local": {
"type" : "boolean",
"description" : "With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true)"
}
}
},
"body": {
"description" : "The document (`doc`) to percolate against registered queries; optionally also a `query` to limit the percolation to specific registered queries",
"required" : true
}
}
}

View File

@ -0,0 +1,29 @@
{
"scroll": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/search/scroll/",
"methods": ["GET", "POST"],
"url": {
"path": "/_search/scroll",
"paths": ["/_search/scroll", "/_search/scroll/{scroll_id}"],
"parts": {
"scroll_id": {
"type" : "string",
"description" : "The scroll ID"
}
},
"params": {
"scroll": {
"type" : "duration",
"description" : "Specify how long a consistent view of the index should be maintained for scrolled search"
},
"scroll_id": {
"type" : "string",
"description" : "The scroll ID for scrolled search"
}
}
},
"body": {
"description": "The scroll ID if not passed by URL or query parameter."
}
}
}

View File

@ -0,0 +1,149 @@
{
"search": {
"documentation": "http://www.elasticsearch.org/guide/reference/api/search/",
"methods": ["GET", "POST"],
"url": {
"path": "/_search",
"paths": ["/_search", "/{index}/_search", "/{index}/{type}/_search"],
"parts": {
"index": {
"type" : "list",
"default" : "_all",
"description" : "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types to search; leave empty to perform the operation on all types"
}
},
"params": {
"analyzer": {
"type" : "string",
"description" : "The analyzer to use for the query string"
},
"analyze_wildcard": {
"type" : "boolean",
"description" : "Specify whether wildcard and prefix queries should be analyzed (default: false)"
},
"default_operator": {
"type" : "enum",
"options" : ["AND","OR"],
"default" : "OR",
"description" : "The default operator for query string query (AND or OR)"
},
"df": {
"type" : "string",
"description" : "The field to use as default where no field prefix is given in the query string"
},
"explain": {
"type" : "boolean",
"description" : "Specify whether to return detailed information about score computation as part of a hit"
},
"fields": {
"type" : "list",
"description" : "A comma-separated list of fields to return as part of a hit"
},
"from": {
"type" : "number",
"description" : "Starting offset (default: 0)"
},
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"indices_boost": {
"type" : "list",
"description" : "Comma-separated list of index boosts"
},
"lenient": {
"type" : "boolean",
"description" : "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored"
},
"lowercase_expanded_terms": {
"type" : "boolean",
"description" : "Specify whether query terms should be lowercased"
},
"preference": {
"type" : "string",
"description" : "Specify the node or shard the operation should be performed on (default: random)"
},
"q": {
"type" : "string",
"description" : "Query in the Lucene query string syntax"
},
"routing": {
"type" : "list",
"description" : "A comma-separated list of specific routing values"
},
"scroll": {
"type" : "duration",
"description" : "Specify how long a consistent view of the index should be maintained for scrolled search"
},
"search_type": {
"type" : "enum",
"options" : ["query_then_fetch", "query_and_fetch", "dfs_query_then_fetch", "dfs_query_and_fetch", "count", "scan"],
"description" : "Search operation type"
},
"size": {
"type" : "number",
"description" : "Number of hits to return (default: 10)"
},
"sort": {
"type" : "list",
"description" : "A comma-separated list of <field>:<direction> pairs"
},
"source": {
"type" : "string",
"description" : "The URL-encoded request definition using the Query DSL (instead of using request body)"
},
"_source": {
"type" : "list",
"description" : "True or false to return the _source field or not, or a list of fields to return"
},
"_source_exclude": {
"type" : "list",
"description" : "A list of fields to exclude from the returned _source field"
},
"_source_include": {
"type" : "list",
"description" : "A list of fields to extract and return from the _source field"
},
"stats": {
"type" : "list",
"description" : "Specific 'tag' of the request for logging and statistical purposes"
},
"suggest_field": {
"type" : "string",
"description" : "Specify which field to use for suggestions"
},
"suggest_mode": {
"type" : "enum",
"options" : ["missing", "popular", "always"],
"default" : "missing",
"description" : "Specify suggest mode"
},
"suggest_size": {
"type" : "number",
"description" : "How many suggestions to return in response"
},
"suggest_text": {
"type" : "text",
"description" : "The source text for which the suggestions should be returned"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"version": {
"type" : "boolean",
"description" : "Specify whether to return document version as part of a hit"
}
}
},
"body": {
"description": "The search definition using the Query DSL"
}
}
}

View File

@ -0,0 +1,39 @@
{
"suggest": {
"documentation": "http://elasticsearch.org/guide/reference/api/search/suggest/",
"methods": ["POST", "GET"],
"url": {
"path": "/_suggest",
"paths": ["/_suggest", "/{index}/_suggest"],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices"
}
},
"params": {
"ignore_indices": {
"type" : "enum",
"options" : ["none","missing"],
"default" : "none",
"description" : "When performed on multiple indices, allows to ignore `missing` ones"
},
"preference": {
"type" : "string",
"description" : "Specify the node or shard the operation should be performed on (default: random)"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"source": {
"type" : "string",
"description" : "The URL-encoded request definition (instead of using request body)"
}
}
},
"body": {
"description" : "The request definition"
}
}
}

View File

@ -0,0 +1,95 @@
{
"update": {
"documentation": "http://elasticsearch.org/guide/reference/api/update/",
"methods": ["POST"],
"url": {
"path": "/{index}/{type}/{id}/_update",
"paths": ["/{index}/{type}/{id}/_update"],
"parts": {
"id": {
"type" : "string",
"required" : true,
"description" : "Document ID"
},
"index": {
"type" : "string",
"required" : true,
"description" : "The name of the index"
},
"type": {
"type" : "string",
"required" : true,
"description" : "The type of the document"
}
},
"params": {
"consistency": {
"type" : "enum",
"options" : ["one", "quorum", "all"],
"description" : "Explicit write consistency setting for the operation"
},
"fields": {
"type": "list",
"description" : "A comma-separated list of fields to return in the response"
},
"lang": {
"type" : "string",
"description" : "The script language (default: mvel)"
},
"parent": {
"type" : "string",
"description" : "ID of the parent document"
},
"percolate": {
"type" : "string",
"description" : "Perform percolation during the operation; use specific registered query name, attribute, or wildcard"
},
"refresh": {
"type" : "boolean",
"description" : "Refresh the index after performing the operation"
},
"replication": {
"type" : "enum",
"options" : ["sync","async"],
"default" : "sync",
"description" : "Specific replication type"
},
"retry_on_conflict": {
"type" : "number",
"description" : "Specify how many times should the operation be retried when a conflict occurs (default: 0)"
},
"routing": {
"type" : "string",
"description" : "Specific routing value"
},
"script": {
"description" : "The URL-encoded script definition (instead of using request body)"
},
"timeout": {
"type" : "time",
"description" : "Explicit operation timeout"
},
"timestamp": {
"type" : "time",
"description" : "Explicit timestamp for the document"
},
"ttl": {
"type" : "duration",
"description" : "Expiration time for the document"
},
"version" : {
"type" : "number",
"description" : "Explicit version number for concurrency control"
},
"version_type": {
"type" : "enum",
"options" : ["internal","external"],
"description" : "Specific version type"
}
}
},
"body": {
"description" : "The request definition using either `script` or partial `doc`"
}
}
}

View File

@ -0,0 +1,194 @@
Test Suite:
===========
A YAML test file consists of:
* an optional `setup` section, followed by
* one or more test sections
For instance:
setup:
- do: ....
- do: ....
---
"First test":
- do: ...
- match: ...
---
"Second test":
- do: ...
- match: ...
A `setup` section contains a list of commands to run before each test
section in order to setup the same environment for each test section.
A test section represents an independent test, containing multiple `do`
statements and assertions. The contents of a test section must be run in
order, but individual test sections may be run in any order, as follows:
1. run `setup` (if any)
2. reset the `response` var and the `stash` (see below)
2. run test contents
3. run teardown
The `teardown` should delete all indices and all templates.
Dot notation:
-------------
Dot notation is used for (1) method calls and (2) hierarchical data structures. For
instance, a method call like `cluster.health` would do the equivalent of:
client.cluster.health(...params...)
A test against `_tokens.1.token` would examine the `token` key, in the second element
of the `tokens` array, inside the `response` var (see below):
$val = $response->{tokens}[1]{token} # Perl syntax roolz!
If one of the levels (eg `tokens`) does not exist, it should return an undefined value.
If no field name is given (ie the empty string) then return the current
$val -- used for testing the whole response body.
Use \. to specify paths that actually contain '.' in the key name, for example
in the `indices.get_settings` API.
Skipping tests:
---------------
If a test section should only be run on certain versions of Elasticsearch,
then the first entry in the section (after the title) should be called
`skip`, and should contain the range of versions to be
skipped, and the reason why the tests are skipped. For instance:
....
"Parent":
- skip:
version: "0 - 0.90.2"
reason: Delete ignores the parent param
- do:
... test definitions ...
....
All tests in the file following the skip statement should be skipped if:
`min <= current <= max`.
The `version` range should always have an upper bound. Versions should
either have each version part compared numerically, or should be converted
to a string with sufficient digits to allow string comparison, eg
0.90.2 -> 000-090-002
Snapshot versions and versions of the form `1.0.0.Beta1` can be treated
as the rounded down version, eg `1.0.0`.
Required operators:
-------------------
=== `do`
The `do` operator calls a method on the client. For instance:
....
- do:
cluster.health:
level: shards
....
The response from the `do` operator should be stored in the `response` var, which
is reset (1) at the beginning of a file or (2) on the next `do`.
If the arguments to `do` include `catch`, then we are expecting an error, which should
be caught and tested. For instance:
....
- do:
catch: missing
get:
index: test
type: test
id: 1
....
The argument to `catch` can be any of:
[horizontal]
`missing`:: a 404 response from ES
`conflict`:: a 409 response from ES
`request`:: a generic error response from ES
`param`:: a client-side error indicating an unknown parameter has been passed
to the method
`/foo bar/`:: the text of the error message matches this regular expression
If `catch` is specified, then the `response` var must be cleared, and the test
should fail if no error is thrown.
=== `set`
For some tests, it is necessary to extract a value from the previous `response`, in
order to reuse it in a subsequent `do` and other tests. For instance, when
testing indexing a document without a specified ID:
....
- do:
index:
index: test
type: test
- set: { _id: id } # stash the value of `response._id` as `id`
- do:
get:
index: test
type: test
id: $id # replace `$id` with the stashed value
- match: { _id: $id } # the returned `response._id` matches the stashed `id`
....
The stash should be reset at the beginning of each test file.
=== `is_true`
The specified key exists and has a true value (ie not `0`, `false`, `undefined`, `null`
or the empty string), eg:
....
- is_true: fields._parent # the _parent key exists in the fields hash and is "true"
....
=== `is_false`
The specified key doesn't exist or has a false value (ie `0`, `false`, `undefined`,
`null` or the empty string), eg:
....
- is_false: fields._source # the _source key doesn't exist in the fields hash or is "false"
....
=== `match`
Used to compare two variables (could be scalars, arrays or hashes). The two variables
should be identical, eg:
....
- match: { _source: { foo: bar }}
....
=== `lt` and `gt`
Compares two numeric values, eg:
....
- lt: { fields._ttl: 10000 } # the `_ttl` value is less than 10,000
....
=== `length`
This depends on the datatype of the value being examined, eg:
....
- length: { _id: 22 } # the `_id` string is 22 chars long
- length: { _tokens: 3 } # the `_tokens` array has 3 elements
- length: { _source: 5 } # the `_source` hash has 5 keys
....

View File

@ -0,0 +1,25 @@
---
"Array of objects":
- do:
bulk:
refresh: true
body:
- index:
_index: test_index
_type: test_type
_id: test_id
- f1: v1
f2: 42
- index:
_index: test_index
_type: test_type
_id: test_id2
- f1: v2
f2: 47
- do:
count:
index: test_index
- match: {count: 2}

View File

@ -0,0 +1,17 @@
---
"List of strings":
- do:
bulk:
refresh: true
body:
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}'
- '{"f1": "v1", "f2": 42}'
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}}'
- '{"f1": "v2", "f2": 47}'
- do:
count:
index: test_index
- match: {count: 2}

View File

@ -0,0 +1,17 @@
---
"One big string":
- do:
bulk:
refresh: true
body: |
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}
{"f1": "v1", "f2": 42}
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}}
{"f1": "v2", "f2": 47}
- do:
count:
index: test_index
- match: {count: 2}

View File

@ -0,0 +1,8 @@
---
"node_info test":
- do:
cluster.node_info: {}
- is_true: ok
- is_true: nodes
- is_true: cluster_name

View File

@ -0,0 +1,9 @@
---
"Nodes stats":
- do:
cluster.node_stats:
indices: true
transport: true
- is_true: cluster_name
- is_true: nodes

View File

@ -0,0 +1,14 @@
---
"Test put settings":
- do:
cluster.put_settings:
body:
transient:
discovery.zen.minimum_master_nodes: 1
- match: {transient: {discovery.zen.minimum_master_nodes: "1"}}
- do:
cluster.get_settings: {}
- match: {transient: {discovery.zen.minimum_master_nodes: "1"}}

View File

@ -0,0 +1,6 @@
---
"Basic sanity check":
- do:
cluster.reroute: {}
- is_true: ok

View File

@ -0,0 +1,6 @@
---
"cluster state test":
- do:
cluster.state: {}
- is_true: master_node

View File

@ -0,0 +1,34 @@
---
"Create with ID":
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
- is_true: ok
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: "1"}
- match: { _version: 1}
- do:
get:
index: test_1
type: test
id: 1
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: "1"}
- match: { _version: 1}
- match: { _source: { foo: bar }}
- do:
catch: conflict
create:
index: test_1
type: test
id: 1
body: { foo: bar }

View File

@ -0,0 +1,27 @@
---
"Create without ID":
- do:
create:
index: test_1
type: test
body: { foo: bar }
- is_true: ok
- is_true: _id
- match: { _index: test_1 }
- match: { _type: test }
- match: { _version: 1 }
- set: { _id: id }
- do:
get:
index: test_1
type: test
id: '$id'
- match: { _index: test_1 }
- match: { _type: test }
- match: { _id: $id }
- match: { _version: 1 }
- match: { _source: { foo: bar }}

View File

@ -0,0 +1,20 @@
---
"Internal version":
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
catch: conflict
create:
index: test_1
type: test
id: 1
body: { foo: bar }

View File

@ -0,0 +1,33 @@
---
"External version":
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- match: { _version: 5}
- do:
catch: conflict
create:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- do:
catch: conflict
create:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 6

View File

@ -0,0 +1,32 @@
---
"Routing":
- do:
create:
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
cluster.health:
wait_for_status: yellow
- do:
get:
index: test_1
type: test
id: 1
routing: 5
fields: [_routing]
- match: { _id: "1"}
- match: { fields._routing: "5"}
- do:
catch: missing
get:
index: test_1
type: test
id: 1

View File

@ -0,0 +1,49 @@
---
"Parent":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_parent: { type: "foo" }
- do:
cluster.health:
wait_for_status: yellow
- do:
catch: /RoutingMissingException/
create:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
create:
index: test_1
type: test
id: 1
parent: 5
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
parent: 5
fields: [_parent, _routing]
- match: { _id: "1"}
- match: { fields._parent: "5"}
- match: { fields._routing: "5"}
- do:
catch: missing
get:
index: test_1
type: test
id: 1

View File

@ -0,0 +1,51 @@
---
"Parent with routing":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_parent: { type: "foo" }
- do:
cluster.health:
wait_for_status: yellow
- do:
create:
index: test_1
type: test
id: 1
parent: 5
routing: 4
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
parent: 5
routing: 4
fields: [_parent, _routing]
- match: { _id: "1"}
- match: { fields._parent: "5"}
- match: { fields._routing: "4"}
- do:
catch: missing
get:
index: test_1
type: test
id: 1
parent: 5
- do:
get:
index: test_1
type: test
id: 1
routing: 4

View File

@ -0,0 +1,45 @@
---
"Refresh":
- do:
indices.create:
index: test_1
body:
settings:
index.refresh_interval: -1
- do:
cluster.health:
wait_for_status: yellow
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
search:
index: test_1
type: test
body:
query: { term: { _id: 1 }}
- match: { hits.total: 0 }
- do:
create:
index: test_1
type: test
id: 2
refresh: 1
body: { foo: bar }
- do:
search:
index: test_1
type: test
body:
query: { term: { _id: 2 }}
- match: { hits.total: 1 }

View File

@ -0,0 +1,81 @@
---
"Timestamp":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_timestamp:
enabled: 1
store: yes
- do:
cluster.health:
wait_for_status: yellow
# blank timestamp
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
fields: _timestamp
- is_true: fields._timestamp
# milliseconds since epoch
- do:
delete:
index: test_1
type: test
id: 1
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
timestamp: 1372011280000
- do:
get:
index: test_1
type: test
id: 1
fields: _timestamp
- match: { fields._timestamp: 1372011280000 }
# date format
- do:
delete:
index: test_1
type: test
id: 1
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
timestamp: 2013-06-23T18:14:40
- do:
get:
index: test_1
type: test
id: 1
fields: _timestamp
- match: { fields._timestamp: 1372011280000 }

View File

@ -0,0 +1,101 @@
---
"TTL":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_ttl:
enabled: 1
store: yes
default: 10s
- do:
cluster.health:
wait_for_status: yellow
# blank ttl
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
- lt: { fields._ttl: 10000}
- gt: { fields._ttl: 0}
# milliseconds
- do:
delete:
index: test_1
type: test
id: 1
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
ttl: 100000
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
- lt: { fields._ttl: 100000}
- gt: { fields._ttl: 10000}
# duration
- do:
delete:
index: test_1
type: test
id: 1
- do:
create:
index: test_1
type: test
id: 1
body: { foo: bar }
ttl: 20s
- do:
get:
index: test_1
type: test
id: 1
fields: _ttl
- lt: { fields._ttl: 20000}
- gt: { fields._ttl: 10000}
# with timestamp
- do:
delete:
index: test_1
type: test
id: 1
- do:
catch: /AlreadyExpiredException/
create:
index: test_1
type: test
id: 1
body: { foo: bar }
ttl: 20s
timestamp: 2013-06-23T18:14:40

View File

@ -0,0 +1,5 @@
Tests missing for:
# consistency
# percolate
# replication

View File

@ -0,0 +1,20 @@
---
"Basic":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- is_true: ok
- match: { _version: 1 }
- do:
delete:
index: test_1
type: test
id: 1
- match: { _version: 2 }

View File

@ -0,0 +1,28 @@
---
"Internal version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- match: { _version: 1}
- do:
catch: conflict
delete:
index: test_1
type: test
id: 1
version: 2
- do:
delete:
index: test_1
type: test
id: 1
version: 1
- match: { _version: 2 }

View File

@ -0,0 +1,32 @@
---
"External version":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
version_type: external
version: 5
- match: { _version: 5}
- do:
catch: conflict
delete:
index: test_1
type: test
id: 1
version_type: external
version: 4
- do:
delete:
index: test_1
type: test
id: 1
version_type: external
version: 6
- match: { _version: 6}

View File

@ -0,0 +1,29 @@
---
"Routing":
- do:
index:
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
cluster.health:
wait_for_status: yellow
- do:
catch: missing
delete:
index: test_1
type: test
id: 1
routing: 4
- do:
delete:
index: test_1
type: test
id: 1
routing: 5

View File

@ -0,0 +1,41 @@
---
"Parent":
- skip:
version: "0 - 0.90.2"
reason: Delete ignores the parent param
- do:
indices.create:
index: test_1
body:
mappings:
test:
_parent: { type: "foo" }
- do:
cluster.health:
wait_for_status: yellow
- do:
index:
index: test_1
type: test
id: 1
parent: 5
body: { foo: bar }
- do:
catch: missing
delete:
index: test_1
type: test
id: 1
parent: 1
- do:
delete:
index: test_1
type: test
id: 1
parent: 5

View File

@ -0,0 +1,28 @@
---
"Delete on all shards when parent not specified":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_parent: { type: "foo" }
- do:
cluster.health:
wait_for_status: yellow
- do:
index:
index: test_1
type: test
id: 1
parent: 5
body: { foo: bar }
- do:
delete:
index: test_1
type: test
id: 1

View File

@ -0,0 +1,40 @@
---
"Parent with routing":
- do:
indices.create:
index: test_1
body:
mappings:
test:
_parent: { type: "foo" }
- do:
cluster.health:
wait_for_status: yellow
- do:
index:
index: test_1
type: test
id: 1
parent: 5
routing: 4
body: { foo: bar }
- do:
catch: missing
delete:
index: test_1
type: test
id: 1
parent: 5
routing: 1
- do:
delete:
index: test_1
type: test
id: 1
parent: 5
routing: 4

View File

@ -0,0 +1,68 @@
---
"Refresh":
- do:
indices.create:
index: test_1
body:
settings:
index.refresh_interval: -1
- do:
cluster.health:
wait_for_status: yellow
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
refresh: 1
- do:
index:
index: test_1
type: test
id: 2
body: { foo: bar }
refresh: 1
- do:
search:
index: test_1
type: test
body:
query: { terms: { _id: [1,2] }}
- match: { hits.total: 2 }
- do:
delete:
index: test_1
type: test
id: 1
- do:
search:
index: test_1
type: test
body:
query: { terms: { _id: [1,2] }}
- match: { hits.total: 2 }
- do:
delete:
index: test_1
type: test
id: 2
refresh: 1
- do:
search:
index: test_1
type: test
body:
query: { terms: { _id: [1,2] }}
- match: { hits.total: 1 }

View File

@ -0,0 +1,19 @@
---
"Missing document with catch":
- do:
catch: missing
delete:
index: test_1
type: test
id: 1
---
"Missing document with ignore":
- do:
delete:
index: test_1
type: test
id: 1
ignore: 404

View File

@ -0,0 +1,6 @@
Tests missing for:
# consistency
# replication
# timeout

View File

@ -0,0 +1,43 @@
---
"Basic delete_by_query":
- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }
- do:
index:
index: test_1
type: test
id: 2
body: { foo: baz }
- do:
index:
index: test_1
type: test
id: 3
body: { foo: foo }
- do:
indices.refresh: {}
- do:
delete_by_query:
index: test_1
body:
match:
foo: bar
- is_true: ok
- do:
indices.refresh: {}
- do:
count:
index: test_1
- match: { count: 2 }

View File

@ -0,0 +1,27 @@
---
"Basic":
- do:
exists:
index: test_1
type: test
id: 1
- is_false: ''
- do:
index:
index: test_1
type: test
id: 1
body: { "foo": "bar" }
- is_true: ''
- do:
exists:
index: test_1
type: test
id: 1
- is_true: ''

View File

@ -0,0 +1,42 @@
---
"Parent":
- skip:
version: "0 - 0.90.2"
reason: "Parent not supported in exists https://github.com/elasticsearch/elasticsearch/issues/3276"
- do:
indices.create:
index: test_1
body:
mappings:
test:
_parent: { type: "foo" }
- do:
cluster.health:
wait_for_status: yellow
- do:
index:
index: test_1
type: test
id: 1
parent: 5
body: { foo: bar }
- do:
exists:
index: test_1
type: test
id: 1
parent: 5
- is_true: ''
- do:
exists:
index: test_1
type: test
id: 1
- is_false: ''

View File

@ -0,0 +1,29 @@
---
"Routing":
- do:
index:
index: test_1
type: test
id: 1
routing: 5
body: { foo: bar }
- do:
cluster.health:
wait_for_status: yellow
- do:
exists:
index: test_1
type: test
id: 1
routing: 5
- is_true: ''
- do:
exists:
index: test_1
type: test
id: 1
- is_false: ''

Some files were not shown because too many files have changed in this diff Show More