Added new docs examples (#1233)
This commit is contained in:
committed by
GitHub
parent
83e5147d9d
commit
148f2fd864
15
docs/doc_examples/014b788c879e4aaa1020672e45e25473.asciidoc
Normal file
15
docs/doc_examples/014b788c879e4aaa1020672e45e25473.asciidoc
Normal file
@ -0,0 +1,15 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.cluster.putSettings({
|
||||
body: {
|
||||
transient: {
|
||||
'cluster.routing.use_adaptive_replica_selection': false
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
14
docs/doc_examples/025b54db0edc50c24ea48a2bd94366ad.asciidoc
Normal file
14
docs/doc_examples/025b54db0edc50c24ea48a2bd94366ad.asciidoc
Normal file
@ -0,0 +1,14 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'twitter',
|
||||
size: '0',
|
||||
q: 'extra:test',
|
||||
filter_path: 'hits.total'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
13
docs/doc_examples/073539a7e38be3cdf13008330b6a536a.asciidoc
Normal file
13
docs/doc_examples/073539a7e38be3cdf13008330b6a536a.asciidoc
Normal file
@ -0,0 +1,13 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.cat.indices({
|
||||
index: 'twi*',
|
||||
v: true,
|
||||
s: 'index'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
14
docs/doc_examples/09cdd5ae8114c49886026fef8d00a19c.asciidoc
Normal file
14
docs/doc_examples/09cdd5ae8114c49886026fef8d00a19c.asciidoc
Normal file
@ -0,0 +1,14 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.indices.getMapping({
|
||||
index: '_all'
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.indices.getMapping()
|
||||
console.log(response1)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/09dbd90c5e22ea4a17b4cf9aa72e08ae.asciidoc
Normal file
12
docs/doc_examples/09dbd90c5e22ea4a17b4cf9aa72e08ae.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
q: 'elasticsearch',
|
||||
filter_path: 'took,hits.hits._id,hits.hits._score'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
22
docs/doc_examples/09ecba5814d71e4c44468575eada9878.asciidoc
Normal file
22
docs/doc_examples/09ecba5814d71e4c44468575eada9878.asciidoc
Normal file
@ -0,0 +1,22 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
sales_over_time: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
fixed_interval: '30d'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
34
docs/doc_examples/0d664883151008b1051ef2c9ab2d0373.asciidoc
Normal file
34
docs/doc_examples/0d664883151008b1051ef2c9ab2d0373.asciidoc
Normal file
@ -0,0 +1,34 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
body: {
|
||||
slice: {
|
||||
id: 0,
|
||||
max: 2
|
||||
},
|
||||
script: {
|
||||
source: "ctx._source['extra'] = 'test'"
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
body: {
|
||||
slice: {
|
||||
id: 1,
|
||||
max: 2
|
||||
},
|
||||
script: {
|
||||
source: "ctx._source['extra'] = 'test'"
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
----
|
||||
|
||||
40
docs/doc_examples/1027ab1ca767ac1428176ef4f84bfbcf.asciidoc
Normal file
40
docs/doc_examples/1027ab1ca767ac1428176ef4f84bfbcf.asciidoc
Normal file
@ -0,0 +1,40 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.search({
|
||||
index: 'twitter',
|
||||
scroll: '1m',
|
||||
body: {
|
||||
slice: {
|
||||
id: 0,
|
||||
max: 2
|
||||
},
|
||||
query: {
|
||||
match: {
|
||||
title: 'elasticsearch'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.search({
|
||||
index: 'twitter',
|
||||
scroll: '1m',
|
||||
body: {
|
||||
slice: {
|
||||
id: 1,
|
||||
max: 2
|
||||
},
|
||||
query: {
|
||||
match: {
|
||||
title: 'elasticsearch'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/1252fa45847edba5ec2b2f33da70ec5b.asciidoc
Normal file
11
docs/doc_examples/1252fa45847edba5ec2b2f33da70ec5b.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.cluster.state({
|
||||
filter_path: 'routing_table.indices.**.state'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
19
docs/doc_examples/189a921df2f5b1fe580937210ce9c1c2.asciidoc
Normal file
19
docs/doc_examples/189a921df2f5b1fe580937210ce9c1c2.asciidoc
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
body: {
|
||||
query: {
|
||||
match_all: {}
|
||||
},
|
||||
stats: [
|
||||
'group1',
|
||||
'group2'
|
||||
]
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/1dbb8cf17fbc45c87c7d2f75f15f9778.asciidoc
Normal file
11
docs/doc_examples/1dbb8cf17fbc45c87c7d2f75f15f9778.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.cluster.state({
|
||||
filter_path: 'metadata.indices.*.stat*'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/1e18a67caf8f06ff2710ec4a8b30f625.asciidoc
Normal file
11
docs/doc_examples/1e18a67caf8f06ff2710ec4a8b30f625.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.cluster.state({
|
||||
filter_path: 'metadata.indices.*.state,-metadata.indices.logstash-*'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
19
docs/doc_examples/1e50d993bd6517e6c381e82d09f0389e.asciidoc
Normal file
19
docs/doc_examples/1e50d993bd6517e6c381e82d09f0389e.asciidoc
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
body: {
|
||||
from: 5,
|
||||
size: 20,
|
||||
query: {
|
||||
term: {
|
||||
'user.id': '8a4f500d'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
26
docs/doc_examples/213ab768f1b6a895e09403a0880e259a.asciidoc
Normal file
26
docs/doc_examples/213ab768f1b6a895e09403a0880e259a.asciidoc
Normal file
@ -0,0 +1,26 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
types_count: {
|
||||
value_count: {
|
||||
script: {
|
||||
id: 'my_script',
|
||||
params: {
|
||||
field: 'type'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
26
docs/doc_examples/2533e4b36ae837eaecda08407ecb6383.asciidoc
Normal file
26
docs/doc_examples/2533e4b36ae837eaecda08407ecb6383.asciidoc
Normal file
@ -0,0 +1,26 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
body: {
|
||||
suggest: {
|
||||
'my-suggest-1': {
|
||||
text: 'tring out Elasticsearch',
|
||||
term: {
|
||||
field: 'message'
|
||||
}
|
||||
},
|
||||
'my-suggest-2': {
|
||||
text: 'kmichy',
|
||||
term: {
|
||||
field: 'user'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
22
docs/doc_examples/2bb2339ac055337abf753bddb7771659.asciidoc
Normal file
22
docs/doc_examples/2bb2339ac055337abf753bddb7771659.asciidoc
Normal file
@ -0,0 +1,22 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
sales_over_time: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
fixed_interval: '2w'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
22
docs/doc_examples/2fd69fb0538e4f36ac69a8b8f8bf5ae8.asciidoc
Normal file
22
docs/doc_examples/2fd69fb0538e4f36ac69a8b8f8bf5ae8.asciidoc
Normal file
@ -0,0 +1,22 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
body: {
|
||||
script: {
|
||||
source: 'ctx._source.likes++',
|
||||
lang: 'painless'
|
||||
},
|
||||
query: {
|
||||
term: {
|
||||
user: 'kimchy'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
57
docs/doc_examples/2fe28d9a91b3081a9ec4601af8fb7b1c.asciidoc
Normal file
57
docs/doc_examples/2fe28d9a91b3081a9ec4601af8fb7b1c.asciidoc
Normal file
@ -0,0 +1,57 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.indices.create({
|
||||
index: 'test',
|
||||
body: {
|
||||
mappings: {
|
||||
dynamic: false,
|
||||
properties: {
|
||||
text: {
|
||||
type: 'text'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.index({
|
||||
index: 'test',
|
||||
refresh: true,
|
||||
body: {
|
||||
text: 'words words',
|
||||
flag: 'bar'
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
|
||||
const response2 = await client.index({
|
||||
index: 'test',
|
||||
refresh: true,
|
||||
body: {
|
||||
text: 'words words',
|
||||
flag: 'foo'
|
||||
}
|
||||
})
|
||||
console.log(response2)
|
||||
|
||||
const response3 = await client.indices.putMapping({
|
||||
index: 'test',
|
||||
body: {
|
||||
properties: {
|
||||
text: {
|
||||
type: 'text'
|
||||
},
|
||||
flag: {
|
||||
type: 'text',
|
||||
analyzer: 'keyword'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response3)
|
||||
----
|
||||
|
||||
23
docs/doc_examples/3722cb3705b6bc7f486969deace3dd83.asciidoc
Normal file
23
docs/doc_examples/3722cb3705b6bc7f486969deace3dd83.asciidoc
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
type_count: {
|
||||
value_count: {
|
||||
script: {
|
||||
source: "doc['type'].value"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
23
docs/doc_examples/39a6a038c4b551022afe83de0523634e.asciidoc
Normal file
23
docs/doc_examples/39a6a038c4b551022afe83de0523634e.asciidoc
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
sale_date: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
calendar_interval: 'year',
|
||||
missing: '2000/01/01'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
16
docs/doc_examples/3a700f836d8d5da1b656a876554028aa.asciidoc
Normal file
16
docs/doc_examples/3a700f836d8d5da1b656a876554028aa.asciidoc
Normal file
@ -0,0 +1,16 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.clearScroll({
|
||||
body: {
|
||||
scroll_id: [
|
||||
'DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==',
|
||||
'DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB'
|
||||
]
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
17
docs/doc_examples/4acf902c2598b2558f34f20c1744c433.asciidoc
Normal file
17
docs/doc_examples/4acf902c2598b2558f34f20c1744c433.asciidoc
Normal file
@ -0,0 +1,17 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.indices.refresh()
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.search({
|
||||
index: 'twitter',
|
||||
size: '0',
|
||||
q: 'extra:test',
|
||||
filter_path: 'hits.total'
|
||||
})
|
||||
console.log(response1)
|
||||
----
|
||||
|
||||
65
docs/doc_examples/5271f4ff29bb48838396e5a674664ee0.asciidoc
Normal file
65
docs/doc_examples/5271f4ff29bb48838396e5a674664ee0.asciidoc
Normal file
@ -0,0 +1,65 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.indices.create({
|
||||
index: 'my_index',
|
||||
body: {
|
||||
mappings: {
|
||||
properties: {
|
||||
city: {
|
||||
type: 'text',
|
||||
fields: {
|
||||
raw: {
|
||||
type: 'keyword'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '1',
|
||||
body: {
|
||||
city: 'New York'
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
|
||||
const response2 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '2',
|
||||
body: {
|
||||
city: 'York'
|
||||
}
|
||||
})
|
||||
console.log(response2)
|
||||
|
||||
const response3 = await client.search({
|
||||
index: 'my_index',
|
||||
body: {
|
||||
query: {
|
||||
match: {
|
||||
city: 'york'
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
'city.raw': 'asc'
|
||||
},
|
||||
aggs: {
|
||||
Cities: {
|
||||
terms: {
|
||||
field: 'city.raw'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response3)
|
||||
----
|
||||
|
||||
25
docs/doc_examples/5275842787967b6db876025f4a1c6942.asciidoc
Normal file
25
docs/doc_examples/5275842787967b6db876025f4a1c6942.asciidoc
Normal file
@ -0,0 +1,25 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
body: {
|
||||
suggest: {
|
||||
text: 'tring out Elasticsearch',
|
||||
'my-suggest-1': {
|
||||
term: {
|
||||
field: 'message'
|
||||
}
|
||||
},
|
||||
'my-suggest-2': {
|
||||
term: {
|
||||
field: 'user'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
19
docs/doc_examples/52a87b81e4e0b6b11e23e85db1602a63.asciidoc
Normal file
19
docs/doc_examples/52a87b81e4e0b6b11e23e85db1602a63.asciidoc
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
conflicts: 'proceed',
|
||||
body: {
|
||||
query: {
|
||||
term: {
|
||||
user: 'kimchy'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/54a770f053f3225ea0d1e34334232411.asciidoc
Normal file
12
docs/doc_examples/54a770f053f3225ea0d1e34334232411.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
scroll_size: '100'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/5925c23a173a63bdb30b458248d1df76.asciidoc
Normal file
12
docs/doc_examples/5925c23a173a63bdb30b458248d1df76.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getSettings({
|
||||
index: 'twitter',
|
||||
flat_settings: 'false'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
17
docs/doc_examples/5d32279dcd52b22d9e1178a02a3ad957.asciidoc
Normal file
17
docs/doc_examples/5d32279dcd52b22d9e1178a02a3ad957.asciidoc
Normal file
@ -0,0 +1,17 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.index({
|
||||
index: 'twitter',
|
||||
routing: 'kimchy',
|
||||
body: {
|
||||
user: 'kimchy',
|
||||
post_date: '2009-11-15T14:12:12',
|
||||
message: 'trying out Elasticsearch'
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
21
docs/doc_examples/5dd695679b5141d9142d3d30ba8d300a.asciidoc
Normal file
21
docs/doc_examples/5dd695679b5141d9142d3d30ba8d300a.asciidoc
Normal file
@ -0,0 +1,21 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
types_count: {
|
||||
value_count: {
|
||||
field: 'type'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/621665fdbd7fc103c09bfeed28b67b1a.asciidoc
Normal file
11
docs/doc_examples/621665fdbd7fc103c09bfeed28b67b1a.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.count({
|
||||
filter_path: '-_shards'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
26
docs/doc_examples/626f8c4b3e2cd3d9beaa63a7f5799d7a.asciidoc
Normal file
26
docs/doc_examples/626f8c4b3e2cd3d9beaa63a7f5799d7a.asciidoc
Normal file
@ -0,0 +1,26 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'twitter',
|
||||
body: {
|
||||
query: {
|
||||
match: {
|
||||
message: 'tring out Elasticsearch'
|
||||
}
|
||||
},
|
||||
suggest: {
|
||||
'my-suggestion': {
|
||||
text: 'tring out Elasticsearch',
|
||||
term: {
|
||||
field: 'message'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
43
docs/doc_examples/6464124d1677f4552ddddd95a340ca3a.asciidoc
Normal file
43
docs/doc_examples/6464124d1677f4552ddddd95a340ca3a.asciidoc
Normal file
@ -0,0 +1,43 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.index({
|
||||
index: 'library',
|
||||
refresh: true,
|
||||
body: {
|
||||
title: 'Book #1',
|
||||
rating: 200.1
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.index({
|
||||
index: 'library',
|
||||
refresh: true,
|
||||
body: {
|
||||
title: 'Book #2',
|
||||
rating: 1.7
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
|
||||
const response2 = await client.index({
|
||||
index: 'library',
|
||||
refresh: true,
|
||||
body: {
|
||||
title: 'Book #3',
|
||||
rating: 0.1
|
||||
}
|
||||
})
|
||||
console.log(response2)
|
||||
|
||||
const response3 = await client.search({
|
||||
filter_path: 'hits.hits._source',
|
||||
_source: 'title',
|
||||
sort: 'rating:desc'
|
||||
})
|
||||
console.log(response3)
|
||||
----
|
||||
|
||||
13
docs/doc_examples/6d1e75312a28a5ba23837abf768f2510.asciidoc
Normal file
13
docs/doc_examples/6d1e75312a28a5ba23837abf768f2510.asciidoc
Normal file
@ -0,0 +1,13 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'twitter',
|
||||
size: 'surprise_me',
|
||||
error_trace: 'true'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
24
docs/doc_examples/6faf10a73f7d5fffbcb037bdb2cbaff8.asciidoc
Normal file
24
docs/doc_examples/6faf10a73f7d5fffbcb037bdb2cbaff8.asciidoc
Normal file
@ -0,0 +1,24 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
dayOfWeek: {
|
||||
terms: {
|
||||
script: {
|
||||
lang: 'painless',
|
||||
source: "doc['date'].value.dayOfWeekEnum.value"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
42
docs/doc_examples/70f0aa5853697e265ef3b1df72940951.asciidoc
Normal file
42
docs/doc_examples/70f0aa5853697e265ef3b1df72940951.asciidoc
Normal file
@ -0,0 +1,42 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '1',
|
||||
refresh: true,
|
||||
body: {
|
||||
date: '2015-10-01T00:30:00Z'
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '2',
|
||||
refresh: true,
|
||||
body: {
|
||||
date: '2015-10-01T01:30:00Z'
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
|
||||
const response2 = await client.search({
|
||||
index: 'my_index',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
by_day: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
calendar_interval: 'day'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response2)
|
||||
----
|
||||
|
||||
20
docs/doc_examples/72231b7debac60c95b9869a97dafda3a.asciidoc
Normal file
20
docs/doc_examples/72231b7debac60c95b9869a97dafda3a.asciidoc
Normal file
@ -0,0 +1,20 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
body: {
|
||||
query: {
|
||||
match_phrase: {
|
||||
message: {
|
||||
query: 'this is a test',
|
||||
analyzer: 'my_analyzer'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/72beebe779a258c225dee7b023e60c52.asciidoc
Normal file
12
docs/doc_examples/72beebe779a258c225dee7b023e60c52.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.nodes.stats({
|
||||
metric: 'indices',
|
||||
index_metric: 'search'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
22
docs/doc_examples/73e5c88ad1488b213fb278ee1cb42289.asciidoc
Normal file
22
docs/doc_examples/73e5c88ad1488b213fb278ee1cb42289.asciidoc
Normal file
@ -0,0 +1,22 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
sales_over_time: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
calendar_interval: '2d'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/7df191cc7f814e410a4ac7261065e6ef.asciidoc
Normal file
12
docs/doc_examples/7df191cc7f814e410a4ac7261065e6ef.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.tasks.list({
|
||||
detailed: 'true',
|
||||
actions: '*byquery'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
20
docs/doc_examples/7e52bec09624cf6c0de5d13f2bfad5a5.asciidoc
Normal file
20
docs/doc_examples/7e52bec09624cf6c0de5d13f2bfad5a5.asciidoc
Normal file
@ -0,0 +1,20 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'twitter',
|
||||
scroll: '1m',
|
||||
body: {
|
||||
size: 100,
|
||||
query: {
|
||||
match: {
|
||||
title: 'elasticsearch'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
17
docs/doc_examples/83f95657beca9bf5d8264c80c7fb463f.asciidoc
Normal file
17
docs/doc_examples/83f95657beca9bf5d8264c80c7fb463f.asciidoc
Normal file
@ -0,0 +1,17 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
body: {
|
||||
query: {
|
||||
match_phrase: {
|
||||
message: 'this is a test'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
@ -4,9 +4,8 @@
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'twitter',
|
||||
body: {
|
||||
from: 0,
|
||||
size: 10,
|
||||
query: {
|
||||
term: {
|
||||
user: 'kimchy'
|
||||
23
docs/doc_examples/8a355eb25d2a01ba62dc1a22dd46f46f.asciidoc
Normal file
23
docs/doc_examples/8a355eb25d2a01ba62dc1a22dd46f46f.asciidoc
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
sales_over_time: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
calendar_interval: '1M',
|
||||
format: 'yyyy-MM-dd'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
28
docs/doc_examples/8acc1d67b152e7027e0f0e1a8b4b2431.asciidoc
Normal file
28
docs/doc_examples/8acc1d67b152e7027e0f0e1a8b4b2431.asciidoc
Normal file
@ -0,0 +1,28 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'twitter',
|
||||
routing: 'kimchy',
|
||||
body: {
|
||||
query: {
|
||||
bool: {
|
||||
must: {
|
||||
query_string: {
|
||||
query: 'some query string here'
|
||||
}
|
||||
},
|
||||
filter: {
|
||||
term: {
|
||||
user: 'kimchy'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
40
docs/doc_examples/8d9a63d7c31f08bd27d92ece3de1649c.asciidoc
Normal file
40
docs/doc_examples/8d9a63d7c31f08bd27d92ece3de1649c.asciidoc
Normal file
@ -0,0 +1,40 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '1',
|
||||
body: {
|
||||
text: 'Document with ID 1'
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '2',
|
||||
refresh: 'true',
|
||||
body: {
|
||||
text: 'Document with ID 2'
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
|
||||
const response2 = await client.search({
|
||||
index: 'my_index',
|
||||
body: {
|
||||
query: {
|
||||
terms: {
|
||||
_id: [
|
||||
'1',
|
||||
'2'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response2)
|
||||
----
|
||||
|
||||
23
docs/doc_examples/8de3206f80e18185a5ad6481f4c2ee07.asciidoc
Normal file
23
docs/doc_examples/8de3206f80e18185a5ad6481f4c2ee07.asciidoc
Normal file
@ -0,0 +1,23 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'my_index',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
by_day: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
calendar_interval: 'day',
|
||||
time_zone: '-01:00'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
15
docs/doc_examples/8e6bfb4441ffa15c86d5dc20fa083571.asciidoc
Normal file
15
docs/doc_examples/8e6bfb4441ffa15c86d5dc20fa083571.asciidoc
Normal file
@ -0,0 +1,15 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.cluster.putSettings({
|
||||
body: {
|
||||
transient: {
|
||||
'logger.org.elasticsearch.transport': 'trace'
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
24
docs/doc_examples/9524a9b7373fa4eb2905183b0e806962.asciidoc
Normal file
24
docs/doc_examples/9524a9b7373fa4eb2905183b0e806962.asciidoc
Normal file
@ -0,0 +1,24 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
sales_over_time: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
calendar_interval: '1M',
|
||||
format: 'yyyy-MM-dd',
|
||||
keyed: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
18
docs/doc_examples/978088f989d45dd09339582e9cbc60e0.asciidoc
Normal file
18
docs/doc_examples/978088f989d45dd09339582e9cbc60e0.asciidoc
Normal file
@ -0,0 +1,18 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: '%3Clogstash-%7Bnow%2Fd%7D%3E',
|
||||
body: {
|
||||
query: {
|
||||
match: {
|
||||
test: 'data'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
26
docs/doc_examples/97babc8d19ef0866774576716eb6d19e.asciidoc
Normal file
26
docs/doc_examples/97babc8d19ef0866774576716eb6d19e.asciidoc
Normal file
@ -0,0 +1,26 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.updateByQuery({
|
||||
index: 'test',
|
||||
refresh: true,
|
||||
conflicts: 'proceed'
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.search({
|
||||
index: 'test',
|
||||
filter_path: 'hits.total',
|
||||
body: {
|
||||
query: {
|
||||
match: {
|
||||
flag: 'foo'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
----
|
||||
|
||||
18
docs/doc_examples/a34d70d7022eb4ba48909d440c80390f.asciidoc
Normal file
18
docs/doc_examples/a34d70d7022eb4ba48909d440c80390f.asciidoc
Normal file
@ -0,0 +1,18 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: '%3Clogstash-%7Bnow%2Fd-2d%7D%3E%2C%3Clogstash-%7Bnow%2Fd-1d%7D%3E%2C%3Clogstash-%7Bnow%2Fd%7D%3E',
|
||||
body: {
|
||||
query: {
|
||||
match: {
|
||||
test: 'data'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/a4a396cd07657b3977713fb3a742c41b.asciidoc
Normal file
12
docs/doc_examples/a4a396cd07657b3977713fb3a742c41b.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
conflicts: 'proceed'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/a6f8636b03cc5f677b7d89e750328612.asciidoc
Normal file
12
docs/doc_examples/a6f8636b03cc5f677b7d89e750328612.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'twitter',
|
||||
size: 'surprise_me'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
27
docs/doc_examples/a71c438cc4df1cafe3109ccff475afdb.asciidoc
Normal file
27
docs/doc_examples/a71c438cc4df1cafe3109ccff475afdb.asciidoc
Normal file
@ -0,0 +1,27 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.create({
|
||||
index: 'my_index',
|
||||
body: {
|
||||
mappings: {
|
||||
properties: {
|
||||
number_of_bytes: {
|
||||
type: 'integer'
|
||||
},
|
||||
time_in_seconds: {
|
||||
type: 'float'
|
||||
},
|
||||
price: {
|
||||
type: 'scaled_float',
|
||||
scaling_factor: 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/a8fba09a46b2c3524428aa3259b7124f.asciidoc
Normal file
11
docs/doc_examples/a8fba09a46b2c3524428aa3259b7124f.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getMapping({
|
||||
index: 'twitter'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
43
docs/doc_examples/aa6bfe54e2436eb668091fe31c2fbf4d.asciidoc
Normal file
43
docs/doc_examples/aa6bfe54e2436eb668091fe31c2fbf4d.asciidoc
Normal file
@ -0,0 +1,43 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '1',
|
||||
refresh: true,
|
||||
body: {
|
||||
date: '2015-10-01T05:30:00Z'
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '2',
|
||||
refresh: true,
|
||||
body: {
|
||||
date: '2015-10-01T06:30:00Z'
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
|
||||
const response2 = await client.search({
|
||||
index: 'my_index',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
by_day: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
calendar_interval: 'day',
|
||||
offset: '+6h'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response2)
|
||||
----
|
||||
|
||||
19
docs/doc_examples/abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc
Normal file
19
docs/doc_examples/abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc
Normal file
@ -0,0 +1,19 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'test',
|
||||
filter_path: 'hits.total',
|
||||
body: {
|
||||
query: {
|
||||
match: {
|
||||
flag: 'foo'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
13
docs/doc_examples/b0d64d0a554549e5b2808002a0725493.asciidoc
Normal file
13
docs/doc_examples/b0d64d0a554549e5b2808002a0725493.asciidoc
Normal file
@ -0,0 +1,13 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.clearScroll({
|
||||
body: {
|
||||
scroll_id: 'DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=='
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
14
docs/doc_examples/b41dce56b0e640d32b1cf452f87cec17.asciidoc
Normal file
14
docs/doc_examples/b41dce56b0e640d32b1cf452f87cec17.asciidoc
Normal file
@ -0,0 +1,14 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.scroll({
|
||||
body: {
|
||||
scroll: '1m',
|
||||
scroll_id: 'DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=='
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
22
docs/doc_examples/b789292f9cf63ce912e058c46d90ce20.asciidoc
Normal file
22
docs/doc_examples/b789292f9cf63ce912e058c46d90ce20.asciidoc
Normal file
@ -0,0 +1,22 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
sales_over_time: {
|
||||
date_histogram: {
|
||||
field: 'date',
|
||||
calendar_interval: 'month'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
30
docs/doc_examples/b93ed4ef309819734f0eeea82e8b0f1f.asciidoc
Normal file
30
docs/doc_examples/b93ed4ef309819734f0eeea82e8b0f1f.asciidoc
Normal file
@ -0,0 +1,30 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'sales',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
t_shirts: {
|
||||
filter: {
|
||||
term: {
|
||||
type: 't-shirt'
|
||||
}
|
||||
},
|
||||
aggs: {
|
||||
avg_price: {
|
||||
avg: {
|
||||
field: 'price'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/b94cee0f74f57742b3948f9b784dfdd4.asciidoc
Normal file
11
docs/doc_examples/b94cee0f74f57742b3948f9b784dfdd4.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.clearScroll({
|
||||
scroll_id: 'DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==,DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/b9a153725b28fdd0a5aabd7f17a8c2d7.asciidoc
Normal file
12
docs/doc_examples/b9a153725b28fdd0a5aabd7f17a8c2d7.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getSettings({
|
||||
index: 'twitter',
|
||||
flat_settings: 'true'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/bdb30dd52d32f50994008f4f9c0da5f0.asciidoc
Normal file
12
docs/doc_examples/bdb30dd52d32f50994008f4f9c0da5f0.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.updateByQueryRethrottle({
|
||||
task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619',
|
||||
requests_per_second: '-1'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/be8f28f31207b173de61be032fcf239c.asciidoc
Normal file
11
docs/doc_examples/be8f28f31207b173de61be032fcf239c.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.get({
|
||||
index: 'twitter'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/c2c21e2824fbf6b7198ede30419da82b.asciidoc
Normal file
11
docs/doc_examples/c2c21e2824fbf6b7198ede30419da82b.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.clearScroll({
|
||||
scroll_id: '_all'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
28
docs/doc_examples/c4b278ba293abd0d02a0b5ad1a99f84a.asciidoc
Normal file
28
docs/doc_examples/c4b278ba293abd0d02a0b5ad1a99f84a.asciidoc
Normal file
@ -0,0 +1,28 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.ingest.putPipeline({
|
||||
id: 'set-foo',
|
||||
body: {
|
||||
description: 'sets foo',
|
||||
processors: [
|
||||
{
|
||||
set: {
|
||||
field: 'foo',
|
||||
value: 'bar'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
pipeline: 'set-foo'
|
||||
})
|
||||
console.log(response1)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/cde4dddae5c06e7f1d38c9d933dbc7ac.asciidoc
Normal file
11
docs/doc_examples/cde4dddae5c06e7f1d38c9d933dbc7ac.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.updateByQuery({
|
||||
index: 'twitter,blog'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
11
docs/doc_examples/cf02e3d8b371bd59f0224967c36330da.asciidoc
Normal file
11
docs/doc_examples/cf02e3d8b371bd59f0224967c36330da.asciidoc
Normal file
@ -0,0 +1,11 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.indices.getMapping({
|
||||
index: 'twitter,kimchy'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
16
docs/doc_examples/d5dcddc6398b473b6ad9bce5c6adf986.asciidoc
Normal file
16
docs/doc_examples/d5dcddc6398b473b6ad9bce5c6adf986.asciidoc
Normal file
@ -0,0 +1,16 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
scroll: '1m',
|
||||
body: {
|
||||
sort: [
|
||||
'_doc'
|
||||
]
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
12
docs/doc_examples/d8b115341da772a628a024e7d1644e73.asciidoc
Normal file
12
docs/doc_examples/d8b115341da772a628a024e7d1644e73.asciidoc
Normal file
@ -0,0 +1,12 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
routing: '1'
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
71
docs/doc_examples/e9fe608f105d7e3268a15e409e2cb9ab.asciidoc
Normal file
71
docs/doc_examples/e9fe608f105d7e3268a15e409e2cb9ab.asciidoc
Normal file
@ -0,0 +1,71 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.index({
|
||||
index: 'metrics_index',
|
||||
id: '1',
|
||||
body: {
|
||||
'network.name': 'net-1',
|
||||
latency_histo: {
|
||||
values: [
|
||||
0.1,
|
||||
0.2,
|
||||
0.3,
|
||||
0.4,
|
||||
0.5
|
||||
],
|
||||
counts: [
|
||||
3,
|
||||
7,
|
||||
23,
|
||||
12,
|
||||
6
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.index({
|
||||
index: 'metrics_index',
|
||||
id: '2',
|
||||
body: {
|
||||
'network.name': 'net-2',
|
||||
latency_histo: {
|
||||
values: [
|
||||
0.1,
|
||||
0.2,
|
||||
0.3,
|
||||
0.4,
|
||||
0.5
|
||||
],
|
||||
counts: [
|
||||
8,
|
||||
17,
|
||||
8,
|
||||
7,
|
||||
6
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
|
||||
const response2 = await client.search({
|
||||
index: 'metrics_index',
|
||||
size: '0',
|
||||
body: {
|
||||
aggs: {
|
||||
total_requests: {
|
||||
value_count: {
|
||||
field: 'latency_histo'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response2)
|
||||
----
|
||||
|
||||
18
docs/doc_examples/ea02de2dbe05091fcb0dac72c8ba5f83.asciidoc
Normal file
18
docs/doc_examples/ea02de2dbe05091fcb0dac72c8ba5f83.asciidoc
Normal file
@ -0,0 +1,18 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.updateByQuery({
|
||||
index: 'twitter',
|
||||
refresh: true,
|
||||
slices: '5',
|
||||
body: {
|
||||
script: {
|
||||
source: "ctx._source['extra'] = 'test'"
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
61
docs/doc_examples/fc8097bdfb6f3a4017bf4186ccca8a84.asciidoc
Normal file
61
docs/doc_examples/fc8097bdfb6f3a4017bf4186ccca8a84.asciidoc
Normal file
@ -0,0 +1,61 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response0 = await client.indices.create({
|
||||
index: 'my_index',
|
||||
body: {
|
||||
mappings: {
|
||||
properties: {
|
||||
text: {
|
||||
type: 'text',
|
||||
fields: {
|
||||
english: {
|
||||
type: 'text',
|
||||
analyzer: 'english'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response0)
|
||||
|
||||
const response1 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '1',
|
||||
body: {
|
||||
text: 'quick brown fox'
|
||||
}
|
||||
})
|
||||
console.log(response1)
|
||||
|
||||
const response2 = await client.index({
|
||||
index: 'my_index',
|
||||
id: '2',
|
||||
body: {
|
||||
text: 'quick brown foxes'
|
||||
}
|
||||
})
|
||||
console.log(response2)
|
||||
|
||||
const response3 = await client.search({
|
||||
index: 'my_index',
|
||||
body: {
|
||||
query: {
|
||||
multi_match: {
|
||||
query: 'quick brown foxes',
|
||||
fields: [
|
||||
'text',
|
||||
'text.english'
|
||||
],
|
||||
type: 'most_fields'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response3)
|
||||
----
|
||||
|
||||
24
docs/doc_examples/fdcaba9547180439ff4b6275034a5170.asciidoc
Normal file
24
docs/doc_examples/fdcaba9547180439ff4b6275034a5170.asciidoc
Normal file
@ -0,0 +1,24 @@
|
||||
// This file is autogenerated, DO NOT EDIT
|
||||
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
|
||||
|
||||
[source, js]
|
||||
----
|
||||
const response = await client.search({
|
||||
index: 'twitter',
|
||||
scroll: '1m',
|
||||
body: {
|
||||
slice: {
|
||||
field: 'date',
|
||||
id: 0,
|
||||
max: 10
|
||||
},
|
||||
query: {
|
||||
match: {
|
||||
title: 'elasticsearch'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
console.log(response)
|
||||
----
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[[client-usage]]
|
||||
== Usage
|
||||
|
||||
Using the client is straightforward, it supports all the public APIs of {es},
|
||||
Using the client is straightforward, it supports all the public APIs of {es},
|
||||
and every method exposes the same signature.
|
||||
|
||||
|
||||
@ -40,11 +40,11 @@ The returned value of every API call is formed as follows:
|
||||
|
||||
NOTE: The body is a boolean value when you use `HEAD` APIs.
|
||||
|
||||
The above value is returned even if there is an error during the execution of
|
||||
the request, this means that you can safely use the
|
||||
The above value is returned even if there is an error during the execution of
|
||||
the request, this means that you can safely use the
|
||||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment[destructuring assignment].
|
||||
|
||||
The `meta` key contains all the information about the request, such as attempt,
|
||||
The `meta` key contains all the information about the request, such as attempt,
|
||||
options, and the connection that has been used.
|
||||
|
||||
[source,js]
|
||||
@ -181,8 +181,8 @@ _Default:_ `null`
|
||||
|
||||
=== Error handling
|
||||
|
||||
The client exposes a variety of error objects that you can use to enhance your
|
||||
error handling. You can find all the error objects inside the `errors` key in
|
||||
The client exposes a variety of error objects that you can use to enhance your
|
||||
error handling. You can find all the error objects inside the `errors` key in
|
||||
the client.
|
||||
|
||||
[source,js]
|
||||
|
||||
@ -74,7 +74,24 @@ const enabledFiles = [
|
||||
'indices/aliases.asciidoc',
|
||||
'indices/update-settings.asciidoc',
|
||||
'search/request/from-size.asciidoc',
|
||||
'search/count.asciidoc'
|
||||
'search/count.asciidoc',
|
||||
'setup/logging-config.asciidoc',
|
||||
'search/request/from-size.asciidoc',
|
||||
'query-dsl/match-phrase-query.asciidoc',
|
||||
'aggregations/metrics/valuecount-aggregation.asciidoc',
|
||||
'aggregations/bucket/datehistogram-aggregation.asciidoc',
|
||||
'aggregations/bucket/filter-aggregation.asciidoc',
|
||||
'mapping/types/numeric.asciidoc',
|
||||
'mapping/fields/id-field.asciidoc',
|
||||
'mapping/params/multi-fields.asciidoc',
|
||||
'api-conventions.asciidoc',
|
||||
'cat/indices.asciidoc',
|
||||
'docs/update-by-query.asciidoc',
|
||||
'indices/get-index.asciidoc',
|
||||
'indices/get-mapping.asciidoc',
|
||||
'search.asciidoc',
|
||||
'search/request/scroll.asciidoc',
|
||||
'search/suggesters.asciidoc'
|
||||
]
|
||||
|
||||
function generate () {
|
||||
|
||||
Reference in New Issue
Block a user