updated the API, which includes countPercolate and mpercolate methods.

This commit is contained in:
Spencer Alger
2014-01-20 15:44:16 -07:00
parent 3f45f93f81
commit cef934b265
6 changed files with 365 additions and 25 deletions

View File

@ -8,6 +8,7 @@ NOTE: At this time, you must opt into the 1.0 API by setting the `apiVerion` con
* <<api-bulk,bulk>> * <<api-bulk,bulk>>
* <<api-clearscroll,clearScroll>> * <<api-clearscroll,clearScroll>>
* <<api-count,count>> * <<api-count,count>>
* <<api-countpercolate,countPercolate>>
* <<api-create,create>> * <<api-create,create>>
* <<api-delete,delete>> * <<api-delete,delete>>
* <<api-deletebyquery,deleteByQuery>> * <<api-deletebyquery,deleteByQuery>>
@ -19,6 +20,7 @@ NOTE: At this time, you must opt into the 1.0 API by setting the `apiVerion` con
* <<api-info,info>> * <<api-info,info>>
* <<api-mget,mget>> * <<api-mget,mget>>
* <<api-mlt,mlt>> * <<api-mlt,mlt>>
* <<api-mpercolate,mpercolate>>
* <<api-msearch,msearch>> * <<api-msearch,msearch>>
* <<api-percolate,percolate>> * <<api-percolate,percolate>>
* <<api-ping,ping>> * <<api-ping,ping>>
@ -257,6 +259,59 @@ Options:::
link:#[back to top] link:#[back to top]
[[api-countpercolate]]
=== `countPercolate`
[source,js]
--------
client.countPercolate([params, [callback]])
--------
// no description
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`routing`::
`String, String[], Boolean` -- A comma-separated list of specific routing values
`preference`::
`String` -- Specify the node or shard the operation should be performed on (default: random)
`ignoreUnavailable`::
`Boolean` -- Whether specified concrete indices should be ignored when unavailable (missing or closed)
`allowNoIndices`::
`Boolean` -- Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
`[expandWildcards=open]`::
`String` -- Whether to expand wildcard expression to concrete indices that are open, closed or both.
Options:::
* `"open"`
* `"closed"`
`percolateIndex`::
`String` -- The index to count percolate the document into. Defaults to index.
`percolateType`::
`String` -- The type to count percolate document into. Defaults to type.
`version`::
`Number` -- Explicit version number for concurrency control
`versionType`::
`String` -- Specific version type
Options:::
* `"internal"`
* `"external"`
`index`::
`String` -- The index of the document being count percolated.
`type`::
`String` -- The type of the document being count percolated.
`id`::
`String` -- Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
link:#[back to top]
[[api-create]] [[api-create]]
=== `create` === `create`
@ -984,6 +1039,41 @@ client.mlt({
link:#[back to top] link:#[back to top]
[[api-mpercolate]]
=== `mpercolate`
[source,js]
--------
client.mpercolate([params, [callback]])
--------
// no description
The default method is `POST` and the usual <<api-conventions,params and return values>> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html[the elasticsearch docs] for more about this method.
// no examples
==== Params
[horizontal]
`ignoreUnavailable`::
`Boolean` -- Whether specified concrete indices should be ignored when unavailable (missing or closed)
`allowNoIndices`::
`Boolean` -- Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
`[expandWildcards=open]`::
`String` -- Whether to expand wildcard expression to concrete indices that are open, closed or both.
Options:::
* `"open"`
* `"closed"`
`index`::
`String` -- The index of the document being count percolated to use as default
`type`::
`String` -- The type of the document being percolated to use as default.
link:#[back to top]
[[api-msearch]] [[api-msearch]]
=== `msearch` === `msearch`
@ -1119,12 +1209,38 @@ client.percolate({
==== Params ==== Params
[horizontal] [horizontal]
`preferLocal`:: `routing`::
`Boolean` -- With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true) `String, String[], Boolean` -- A comma-separated list of specific routing values
`preference`::
`String` -- Specify the node or shard the operation should be performed on (default: random)
`ignoreUnavailable`::
`Boolean` -- Whether specified concrete indices should be ignored when unavailable (missing or closed)
`allowNoIndices`::
`Boolean` -- Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
`[expandWildcards=open]`::
`String` -- Whether to expand wildcard expression to concrete indices that are open, closed or both.
Options:::
* `"open"`
* `"closed"`
`percolateIndex`::
`String` -- The index to percolate the document into. Defaults to index.
`percolateType`::
`String` -- The type to percolate document into. Defaults to type.
`version`::
`Number` -- Explicit version number for concurrency control
`versionType`::
`String` -- Specific version type
Options:::
* `"internal"`
* `"external"`
`index`:: `index`::
`String` -- The name of the index with a registered percolator query `String` -- The index of the document being percolated.
`type`:: `type`::
`String` -- The document type `String` -- The type of the document being percolated.
`id`::
`String` -- Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
link:#[back to top] link:#[back to top]
@ -3636,7 +3752,7 @@ The default method is `GET` and the usual <<api-conventions,params and return va
`masterTimeout`:: `masterTimeout`::
`Date, Number` -- Explicit operation timeout for connection to master node `Date, Number` -- Explicit operation timeout for connection to master node
`repository`:: `repository`::
`String, String[], Boolean` -- A comma-separated list of repository names `String` -- A repository name
`snapshot`:: `snapshot`::
`String, String[], Boolean` -- A comma-separated list of snapshot names `String, String[], Boolean` -- A comma-separated list of snapshot names

View File

@ -64,6 +64,7 @@
}, },
"scripts": { "scripts": {
"test": "grunt test", "test": "grunt test",
"generate": "node scripts/generate",
"blanket": { "blanket": {
"pattern": [ "pattern": [
"src" "src"

View File

@ -81,10 +81,17 @@ function manage_es {
case "$DO" in case "$DO" in
reinstall)
if [ -x "$ES_BIN" ]; then
echo "removing $ES_VERSION"
rm -rf ${SNAPSHOTS}/${ES_VERSION}*
fi
manage_es install $ES_BRANCH $ES_RELEASE
;;
install) install)
if [ ! -x "$ES_BIN" ]; then if [ ! -x "$ES_BIN" ]; then
echo "Downloading Elasticsearch $ES_VERSION" echo "Downloading Elasticsearch $ES_VERSION"
call rm -rf ${SNAPSHOTS}/${ES_VERSION}* rm -rf ${SNAPSHOTS}/${ES_VERSION}*
call curl --silent -O $ES_URL call curl --silent -O $ES_URL
unzip -q elasticsearch-*.zip unzip -q elasticsearch-*.zip
rm elasticsearch-*.zip rm elasticsearch-*.zip
@ -108,11 +115,11 @@ function manage_es {
return 1 return 1
else else
echo "PID file was left behind by ES" echo "PID file was left behind by ES"
call rm $PIDFILE rm $PIDFILE
fi fi
fi fi
./scripts/es.sh install $ES_BRANCH $ES_RELEASE manage_es install $ES_BRANCH $ES_RELEASE
if [ ! -x "$ES_BIN" ]; then if [ ! -x "$ES_BIN" ]; then
echo "Unable to find elasticsearch executable" echo "Unable to find elasticsearch executable"

View File

@ -18,5 +18,9 @@ fi
source scripts/_utils.sh source scripts/_utils.sh
if [[ -z "$ES_NODE_NAME" ]]; then
export ES_NODE_NAME="elasticsearch_js_test_runner"
fi
manage_es $* manage_es $*
exit $? exit $?

View File

@ -934,6 +934,98 @@ api.count = ca({
method: 'POST' method: 'POST'
}); });
/**
* Perform a [countPercolate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String, String[], Boolean} params.routing - A comma-separated list of specific routing values
* @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random)
* @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {String} params.percolateIndex - The index to count percolate the document into. Defaults to index.
* @param {String} params.percolateType - The type to count percolate document into. Defaults to type.
* @param {Number} params.version - Explicit version number for concurrency control
* @param {String} params.versionType - Specific version type
* @param {String} params.index - The index of the document being count percolated.
* @param {String} params.type - The type of the document being count percolated.
* @param {String} params.id - Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
*/
api.countPercolate = ca({
params: {
routing: {
type: 'list'
},
preference: {
type: 'string'
},
ignoreUnavailable: {
type: 'boolean',
name: 'ignore_unavailable'
},
allowNoIndices: {
type: 'boolean',
name: 'allow_no_indices'
},
expandWildcards: {
type: 'enum',
'default': 'open',
options: [
'open',
'closed'
],
name: 'expand_wildcards'
},
percolateIndex: {
type: 'string',
name: 'percolate_index'
},
percolateType: {
type: 'string',
name: 'percolate_type'
},
version: {
type: 'number'
},
versionType: {
type: 'enum',
options: [
'internal',
'external'
],
name: 'version_type'
}
},
urls: [
{
fmt: '/<%=index%>/<%=type%>/<%=id%>/_percolate/count',
req: {
index: {
type: 'string'
},
type: {
type: 'string'
},
id: {
type: 'string'
}
}
},
{
fmt: '/<%=index%>/<%=type%>/_percolate/count',
req: {
index: {
type: 'string'
},
type: {
type: 'string'
}
}
}
],
method: 'POST'
});
/** /**
* Perform a [delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-delete.html) request * Perform a [delete](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-delete.html) request
* *
@ -3629,6 +3721,63 @@ api.mlt = ca({
method: 'POST' method: 'POST'
}); });
/**
* Perform a [mpercolate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {String} params.index - The index of the document being count percolated to use as default
* @param {String} params.type - The type of the document being percolated to use as default.
*/
api.mpercolate = ca({
params: {
ignoreUnavailable: {
type: 'boolean',
name: 'ignore_unavailable'
},
allowNoIndices: {
type: 'boolean',
name: 'allow_no_indices'
},
expandWildcards: {
type: 'enum',
'default': 'open',
options: [
'open',
'closed'
],
name: 'expand_wildcards'
}
},
urls: [
{
fmt: '/<%=index%>/<%=type%>/_mpercolate',
req: {
index: {
type: 'string'
},
type: {
type: 'string'
}
}
},
{
fmt: '/<%=index%>/_mpercolate',
req: {
index: {
type: 'string'
}
}
},
{
fmt: '/_mpercolate'
}
],
method: 'POST'
});
/** /**
* Perform a [msearch](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-multi-search.html) request * Perform a [msearch](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-multi-search.html) request
* *
@ -4037,28 +4186,91 @@ api.nodes.prototype.stats = ca({
* Perform a [percolate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html) request * Perform a [percolate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-percolate.html) request
* *
* @param {Object} params - An object with parameters used to carry out this action * @param {Object} params - An object with parameters used to carry out this action
* @param {Boolean} params.preferLocal - With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true) * @param {String, String[], Boolean} params.routing - A comma-separated list of specific routing values
* @param {String} params.index - The name of the index with a registered percolator query * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random)
* @param {String} params.type - The document type * @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
* @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
* @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both.
* @param {String} params.percolateIndex - The index to percolate the document into. Defaults to index.
* @param {String} params.percolateType - The type to percolate document into. Defaults to type.
* @param {Number} params.version - Explicit version number for concurrency control
* @param {String} params.versionType - Specific version type
* @param {String} params.index - The index of the document being percolated.
* @param {String} params.type - The type of the document being percolated.
* @param {String} params.id - Substitute the document in the request body with a document that is known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document from within the cluster.
*/ */
api.percolate = ca({ api.percolate = ca({
params: { params: {
preferLocal: { routing: {
type: 'list'
},
preference: {
type: 'string'
},
ignoreUnavailable: {
type: 'boolean', type: 'boolean',
name: 'prefer_local' name: 'ignore_unavailable'
},
allowNoIndices: {
type: 'boolean',
name: 'allow_no_indices'
},
expandWildcards: {
type: 'enum',
'default': 'open',
options: [
'open',
'closed'
],
name: 'expand_wildcards'
},
percolateIndex: {
type: 'string',
name: 'percolate_index'
},
percolateType: {
type: 'string',
name: 'percolate_type'
},
version: {
type: 'number'
},
versionType: {
type: 'enum',
options: [
'internal',
'external'
],
name: 'version_type'
} }
}, },
url: { urls: [
fmt: '/<%=index%>/<%=type%>/_percolate', {
req: { fmt: '/<%=index%>/<%=type%>/<%=id%>/_percolate',
index: { req: {
type: 'string' index: {
}, type: 'string'
type: { },
type: 'string' type: {
type: 'string'
},
id: {
type: 'string'
}
}
},
{
fmt: '/<%=index%>/<%=type%>/_percolate',
req: {
index: {
type: 'string'
},
type: {
type: 'string'
}
} }
} }
}, ],
method: 'POST' method: 'POST'
}); });
@ -4437,7 +4649,7 @@ api.snapshot.prototype.deleteRepository = ca({
* *
* @param {Object} params - An object with parameters used to carry out this action * @param {Object} params - An object with parameters used to carry out this action
* @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node * @param {Date, Number} params.masterTimeout - Explicit operation timeout for connection to master node
* @param {String, String[], Boolean} params.repository - A comma-separated list of repository names * @param {String} params.repository - A repository name
* @param {String, String[], Boolean} params.snapshot - A comma-separated list of snapshot names * @param {String, String[], Boolean} params.snapshot - A comma-separated list of snapshot names
*/ */
api.snapshot.prototype.get = ca({ api.snapshot.prototype.get = ca({
@ -4451,7 +4663,7 @@ api.snapshot.prototype.get = ca({
fmt: '/_snapshot/<%=repository%>/<%=snapshot%>', fmt: '/_snapshot/<%=repository%>/<%=snapshot%>',
req: { req: {
repository: { repository: {
type: 'list' type: 'string'
}, },
snapshot: { snapshot: {
type: 'list' type: 'list'