-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
120 lines (117 loc) · 3.44 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
'use strict';
var ca = require('elasticsearch/src/lib/client_action').makeFactoryWithModifier(function (spec) {
return require('elasticsearch/src/lib/utils').merge(spec, {
params: {
filterPath: {
type: 'list',
name: 'filter_path'
}
}
});
});
/**
* Perform a [deleteByQuery](http://www.elastic.co/guide/en/elasticsearch/reference/1.6/docs-delete-by-query.html) request
*
* @param {Object} params - An object with parameters used to carry out this action
* @param {String} params.analyzer - The analyzer to use for the query string
* @param {String} params.consistency - Specific write consistency setting for the operation
* @param {String} [params.defaultOperator=OR] - The default operator for query string query (AND or OR)
* @param {String} params.df - The field to use as default where no field prefix is given in the query string
* @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.replication=sync] - Specific replication type
* @param {String} params.q - Query in the Lucene query string syntax
* @param {String} params.routing - Specific routing value
* @param {Date, Number} params.timeout - Explicit operation timeout
* @param {String, String[], Boolean} params.index - A comma-separated list of indices to restrict the operation; use `_all` to perform the operation on all indices
* @param {String, String[], Boolean} params.type - A comma-separated list of types to restrict the operation
*/
function deleteByQuery(Client, config, components) {
Client.prototype.deleteByQuery = ca({
params: {
analyzer: {
type: 'string'
},
consistency: {
type: 'enum',
options: [
'one',
'quorum',
'all'
]
},
defaultOperator: {
type: 'enum',
'default': 'OR',
options: [
'AND',
'OR'
],
name: 'default_operator'
},
df: {
type: 'string'
},
ignoreUnavailable: {
type: 'boolean',
name: 'ignore_unavailable'
},
allowNoIndices: {
type: 'boolean',
name: 'allow_no_indices'
},
expandWildcards: {
type: 'enum',
'default': 'open',
options: [
'open',
'closed',
'none',
'all'
],
name: 'expand_wildcards'
},
replication: {
type: 'enum',
'default': 'sync',
options: [
'sync',
'async'
]
},
q: {
type: 'string'
},
routing: {
type: 'string'
},
timeout: {
type: 'time'
}
},
urls: [
{
fmt: '/<%=index%>/<%=type%>/_query',
req: {
index: {
type: 'list'
},
type: {
type: 'list'
}
}
},
{
fmt: '/<%=index%>/_query',
req: {
index: {
type: 'list'
}
}
}
],
method: 'DELETE'
});
}
module.exports = deleteByQuery;