From 0e659031e348fc02011b09e358583adcce8d253f Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 10 Apr 2020 12:20:25 +0200 Subject: [PATCH] Added new docs examples (#1149) * Updated enabled files list * Added new docs examples --- .../04fe1e3a0047b0cdb10987b79fc3f3f3.asciidoc | 30 ++++++ .../0c4ad860a485fe53d8140ad3ccd11dcf.asciidoc | 21 ++++ .../14701dcc0cca9665fce2aace0cb62af7.asciidoc | 22 ++++ .../15dad5338065baaaa7d475abe85f4c22.asciidoc | 29 +++++ .../18ddb7e7a4bcafd449df956e828ed7a8.asciidoc | 11 ++ .../1e49eba5b9042c1900a608fe5105ba43.asciidoc | 42 ++++++++ .../216848930c2d344fe0bed0daa70c35b9.asciidoc | 12 +++ .../22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc | 64 +++++++++++ .../2891aa10ee9d474780adf94d5607f2db.asciidoc | 20 ++++ .../3342c69b2c2303247217532956fcce85.asciidoc | 17 +++ .../3e573bfabe00f8bfb8bb69aa5820768e.asciidoc | 25 +++++ .../43af86de5e49aa06070092fffc138208.asciidoc | 21 ++++ .../52c7e4172a446c394210a07c464c57d2.asciidoc | 12 +++ .../5f3549ac7fee94682ca0d7439eebdd2a.asciidoc | 20 ++++ .../7477671958734843dd67cf0b8e6c7515.asciidoc | 20 ++++ .../77243bbf92f2a55e0fca6c2a349a1c15.asciidoc | 35 ++++++ .../7f465b7e8ed42df6c42251b4481e699e.asciidoc | 21 ++++ .../899eef71a67a1b2aa11a2166ec7f48f1.asciidoc | 24 +++++ .../8baccd8688a6bad1749b8935f9601ea4.asciidoc | 25 +++++ .../8c5977410335d58217e0626618ce6641.asciidoc | 15 +++ .../979d25dff2d8987119410291ad47b0d1.asciidoc | 29 +++++ .../9e56d79ad9a02b642c361f0b85dd95d7.asciidoc | 20 ++++ .../a1db5c822745fe167e9ef854dca3d129.asciidoc | 26 +++++ .../a5a7050fb9dcb9574e081957ade28617.asciidoc | 22 ++++ .../abf329ebefaf58acd4ee30e685731499.asciidoc | 20 ++++ .../ae9b5fbd42af2386ffbf56ad4a697e51.asciidoc | 33 ++++++ .../b214942b938e47f2c486e523546cb574.asciidoc | 29 +++++ .../b919f88e6f47a40d5793479440a90ba6.asciidoc | 102 ++++++++++++++++++ .../b997885974522ef439d5e345924cc5ba.asciidoc | 39 +++++++ .../be3a6431d01846950dc1a39a7a6a1faa.asciidoc | 11 ++ .../c22b72c4a52ee098331b3f252c22860d.asciidoc | 16 +++ .../c32a3f8071d87f0a3f5a78e07fe7a669.asciidoc | 21 ++++ .../d17269bb80fb63ec0bf37d219e003dcb.asciidoc | 32 ++++++ .../d1b3b7d2bb2ab90d15fd10318abd24db.asciidoc | 29 +++++ .../d1bcf2eb63a462bfdcf01a68e68d5b4a.asciidoc | 23 ++++ .../d3088d5fa59b3ab110f64fb4f9b0065c.asciidoc | 18 ++++ .../d31062ff8c015387889fed4ad86fd914.asciidoc | 21 ++++ .../d50a3c64890f88af32c6d4ef4899d82a.asciidoc | 26 +++++ .../de139866a220124360e5e27d1a736ea4.asciidoc | 33 ++++++ .../dfb1fe96d806a644214d06f9b4b87878.asciidoc | 19 ++++ .../e21e1c26dc8687e7bf7bd2bf019a6698.asciidoc | 17 +++ .../e8e451bc8c45bcf16df43804c4fc8329.asciidoc | 31 ++++++ .../ebb6b59fbc9325c17e45f524602d6be2.asciidoc | 18 ++++ .../ef0f4fa4272c47ff62fb7b422cf975e7.asciidoc | 24 +++++ .../f4a1008b3f9baa67bb03ce9ef5ab4cb4.asciidoc | 20 ++++ .../f6b5032bf27c2445d28845be0d413970.asciidoc | 20 ++++ scripts/generate-docs-examples.js | 9 +- 47 files changed, 1193 insertions(+), 1 deletion(-) create mode 100644 docs/doc_examples/04fe1e3a0047b0cdb10987b79fc3f3f3.asciidoc create mode 100644 docs/doc_examples/0c4ad860a485fe53d8140ad3ccd11dcf.asciidoc create mode 100644 docs/doc_examples/14701dcc0cca9665fce2aace0cb62af7.asciidoc create mode 100644 docs/doc_examples/15dad5338065baaaa7d475abe85f4c22.asciidoc create mode 100644 docs/doc_examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc create mode 100644 docs/doc_examples/1e49eba5b9042c1900a608fe5105ba43.asciidoc create mode 100644 docs/doc_examples/216848930c2d344fe0bed0daa70c35b9.asciidoc create mode 100644 docs/doc_examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc create mode 100644 docs/doc_examples/2891aa10ee9d474780adf94d5607f2db.asciidoc create mode 100644 docs/doc_examples/3342c69b2c2303247217532956fcce85.asciidoc create mode 100644 docs/doc_examples/3e573bfabe00f8bfb8bb69aa5820768e.asciidoc create mode 100644 docs/doc_examples/43af86de5e49aa06070092fffc138208.asciidoc create mode 100644 docs/doc_examples/52c7e4172a446c394210a07c464c57d2.asciidoc create mode 100644 docs/doc_examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc create mode 100644 docs/doc_examples/7477671958734843dd67cf0b8e6c7515.asciidoc create mode 100644 docs/doc_examples/77243bbf92f2a55e0fca6c2a349a1c15.asciidoc create mode 100644 docs/doc_examples/7f465b7e8ed42df6c42251b4481e699e.asciidoc create mode 100644 docs/doc_examples/899eef71a67a1b2aa11a2166ec7f48f1.asciidoc create mode 100644 docs/doc_examples/8baccd8688a6bad1749b8935f9601ea4.asciidoc create mode 100644 docs/doc_examples/8c5977410335d58217e0626618ce6641.asciidoc create mode 100644 docs/doc_examples/979d25dff2d8987119410291ad47b0d1.asciidoc create mode 100644 docs/doc_examples/9e56d79ad9a02b642c361f0b85dd95d7.asciidoc create mode 100644 docs/doc_examples/a1db5c822745fe167e9ef854dca3d129.asciidoc create mode 100644 docs/doc_examples/a5a7050fb9dcb9574e081957ade28617.asciidoc create mode 100644 docs/doc_examples/abf329ebefaf58acd4ee30e685731499.asciidoc create mode 100644 docs/doc_examples/ae9b5fbd42af2386ffbf56ad4a697e51.asciidoc create mode 100644 docs/doc_examples/b214942b938e47f2c486e523546cb574.asciidoc create mode 100644 docs/doc_examples/b919f88e6f47a40d5793479440a90ba6.asciidoc create mode 100644 docs/doc_examples/b997885974522ef439d5e345924cc5ba.asciidoc create mode 100644 docs/doc_examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc create mode 100644 docs/doc_examples/c22b72c4a52ee098331b3f252c22860d.asciidoc create mode 100644 docs/doc_examples/c32a3f8071d87f0a3f5a78e07fe7a669.asciidoc create mode 100644 docs/doc_examples/d17269bb80fb63ec0bf37d219e003dcb.asciidoc create mode 100644 docs/doc_examples/d1b3b7d2bb2ab90d15fd10318abd24db.asciidoc create mode 100644 docs/doc_examples/d1bcf2eb63a462bfdcf01a68e68d5b4a.asciidoc create mode 100644 docs/doc_examples/d3088d5fa59b3ab110f64fb4f9b0065c.asciidoc create mode 100644 docs/doc_examples/d31062ff8c015387889fed4ad86fd914.asciidoc create mode 100644 docs/doc_examples/d50a3c64890f88af32c6d4ef4899d82a.asciidoc create mode 100644 docs/doc_examples/de139866a220124360e5e27d1a736ea4.asciidoc create mode 100644 docs/doc_examples/dfb1fe96d806a644214d06f9b4b87878.asciidoc create mode 100644 docs/doc_examples/e21e1c26dc8687e7bf7bd2bf019a6698.asciidoc create mode 100644 docs/doc_examples/e8e451bc8c45bcf16df43804c4fc8329.asciidoc create mode 100644 docs/doc_examples/ebb6b59fbc9325c17e45f524602d6be2.asciidoc create mode 100644 docs/doc_examples/ef0f4fa4272c47ff62fb7b422cf975e7.asciidoc create mode 100644 docs/doc_examples/f4a1008b3f9baa67bb03ce9ef5ab4cb4.asciidoc create mode 100644 docs/doc_examples/f6b5032bf27c2445d28845be0d413970.asciidoc diff --git a/docs/doc_examples/04fe1e3a0047b0cdb10987b79fc3f3f3.asciidoc b/docs/doc_examples/04fe1e3a0047b0cdb10987b79fc3f3f3.asciidoc new file mode 100644 index 000000000..12bf2c8fa --- /dev/null +++ b/docs/doc_examples/04fe1e3a0047b0cdb10987b79fc3f3f3.asciidoc @@ -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({ + body: { + query: { + term: { + user: 'kimchy' + } + }, + sort: { + _script: { + type: 'number', + script: { + lang: 'painless', + source: "doc['field_name'].value * params.factor", + params: { + factor: 1.1 + } + }, + order: 'asc' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/0c4ad860a485fe53d8140ad3ccd11dcf.asciidoc b/docs/doc_examples/0c4ad860a485fe53d8140ad3ccd11dcf.asciidoc new file mode 100644 index 000000000..441a025db --- /dev/null +++ b/docs/doc_examples/0c4ad860a485fe53d8140ad3ccd11dcf.asciidoc @@ -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({ + body: { + query: { + terms: { + user: [ + 'kimchy', + 'elasticsearch' + ], + boost: 1 + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/14701dcc0cca9665fce2aace0cb62af7.asciidoc b/docs/doc_examples/14701dcc0cca9665fce2aace0cb62af7.asciidoc new file mode 100644 index 000000000..7bd77883a --- /dev/null +++ b/docs/doc_examples/14701dcc0cca9665fce2aace0cb62af7.asciidoc @@ -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: 'twitter', + size: '0', + filter_path: 'hits.total', + body: { + query: { + range: { + likes: { + lt: 10 + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/15dad5338065baaaa7d475abe85f4c22.asciidoc b/docs/doc_examples/15dad5338065baaaa7d475abe85f4c22.asciidoc new file mode 100644 index 000000000..4e604ffd1 --- /dev/null +++ b/docs/doc_examples/15dad5338065baaaa7d475abe85f4c22.asciidoc @@ -0,0 +1,29 @@ +// 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: { + sort: [ + { + _geo_distance: { + 'pin.location': [ + -70, + 40 + ], + order: 'asc', + unit: 'km' + } + } + ], + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc b/docs/doc_examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc new file mode 100644 index 000000000..7172806a0 --- /dev/null +++ b/docs/doc_examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc @@ -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.tasks.cancel({ + task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619' +}) +console.log(response) +---- + diff --git a/docs/doc_examples/1e49eba5b9042c1900a608fe5105ba43.asciidoc b/docs/doc_examples/1e49eba5b9042c1900a608fe5105ba43.asciidoc new file mode 100644 index 000000000..81a58db85 --- /dev/null +++ b/docs/doc_examples/1e49eba5b9042c1900a608fe5105ba43.asciidoc @@ -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.deleteByQuery({ + index: 'twitter', + body: { + slice: { + id: 0, + max: 2 + }, + query: { + range: { + likes: { + lt: 10 + } + } + } + } +}) +console.log(response0) + +const response1 = await client.deleteByQuery({ + index: 'twitter', + body: { + slice: { + id: 1, + max: 2 + }, + query: { + range: { + likes: { + lt: 10 + } + } + } + } +}) +console.log(response1) +---- + diff --git a/docs/doc_examples/216848930c2d344fe0bed0daa70c35b9.asciidoc b/docs/doc_examples/216848930c2d344fe0bed0daa70c35b9.asciidoc new file mode 100644 index 000000000..841913ded --- /dev/null +++ b/docs/doc_examples/216848930c2d344fe0bed0daa70c35b9.asciidoc @@ -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: '*/delete/byquery' +}) +console.log(response) +---- + diff --git a/docs/doc_examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc b/docs/doc_examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc new file mode 100644 index 000000000..246f3de57 --- /dev/null +++ b/docs/doc_examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc @@ -0,0 +1,64 @@ +// 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: { + nested: { + path: 'parent', + query: { + bool: { + must: { + range: { + 'parent.age': { + gte: 21 + } + } + }, + filter: { + nested: { + path: 'parent.child', + query: { + match: { + 'parent.child.name': 'matt' + } + } + } + } + } + } + } + }, + sort: [ + { + 'parent.child.age': { + mode: 'min', + order: 'asc', + nested: { + path: 'parent', + filter: { + range: { + 'parent.age': { + gte: 21 + } + } + }, + nested: { + path: 'parent.child', + filter: { + match: { + 'parent.child.name': 'matt' + } + } + } + } + } + } + ] + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/2891aa10ee9d474780adf94d5607f2db.asciidoc b/docs/doc_examples/2891aa10ee9d474780adf94d5607f2db.asciidoc new file mode 100644 index 000000000..755d0b234 --- /dev/null +++ b/docs/doc_examples/2891aa10ee9d474780adf94d5607f2db.asciidoc @@ -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: 'index_long,index_double', + body: { + sort: [ + { + field: { + numeric_type: 'double' + } + } + ] + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/3342c69b2c2303247217532956fcce85.asciidoc b/docs/doc_examples/3342c69b2c2303247217532956fcce85.asciidoc new file mode 100644 index 000000000..4b9941a85 --- /dev/null +++ b/docs/doc_examples/3342c69b2c2303247217532956fcce85.asciidoc @@ -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: { + exists: { + field: 'user' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/3e573bfabe00f8bfb8bb69aa5820768e.asciidoc b/docs/doc_examples/3e573bfabe00f8bfb8bb69aa5820768e.asciidoc new file mode 100644 index 000000000..a7e633b13 --- /dev/null +++ b/docs/doc_examples/3e573bfabe00f8bfb8bb69aa5820768e.asciidoc @@ -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 response0 = await client.indices.refresh() +console.log(response0) + +const response1 = await client.search({ + index: 'twitter', + size: '0', + filter_path: 'hits.total', + body: { + query: { + range: { + likes: { + lt: 10 + } + } + } + } +}) +console.log(response1) +---- + diff --git a/docs/doc_examples/43af86de5e49aa06070092fffc138208.asciidoc b/docs/doc_examples/43af86de5e49aa06070092fffc138208.asciidoc new file mode 100644 index 000000000..85af5a8ba --- /dev/null +++ b/docs/doc_examples/43af86de5e49aa06070092fffc138208.asciidoc @@ -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({ + body: { + query: { + bool: { + must_not: { + exists: { + field: 'user' + } + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/52c7e4172a446c394210a07c464c57d2.asciidoc b/docs/doc_examples/52c7e4172a446c394210a07c464c57d2.asciidoc new file mode 100644 index 000000000..c15b0db56 --- /dev/null +++ b/docs/doc_examples/52c7e4172a446c394210a07c464c57d2.asciidoc @@ -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.deleteByQueryRethrottle({ + task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619', + requests_per_second: '-1' +}) +console.log(response) +---- + diff --git a/docs/doc_examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc b/docs/doc_examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc new file mode 100644 index 000000000..5a623c1ef --- /dev/null +++ b/docs/doc_examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc @@ -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: 'index_long,index_double', + body: { + sort: [ + { + field: { + numeric_type: 'date_nanos' + } + } + ] + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/7477671958734843dd67cf0b8e6c7515.asciidoc b/docs/doc_examples/7477671958734843dd67cf0b8e6c7515.asciidoc new file mode 100644 index 000000000..42a9afd21 --- /dev/null +++ b/docs/doc_examples/7477671958734843dd67cf0b8e6c7515.asciidoc @@ -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.indices.create({ + index: 'index_long', + body: { + mappings: { + properties: { + field: { + type: 'date_nanos' + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/77243bbf92f2a55e0fca6c2a349a1c15.asciidoc b/docs/doc_examples/77243bbf92f2a55e0fca6c2a349a1c15.asciidoc new file mode 100644 index 000000000..1a12ff2cc --- /dev/null +++ b/docs/doc_examples/77243bbf92f2a55e0fca6c2a349a1c15.asciidoc @@ -0,0 +1,35 @@ +// 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: { + sort: [ + { + _geo_distance: { + 'pin.location': [ + [ + -70, + 40 + ], + [ + -71, + 42 + ] + ], + order: 'asc', + unit: 'km' + } + } + ], + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/7f465b7e8ed42df6c42251b4481e699e.asciidoc b/docs/doc_examples/7f465b7e8ed42df6c42251b4481e699e.asciidoc new file mode 100644 index 000000000..36b2e4f68 --- /dev/null +++ b/docs/doc_examples/7f465b7e8ed42df6c42251b4481e699e.asciidoc @@ -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.indices.create({ + index: 'my_index', + body: { + mappings: { + properties: { + date: { + type: 'date', + format: 'yyyy-MM-dd' + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/899eef71a67a1b2aa11a2166ec7f48f1.asciidoc b/docs/doc_examples/899eef71a67a1b2aa11a2166ec7f48f1.asciidoc new file mode 100644 index 000000000..5c91f566b --- /dev/null +++ b/docs/doc_examples/899eef71a67a1b2aa11a2166ec7f48f1.asciidoc @@ -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({ + body: { + sort: [ + { + price: { + unmapped_type: 'long' + } + } + ], + query: { + term: { + product: 'chocolate' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/8baccd8688a6bad1749b8935f9601ea4.asciidoc b/docs/doc_examples/8baccd8688a6bad1749b8935f9601ea4.asciidoc new file mode 100644 index 000000000..f83ba6405 --- /dev/null +++ b/docs/doc_examples/8baccd8688a6bad1749b8935f9601ea4.asciidoc @@ -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.index({ + index: 'my_index', + id: '1', + body: { + group: 'fans', + user: [ + { + first: 'John', + last: 'Smith' + }, + { + first: 'Alice', + last: 'White' + } + ] + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/8c5977410335d58217e0626618ce6641.asciidoc b/docs/doc_examples/8c5977410335d58217e0626618ce6641.asciidoc new file mode 100644 index 000000000..83e2c51bd --- /dev/null +++ b/docs/doc_examples/8c5977410335d58217e0626618ce6641.asciidoc @@ -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.index({ + index: 'my_index', + id: '2', + body: { + color: 'blue' + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/979d25dff2d8987119410291ad47b0d1.asciidoc b/docs/doc_examples/979d25dff2d8987119410291ad47b0d1.asciidoc new file mode 100644 index 000000000..69b52ce27 --- /dev/null +++ b/docs/doc_examples/979d25dff2d8987119410291ad47b0d1.asciidoc @@ -0,0 +1,29 @@ +// 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: { + sort: [ + { + _geo_distance: { + 'pin.location': { + lat: 40, + lon: -70 + }, + order: 'asc', + unit: 'km' + } + } + ], + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/9e56d79ad9a02b642c361f0b85dd95d7.asciidoc b/docs/doc_examples/9e56d79ad9a02b642c361f0b85dd95d7.asciidoc new file mode 100644 index 000000000..ca673d252 --- /dev/null +++ b/docs/doc_examples/9e56d79ad9a02b642c361f0b85dd95d7.asciidoc @@ -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.indices.create({ + index: 'my_index', + body: { + mappings: { + properties: { + color: { + type: 'keyword' + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/a1db5c822745fe167e9ef854dca3d129.asciidoc b/docs/doc_examples/a1db5c822745fe167e9ef854dca3d129.asciidoc new file mode 100644 index 000000000..f15cf7bf7 --- /dev/null +++ b/docs/doc_examples/a1db5c822745fe167e9ef854dca3d129.asciidoc @@ -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: { + sort: [ + { + _geo_distance: { + 'pin.location': 'drm3btev3e86', + order: 'asc', + unit: 'km' + } + } + ], + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/a5a7050fb9dcb9574e081957ade28617.asciidoc b/docs/doc_examples/a5a7050fb9dcb9574e081957ade28617.asciidoc new file mode 100644 index 000000000..b9cb57e59 --- /dev/null +++ b/docs/doc_examples/a5a7050fb9dcb9574e081957ade28617.asciidoc @@ -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.deleteByQuery({ + index: 'twitter', + refresh: true, + slices: '5', + body: { + query: { + range: { + likes: { + lt: 10 + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/abf329ebefaf58acd4ee30e685731499.asciidoc b/docs/doc_examples/abf329ebefaf58acd4ee30e685731499.asciidoc new file mode 100644 index 000000000..f319e125b --- /dev/null +++ b/docs/doc_examples/abf329ebefaf58acd4ee30e685731499.asciidoc @@ -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.indices.create({ + index: 'index_double', + body: { + mappings: { + properties: { + field: { + type: 'double' + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/ae9b5fbd42af2386ffbf56ad4a697e51.asciidoc b/docs/doc_examples/ae9b5fbd42af2386ffbf56ad4a697e51.asciidoc new file mode 100644 index 000000000..44685f225 --- /dev/null +++ b/docs/doc_examples/ae9b5fbd42af2386ffbf56ad4a697e51.asciidoc @@ -0,0 +1,33 @@ +// 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', + body: { + sort: [ + { + post_date: { + order: 'asc' + } + }, + 'user', + { + name: 'desc' + }, + { + age: 'desc' + }, + '_score' + ], + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/b214942b938e47f2c486e523546cb574.asciidoc b/docs/doc_examples/b214942b938e47f2c486e523546cb574.asciidoc new file mode 100644 index 000000000..009fd0fcc --- /dev/null +++ b/docs/doc_examples/b214942b938e47f2c486e523546cb574.asciidoc @@ -0,0 +1,29 @@ +// 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', + body: { + query: { + bool: { + must: [ + { + match: { + 'user.first': 'Alice' + } + }, + { + match: { + 'user.last': 'Smith' + } + } + ] + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/b919f88e6f47a40d5793479440a90ba6.asciidoc b/docs/doc_examples/b919f88e6f47a40d5793479440a90ba6.asciidoc new file mode 100644 index 000000000..a05989f32 --- /dev/null +++ b/docs/doc_examples/b919f88e6f47a40d5793479440a90ba6.asciidoc @@ -0,0 +1,102 @@ +// 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: { + user: { + type: 'nested' + } + } + } + } +}) +console.log(response0) + +const response1 = await client.index({ + index: 'my_index', + id: '1', + body: { + group: 'fans', + user: [ + { + first: 'John', + last: 'Smith' + }, + { + first: 'Alice', + last: 'White' + } + ] + } +}) +console.log(response1) + +const response2 = await client.search({ + index: 'my_index', + body: { + query: { + nested: { + path: 'user', + query: { + bool: { + must: [ + { + match: { + 'user.first': 'Alice' + } + }, + { + match: { + 'user.last': 'Smith' + } + } + ] + } + } + } + } + } +}) +console.log(response2) + +const response3 = await client.search({ + index: 'my_index', + body: { + query: { + nested: { + path: 'user', + query: { + bool: { + must: [ + { + match: { + 'user.first': 'Alice' + } + }, + { + match: { + 'user.last': 'White' + } + } + ] + } + }, + inner_hits: { + highlight: { + fields: { + 'user.first': {} + } + } + } + } + } + } +}) +console.log(response3) +---- + diff --git a/docs/doc_examples/b997885974522ef439d5e345924cc5ba.asciidoc b/docs/doc_examples/b997885974522ef439d5e345924cc5ba.asciidoc new file mode 100644 index 000000000..b7d1582c0 --- /dev/null +++ b/docs/doc_examples/b997885974522ef439d5e345924cc5ba.asciidoc @@ -0,0 +1,39 @@ +// 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: { + product: 'chocolate', + price: [ + 20, + 4 + ] + } +}) +console.log(response0) + +const response1 = await client.search({ + body: { + query: { + term: { + product: 'chocolate' + } + }, + sort: [ + { + price: { + order: 'asc', + mode: 'avg' + } + } + ] + } +}) +console.log(response1) +---- + diff --git a/docs/doc_examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc b/docs/doc_examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc new file mode 100644 index 000000000..9bfabc15d --- /dev/null +++ b/docs/doc_examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc @@ -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.tasks.get({ + task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619' +}) +console.log(response) +---- + diff --git a/docs/doc_examples/c22b72c4a52ee098331b3f252c22860d.asciidoc b/docs/doc_examples/c22b72c4a52ee098331b3f252c22860d.asciidoc new file mode 100644 index 000000000..b4af4528c --- /dev/null +++ b/docs/doc_examples/c22b72c4a52ee098331b3f252c22860d.asciidoc @@ -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.deleteByQuery({ + index: 'twitter,blog', + body: { + query: { + match_all: {} + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/c32a3f8071d87f0a3f5a78e07fe7a669.asciidoc b/docs/doc_examples/c32a3f8071d87f0a3f5a78e07fe7a669.asciidoc new file mode 100644 index 000000000..219f4e552 --- /dev/null +++ b/docs/doc_examples/c32a3f8071d87f0a3f5a78e07fe7a669.asciidoc @@ -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.deleteByQuery({ + index: 'twitter', + routing: '1', + body: { + query: { + range: { + age: { + gte: 10 + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/d17269bb80fb63ec0bf37d219e003dcb.asciidoc b/docs/doc_examples/d17269bb80fb63ec0bf37d219e003dcb.asciidoc new file mode 100644 index 000000000..b4973123c --- /dev/null +++ b/docs/doc_examples/d17269bb80fb63ec0bf37d219e003dcb.asciidoc @@ -0,0 +1,32 @@ +// 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: { + sort: [ + { + _geo_distance: { + 'pin.location': [ + -70, + 40 + ], + order: 'asc', + unit: 'km', + mode: 'min', + distance_type: 'arc', + ignore_unmapped: true + } + } + ], + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/d1b3b7d2bb2ab90d15fd10318abd24db.asciidoc b/docs/doc_examples/d1b3b7d2bb2ab90d15fd10318abd24db.asciidoc new file mode 100644 index 000000000..c08921115 --- /dev/null +++ b/docs/doc_examples/d1b3b7d2bb2ab90d15fd10318abd24db.asciidoc @@ -0,0 +1,29 @@ +// 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: { + post_date: { + type: 'date' + }, + user: { + type: 'keyword' + }, + name: { + type: 'keyword' + }, + age: { + type: 'integer' + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/d1bcf2eb63a462bfdcf01a68e68d5b4a.asciidoc b/docs/doc_examples/d1bcf2eb63a462bfdcf01a68e68d5b4a.asciidoc new file mode 100644 index 000000000..279780d17 --- /dev/null +++ b/docs/doc_examples/d1bcf2eb63a462bfdcf01a68e68d5b4a.asciidoc @@ -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', + pretty: true, + body: { + query: { + terms: { + color: { + index: 'my_index', + id: '2', + path: 'color' + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/d3088d5fa59b3ab110f64fb4f9b0065c.asciidoc b/docs/doc_examples/d3088d5fa59b3ab110f64fb4f9b0065c.asciidoc new file mode 100644 index 000000000..aed022fbe --- /dev/null +++ b/docs/doc_examples/d3088d5fa59b3ab110f64fb4f9b0065c.asciidoc @@ -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.index({ + index: 'my_index', + id: '1', + body: { + color: [ + 'blue', + 'green' + ] + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/d31062ff8c015387889fed4ad86fd914.asciidoc b/docs/doc_examples/d31062ff8c015387889fed4ad86fd914.asciidoc new file mode 100644 index 000000000..a4c4076b7 --- /dev/null +++ b/docs/doc_examples/d31062ff8c015387889fed4ad86fd914.asciidoc @@ -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({ + body: { + query: { + wildcard: { + user: { + value: 'ki*y', + boost: 1, + rewrite: 'constant_score' + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/d50a3c64890f88af32c6d4ef4899d82a.asciidoc b/docs/doc_examples/d50a3c64890f88af32c6d4ef4899d82a.asciidoc new file mode 100644 index 000000000..754985636 --- /dev/null +++ b/docs/doc_examples/d50a3c64890f88af32c6d4ef4899d82a.asciidoc @@ -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: { + sort: [ + { + _geo_distance: { + 'pin.location': '40,-70', + order: 'asc', + unit: 'km' + } + } + ], + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/de139866a220124360e5e27d1a736ea4.asciidoc b/docs/doc_examples/de139866a220124360e5e27d1a736ea4.asciidoc new file mode 100644 index 000000000..3d0a76dd4 --- /dev/null +++ b/docs/doc_examples/de139866a220124360e5e27d1a736ea4.asciidoc @@ -0,0 +1,33 @@ +// 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: { + term: { + product: 'chocolate' + } + }, + sort: [ + { + 'offer.price': { + mode: 'avg', + order: 'asc', + nested: { + path: 'offer', + filter: { + term: { + 'offer.color': 'blue' + } + } + } + } + } + ] + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/dfb1fe96d806a644214d06f9b4b87878.asciidoc b/docs/doc_examples/dfb1fe96d806a644214d06f9b4b87878.asciidoc new file mode 100644 index 000000000..3cc9e1ed8 --- /dev/null +++ b/docs/doc_examples/dfb1fe96d806a644214d06f9b4b87878.asciidoc @@ -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.deleteByQuery({ + index: 'twitter', + scroll_size: '5000', + body: { + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/e21e1c26dc8687e7bf7bd2bf019a6698.asciidoc b/docs/doc_examples/e21e1c26dc8687e7bf7bd2bf019a6698.asciidoc new file mode 100644 index 000000000..8517fa362 --- /dev/null +++ b/docs/doc_examples/e21e1c26dc8687e7bf7bd2bf019a6698.asciidoc @@ -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.deleteByQuery({ + index: 'twitter', + conflicts: 'proceed', + body: { + query: { + match_all: {} + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/e8e451bc8c45bcf16df43804c4fc8329.asciidoc b/docs/doc_examples/e8e451bc8c45bcf16df43804c4fc8329.asciidoc new file mode 100644 index 000000000..84fe964c2 --- /dev/null +++ b/docs/doc_examples/e8e451bc8c45bcf16df43804c4fc8329.asciidoc @@ -0,0 +1,31 @@ +// 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: { + track_scores: true, + sort: [ + { + post_date: { + order: 'desc' + } + }, + { + name: 'desc' + }, + { + age: 'desc' + } + ], + query: { + term: { + user: 'kimchy' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/ebb6b59fbc9325c17e45f524602d6be2.asciidoc b/docs/doc_examples/ebb6b59fbc9325c17e45f524602d6be2.asciidoc new file mode 100644 index 000000000..061466a85 --- /dev/null +++ b/docs/doc_examples/ebb6b59fbc9325c17e45f524602d6be2.asciidoc @@ -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.deleteByQuery({ + index: 'twitter', + body: { + query: { + match: { + message: 'some message' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/ef0f4fa4272c47ff62fb7b422cf975e7.asciidoc b/docs/doc_examples/ef0f4fa4272c47ff62fb7b422cf975e7.asciidoc new file mode 100644 index 000000000..7f7ab93ab --- /dev/null +++ b/docs/doc_examples/ef0f4fa4272c47ff62fb7b422cf975e7.asciidoc @@ -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({ + body: { + sort: [ + { + price: { + missing: '_last' + } + } + ], + query: { + term: { + product: 'chocolate' + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/f4a1008b3f9baa67bb03ce9ef5ab4cb4.asciidoc b/docs/doc_examples/f4a1008b3f9baa67bb03ce9ef5ab4cb4.asciidoc new file mode 100644 index 000000000..12bf7d016 --- /dev/null +++ b/docs/doc_examples/f4a1008b3f9baa67bb03ce9ef5ab4cb4.asciidoc @@ -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.indices.create({ + index: 'index_double', + body: { + mappings: { + properties: { + field: { + type: 'date' + } + } + } + } +}) +console.log(response) +---- + diff --git a/docs/doc_examples/f6b5032bf27c2445d28845be0d413970.asciidoc b/docs/doc_examples/f6b5032bf27c2445d28845be0d413970.asciidoc new file mode 100644 index 000000000..654779b1a --- /dev/null +++ b/docs/doc_examples/f6b5032bf27c2445d28845be0d413970.asciidoc @@ -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.indices.create({ + index: 'index_long', + body: { + mappings: { + properties: { + field: { + type: 'long' + } + } + } + } +}) +console.log(response) +---- + diff --git a/scripts/generate-docs-examples.js b/scripts/generate-docs-examples.js index 71377c1b6..8e8fc222d 100644 --- a/scripts/generate-docs-examples.js +++ b/scripts/generate-docs-examples.js @@ -54,7 +54,14 @@ const enabledFiles = [ 'query-dsl/term-query.asciidoc', 'docs/update.asciidoc', 'docs/reindex.asciidoc', - 'indices/templates.asciidoc' + 'indices/templates.asciidoc', + 'query-dsl/exists-query.asciidoc', + 'query-dsl/terms-query.asciidoc', + 'query-dsl/wildcard-query.asciidoc', + 'mapping/types/nested.asciidoc', + 'mapping/params/format.asciidoc', + 'docs/delete-by-query.asciidoc', + 'search/request/sort.asciidoc' ] function generate () {