├── .dockerignore ├── CODE_OF_CONDUCT.md ├── test ├── fixtures │ └── small-dataset.ndjson └── unit │ └── esm │ ├── index.mjs │ └── index.test.js ├── .ci ├── docker │ └── Dockerfile ├── test-matrix.yml ├── Dockerfile ├── packer_cache.sh └── jobs │ ├── elastic+elasticsearch-js+5.x.yml │ ├── elastic+elasticsearch-js+6.x.yml │ ├── elastic+elasticsearch-js+7.9.yml │ ├── elastic+elasticsearch-js+7.x.yml │ ├── elastic+elasticsearch-js+master.yml │ └── elastic+elasticsearch-js+pull-request.yml ├── codecov.yml ├── scripts ├── kibana-docker.sh ├── utils │ └── patch.json └── wait-cluster.sh ├── .github ├── ISSUE_TEMPLATE │ ├── security.md │ └── question.md ├── workflows │ └── backport.yml └── PULL_REQUEST_TEMPLATE.md └── docs ├── doc_examples ├── 3d1ff6097e2359f927c88c2ccdb36252.asciidoc ├── b02e4907c9936c1adc16ccce9d49900d.asciidoc ├── f8cc4b331a19ff4df8e4a490f906ee69.asciidoc ├── 168bfdde773570cfc6dd3ab3574e413b.asciidoc ├── d2153f3100bf12c2de98f14eb86ab061.asciidoc ├── 1c23507edd7a3c18538b68223378e4ab.asciidoc ├── 621665fdbd7fc103c09bfeed28b67b1a.asciidoc ├── 98f14fddddea54a7d6149ab7b92e099d.asciidoc ├── be8f28f31207b173de61be032fcf239c.asciidoc ├── c2c21e2824fbf6b7198ede30419da82b.asciidoc ├── 12433d2b637d002e8d5c9a1adce69d3b.asciidoc ├── 210cf5c76bff517f48e80fa1c2d63907.asciidoc ├── 3f3b3e207f79303ce6f86e03e928e062.asciidoc ├── 609260ad1d5998be2ca09ff1fe237efa.asciidoc ├── 67bba546d835bca8f31df13e3587c348.asciidoc ├── a8fba09a46b2c3524428aa3259b7124f.asciidoc ├── cde4dddae5c06e7f1d38c9d933dbc7ac.asciidoc ├── cfc37446bd892d1ac42a3c8e8b204e6c.asciidoc ├── fbcf5078a6a9e09790553804054c36b3.asciidoc ├── 43682666e1abcb14770c99f02eb26a0d.asciidoc ├── 89a8ac1509936acc272fc2d72907bc45.asciidoc ├── 98234499cfec70487cec5d013e976a84.asciidoc ├── c5e5873783246c7b1c01d8464fed72c4.asciidoc ├── cf02e3d8b371bd59f0224967c36330da.asciidoc ├── 1b542e3ea87a742f95641d64dcfb1bdb.asciidoc ├── 2468ab381257d759d8a88af1141f6f9c.asciidoc ├── 8022e6a690344035b6472a43a9d122e0.asciidoc ├── 18ddb7e7a4bcafd449df956e828ed7a8.asciidoc ├── a6f8636b03cc5f677b7d89e750328612.asciidoc ├── be3a6431d01846950dc1a39a7a6a1faa.asciidoc ├── be49260e1b3496c4feac38c56ebb0669.asciidoc ├── d8b115341da772a628a024e7d1644e73.asciidoc ├── 1dbb8cf17fbc45c87c7d2f75f15f9778.asciidoc ├── 54a770f053f3225ea0d1e34334232411.asciidoc ├── 7df191cc7f814e410a4ac7261065e6ef.asciidoc ├── c48264ec5d9b9679fddd72e5c44425b9.asciidoc ├── 073539a7e38be3cdf13008330b6a536a.asciidoc ├── 1252fa45847edba5ec2b2f33da70ec5b.asciidoc ├── 138ccd89f72aa7502dd9578403dcc589.asciidoc ├── 1d65cb6d055c46a1bde809687d835b71.asciidoc ├── 72beebe779a258c225dee7b023e60c52.asciidoc ├── a4a396cd07657b3977713fb3a742c41b.asciidoc ├── d90a84a24a407731dfc1929ac8327746.asciidoc ├── f5569945024b9d664828693705c27c1a.asciidoc ├── 04f5dd677c777bcb15d7d5fa63275fc8.asciidoc ├── 216848930c2d344fe0bed0daa70c35b9.asciidoc ├── 47b5ff897f26e9c943cee5c06034181d.asciidoc ├── 5925c23a173a63bdb30b458248d1df76.asciidoc ├── b9a153725b28fdd0a5aabd7f17a8c2d7.asciidoc ├── fabe14480624a99e8ee42c7338672058.asciidoc ├── fe5763d32955e8b65eb3048e97b1580c.asciidoc ├── 427f6b5c5376cbf0f71f242a60ca3d9e.asciidoc ├── 46658f00edc4865dfe472a392374cd0f.asciidoc ├── 745f9b8cdb8e91073f6e520e1d9f8c05.asciidoc ├── 99a52be903945b17e734a1d02a57e958.asciidoc ├── 09d617863a103c82fb4101e6165ea7fe.asciidoc ├── 710c7871f20f176d51209b1574b0d61b.asciidoc ├── bfcd65ab85d684d36a8550080032958d.asciidoc ├── 1e18a67caf8f06ff2710ec4a8b30f625.asciidoc ├── 6d1e75312a28a5ba23837abf768f2510.asciidoc ├── 81c9aa2678d6166a9662ddf2c011a6a5.asciidoc ├── b0ec418bf416c62bed602b0a32a6d5f5.asciidoc ├── e567e6dbf86300142573c73789c8fce4.asciidoc ├── 09dbd90c5e22ea4a17b4cf9aa72e08ae.asciidoc ├── 8c5977410335d58217e0626618ce6641.asciidoc ├── 311c4b632a29b9ead63b02d01f10096b.asciidoc ├── 68738b4fd0dda177022be45be95b4c84.asciidoc ├── d5dcddc6398b473b6ad9bce5c6adf986.asciidoc ├── 52c7e4172a446c394210a07c464c57d2.asciidoc ├── bdb30dd52d32f50994008f4f9c0da5f0.asciidoc ├── 025b54db0edc50c24ea48a2bd94366ad.asciidoc ├── 69a7be47f85138b10437113ab2f0d72d.asciidoc ├── 8fdf2344c4fb3de6902ad7c5735270df.asciidoc ├── d4b4cefba4318caeba7480187faf2b13.asciidoc ├── 58df61acbfb15b8ef0aaa18b81ae98a6.asciidoc ├── d222c6a6ec7a3beca6c97011b0874512.asciidoc ├── 3342c69b2c2303247217532956fcce85.asciidoc ├── 38c1d0f6668e9563c0827f839f9fa505.asciidoc ├── 75330ec1305d2beb0e2f34d2195464e2.asciidoc ├── b0d64d0a554549e5b2808002a0725493.asciidoc ├── c22b72c4a52ee098331b3f252c22860d.asciidoc ├── 09cdd5ae8114c49886026fef8d00a19c.asciidoc ├── 0be2c28ee65384774b1e479b47dc3d92.asciidoc ├── 381fced1882ca8337143e6bb180a5715.asciidoc ├── 42744a175125df5be0ef77413bf8f608.asciidoc ├── 8653e76676de5d327201b77512afa3a0.asciidoc ├── 8e6bfb4441ffa15c86d5dc20fa083571.asciidoc ├── dfac8d098b50aa0181161bcd17b38ef4.asciidoc ├── eb30ba547e4a7b8f54f33ab259aca523.asciidoc ├── fa2fe60f570bd930d2891778c6efbfe6.asciidoc ├── 5eabcdbf61bfcb484dc694f25c2bba36.asciidoc ├── 83f95657beca9bf5d8264c80c7fb463f.asciidoc ├── d3088d5fa59b3ab110f64fb4f9b0065c.asciidoc ├── 014b788c879e4aaa1020672e45e25473.asciidoc ├── 0ce3606f1dba490eef83c4317b315b62.asciidoc ├── 1577e6e806b3283c9e99f1596d310754.asciidoc ├── 84d6a777a51963629272b1be5698b091.asciidoc ├── b41dce56b0e640d32b1cf452f87cec17.asciidoc ├── 4d46dbb96125b27f46299547de9d8709.asciidoc ├── 53d938c754f36a912fcbe6473abb463f.asciidoc ├── cd247f267968aa0927bfdad56852f8f5.asciidoc ├── e21e1c26dc8687e7bf7bd2bf019a6698.asciidoc ├── 015294a400986295039e52ebc62033be.asciidoc ├── 0cc991e3f7f8511a34730e154b3c5edc.asciidoc ├── 7cac05cb589f1614fd5b8589153bef06.asciidoc ├── db6cba451ba562abe953d09ad80cc15c.asciidoc ├── 189a921df2f5b1fe580937210ce9c1c2.asciidoc ├── 231aa0bb39c35fe199d28fe0e4a62b2e.asciidoc ├── 9a8995fd31351045d99c78e40444c8ea.asciidoc ├── 0ba0b2db24852abccb7c0fc1098d566e.asciidoc ├── 1e50d993bd6517e6c381e82d09f0389e.asciidoc ├── 5be23858b35043fcb7b50fe36b873e6e.asciidoc ├── 978088f989d45dd09339582e9cbc60e0.asciidoc ├── b9c5d7ca6ca9c6f747201f45337a4abf.asciidoc ├── ebb6b59fbc9325c17e45f524602d6be2.asciidoc ├── 36818c6d9f434d387819c30bd9addb14.asciidoc ├── e4be53736bcc02b03068fd72fdbfe271.asciidoc ├── 52b2bfbdd78f8283b6f4891c48013237.asciidoc ├── abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc ├── e0d6e02b998bdea99c9c08dcc3630c5e.asciidoc ├── 3ae03ba3b56e5e287953094050766738.asciidoc ├── dfb1fe96d806a644214d06f9b4b87878.asciidoc ├── 048d8abd42d094bbdcf4452a58ccb35b.asciidoc ├── 52a87b81e4e0b6b11e23e85db1602a63.asciidoc ├── a80f5db4357bb25b8704d374c18318ed.asciidoc ├── bb143628fd04070683eeeadc9406d9cc.asciidoc ├── cdedd5f33f7e5f7acde561e97bff61de.asciidoc ├── d0a8a938a2fa913b6fdbc871079a59dd.asciidoc ├── e17e8852ec3f31781e1364f4dffeb6d0.asciidoc ├── b1efa1c51a34dd5ab5511b71a399f5b1.asciidoc ├── ea02de2dbe05091fcb0dac72c8ba5f83.asciidoc ├── f085fb032dae56a3b104ab874eaea2ad.asciidoc ├── 400e89eb46ead8e9c9e40f123fd5e590.asciidoc ├── 527324766814561b75aaee853ede49a7.asciidoc ├── 5d32279dcd52b22d9e1178a02a3ad957.asciidoc ├── 625dc94df1f9affb49a082fd99d41620.asciidoc ├── 67ceac4bf2d9ac7cc500390544cdcb41.asciidoc ├── 774d715155cd13713e6e327adf6ce328.asciidoc ├── 7e52bec09624cf6c0de5d13f2bfad5a5.asciidoc ├── a7c15fe6b5779c84ce9a34bf4b2a7ab7.asciidoc ├── ad6ea0c1e46712aa1fd6d3bfa0ec979e.asciidoc ├── cb01106bf524df5e0501d4c655c1aa7b.asciidoc ├── 17de0020b228df961ad3c6b06233c948.asciidoc ├── 1f336ecc62480c1d56351cc2f82d0d08.asciidoc ├── 23ab0f1023b1b2cd5cdf2a8f9ccfd57b.asciidoc ├── 4acf902c2598b2558f34f20c1744c433.asciidoc ├── 506844befdc5691d835771bcbb1c1a60.asciidoc ├── 71ba9033107882f61cdc3b32fc73568d.asciidoc ├── a116949e446f34dc25ae57d4b703d0c1.asciidoc ├── b4392116f2cc57ce8064ccbad30318d5.asciidoc ├── bd5918ab903c0889bb1f09c8c2466e43.asciidoc ├── c849c6c8f8659dbb93e1c14356f74e37.asciidoc ├── e5d2172b524332196cac0f031c043659.asciidoc ├── 2891aa10ee9d474780adf94d5607f2db.asciidoc ├── 2a1de18774f9c68cafa169847832b2bc.asciidoc ├── 3653567181f43a5f64c74f934aa821c2.asciidoc ├── 3b04cc894e6a47d57983484010feac0c.asciidoc ├── 43af86de5e49aa06070092fffc138208.asciidoc ├── 46c4b0dfb674825f9579203d41e7f404.asciidoc ├── 5f3549ac7fee94682ca0d7439eebdd2a.asciidoc ├── 6138d6919f3cbaaf61e1092f817d295c.asciidoc ├── 645c4c6e209719d3a4d25b1a629cb23b.asciidoc ├── 6f097c298a7abf4c032c4314920c49c8.asciidoc ├── 9e56d79ad9a02b642c361f0b85dd95d7.asciidoc ├── afc29b61c532cf683f749baf013e7bfe.asciidoc ├── c32a3f8071d87f0a3f5a78e07fe7a669.asciidoc ├── c612d93e7f682a0d731e385edf9f5d56.asciidoc ├── d3016e4e8025362ad9a05ee86bb2061f.asciidoc ├── f4a1008b3f9baa67bb03ce9ef5ab4cb4.asciidoc ├── f6b5032bf27c2445d28845be0d413970.asciidoc ├── f70a54cd9a9f4811bf962e469f2ca2ea.asciidoc ├── 0c4ad860a485fe53d8140ad3ccd11dcf.asciidoc ├── 28aad2c5942bfb221c2bf1bbdc01658e.asciidoc ├── 5043b83a89091fa00edb341ddf7ba370.asciidoc ├── 6799d132c1c7ca3970763acde2337ef9.asciidoc ├── 734c2e2a1e45b84f1e4e65b51356fcd7.asciidoc ├── 7477671958734843dd67cf0b8e6c7515.asciidoc ├── abf329ebefaf58acd4ee30e685731499.asciidoc ├── b918d6b798da673a33e49b94f61dcdc0.asciidoc ├── d718b63cf1b6591a1d59a0cf4fd995eb.asciidoc ├── 162b5b693b713f0bfab1209d59443c46.asciidoc ├── 5dd695679b5141d9142d3d30ba8d300a.asciidoc ├── 6bf63f2ec6ba55fcaf1092f48212bf25.asciidoc ├── 6a1702dd50690cae833572e48a0ddf25.asciidoc ├── 72231b7debac60c95b9869a97dafda3a.asciidoc ├── feefeb68144002fd1fff57b77b95b85e.asciidoc ├── 7f56755fb6c42f7e6203339a6d0cb6e6.asciidoc ├── f2d68493abd3ca430bd03a7f7f8d18f9.asciidoc ├── f32f0c19b42de3b87dd764fe4ca17e7c.asciidoc ├── 0afaf1cad692e6201aa574c8feb6e622.asciidoc ├── 14701dcc0cca9665fce2aace0cb62af7.asciidoc ├── 53b908c3432118c5a6e460f74d32006b.asciidoc ├── 9166cf38427d5cde5d2ec12a2012b669.asciidoc ├── a5a7050fb9dcb9574e081957ade28617.asciidoc ├── bc1ad5cc6d3eab98e3ce01f209ba7094.asciidoc ├── d31062ff8c015387889fed4ad86fd914.asciidoc ├── e30ea6e3823a139d7693d8cce1920a06.asciidoc ├── e9c2e15b36372d5281c879d336322b6c.asciidoc ├── 4b90feb9d5d3dbfce424dac0341320b7.asciidoc ├── 58b5003c0a53a39bf509aa3797aad471.asciidoc ├── 6a4679531e64c492fce16dc12de6dcb0.asciidoc ├── 93f1bdd72e79827dcf9a34efa02fd977.asciidoc ├── a34d70d7022eb4ba48909d440c80390f.asciidoc ├── 1216f8f7367df3aa823012cef310c08a.asciidoc ├── 1f6fe6833686e38c3711c6f2aa00a078.asciidoc ├── 35e8da9410b8432cf4095f2541ad7b1d.asciidoc ├── 5c2f486c27bd5346e512265f93375d16.asciidoc ├── 60ee33f3acfdd0fe6f288ac77312c780.asciidoc ├── 7f465b7e8ed42df6c42251b4481e699e.asciidoc ├── 4cd246e5c4c035a2cd4081ae9a3d54e5.asciidoc ├── 96de5703ba0bd43fd4ac239ec5408542.asciidoc ├── 0ac9916f47a2483b89c1416684af322a.asciidoc ├── 0bbd30b9be3e54ff3028b9f4459634d2.asciidoc ├── ef0f4fa4272c47ff62fb7b422cf975e7.asciidoc ├── 033778305d52746f5ce0a2a922c8e521.asciidoc ├── 2bb2339ac055337abf753bddb7771659.asciidoc ├── 2fd69fb0538e4f36ac69a8b8f8bf5ae8.asciidoc ├── 764f9884b370cbdc82a1c5c42ed40ff3.asciidoc ├── 899eef71a67a1b2aa11a2166ec7f48f1.asciidoc ├── 09ecba5814d71e4c44468575eada9878.asciidoc ├── 68721288dc9ad8aa1b55099b4d303051.asciidoc ├── 73e5c88ad1488b213fb278ee1cb42289.asciidoc ├── 0e118857b815b62118a30c042f079db1.asciidoc ├── 5f210f74725ea0c9265190346edfa246.asciidoc ├── a2a25aad1fea9a541b52ac613c78fb64.asciidoc ├── a42f33e15b0995bb4b6058659bfdea85.asciidoc ├── b789292f9cf63ce912e058c46d90ce20.asciidoc ├── be1bd47393646ac6bbee177d1cdb7738.asciidoc ├── d1bcf2eb63a462bfdcf01a68e68d5b4a.asciidoc ├── dfef545b1e2c247bafd1347e8e807ac1.asciidoc ├── 3722cb3705b6bc7f486969deace3dd83.asciidoc ├── 8eaf4d5dd4ab1335deefa7749fdbbcc3.asciidoc ├── fa88f6f5a7d728ec4f1d05244228cb09.asciidoc ├── fdcaba9547180439ff4b6275034a5170.asciidoc ├── fdd38f0d248385a444c777e7acd97846.asciidoc ├── 5f3a3eefeefe6fa85ec49d499212d245.asciidoc ├── 78c96113ae4ed0054e581b17542528a7.asciidoc ├── e2a042c629429855c3bcaefffb26b7fa.asciidoc ├── fa0f4485cd48f986b7ae8cbb24e331c4.asciidoc ├── 618d5f3d35921d8cb7e9ccfbe9a4c3e3.asciidoc ├── a49169b4622918992411fab4ec48191b.asciidoc ├── 4646764bf09911fee7d58630c72d3137.asciidoc ├── 5da6efd5b038ada64c9e853c88c1ec47.asciidoc ├── 8baccd8688a6bad1749b8935f9601ea4.asciidoc ├── 8de3206f80e18185a5ad6481f4c2ee07.asciidoc ├── 047266b0d20fdb62ebc72d51952c8f6d.asciidoc ├── 0989cc65d8924f666ce3eb0820d2d244.asciidoc ├── 0a958e486ede3f519d48431ab689eded.asciidoc ├── 39a6a038c4b551022afe83de0523634e.asciidoc ├── 4d56b179242fed59e3d6476f817b6055.asciidoc ├── 8a355eb25d2a01ba62dc1a22dd46f46f.asciidoc ├── d9474f66970c6955e24b17c7447e7b5f.asciidoc ├── e270f3f721a5712cd11a5ca03554f5b0.asciidoc ├── 7b908b1189f076942de8cd497ff1fa59.asciidoc ├── 98aeb275f829b5f7b8eb2147701565ff.asciidoc ├── 179f0a3e84ff4bbac18787a018eabf89.asciidoc ├── 6f21a878fee3b43c5332b81aaddbeac7.asciidoc ├── ad0dcbc7fc619e952c8825b8f307b7b2.asciidoc ├── ec27afee074001b0e4e393611010842b.asciidoc ├── 1bc731a4df952228af6dfa6b48627332.asciidoc ├── 3e573bfabe00f8bfb8bb69aa5820768e.asciidoc ├── 6faf10a73f7d5fffbcb037bdb2cbaff8.asciidoc ├── ac544eb247a29ca42aab13826ca88561.asciidoc ├── d50a3c64890f88af32c6d4ef4899d82a.asciidoc ├── 5275842787967b6db876025f4a1c6942.asciidoc ├── 7cf71671859be7c1ecf673396db377cd.asciidoc ├── 9524a9b7373fa4eb2905183b0e806962.asciidoc ├── a1db5c822745fe167e9ef854dca3d129.asciidoc ├── f0e21e03a07c8fa0209b0aafdb3791e6.asciidoc ├── 913770050ebbf3b9b549a899bc11060a.asciidoc ├── af3fb9fa5691a7b37a6dc2a69ff66e64.asciidoc ├── b94cee0f74f57742b3948f9b784dfdd4.asciidoc ├── ef9111c1648d7820925f12e07d1346c5.asciidoc ├── d8b2a88b5eca99d3691ad3cd40266736.asciidoc ├── 213ab768f1b6a895e09403a0880e259a.asciidoc ├── 973a3ff47fc4ce036ecd9bd363fef9f7.asciidoc ├── 64b9baa6d7556b960b29698f3383aa31.asciidoc ├── 8871b8fcb6de4f0c7dff22798fb10fb7.asciidoc ├── 97babc8d19ef0866774576716eb6d19e.asciidoc ├── 2533e4b36ae837eaecda08407ecb6383.asciidoc ├── 626f8c4b3e2cd3d9beaa63a7f5799d7a.asciidoc ├── f6d6889667f56b8f49d2858070571a6b.asciidoc ├── 15dad5338065baaaa7d475abe85f4c22.asciidoc ├── 251ea12c1248385ab409906ac64d9ee9.asciidoc ├── ec473de07fe89bcbac1f8e278617fe46.asciidoc ├── 7f28f8ae8fcdbd807dadde0b5b007a6d.asciidoc ├── 9a4d5e41c52c20635d1fd9c6e13f6c7a.asciidoc ├── 979d25dff2d8987119410291ad47b0d1.asciidoc ├── e8e451bc8c45bcf16df43804c4fc8329.asciidoc ├── 36b2778f23d0955255f52c075c4d213d.asciidoc ├── cfbaea6f0df045c5d940bbb6a9c69cd8.asciidoc ├── 3a700f836d8d5da1b656a876554028aa.asciidoc ├── 6a81d00f0d73bc5985e76b3cadab645e.asciidoc ├── 8acc1d67b152e7027e0f0e1a8b4b2431.asciidoc ├── 7f697eb436dfa3c30dfe610d8c32d132.asciidoc ├── b214942b938e47f2c486e523546cb574.asciidoc ├── a71c438cc4df1cafe3109ccff475afdb.asciidoc ├── ad79228630684d950fe9792a768d24c5.asciidoc ├── c4b278ba293abd0d02a0b5ad1a99f84a.asciidoc ├── f9636d7ef1a45be4f36418c875cf6bef.asciidoc ├── b0eaf67e5cce24ef8889bf20951ccec1.asciidoc ├── 33f148e3d8676de6cc52f58749898a13.asciidoc ├── 47bb632c6091ad0cd94bc660bdd309a5.asciidoc ├── b93ed4ef309819734f0eeea82e8b0f1f.asciidoc ├── d1b3b7d2bb2ab90d15fd10318abd24db.asciidoc ├── 71b5b2ba9557d0f296ff2de91727d2f6.asciidoc ├── ae9b5fbd42af2386ffbf56ad4a697e51.asciidoc ├── 34efeade38445b2834749ced59782e25.asciidoc ├── cd5bc5bf7cd58d7b1492c9c298b345f6.asciidoc ├── 1da77e114459e0b77d78a3dcc8fae429.asciidoc ├── 04fe1e3a0047b0cdb10987b79fc3f3f3.asciidoc ├── 1b8caf0a6741126c6d0ad83b56fce290.asciidoc ├── 645796e8047967ca4a7635a22a876f4c.asciidoc ├── 98b121bf47cebd85671a2cb519688d28.asciidoc ├── d17269bb80fb63ec0bf37d219e003dcb.asciidoc ├── 8f0511f8a5cb176ff2afdd4311799a33.asciidoc ├── b68c85fe1b0d2f264dc0d1cbf530f319.asciidoc ├── ba0b4081c98f3387f76b77847c52ee9a.asciidoc ├── 77243bbf92f2a55e0fca6c2a349a1c15.asciidoc ├── de139866a220124360e5e27d1a736ea4.asciidoc ├── 0d664883151008b1051ef2c9ab2d0373.asciidoc ├── 6bbc613bd4f9aec1bbdbabf5db021d28.asciidoc ├── 1b8655e6ba99fe39933c6eafe78728b7.asciidoc ├── de176bc4788ea286fff9e92418a43ea8.asciidoc ├── b997885974522ef439d5e345924cc5ba.asciidoc ├── e5f50b31f165462d883ecbff45f74985.asciidoc ├── 1027ab1ca767ac1428176ef4f84bfbcf.asciidoc ├── 804a97ff4d0613e6568e4efb19c52021.asciidoc ├── 1aa91d3d48140d6367b6cabca8737b8f.asciidoc ├── 5d9d7b84e2fec7ecd832145cbb951cf1.asciidoc └── 1e49eba5b9042c1900a608fe5105ba43.asciidoc ├── index.asciidoc └── examples └── exists.asciidoc /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | test/benchmarks 4 | elasticsearch 5 | .git 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 303 See Other 2 | 3 | Location: https://www.elastic.co/community/codeofconduct 4 | -------------------------------------------------------------------------------- /test/fixtures/small-dataset.ndjson: -------------------------------------------------------------------------------- 1 | {"user":"jon","age":23} 2 | {"user":"arya","age":18} 3 | {"user":"tyrion","age":39} 4 | -------------------------------------------------------------------------------- /.ci/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_JS_VERSION=10 2 | FROM node:${NODE_JS_VERSION}-alpine 3 | 4 | RUN apk --no-cache add git 5 | 6 | # Create app directory 7 | WORKDIR /usr/src/app 8 | -------------------------------------------------------------------------------- /.ci/test-matrix.yml: -------------------------------------------------------------------------------- 1 | --- 2 | STACK_VERSION: 3 | - 8.0.0-SNAPSHOT 4 | 5 | NODE_JS_VERSION: 6 | - 14 7 | - 12 8 | - 10 9 | - 8 10 | 11 | TEST_SUITE: 12 | - oss 13 | - xpack 14 | 15 | exclude: ~ 16 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: off 2 | 3 | coverage: 4 | precision: 2 5 | round: down 6 | range: "95...100" 7 | 8 | status: 9 | project: yes 10 | patch: yes 11 | changes: no 12 | 13 | ignore: 14 | - "api" 15 | -------------------------------------------------------------------------------- /scripts/kibana-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exec docker run \ 4 | --rm \ 5 | -e ELASTICSEARCH_URL="http://elasticsearch:9200" \ 6 | -p 5601:5601 \ 7 | --network=elastic \ 8 | docker.elastic.co/kibana/kibana:7.0.0-beta1 9 | -------------------------------------------------------------------------------- /.ci/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG NODE_JS_VERSION=10 2 | FROM node:${NODE_JS_VERSION} 3 | 4 | # Create app directory 5 | WORKDIR /usr/src/app 6 | 7 | # Install app dependencies 8 | COPY package*.json ./ 9 | RUN npm install 10 | 11 | COPY . . 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/security.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 👮 Security Issue 3 | about: Responsible Disclosure 4 | --- 5 | 6 | If you want to report a security issue, please take a look at [elastic/security](https://www.elastic.co/community/security). 7 | -------------------------------------------------------------------------------- /test/unit/esm/index.mjs: -------------------------------------------------------------------------------- 1 | import t from 'tap' 2 | import { Client } from '../../../index.mjs' 3 | 4 | t.test('esm support', t => { 5 | t.plan(1) 6 | const client = new Client({ node: 'http://localhost:9200' }) 7 | t.strictEqual(client.name, 'elasticsearch-js') 8 | }) 9 | -------------------------------------------------------------------------------- /docs/doc_examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.info() 7 | console.log(response) 8 | ---- 9 | 10 | -------------------------------------------------------------------------------- /docs/doc_examples/b02e4907c9936c1adc16ccce9d49900d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cluster.health() 7 | console.log(response) 8 | ---- 9 | 10 | -------------------------------------------------------------------------------- /docs/doc_examples/f8cc4b331a19ff4df8e4a490f906ee69.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cat.health({ 7 | v: true 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/168bfdde773570cfc6dd3ab3574e413b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | q: 'user:kimchy' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/d2153f3100bf12c2de98f14eb86ab061.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/1c23507edd7a3c18538b68223378e4ab.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'twitter' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/621665fdbd7fc103c09bfeed28b67b1a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.count({ 7 | filter_path: '-_shards' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/98f14fddddea54a7d6149ab7b92e099d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.delete({ 7 | index: 'twitter' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/be8f28f31207b173de61be032fcf239c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.get({ 7 | index: 'twitter' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/c2c21e2824fbf6b7198ede30419da82b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.clearScroll({ 7 | scroll_id: '_all' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/12433d2b637d002e8d5c9a1adce69d3b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'publications' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/210cf5c76bff517f48e80fa1c2d63907.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.getMapping({ 7 | index: 'my_index' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/3f3b3e207f79303ce6f86e03e928e062.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'customer', 8 | id: '1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/609260ad1d5998be2ca09ff1fe237efa.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.getMapping({ 7 | index: 'my-index' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/67bba546d835bca8f31df13e3587c348.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'test', 8 | id: '1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/a8fba09a46b2c3524428aa3259b7124f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.getMapping({ 7 | index: 'twitter' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/cde4dddae5c06e7f1d38c9d933dbc7ac.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.updateByQuery({ 7 | index: 'twitter,blog' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/cfc37446bd892d1ac42a3c8e8b204e6c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'test2', 8 | id: '1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/fbcf5078a6a9e09790553804054c36b3.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'twitter', 8 | id: '0' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /.ci/packer_cache.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source /usr/local/bin/bash_standard_lib.sh 4 | 5 | DOCKER_IMAGES="node:14-alpine 6 | node:12-alpine 7 | node:10-alpine 8 | node:8-alpine 9 | " 10 | 11 | for di in ${DOCKER_IMAGES} 12 | do 13 | (retry 2 docker pull "${di}") || echo "Error pulling ${di} Docker image, we continue" 14 | done 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/43682666e1abcb14770c99f02eb26a0d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: '*', 8 | q: 'user:kimchy' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/89a8ac1509936acc272fc2d72907bc45.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.getSource({ 7 | index: 'twitter', 8 | id: '1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/98234499cfec70487cec5d013e976a84.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.exists({ 7 | index: 'twitter', 8 | id: '0' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/c5e5873783246c7b1c01d8464fed72c4.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.delete({ 7 | index: 'twitter', 8 | id: '1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/cf02e3d8b371bd59f0224967c36330da.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.getMapping({ 7 | index: 'twitter,kimchy' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/1b542e3ea87a742f95641d64dcfb1bdb.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.count({ 7 | index: 'twitter', 8 | q: 'user:kimchy' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/2468ab381257d759d8a88af1141f6f9c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.existsSource({ 7 | index: 'twitter', 8 | id: '1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/8022e6a690344035b6472a43a9d122e0.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: '_all', 8 | q: 'user:kimchy' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.tasks.cancel({ 7 | task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/a6f8636b03cc5f677b7d89e750328612.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | size: 'surprise_me' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.tasks.get({ 7 | task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/be49260e1b3496c4feac38c56ebb0669.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | q: 'user:kimchy' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/d8b115341da772a628a024e7d1644e73.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.updateByQuery({ 7 | index: 'twitter', 8 | routing: '1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/1dbb8cf17fbc45c87c7d2f75f15f9778.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cluster.state({ 7 | filter_path: 'metadata.indices.*.stat*' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/54a770f053f3225ea0d1e34334232411.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.updateByQuery({ 7 | index: 'twitter', 8 | scroll_size: '100' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/7df191cc7f814e410a4ac7261065e6ef.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.tasks.list({ 7 | detailed: 'true', 8 | actions: '*byquery' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/c48264ec5d9b9679fddd72e5c44425b9.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cluster.health({ 7 | index: 'twitter', 8 | level: 'shards' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/073539a7e38be3cdf13008330b6a536a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cat.indices({ 7 | index: 'twi*', 8 | v: true, 9 | s: 'index' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/1252fa45847edba5ec2b2f33da70ec5b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cluster.state({ 7 | filter_path: 'routing_table.indices.**.state' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/138ccd89f72aa7502dd9578403dcc589.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'twitter', 8 | id: '0', 9 | _source: 'false' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/1d65cb6d055c46a1bde809687d835b71.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'twitter', 8 | id: '2', 9 | routing: 'user1' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/72beebe779a258c225dee7b023e60c52.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.nodes.stats({ 7 | metric: 'indices', 8 | index_metric: 'search' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/a4a396cd07657b3977713fb3a742c41b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.updateByQuery({ 7 | index: 'twitter', 8 | conflicts: 'proceed' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/d90a84a24a407731dfc1929ac8327746.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.delete({ 7 | index: 'twitter', 8 | id: '1', 9 | timeout: '5m' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/f5569945024b9d664828693705c27c1a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'kimchy,elasticsearch', 8 | q: 'user:kimchy' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /.github/workflows/backport.yml: -------------------------------------------------------------------------------- 1 | name: Backport 2 | on: 3 | pull_request: 4 | types: 5 | - closed 6 | - labeled 7 | 8 | jobs: 9 | backport: 10 | runs-on: ubuntu-latest 11 | name: Backport 12 | steps: 13 | - name: Backport 14 | uses: tibdex/backport@v1 15 | with: 16 | github_token: ${{ secrets.GITHUB_TOKEN }} 17 | -------------------------------------------------------------------------------- /docs/doc_examples/04f5dd677c777bcb15d7d5fa63275fc8.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cluster.health({ 7 | wait_for_status: 'yellow', 8 | timeout: '50s' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/216848930c2d344fe0bed0daa70c35b9.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.tasks.list({ 7 | detailed: 'true', 8 | actions: '*/delete/byquery' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/47b5ff897f26e9c943cee5c06034181d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.delete({ 7 | index: 'twitter', 8 | id: '1', 9 | routing: 'kimchy' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/5925c23a173a63bdb30b458248d1df76.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.getSettings({ 7 | index: 'twitter', 8 | flat_settings: 'false' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/b9a153725b28fdd0a5aabd7f17a8c2d7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.getSettings({ 7 | index: 'twitter', 8 | flat_settings: 'true' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/fabe14480624a99e8ee42c7338672058.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'test', 8 | wait_for_active_shards: '2' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/fe5763d32955e8b65eb3048e97b1580c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.forcemerge({ 7 | index: 'twitter', 8 | max_num_segments: '5' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/427f6b5c5376cbf0f71f242a60ca3d9e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'alias2', 8 | q: 'user:kimchy', 9 | routing: '2,3' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/46658f00edc4865dfe472a392374cd0f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.getTemplate({ 7 | name: 'template_1', 8 | filter_path: '*.version' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/745f9b8cdb8e91073f6e520e1d9f8c05.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'twitter', 8 | id: '0', 9 | _source: '*.id,retweeted' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/99a52be903945b17e734a1d02a57e958.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.getFieldMapping({ 7 | index: 'my-index', 8 | fields: 'employee-id' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/09d617863a103c82fb4101e6165ea7fe.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match_all: {} 10 | } 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/710c7871f20f176d51209b1574b0d61b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'twitter', 8 | id: '1', 9 | stored_fields: 'tags,counter' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/bfcd65ab85d684d36a8550080032958d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | q: 'message:number', 8 | size: '0', 9 | terminate_after: '1' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/1e18a67caf8f06ff2710ec4a8b30f625.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cluster.state({ 7 | filter_path: 'metadata.indices.*.state,-metadata.indices.logstash-*' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/6d1e75312a28a5ba23837abf768f2510.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | size: 'surprise_me', 9 | error_trace: 'true' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/81c9aa2678d6166a9662ddf2c011a6a5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match_none: {} 10 | } 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/b0ec418bf416c62bed602b0a32a6d5f5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'alias1', 8 | id: '1', 9 | body: { 10 | foo: 'bar' 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/e567e6dbf86300142573c73789c8fce4.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'new_twitter', 8 | size: '0', 9 | filter_path: 'hits.total' 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /scripts/utils/patch.json: -------------------------------------------------------------------------------- 1 | { 2 | "6": { 3 | "_source_includes": "_source_include", 4 | "_source_excludes": "_source_exclude" 5 | }, 6 | "7": { 7 | "_source_includes": "_source_include", 8 | "_source_excludes": "_source_exclude" 9 | }, 10 | "master": { 11 | "_source_includes": "_source_include", 12 | "_source_excludes": "_source_exclude" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docs/doc_examples/09dbd90c5e22ea4a17b4cf9aa72e08ae.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | q: 'elasticsearch', 8 | filter_path: 'took,hits.hits._id,hits.hits._score' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/8c5977410335d58217e0626618ce6641.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'my_index', 8 | id: '2', 9 | body: { 10 | color: 'blue' 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/311c4b632a29b9ead63b02d01f10096b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'customer', 8 | id: '1', 9 | body: { 10 | name: 'John Doe' 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/68738b4fd0dda177022be45be95b4c84.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindexRethrottle({ 7 | task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619', 8 | requests_per_second: '-1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/d5dcddc6398b473b6ad9bce5c6adf986.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | scroll: '1m', 8 | body: { 9 | sort: [ 10 | '_doc' 11 | ] 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/52c7e4172a446c394210a07c464c57d2.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.deleteByQueryRethrottle({ 7 | task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619', 8 | requests_per_second: '-1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/bdb30dd52d32f50994008f4f9c0da5f0.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.updateByQueryRethrottle({ 7 | task_id: 'r1A2WoRbTwKZ516z6NEs5A:36619', 8 | requests_per_second: '-1' 9 | }) 10 | console.log(response) 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /docs/doc_examples/025b54db0edc50c24ea48a2bd94366ad.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | size: '0', 9 | q: 'extra:test', 10 | filter_path: 'hits.total' 11 | }) 12 | console.log(response) 13 | ---- 14 | 15 | -------------------------------------------------------------------------------- /docs/doc_examples/69a7be47f85138b10437113ab2f0d72d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'twitter', 8 | id: '2', 9 | routing: 'user1', 10 | stored_fields: 'tags,counter' 11 | }) 12 | console.log(response) 13 | ---- 14 | 15 | -------------------------------------------------------------------------------- /docs/doc_examples/8fdf2344c4fb3de6902ad7c5735270df.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.get({ 7 | index: 'twitter', 8 | id: '0', 9 | _source_includes: '*.id', 10 | _source_excludes: 'entities' 11 | }) 12 | console.log(response) 13 | ---- 14 | 15 | -------------------------------------------------------------------------------- /docs/doc_examples/d4b4cefba4318caeba7480187faf2b13.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'my_index', 8 | id: '1', 9 | body: { 10 | full_text: 'Quick Brown Foxes!' 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/58df61acbfb15b8ef0aaa18b81ae98a6.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | script: "ctx._source.remove('new_field')" 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/d222c6a6ec7a3beca6c97011b0874512.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.getSource({ 7 | index: 'twitter', 8 | id: '1', 9 | _source_includes: '*.id', 10 | _source_excludes: 'entities' 11 | }) 12 | console.log(response) 13 | ---- 14 | 15 | -------------------------------------------------------------------------------- /docs/doc_examples/3342c69b2c2303247217532956fcce85.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | exists: { 10 | field: 'user' 11 | } 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/38c1d0f6668e9563c0827f839f9fa505.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | doc: { 11 | name: 'new_name' 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/75330ec1305d2beb0e2f34d2195464e2.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match_all: { 10 | boost: 1.2 11 | } 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/b0d64d0a554549e5b2808002a0725493.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.clearScroll({ 7 | body: { 8 | scroll_id: 'DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==' 9 | } 10 | }) 11 | console.log(response) 12 | ---- 13 | 14 | -------------------------------------------------------------------------------- /docs/doc_examples/c22b72c4a52ee098331b3f252c22860d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.deleteByQuery({ 7 | index: 'twitter,blog', 8 | body: { 9 | query: { 10 | match_all: {} 11 | } 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/09cdd5ae8114c49886026fef8d00a19c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.indices.getMapping({ 7 | index: '_all' 8 | }) 9 | console.log(response0) 10 | 11 | const response1 = await client.indices.getMapping() 12 | console.log(response1) 13 | ---- 14 | 15 | -------------------------------------------------------------------------------- /docs/doc_examples/0be2c28ee65384774b1e479b47dc3d92.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putSettings({ 7 | index: 'twitter', 8 | body: { 9 | index: { 10 | refresh_interval: '1s' 11 | } 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/381fced1882ca8337143e6bb180a5715.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | counter: 1, 11 | tags: [ 12 | 'red' 13 | ] 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/42744a175125df5be0ef77413bf8f608.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putSettings({ 7 | index: 'twitter', 8 | body: { 9 | index: { 10 | refresh_interval: null 11 | } 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/8653e76676de5d327201b77512afa3a0.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putSettings({ 7 | index: 'twitter', 8 | body: { 9 | index: { 10 | number_of_replicas: 2 11 | } 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/8e6bfb4441ffa15c86d5dc20fa083571.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cluster.putSettings({ 7 | body: { 8 | transient: { 9 | 'logger.org.elasticsearch.transport': 'trace' 10 | } 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/dfac8d098b50aa0181161bcd17b38ef4.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putSettings({ 7 | index: 'twitter', 8 | body: { 9 | index: { 10 | refresh_interval: '-1' 11 | } 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/eb30ba547e4a7b8f54f33ab259aca523.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | script: "ctx._source.new_field = 'value_of_new_field'" 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/fa2fe60f570bd930d2891778c6efbfe6.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match: { 10 | message: 'this is a test' 11 | } 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/5eabcdbf61bfcb484dc694f25c2bba36.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | id: '1', 9 | body: { 10 | counter: 1, 11 | tags: [ 12 | 'red' 13 | ] 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/83f95657beca9bf5d8264c80c7fb463f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match_phrase: { 10 | message: 'this is a test' 11 | } 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/d3088d5fa59b3ab110f64fb4f9b0065c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'my_index', 8 | id: '1', 9 | body: { 10 | color: [ 11 | 'blue', 12 | 'green' 13 | ] 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/014b788c879e4aaa1020672e45e25473.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.cluster.putSettings({ 7 | body: { 8 | transient: { 9 | 'cluster.routing.use_adaptive_replica_selection': false 10 | } 11 | } 12 | }) 13 | console.log(response) 14 | ---- 15 | 16 | -------------------------------------------------------------------------------- /docs/doc_examples/0ce3606f1dba490eef83c4317b315b62.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | body: { 9 | query: { 10 | term: { 11 | user: 'kimchy' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/1577e6e806b3283c9e99f1596d310754.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'test', 8 | id: '1', 9 | refresh: true, 10 | body: { 11 | text: 'words words', 12 | flag: 'foo' 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/84d6a777a51963629272b1be5698b091.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | body: { 9 | query: { 10 | term: { 11 | user: 'kimchy' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/b41dce56b0e640d32b1cf452f87cec17.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.scroll({ 7 | body: { 8 | scroll: '1m', 9 | scroll_id: 'DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==' 10 | } 11 | }) 12 | console.log(response) 13 | ---- 14 | 15 | -------------------------------------------------------------------------------- /docs/doc_examples/4d46dbb96125b27f46299547de9d8709.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'test', 8 | body: { 9 | settings: { 10 | 'index.write.wait_for_active_shards': '2' 11 | } 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/53d938c754f36a912fcbe6473abb463f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'users' 10 | }, 11 | dest: { 12 | index: 'new_users' 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/cd247f267968aa0927bfdad56852f8f5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | query: { 10 | match: { 11 | address: 'mill lane' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/e21e1c26dc8687e7bf7bd2bf019a6698.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.deleteByQuery({ 7 | index: 'twitter', 8 | conflicts: 'proceed', 9 | body: { 10 | query: { 11 | match_all: {} 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/015294a400986295039e52ebc62033be.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | doc: { 11 | name: 'new_name' 12 | }, 13 | detect_noop: false 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/0cc991e3f7f8511a34730e154b3c5edc.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'twitter' 10 | }, 11 | dest: { 12 | index: 'new_twitter' 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/7cac05cb589f1614fd5b8589153bef06.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | doc: { 11 | name: 'new_name' 12 | }, 13 | doc_as_upsert: true 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/db6cba451ba562abe953d09ad80cc15c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | query: 'city.\\*:(this AND that OR thus)' 11 | } 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/189a921df2f5b1fe580937210ce9c1c2.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match_all: {} 10 | }, 11 | stats: [ 12 | 'group1', 13 | 'group2' 14 | ] 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/231aa0bb39c35fe199d28fe0e4a62b2e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | query: { 10 | match_phrase: { 11 | address: 'mill lane' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/9a8995fd31351045d99c78e40444c8ea.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | genres: { 10 | terms: { 11 | field: 'genre' 12 | } 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/0ba0b2db24852abccb7c0fc1098d566e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | id: '2', 9 | routing: 'user1', 10 | body: { 11 | counter: 1, 12 | tags: [ 13 | 'white' 14 | ] 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/1e50d993bd6517e6c381e82d09f0389e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | from: 5, 9 | size: 20, 10 | query: { 11 | term: { 12 | 'user.id': '8a4f500d' 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/5be23858b35043fcb7b50fe36b873e6e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putMapping({ 7 | index: 'twitter', 8 | body: { 9 | properties: { 10 | email: { 11 | type: 'keyword' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/978088f989d45dd09339582e9cbc60e0.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: '%3Clogstash-%7Bnow%2Fd%7D%3E', 8 | body: { 9 | query: { 10 | match: { 11 | test: 'data' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/b9c5d7ca6ca9c6f747201f45337a4abf.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'twitter', 8 | body: { 9 | settings: { 10 | number_of_shards: 3, 11 | number_of_replicas: 2 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/ebb6b59fbc9325c17e45f524602d6be2.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.deleteByQuery({ 7 | index: 'twitter', 8 | body: { 9 | query: { 10 | match: { 11 | message: 'some message' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/36818c6d9f434d387819c30bd9addb14.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | body: { 9 | user: 'kimchy', 10 | post_date: '2009-11-15T14:12:12', 11 | message: 'trying out Elasticsearch' 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/e4be53736bcc02b03068fd72fdbfe271.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putMapping({ 7 | index: 'publications', 8 | body: { 9 | properties: { 10 | title: { 11 | type: 'text' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/52b2bfbdd78f8283b6f4891c48013237.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | max_docs: 1, 9 | source: { 10 | index: 'twitter' 11 | }, 12 | dest: { 13 | index: 'new_twitter' 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'test', 8 | filter_path: 'hits.total', 9 | body: { 10 | query: { 11 | match: { 12 | flag: 'foo' 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/e0d6e02b998bdea99c9c08dcc3630c5e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match: { 10 | message: { 11 | query: 'this is a test' 12 | } 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/3ae03ba3b56e5e287953094050766738.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.indices.refresh() 7 | console.log(response0) 8 | 9 | const response1 = await client.search({ 10 | index: 'new_twitter', 11 | size: '0', 12 | filter_path: 'hits.total' 13 | }) 14 | console.log(response1) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/dfb1fe96d806a644214d06f9b4b87878.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.deleteByQuery({ 7 | index: 'twitter', 8 | scroll_size: '5000', 9 | body: { 10 | query: { 11 | term: { 12 | user: 'kimchy' 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/048d8abd42d094bbdcf4452a58ccb35b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.create({ 7 | index: 'twitter', 8 | id: '1', 9 | body: { 10 | user: 'kimchy', 11 | post_date: '2009-11-15T14:12:12', 12 | message: 'trying out Elasticsearch' 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/52a87b81e4e0b6b11e23e85db1602a63.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.updateByQuery({ 7 | index: 'twitter', 8 | conflicts: 'proceed', 9 | body: { 10 | query: { 11 | term: { 12 | user: 'kimchy' 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/a80f5db4357bb25b8704d374c18318ed.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'my_index', 8 | pretty: true, 9 | body: { 10 | query: { 11 | match: { 12 | full_text: 'Quick Brown Foxes!' 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/bb143628fd04070683eeeadc9406d9cc.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | id: '1', 9 | body: { 10 | user: 'kimchy', 11 | post_date: '2009-11-15T14:12:12', 12 | message: 'trying out Elasticsearch' 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/cdedd5f33f7e5f7acde561e97bff61de.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'my_index', 8 | pretty: true, 9 | body: { 10 | query: { 11 | term: { 12 | full_text: 'Quick Brown Foxes!' 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/d0a8a938a2fa913b6fdbc871079a59dd.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | term: { 10 | user: { 11 | value: 'Kimchy', 12 | boost: 1 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/e17e8852ec3f31781e1364f4dffeb6d0.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | query: '(content:this OR name:this) AND (content:that OR name:that)' 11 | } 12 | } 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/b1efa1c51a34dd5ab5511b71a399f5b1.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'source' 10 | }, 11 | dest: { 12 | index: 'dest', 13 | pipeline: 'some_ingest_pipeline' 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/ea02de2dbe05091fcb0dac72c8ba5f83.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.updateByQuery({ 7 | index: 'twitter', 8 | refresh: true, 9 | slices: '5', 10 | body: { 11 | script: { 12 | source: "ctx._source['extra'] = 'test'" 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/f085fb032dae56a3b104ab874eaea2ad.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | tags: { 10 | terms: { 11 | field: 'tags', 12 | missing: 'N/A' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/400e89eb46ead8e9c9e40f123fd5e590.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'source', 10 | size: 100 11 | }, 12 | dest: { 13 | index: 'dest', 14 | routing: '=cat' 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/527324766814561b75aaee853ede49a7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | tags: { 10 | terms: { 11 | field: 'tags', 12 | min_doc_count: 10 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/5d32279dcd52b22d9e1178a02a3ad957.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | routing: 'kimchy', 9 | body: { 10 | user: 'kimchy', 11 | post_date: '2009-11-15T14:12:12', 12 | message: 'trying out Elasticsearch' 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/625dc94df1f9affb49a082fd99d41620.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | routing: 'kimchy', 9 | body: { 10 | user: 'kimchy', 11 | post_date: '2009-11-15T14:12:12', 12 | message: 'trying out Elasticsearch' 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/67ceac4bf2d9ac7cc500390544cdcb41.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | range: { 10 | timestamp: { 11 | gte: 'now-1d/d', 12 | lt: 'now/d' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/774d715155cd13713e6e327adf6ce328.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | tags: { 10 | terms: { 11 | field: 'tags', 12 | execution_hint: 'map' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/7e52bec09624cf6c0de5d13f2bfad5a5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | scroll: '1m', 9 | body: { 10 | size: 100, 11 | query: { 12 | match: { 13 | title: 'elasticsearch' 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/a7c15fe6b5779c84ce9a34bf4b2a7ab7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putMapping({ 7 | index: 'my_index', 8 | body: { 9 | properties: { 10 | my_field: { 11 | type: 'text', 12 | fielddata: true 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/ad6ea0c1e46712aa1fd6d3bfa0ec979e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | query: '(new york city) OR (big apple)', 11 | default_field: 'content' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/cb01106bf524df5e0501d4c655c1aa7b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | slices: '5', 8 | refresh: true, 9 | body: { 10 | source: { 11 | index: 'twitter' 12 | }, 13 | dest: { 14 | index: 'new_twitter' 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/17de0020b228df961ad3c6b06233c948.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putMapping({ 7 | index: 'my_index', 8 | body: { 9 | properties: { 10 | user_id: { 11 | type: 'keyword', 12 | ignore_above: 100 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/1f336ecc62480c1d56351cc2f82d0d08.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | id: '1', 9 | version: '2', 10 | version_type: 'external', 11 | body: { 12 | message: 'elasticsearch now has versioning support, double cool!' 13 | } 14 | }) 15 | console.log(response) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/23ab0f1023b1b2cd5cdf2a8f9ccfd57b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'test1', 8 | body: { 9 | mappings: { 10 | properties: { 11 | user: { 12 | type: 'keyword' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/4acf902c2598b2558f34f20c1744c433.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.indices.refresh() 7 | console.log(response0) 8 | 9 | const response1 = await client.search({ 10 | index: 'twitter', 11 | size: '0', 12 | q: 'extra:test', 13 | filter_path: 'hits.total' 14 | }) 15 | console.log(response1) 16 | ---- 17 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/506844befdc5691d835771bcbb1c1a60.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | query: { 10 | match_all: {} 11 | }, 12 | sort: [ 13 | { 14 | account_number: 'asc' 15 | } 16 | ] 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/71ba9033107882f61cdc3b32fc73568d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putMapping({ 7 | index: 'my-index', 8 | body: { 9 | properties: { 10 | 'employee-id': { 11 | type: 'keyword', 12 | index: false 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/a116949e446f34dc25ae57d4b703d0c1.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | range: { 10 | age: { 11 | gte: 10, 12 | lte: 20, 13 | boost: 2 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/b4392116f2cc57ce8064ccbad30318d5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'test1', 12 | alias: 'alias1' 13 | } 14 | } 15 | ] 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/bd5918ab903c0889bb1f09c8c2466e43.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'users', 8 | body: { 9 | mappings: { 10 | properties: { 11 | user_id: { 12 | type: 'long' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/c849c6c8f8659dbb93e1c14356f74e37.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | city: { 12 | type: 'text' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/e5d2172b524332196cac0f031c043659.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'twitter', 8 | body: { 9 | settings: { 10 | index: { 11 | number_of_shards: 3, 12 | number_of_replicas: 2 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/2891aa10ee9d474780adf94d5607f2db.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'index_long,index_double', 8 | body: { 9 | sort: [ 10 | { 11 | field: { 12 | numeric_type: 'double' 13 | } 14 | } 15 | ] 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/2a1de18774f9c68cafa169847832b2bc.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | full_text: { 12 | type: 'text' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/3653567181f43a5f64c74f934aa821c2.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | remove: { 11 | index: 'test1', 12 | alias: 'alias1' 13 | } 14 | } 15 | ] 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/3b04cc894e6a47d57983484010feac0c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.get({ 7 | index: 'metricbeat-2016.05.30-1', 8 | id: '1' 9 | }) 10 | console.log(response0) 11 | 12 | const response1 = await client.get({ 13 | index: 'metricbeat-2016.05.31-1', 14 | id: '1' 15 | }) 16 | console.log(response1) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/43af86de5e49aa06070092fffc138208.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | bool: { 10 | must_not: { 11 | exists: { 12 | field: 'user' 13 | } 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/46c4b0dfb674825f9579203d41e7f404.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | tags: { 12 | type: 'keyword' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'index_long,index_double', 8 | body: { 9 | sort: [ 10 | { 11 | field: { 12 | numeric_type: 'date_nanos' 13 | } 14 | } 15 | ] 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/6138d6919f3cbaaf61e1092f817d295c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match: { 10 | message: { 11 | query: 'this is a test', 12 | operator: 'and' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/645c4c6e209719d3a4d25b1a629cb23b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | function_score: { 10 | random_score: { 11 | seed: 10, 12 | field: '_seq_no' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/6f097c298a7abf4c032c4314920c49c8.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: [ 10 | 'twitter', 11 | 'blog' 12 | ] 13 | }, 14 | dest: { 15 | index: 'all_together' 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/9e56d79ad9a02b642c361f0b85dd95d7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | color: { 12 | type: 'keyword' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/afc29b61c532cf683f749baf013e7bfe.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putMapping({ 7 | index: 'my_index', 8 | body: { 9 | properties: { 10 | user_id: { 11 | type: 'alias', 12 | path: 'user_identifier' 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/c32a3f8071d87f0a3f5a78e07fe7a669.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.deleteByQuery({ 7 | index: 'twitter', 8 | routing: '1', 9 | body: { 10 | query: { 11 | range: { 12 | age: { 13 | gte: 10 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/c612d93e7f682a0d731e385edf9f5d56.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | obj1: { 12 | type: 'nested' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/d3016e4e8025362ad9a05ee86bb2061f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'twitter', 12 | alias: 'alias1' 13 | } 14 | } 15 | ] 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/f4a1008b3f9baa67bb03ce9ef5ab4cb4.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'index_double', 8 | body: { 9 | mappings: { 10 | properties: { 11 | field: { 12 | type: 'date' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/f6b5032bf27c2445d28845be0d413970.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'index_long', 8 | body: { 9 | mappings: { 10 | properties: { 11 | field: { 12 | type: 'long' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/f70a54cd9a9f4811bf962e469f2ca2ea.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | bool: { 10 | filter: { 11 | term: { 12 | status: 'active' 13 | } 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/0c4ad860a485fe53d8140ad3ccd11dcf.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | terms: { 10 | user: [ 11 | 'kimchy', 12 | 'elasticsearch' 13 | ], 14 | boost: 1 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/28aad2c5942bfb221c2bf1bbdc01658e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | fields: [ 11 | 'city.*' 12 | ], 13 | query: 'this AND that OR thus' 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/5043b83a89091fa00edb341ddf7ba370.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match: { 10 | message: { 11 | query: 'this is a testt', 12 | fuzziness: 'AUTO' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/6799d132c1c7ca3970763acde2337ef9.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'test*', 12 | alias: 'all_test_indices' 13 | } 14 | } 15 | ] 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/734c2e2a1e45b84f1e4e65b51356fcd7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'new_users', 8 | body: { 9 | mappings: { 10 | properties: { 11 | user_id: { 12 | type: 'keyword' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/7477671958734843dd67cf0b8e6c7515.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'index_long', 8 | body: { 9 | mappings: { 10 | properties: { 11 | field: { 12 | type: 'date_nanos' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/abf329ebefaf58acd4ee30e685731499.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'index_double', 8 | body: { 9 | mappings: { 10 | properties: { 11 | field: { 12 | type: 'double' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/b918d6b798da673a33e49b94f61dcdc0.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | id: '1', 9 | timeout: '5m', 10 | body: { 11 | user: 'kimchy', 12 | post_date: '2009-11-15T14:12:12', 13 | message: 'trying out Elasticsearch' 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/d718b63cf1b6591a1d59a0cf4fd995eb.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'twitter', 8 | id: '1', 9 | op_type: 'create', 10 | body: { 11 | user: 'kimchy', 12 | post_date: '2009-11-15T14:12:12', 13 | message: 'trying out Elasticsearch' 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/162b5b693b713f0bfab1209d59443c46.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | constant_score: { 10 | filter: { 11 | term: { 12 | status: 'active' 13 | } 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/5dd695679b5141d9142d3d30ba8d300a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | types_count: { 12 | value_count: { 13 | field: 'type' 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/6bf63f2ec6ba55fcaf1092f48212bf25.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | user_identifier: { 12 | type: 'keyword' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/6a1702dd50690cae833572e48a0ddf25.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'Will Smith', 11 | fields: [ 12 | 'title', 13 | '*_name' 14 | ] 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/72231b7debac60c95b9869a97dafda3a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match_phrase: { 10 | message: { 11 | query: 'this is a test', 12 | analyzer: 'my_analyzer' 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/feefeb68144002fd1fff57b77b95b85e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | size: 0, 10 | aggs: { 11 | group_by_state: { 12 | terms: { 13 | field: 'state.keyword' 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/7f56755fb6c42f7e6203339a6d0cb6e6.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match: { 10 | message: { 11 | query: 'ny city', 12 | auto_generate_synonyms_phrase_query: false 13 | } 14 | } 15 | } 16 | } 17 | }) 18 | console.log(response) 19 | ---- 20 | 21 | -------------------------------------------------------------------------------- /docs/doc_examples/f2d68493abd3ca430bd03a7f7f8d18f9.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | fields: [ 11 | 'content', 12 | 'name' 13 | ], 14 | query: 'this AND that' 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/f32f0c19b42de3b87dd764fe4ca17e7c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | default_field: 'title', 11 | query: 'ny city', 12 | auto_generate_synonyms_phrase_query: false 13 | } 14 | } 15 | } 16 | }) 17 | console.log(response) 18 | ---- 19 | 20 | -------------------------------------------------------------------------------- /docs/doc_examples/0afaf1cad692e6201aa574c8feb6e622.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | tags: { 10 | terms: { 11 | field: 'tags', 12 | include: '.*sport.*', 13 | exclude: 'water_.*' 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/14701dcc0cca9665fce2aace0cb62af7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | size: '0', 9 | filter_path: 'hits.total', 10 | body: { 11 | query: { 12 | range: { 13 | likes: { 14 | lt: 10 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/53b908c3432118c5a6e460f74d32006b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'this is a test', 11 | fields: [ 12 | 'subject', 13 | 'message' 14 | ] 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/9166cf38427d5cde5d2ec12a2012b669.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putTemplate({ 7 | name: 'template_1', 8 | body: { 9 | index_patterns: [ 10 | '*' 11 | ], 12 | order: 0, 13 | settings: { 14 | number_of_shards: 1 15 | }, 16 | version: 123 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/a5a7050fb9dcb9574e081957ade28617.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.deleteByQuery({ 7 | index: 'twitter', 8 | refresh: true, 9 | slices: '5', 10 | body: { 11 | query: { 12 | range: { 13 | likes: { 14 | lt: 10 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/bc1ad5cc6d3eab98e3ce01f209ba7094.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'test', 12 | alias: 'alias1', 13 | routing: '1' 14 | } 15 | } 16 | ] 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/d31062ff8c015387889fed4ad86fd914.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | wildcard: { 10 | user: { 11 | value: 'ki*y', 12 | boost: 1, 13 | rewrite: 'constant_score' 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/e30ea6e3823a139d7693d8cce1920a06.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'this is a test', 11 | fields: [ 12 | 'subject^3', 13 | 'message' 14 | ] 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/e9c2e15b36372d5281c879d336322b6c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'twitter', 10 | _source: [ 11 | 'user', 12 | '_doc' 13 | ] 14 | }, 15 | dest: { 16 | index: 'new_twitter' 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 💬 Questions / Help 3 | about: If you have questions, please check our Gitter or Help repo 4 | --- 5 | 6 | ## 💬 Questions and Help 7 | 8 | ### Please note that this issue tracker is not a help forum and this issue may be closed. 9 | 10 | It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should [search](https://github.com/elastic/elasticsearch-js/issues) at first before submitting a new one. 11 | -------------------------------------------------------------------------------- /docs/doc_examples/4b90feb9d5d3dbfce424dac0341320b7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | query: { 10 | match_all: {} 11 | }, 12 | sort: [ 13 | { 14 | account_number: 'asc' 15 | } 16 | ], 17 | from: 10, 18 | size: 10 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/58b5003c0a53a39bf509aa3797aad471.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | fields: [ 11 | 'content', 12 | 'name.*^5' 13 | ], 14 | query: 'this AND that OR thus' 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/6a4679531e64c492fce16dc12de6dcb0.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | genres: { 10 | terms: { 11 | field: 'genre', 12 | order: { 13 | _count: 'asc' 14 | } 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/93f1bdd72e79827dcf9a34efa02fd977.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | genres: { 10 | terms: { 11 | field: 'genre', 12 | order: { 13 | _key: 'asc' 14 | } 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/a34d70d7022eb4ba48909d440c80390f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: '%3Clogstash-%7Bnow%2Fd-2d%7D%3E%2C%3Clogstash-%7Bnow%2Fd-1d%7D%3E%2C%3Clogstash-%7Bnow%2Fd%7D%3E', 8 | body: { 9 | query: { 10 | match: { 11 | test: 'data' 12 | } 13 | } 14 | } 15 | }) 16 | console.log(response) 17 | ---- 18 | 19 | -------------------------------------------------------------------------------- /docs/doc_examples/1216f8f7367df3aa823012cef310c08a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'test' 10 | }, 11 | dest: { 12 | index: 'test2' 13 | }, 14 | script: { 15 | source: 'ctx._source.tag = ctx._source.remove("flag")' 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/1f6fe6833686e38c3711c6f2aa00a078.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | user_id: { 12 | type: 'keyword', 13 | ignore_above: 20 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/35e8da9410b8432cf4095f2541ad7b1d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | products: { 10 | terms: { 11 | field: 'product', 12 | size: 5, 13 | show_term_doc_count_error: true 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/5c2f486c27bd5346e512265f93375d16.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | range: { 10 | timestamp: { 11 | time_zone: '+01:00', 12 | gte: '2020-01-01T00:00:00', 13 | lte: 'now' 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/60ee33f3acfdd0fe6f288ac77312c780.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | fields: [ 11 | 'title' 12 | ], 13 | query: 'this that thus', 14 | minimum_should_match: 2 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/7f465b7e8ed42df6c42251b4481e699e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | date: { 12 | type: 'date', 13 | format: 'yyyy-MM-dd' 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/4cd246e5c4c035a2cd4081ae9a3d54e5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | script: { 11 | source: 'ctx._source.tags.add(params.tag)', 12 | lang: 'painless', 13 | params: { 14 | tag: 'blue' 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/96de5703ba0bd43fd4ac239ec5408542.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | script: { 11 | source: 'ctx._source.counter += params.count', 12 | lang: 'painless', 13 | params: { 14 | count: 4 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/0ac9916f47a2483b89c1416684af322a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | match: { 10 | message: { 11 | query: 'to be or not to be', 12 | operator: 'and', 13 | zero_terms_query: 'all' 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/0bbd30b9be3e54ff3028b9f4459634d2.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putMapping({ 7 | index: 'my_index', 8 | body: { 9 | properties: { 10 | name: { 11 | properties: { 12 | last: { 13 | type: 'text' 14 | } 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/ef0f4fa4272c47ff62fb7b422cf975e7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | sort: [ 9 | { 10 | price: { 11 | missing: '_last' 12 | } 13 | } 14 | ], 15 | query: { 16 | term: { 17 | product: 'chocolate' 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/033778305d52746f5ce0a2a922c8e521.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | genres: { 10 | terms: { 11 | script: { 12 | source: "doc['genre'].value", 13 | lang: 'painless' 14 | } 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/2bb2339ac055337abf753bddb7771659.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | sales_over_time: { 12 | date_histogram: { 13 | field: 'date', 14 | fixed_interval: '2w' 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/2fd69fb0538e4f36ac69a8b8f8bf5ae8.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.updateByQuery({ 7 | index: 'twitter', 8 | body: { 9 | script: { 10 | source: 'ctx._source.likes++', 11 | lang: 'painless' 12 | }, 13 | query: { 14 | term: { 15 | user: 'kimchy' 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/764f9884b370cbdc82a1c5c42ed40ff3.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'twitter', 10 | query: { 11 | term: { 12 | user: 'kimchy' 13 | } 14 | } 15 | }, 16 | dest: { 17 | index: 'new_twitter' 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/899eef71a67a1b2aa11a2166ec7f48f1.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | sort: [ 9 | { 10 | price: { 11 | unmapped_type: 'long' 12 | } 13 | } 14 | ], 15 | query: { 16 | term: { 17 | product: 'chocolate' 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/09ecba5814d71e4c44468575eada9878.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | sales_over_time: { 12 | date_histogram: { 13 | field: 'date', 14 | fixed_interval: '30d' 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/68721288dc9ad8aa1b55099b4d303051.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'quick brown f', 11 | type: 'bool_prefix', 12 | fields: [ 13 | 'subject', 14 | 'message' 15 | ] 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/73e5c88ad1488b213fb278ee1cb42289.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | sales_over_time: { 12 | date_histogram: { 13 | field: 'date', 14 | calendar_interval: '2d' 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/0e118857b815b62118a30c042f079db1.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'quick brown f', 11 | type: 'phrase_prefix', 12 | fields: [ 13 | 'subject', 14 | 'message' 15 | ] 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/5f210f74725ea0c9265190346edfa246.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | indices: [ 12 | 'test1', 13 | 'test2' 14 | ], 15 | alias: 'alias1' 16 | } 17 | } 18 | ] 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/a2a25aad1fea9a541b52ac613c78fb64.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | fields: [ 11 | 'content', 12 | 'name^5' 13 | ], 14 | query: 'this AND that OR thus', 15 | tie_breaker: 0 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/a42f33e15b0995bb4b6058659bfdea85.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | function_score: { 10 | query: { 11 | match_all: {} 12 | }, 13 | boost: '5', 14 | random_score: {}, 15 | boost_mode: 'multiply' 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/b789292f9cf63ce912e058c46d90ce20.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | sales_over_time: { 12 | date_histogram: { 13 | field: 'date', 14 | calendar_interval: 'month' 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/be1bd47393646ac6bbee177d1cdb7738.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | fields: [ 11 | 'title', 12 | 'content' 13 | ], 14 | query: 'this that thus', 15 | minimum_should_match: 2 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/d1bcf2eb63a462bfdcf01a68e68d5b4a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'my_index', 8 | pretty: true, 9 | body: { 10 | query: { 11 | terms: { 12 | color: { 13 | index: 'my_index', 14 | id: '2', 15 | path: 'color' 16 | } 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/dfef545b1e2c247bafd1347e8e807ac1.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'test', 8 | body: { 9 | settings: { 10 | number_of_shards: 1 11 | }, 12 | mappings: { 13 | properties: { 14 | field1: { 15 | type: 'text' 16 | } 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /.ci/jobs/elastic+elasticsearch-js+5.x.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - job: 3 | name: elastic+elasticsearch-js+5.x 4 | display-name: 'elastic / elasticsearch-js # 5.x' 5 | description: Testing the elasticsearch-js 5.x branch. 6 | junit_results: "*-junit.xml" 7 | parameters: 8 | - string: 9 | name: branch_specifier 10 | default: refs/heads/5.x 11 | description: the Git branch specifier to build (<branchName>, <tagName>, 12 | <commitId>, etc.) 13 | triggers: 14 | - github 15 | - timed: '@weekly' 16 | -------------------------------------------------------------------------------- /docs/doc_examples/3722cb3705b6bc7f486969deace3dd83.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | type_count: { 12 | value_count: { 13 | script: { 14 | source: "doc['type'].value" 15 | } 16 | } 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/8eaf4d5dd4ab1335deefa7749fdbbcc3.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | function_score: { 10 | field_value_factor: { 11 | field: 'likes', 12 | factor: 1.2, 13 | modifier: 'sqrt', 14 | missing: 1 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/fa88f6f5a7d728ec4f1d05244228cb09.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | bool: { 10 | must: { 11 | match_all: {} 12 | }, 13 | filter: { 14 | term: { 15 | status: 'active' 16 | } 17 | } 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/fdcaba9547180439ff4b6275034a5170.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | scroll: '1m', 9 | body: { 10 | slice: { 11 | field: 'date', 12 | id: 0, 13 | max: 10 14 | }, 15 | query: { 16 | match: { 17 | title: 'elasticsearch' 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/fdd38f0d248385a444c777e7acd97846.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | fields: [ 11 | 'title', 12 | 'content' 13 | ], 14 | query: 'this OR that OR thus', 15 | minimum_should_match: 2 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /.ci/jobs/elastic+elasticsearch-js+6.x.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - job: 3 | name: elastic+elasticsearch-js+6.x 4 | display-name: 'elastic / elasticsearch-js # 6.x' 5 | description: Testing the elasticsearch-js 6.x branch. 6 | junit_results: "*-junit.xml" 7 | parameters: 8 | - string: 9 | name: branch_specifier 10 | default: refs/heads/6.x 11 | description: the Git branch specifier to build (<branchName>, <tagName>, 12 | <commitId>, etc.) 13 | triggers: 14 | - github 15 | - timed: 'H */12 * * *' 16 | -------------------------------------------------------------------------------- /.ci/jobs/elastic+elasticsearch-js+7.9.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - job: 3 | name: elastic+elasticsearch-js+7.9 4 | display-name: 'elastic / elasticsearch-js # 7.9' 5 | description: Testing the elasticsearch-js 7.9 branch. 6 | junit_results: "*-junit.xml" 7 | parameters: 8 | - string: 9 | name: branch_specifier 10 | default: refs/heads/7.9 11 | description: the Git branch specifier to build (<branchName>, <tagName>, 12 | <commitId>, etc.) 13 | triggers: 14 | - github 15 | - timed: 'H */12 * * *' 16 | -------------------------------------------------------------------------------- /.ci/jobs/elastic+elasticsearch-js+7.x.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - job: 3 | name: elastic+elasticsearch-js+7.x 4 | display-name: 'elastic / elasticsearch-js # 7.x' 5 | description: Testing the elasticsearch-js 7.x branch. 6 | junit_results: "*-junit.xml" 7 | parameters: 8 | - string: 9 | name: branch_specifier 10 | default: refs/heads/7.x 11 | description: the Git branch specifier to build (<branchName>, <tagName>, 12 | <commitId>, etc.) 13 | triggers: 14 | - github 15 | - timed: 'H */12 * * *' 16 | -------------------------------------------------------------------------------- /docs/doc_examples/5f3a3eefeefe6fa85ec49d499212d245.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putMapping({ 7 | index: 'my_index', 8 | body: { 9 | properties: { 10 | city: { 11 | type: 'text', 12 | fields: { 13 | raw: { 14 | type: 'keyword' 15 | } 16 | } 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/78c96113ae4ed0054e581b17542528a7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'source', 10 | query: { 11 | match: { 12 | company: 'cat' 13 | } 14 | } 15 | }, 16 | dest: { 17 | index: 'dest', 18 | routing: '=cat' 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/e2a042c629429855c3bcaefffb26b7fa.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | date: { 12 | type: 'date', 13 | format: 'yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis' 14 | } 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/fa0f4485cd48f986b7ae8cbb24e331c4.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'test', 12 | alias: 'alias2', 13 | search_routing: '1,2', 14 | index_routing: '2' 15 | } 16 | } 17 | ] 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/618d5f3d35921d8cb7e9ccfbe9a4c3e3.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | regexp: { 10 | user: { 11 | value: 'k.*y', 12 | flags: 'ALL', 13 | max_determinized_states: 10000, 14 | rewrite: 'constant_score' 15 | } 16 | } 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/a49169b4622918992411fab4ec48191b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | genres: { 10 | terms: { 11 | field: 'genre', 12 | script: { 13 | source: "'Genre: ' +_value", 14 | lang: 'painless' 15 | } 16 | } 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /.ci/jobs/elastic+elasticsearch-js+master.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - job: 3 | name: elastic+elasticsearch-js+master 4 | display-name: 'elastic / elasticsearch-js # master' 5 | description: Testing the elasticsearch-js master branch. 6 | junit_results: "*-junit.xml" 7 | parameters: 8 | - string: 9 | name: branch_specifier 10 | default: refs/heads/master 11 | description: the Git branch specifier to build (<branchName>, <tagName>, 12 | <commitId>, etc.) 13 | triggers: 14 | - github 15 | - timed: 'H */12 * * *' 16 | -------------------------------------------------------------------------------- /docs/doc_examples/4646764bf09911fee7d58630c72d3137.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | genres: { 10 | terms: { 11 | script: { 12 | id: 'my_script', 13 | params: { 14 | field: 'genre' 15 | } 16 | } 17 | } 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/5da6efd5b038ada64c9e853c88c1ec47.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'brown fox', 11 | type: 'best_fields', 12 | fields: [ 13 | 'subject', 14 | 'message' 15 | ], 16 | tie_breaker: 0.3 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/8baccd8688a6bad1749b8935f9601ea4.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.index({ 7 | index: 'my_index', 8 | id: '1', 9 | body: { 10 | group: 'fans', 11 | user: [ 12 | { 13 | first: 'John', 14 | last: 'Smith' 15 | }, 16 | { 17 | first: 'Alice', 18 | last: 'White' 19 | } 20 | ] 21 | } 22 | }) 23 | console.log(response) 24 | ---- 25 | 26 | -------------------------------------------------------------------------------- /docs/doc_examples/8de3206f80e18185a5ad6481f4c2ee07.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'my_index', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | by_day: { 12 | date_histogram: { 13 | field: 'date', 14 | calendar_interval: 'day', 15 | time_zone: '-01:00' 16 | } 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/047266b0d20fdb62ebc72d51952c8f6d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'Will Smith', 11 | type: 'cross_fields', 12 | fields: [ 13 | 'first_name', 14 | 'last_name' 15 | ], 16 | operator: 'and' 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/0989cc65d8924f666ce3eb0820d2d244.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.index({ 7 | index: 'users', 8 | refresh: 'wait_for', 9 | body: { 10 | user_id: 12345 11 | } 12 | }) 13 | console.log(response0) 14 | 15 | const response1 = await client.index({ 16 | index: 'users', 17 | refresh: 'wait_for', 18 | body: { 19 | user_id: 12346 20 | } 21 | }) 22 | console.log(response1) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/0a958e486ede3f519d48431ab689eded.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | script: { 11 | source: 'ctx._source.counter += params.count', 12 | lang: 'painless', 13 | params: { 14 | count: 4 15 | } 16 | }, 17 | upsert: { 18 | counter: 1 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/39a6a038c4b551022afe83de0523634e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | sale_date: { 12 | date_histogram: { 13 | field: 'date', 14 | calendar_interval: 'year', 15 | missing: '2000/01/01' 16 | } 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/4d56b179242fed59e3d6476f817b6055.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'test', 8 | body: { 9 | aliases: { 10 | alias_1: {}, 11 | alias_2: { 12 | filter: { 13 | term: { 14 | user: 'kimchy' 15 | } 16 | }, 17 | routing: 'kimchy' 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/8a355eb25d2a01ba62dc1a22dd46f46f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | sales_over_time: { 12 | date_histogram: { 13 | field: 'date', 14 | calendar_interval: '1M', 15 | format: 'yyyy-MM-dd' 16 | } 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/d9474f66970c6955e24b17c7447e7b5f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | name: { 12 | properties: { 13 | first: { 14 | type: 'text' 15 | } 16 | } 17 | } 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/e270f3f721a5712cd11a5ca03554f5b0.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'Will Smith', 11 | type: 'best_fields', 12 | fields: [ 13 | 'first_name', 14 | 'last_name' 15 | ], 16 | operator: 'and' 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/7b908b1189f076942de8cd497ff1fa59.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'quick brown fox', 11 | type: 'most_fields', 12 | fields: [ 13 | 'title', 14 | 'title.original', 15 | 'title.shingles' 16 | ] 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/98aeb275f829b5f7b8eb2147701565ff.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | script: { 11 | source: "if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'none' }", 12 | lang: 'painless', 13 | params: { 14 | tag: 'green' 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/179f0a3e84ff4bbac18787a018eabf89.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'Jon', 11 | type: 'cross_fields', 12 | analyzer: 'standard', 13 | fields: [ 14 | 'first', 15 | 'last', 16 | '*.edge' 17 | ] 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/6f21a878fee3b43c5332b81aaddbeac7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | query_string: { 10 | fields: [ 11 | 'title', 12 | 'content' 13 | ], 14 | query: 'this OR that OR thus', 15 | type: 'cross_fields', 16 | minimum_should_match: 2 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/ad0dcbc7fc619e952c8825b8f307b7b2.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | multi_match: { 10 | query: 'Jon', 11 | type: 'cross_fields', 12 | fields: [ 13 | 'first', 14 | 'first.edge', 15 | 'last', 16 | 'last.edge' 17 | ] 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/ec27afee074001b0e4e393611010842b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | function_score: { 10 | gauss: { 11 | date: { 12 | origin: '2013-09-17', 13 | scale: '10d', 14 | offset: '5d', 15 | decay: 0.5 16 | } 17 | } 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/index.asciidoc: -------------------------------------------------------------------------------- 1 | = Elasticsearch Node.js client 2 | 3 | :branch: master 4 | include::{asciidoc-dir}/../../shared/attributes.asciidoc[] 5 | 6 | include::introduction.asciidoc[] 7 | include::usage.asciidoc[] 8 | include::configuration.asciidoc[] 9 | include::reference.asciidoc[] 10 | include::breaking-changes.asciidoc[] 11 | include::authentication.asciidoc[] 12 | include::observability.asciidoc[] 13 | include::child.asciidoc[] 14 | include::extend.asciidoc[] 15 | include::helpers.asciidoc[] 16 | include::typescript.asciidoc[] 17 | include::testing.asciidoc[] 18 | include::examples/index.asciidoc[] 19 | -------------------------------------------------------------------------------- /docs/doc_examples/1bc731a4df952228af6dfa6b48627332.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | max_docs: 10, 9 | source: { 10 | index: 'twitter', 11 | query: { 12 | function_score: { 13 | random_score: {}, 14 | min_score: 0.9 15 | } 16 | } 17 | }, 18 | dest: { 19 | index: 'random_twitter' 20 | } 21 | } 22 | }) 23 | console.log(response) 24 | ---- 25 | 26 | -------------------------------------------------------------------------------- /docs/doc_examples/3e573bfabe00f8bfb8bb69aa5820768e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.indices.refresh() 7 | console.log(response0) 8 | 9 | const response1 = await client.search({ 10 | index: 'twitter', 11 | size: '0', 12 | filter_path: 'hits.total', 13 | body: { 14 | query: { 15 | range: { 16 | likes: { 17 | lt: 10 18 | } 19 | } 20 | } 21 | } 22 | }) 23 | console.log(response1) 24 | ---- 25 | 26 | -------------------------------------------------------------------------------- /docs/doc_examples/6faf10a73f7d5fffbcb037bdb2cbaff8.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | dayOfWeek: { 12 | terms: { 13 | script: { 14 | lang: 'painless', 15 | source: "doc['date'].value.dayOfWeekEnum.value" 16 | } 17 | } 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/ac544eb247a29ca42aab13826ca88561.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'test', 8 | id: '1', 9 | body: { 10 | script: { 11 | source: 'if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }', 12 | lang: 'painless', 13 | params: { 14 | tag: 'blue' 15 | } 16 | } 17 | } 18 | }) 19 | console.log(response) 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /docs/doc_examples/d50a3c64890f88af32c6d4ef4899d82a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | sort: [ 9 | { 10 | _geo_distance: { 11 | 'pin.location': '40,-70', 12 | order: 'asc', 13 | unit: 'km' 14 | } 15 | } 16 | ], 17 | query: { 18 | term: { 19 | user: 'kimchy' 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/5275842787967b6db876025f4a1c6942.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | suggest: { 9 | text: 'tring out Elasticsearch', 10 | 'my-suggest-1': { 11 | term: { 12 | field: 'message' 13 | } 14 | }, 15 | 'my-suggest-2': { 16 | term: { 17 | field: 'user' 18 | } 19 | } 20 | } 21 | } 22 | }) 23 | console.log(response) 24 | ---- 25 | 26 | -------------------------------------------------------------------------------- /docs/doc_examples/7cf71671859be7c1ecf673396db377cd.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'test1', 12 | alias: 'alias2', 13 | filter: { 14 | term: { 15 | user: 'kimchy' 16 | } 17 | } 18 | } 19 | } 20 | ] 21 | } 22 | }) 23 | console.log(response) 24 | ---- 25 | 26 | -------------------------------------------------------------------------------- /docs/doc_examples/9524a9b7373fa4eb2905183b0e806962.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | sales_over_time: { 12 | date_histogram: { 13 | field: 'date', 14 | calendar_interval: '1M', 15 | format: 'yyyy-MM-dd', 16 | keyed: true 17 | } 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response) 23 | ---- 24 | 25 | -------------------------------------------------------------------------------- /docs/doc_examples/a1db5c822745fe167e9ef854dca3d129.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | sort: [ 9 | { 10 | _geo_distance: { 11 | 'pin.location': 'drm3btev3e86', 12 | order: 'asc', 13 | unit: 'km' 14 | } 15 | } 16 | ], 17 | query: { 18 | term: { 19 | user: 'kimchy' 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/f0e21e03a07c8fa0209b0aafdb3791e6.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'test1', 12 | alias: 'alias1' 13 | } 14 | }, 15 | { 16 | add: { 17 | index: 'test2', 18 | alias: 'alias1' 19 | } 20 | } 21 | ] 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/913770050ebbf3b9b549a899bc11060a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'twitter', 8 | body: { 9 | mappings: { 10 | properties: { 11 | counter: { 12 | type: 'integer', 13 | store: false 14 | }, 15 | tags: { 16 | type: 'keyword', 17 | store: true 18 | } 19 | } 20 | } 21 | } 22 | }) 23 | console.log(response) 24 | ---- 25 | 26 | -------------------------------------------------------------------------------- /docs/doc_examples/af3fb9fa5691a7b37a6dc2a69ff66e64.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | remove: { 11 | index: 'test1', 12 | alias: 'alias1' 13 | } 14 | }, 15 | { 16 | add: { 17 | index: 'test1', 18 | alias: 'alias2' 19 | } 20 | } 21 | ] 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/b94cee0f74f57742b3948f9b784dfdd4.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.clearScroll({ 7 | scroll_id: 'DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==,DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB' 8 | }) 9 | console.log(response) 10 | ---- 11 | 12 | -------------------------------------------------------------------------------- /docs/doc_examples/ef9111c1648d7820925f12e07d1346c5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | my_field: { 12 | type: 'text', 13 | fields: { 14 | keyword: { 15 | type: 'keyword' 16 | } 17 | } 18 | } 19 | } 20 | } 21 | } 22 | }) 23 | console.log(response) 24 | ---- 25 | 26 | -------------------------------------------------------------------------------- /scripts/wait-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | TEST_ES_SERVER=${TEST_ES_SERVER:-"http://localhost:9200"} 4 | 5 | attempt_counter=0 6 | max_attempts=5 7 | url="${TEST_ES_SERVER}/_cluster/health?wait_for_status=green&timeout=50s" 8 | 9 | echo "Waiting for Elasticsearch..." 10 | while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' --max-time 55 "$url")" != "200" ]]; do 11 | if [ ${attempt_counter} -eq ${max_attempts} ];then 12 | echo "\nCouldn't connect to Elasticsearch" 13 | exit 1 14 | fi 15 | 16 | printf '.' 17 | attempt_counter=$(($attempt_counter+1)) 18 | sleep 5 19 | done 20 | 21 | echo "\nReady" 22 | -------------------------------------------------------------------------------- /docs/doc_examples/d8b2a88b5eca99d3691ad3cd40266736.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my-index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | age: { 12 | type: 'integer' 13 | }, 14 | email: { 15 | type: 'keyword' 16 | }, 17 | name: { 18 | type: 'text' 19 | } 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /test/unit/esm/index.test.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const t = require('tap') 4 | const semver = require('semver') 5 | 6 | if (semver.lt(process.versions.node, '12.17.0')) { 7 | t.skip('Skip because Node version < 12.17.0') 8 | t.end() 9 | } else { 10 | // Node v8 throw a `SyntaxError: Unexpected token import` 11 | // even if this branch is never touch in the code, 12 | // by using `eval` we can avoid this issue. 13 | // eslint-disable-next-line 14 | new Function('module', 'return import(module)')('./index.mjs').catch((err) => { 15 | process.nextTick(() => { 16 | throw err 17 | }) 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /docs/doc_examples/213ab768f1b6a895e09403a0880e259a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | types_count: { 12 | value_count: { 13 | script: { 14 | id: 'my_script', 15 | params: { 16 | field: 'type' 17 | } 18 | } 19 | } 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/973a3ff47fc4ce036ecd9bd363fef9f7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'metricbeat-*' 10 | }, 11 | dest: { 12 | index: 'metricbeat' 13 | }, 14 | script: { 15 | lang: 'painless', 16 | source: "ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'" 17 | } 18 | } 19 | }) 20 | console.log(response) 21 | ---- 22 | 23 | -------------------------------------------------------------------------------- /docs/doc_examples/64b9baa6d7556b960b29698f3383aa31.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | remote: { 10 | host: 'http://otherhost:9200' 11 | }, 12 | index: 'source', 13 | size: 10, 14 | query: { 15 | match: { 16 | test: 'data' 17 | } 18 | } 19 | }, 20 | dest: { 21 | index: 'dest' 22 | } 23 | } 24 | }) 25 | console.log(response) 26 | ---- 27 | 28 | -------------------------------------------------------------------------------- /docs/doc_examples/8871b8fcb6de4f0c7dff22798fb10fb7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'twitter' 10 | }, 11 | dest: { 12 | index: 'new_twitter', 13 | version_type: 'external' 14 | }, 15 | script: { 16 | source: "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}", 17 | lang: 'painless' 18 | } 19 | } 20 | }) 21 | console.log(response) 22 | ---- 23 | 24 | -------------------------------------------------------------------------------- /docs/doc_examples/97babc8d19ef0866774576716eb6d19e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.updateByQuery({ 7 | index: 'test', 8 | refresh: true, 9 | conflicts: 'proceed' 10 | }) 11 | console.log(response0) 12 | 13 | const response1 = await client.search({ 14 | index: 'test', 15 | filter_path: 'hits.total', 16 | body: { 17 | query: { 18 | match: { 19 | flag: 'foo' 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response1) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/2533e4b36ae837eaecda08407ecb6383.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | suggest: { 9 | 'my-suggest-1': { 10 | text: 'tring out Elasticsearch', 11 | term: { 12 | field: 'message' 13 | } 14 | }, 15 | 'my-suggest-2': { 16 | text: 'kmichy', 17 | term: { 18 | field: 'user' 19 | } 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/626f8c4b3e2cd3d9beaa63a7f5799d7a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | body: { 9 | query: { 10 | match: { 11 | message: 'tring out Elasticsearch' 12 | } 13 | }, 14 | suggest: { 15 | 'my-suggestion': { 16 | text: 'tring out Elasticsearch', 17 | term: { 18 | field: 'message' 19 | } 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/f6d6889667f56b8f49d2858070571a6b.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'test', 12 | alias: 'alias1', 13 | is_write_index: true 14 | } 15 | }, 16 | { 17 | add: { 18 | index: 'test2', 19 | alias: 'alias1' 20 | } 21 | } 22 | ] 23 | } 24 | }) 25 | console.log(response) 26 | ---- 27 | 28 | -------------------------------------------------------------------------------- /docs/doc_examples/15dad5338065baaaa7d475abe85f4c22.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | sort: [ 9 | { 10 | _geo_distance: { 11 | 'pin.location': [ 12 | -70, 13 | 40 14 | ], 15 | order: 'asc', 16 | unit: 'km' 17 | } 18 | } 19 | ], 20 | query: { 21 | term: { 22 | user: 'kimchy' 23 | } 24 | } 25 | } 26 | }) 27 | console.log(response) 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /docs/doc_examples/251ea12c1248385ab409906ac64d9ee9.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | query: { 10 | bool: { 11 | must: { 12 | match_all: {} 13 | }, 14 | filter: { 15 | range: { 16 | balance: { 17 | gte: 20000, 18 | lte: 30000 19 | } 20 | } 21 | } 22 | } 23 | } 24 | } 25 | }) 26 | console.log(response) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/ec473de07fe89bcbac1f8e278617fe46.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | function_score: { 10 | query: { 11 | match: { 12 | message: 'elasticsearch' 13 | } 14 | }, 15 | script_score: { 16 | script: { 17 | source: "Math.log(2 + doc['likes'].value)" 18 | } 19 | } 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/7f28f8ae8fcdbd807dadde0b5b007a6d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | actors: { 10 | terms: { 11 | field: 'actors', 12 | size: 10 13 | }, 14 | aggs: { 15 | costars: { 16 | terms: { 17 | field: 'actors', 18 | size: 5 19 | } 20 | } 21 | } 22 | } 23 | } 24 | } 25 | }) 26 | console.log(response) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/9a4d5e41c52c20635d1fd9c6e13f6c7a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.index({ 7 | index: 'metricbeat-2016.05.30', 8 | id: '1', 9 | refresh: true, 10 | body: { 11 | 'system.cpu.idle.pct': 0.908 12 | } 13 | }) 14 | console.log(response0) 15 | 16 | const response1 = await client.index({ 17 | index: 'metricbeat-2016.05.31', 18 | id: '1', 19 | refresh: true, 20 | body: { 21 | 'system.cpu.idle.pct': 0.105 22 | } 23 | }) 24 | console.log(response1) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/979d25dff2d8987119410291ad47b0d1.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | sort: [ 9 | { 10 | _geo_distance: { 11 | 'pin.location': { 12 | lat: 40, 13 | lon: -70 14 | }, 15 | order: 'asc', 16 | unit: 'km' 17 | } 18 | } 19 | ], 20 | query: { 21 | term: { 22 | user: 'kimchy' 23 | } 24 | } 25 | } 26 | }) 27 | console.log(response) 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /docs/doc_examples/e8e451bc8c45bcf16df43804c4fc8329.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | track_scores: true, 9 | sort: [ 10 | { 11 | post_date: { 12 | order: 'desc' 13 | } 14 | }, 15 | { 16 | name: 'desc' 17 | }, 18 | { 19 | age: 'desc' 20 | } 21 | ], 22 | query: { 23 | term: { 24 | user: 'kimchy' 25 | } 26 | } 27 | } 28 | }) 29 | console.log(response) 30 | ---- 31 | 32 | -------------------------------------------------------------------------------- /docs/doc_examples/36b2778f23d0955255f52c075c4d213d.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | remote: { 10 | host: 'http://otherhost:9200', 11 | username: 'user', 12 | password: 'pass' 13 | }, 14 | index: 'source', 15 | query: { 16 | match: { 17 | test: 'data' 18 | } 19 | } 20 | }, 21 | dest: { 22 | index: 'dest' 23 | } 24 | } 25 | }) 26 | console.log(response) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/cfbaea6f0df045c5d940bbb6a9c69cd8.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | size: 0, 10 | aggs: { 11 | group_by_state: { 12 | terms: { 13 | field: 'state.keyword' 14 | }, 15 | aggs: { 16 | average_balance: { 17 | avg: { 18 | field: 'balance' 19 | } 20 | } 21 | } 22 | } 23 | } 24 | } 25 | }) 26 | console.log(response) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/3a700f836d8d5da1b656a876554028aa.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.clearScroll({ 7 | body: { 8 | scroll_id: [ 9 | 'DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==', 10 | 'DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB' 11 | ] 12 | } 13 | }) 14 | console.log(response) 15 | ---- 16 | 17 | -------------------------------------------------------------------------------- /docs/doc_examples/6a81d00f0d73bc5985e76b3cadab645e.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | tag: { 12 | type: 'text', 13 | fielddata: true, 14 | fielddata_frequency_filter: { 15 | min: 0.001, 16 | max: 0.1, 17 | min_segment_size: 500 18 | } 19 | } 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/8acc1d67b152e7027e0f0e1a8b4b2431.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'twitter', 8 | routing: 'kimchy', 9 | body: { 10 | query: { 11 | bool: { 12 | must: { 13 | query_string: { 14 | query: 'some query string here' 15 | } 16 | }, 17 | filter: { 18 | term: { 19 | user: 'kimchy' 20 | } 21 | } 22 | } 23 | } 24 | } 25 | }) 26 | console.log(response) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /.ci/jobs/elastic+elasticsearch-js+pull-request.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - job: 3 | name: elastic+elasticsearch-js+pull-request 4 | display-name: 'elastic / elasticsearch-js # pull-request' 5 | description: Testing of elasticsearch-js pull requests. 6 | junit_results: "*-junit.xml" 7 | scm: 8 | - git: 9 | branches: 10 | - ${ghprbActualCommit} 11 | refspec: +refs/pull/*:refs/remotes/origin/pr/* 12 | triggers: 13 | - github-pull-request: 14 | org-list: 15 | - elastic 16 | allow-whitelist-orgs-as-admins: true 17 | github-hooks: true 18 | status-context: clients-ci 19 | cancel-builds-on-update: true 20 | -------------------------------------------------------------------------------- /docs/doc_examples/7f697eb436dfa3c30dfe610d8c32d132.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.reindex({ 7 | body: { 8 | source: { 9 | remote: { 10 | host: 'http://otherhost:9200', 11 | socket_timeout: '1m', 12 | connect_timeout: '10s' 13 | }, 14 | index: 'source', 15 | query: { 16 | match: { 17 | test: 'data' 18 | } 19 | } 20 | }, 21 | dest: { 22 | index: 'dest' 23 | } 24 | } 25 | }) 26 | console.log(response) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/b214942b938e47f2c486e523546cb574.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'my_index', 8 | body: { 9 | query: { 10 | bool: { 11 | must: [ 12 | { 13 | match: { 14 | 'user.first': 'Alice' 15 | } 16 | }, 17 | { 18 | match: { 19 | 'user.last': 'Smith' 20 | } 21 | } 22 | ] 23 | } 24 | } 25 | } 26 | }) 27 | console.log(response) 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /docs/doc_examples/a71c438cc4df1cafe3109ccff475afdb.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | number_of_bytes: { 12 | type: 'integer' 13 | }, 14 | time_in_seconds: { 15 | type: 'float' 16 | }, 17 | price: { 18 | type: 'scaled_float', 19 | scaling_factor: 100 20 | } 21 | } 22 | } 23 | } 24 | }) 25 | console.log(response) 26 | ---- 27 | 28 | -------------------------------------------------------------------------------- /docs/doc_examples/ad79228630684d950fe9792a768d24c5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.updateAliases({ 7 | body: { 8 | actions: [ 9 | { 10 | add: { 11 | index: 'test', 12 | alias: 'alias1', 13 | is_write_index: false 14 | } 15 | }, 16 | { 17 | add: { 18 | index: 'test2', 19 | alias: 'alias1', 20 | is_write_index: true 21 | } 22 | } 23 | ] 24 | } 25 | }) 26 | console.log(response) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/c4b278ba293abd0d02a0b5ad1a99f84a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.ingest.putPipeline({ 7 | id: 'set-foo', 8 | body: { 9 | description: 'sets foo', 10 | processors: [ 11 | { 12 | set: { 13 | field: 'foo', 14 | value: 'bar' 15 | } 16 | } 17 | ] 18 | } 19 | }) 20 | console.log(response0) 21 | 22 | const response1 = await client.updateByQuery({ 23 | index: 'twitter', 24 | pipeline: 'set-foo' 25 | }) 26 | console.log(response1) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/f9636d7ef1a45be4f36418c875cf6bef.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.update({ 7 | index: 'sessions', 8 | id: 'dh3sgudg8gsrgl', 9 | body: { 10 | scripted_upsert: true, 11 | script: { 12 | id: 'my_web_session_summariser', 13 | params: { 14 | pageViewEvent: { 15 | url: 'foo.com/bar', 16 | response: 404, 17 | time: '2014-01-01 12:32' 18 | } 19 | } 20 | }, 21 | upsert: {} 22 | } 23 | }) 24 | console.log(response) 25 | ---- 26 | 27 | -------------------------------------------------------------------------------- /docs/doc_examples/b0eaf67e5cce24ef8889bf20951ccec1.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | dis_max: { 10 | queries: [ 11 | { 12 | match: { 13 | subject: 'brown fox' 14 | } 15 | }, 16 | { 17 | match: { 18 | message: 'brown fox' 19 | } 20 | } 21 | ], 22 | tie_breaker: 0.3 23 | } 24 | } 25 | } 26 | }) 27 | console.log(response) 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /docs/doc_examples/33f148e3d8676de6cc52f58749898a13.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | dis_max: { 10 | queries: [ 11 | { 12 | match_phrase_prefix: { 13 | subject: 'quick brown f' 14 | } 15 | }, 16 | { 17 | match_phrase_prefix: { 18 | message: 'quick brown f' 19 | } 20 | } 21 | ] 22 | } 23 | } 24 | } 25 | }) 26 | console.log(response) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/47bb632c6091ad0cd94bc660bdd309a5.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | query: { 10 | bool: { 11 | must: [ 12 | { 13 | match: { 14 | age: '40' 15 | } 16 | } 17 | ], 18 | must_not: [ 19 | { 20 | match: { 21 | state: 'ID' 22 | } 23 | } 24 | ] 25 | } 26 | } 27 | } 28 | }) 29 | console.log(response) 30 | ---- 31 | 32 | -------------------------------------------------------------------------------- /docs/doc_examples/b93ed4ef309819734f0eeea82e8b0f1f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'sales', 8 | size: '0', 9 | body: { 10 | aggs: { 11 | t_shirts: { 12 | filter: { 13 | term: { 14 | type: 't-shirt' 15 | } 16 | }, 17 | aggs: { 18 | avg_price: { 19 | avg: { 20 | field: 'price' 21 | } 22 | } 23 | } 24 | } 25 | } 26 | } 27 | }) 28 | console.log(response) 29 | ---- 30 | 31 | -------------------------------------------------------------------------------- /docs/doc_examples/d1b3b7d2bb2ab90d15fd10318abd24db.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.create({ 7 | index: 'my_index', 8 | body: { 9 | mappings: { 10 | properties: { 11 | post_date: { 12 | type: 'date' 13 | }, 14 | user: { 15 | type: 'keyword' 16 | }, 17 | name: { 18 | type: 'keyword' 19 | }, 20 | age: { 21 | type: 'integer' 22 | } 23 | } 24 | } 25 | } 26 | }) 27 | console.log(response) 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /docs/doc_examples/71b5b2ba9557d0f296ff2de91727d2f6.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | genres: { 10 | terms: { 11 | field: 'genre', 12 | order: { 13 | max_play_count: 'desc' 14 | } 15 | }, 16 | aggs: { 17 | max_play_count: { 18 | max: { 19 | field: 'play_count' 20 | } 21 | } 22 | } 23 | } 24 | } 25 | } 26 | }) 27 | console.log(response) 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /docs/doc_examples/ae9b5fbd42af2386ffbf56ad4a697e51.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'my_index', 8 | body: { 9 | sort: [ 10 | { 11 | post_date: { 12 | order: 'asc' 13 | } 14 | }, 15 | 'user', 16 | { 17 | name: 'desc' 18 | }, 19 | { 20 | age: 'desc' 21 | }, 22 | '_score' 23 | ], 24 | query: { 25 | term: { 26 | user: 'kimchy' 27 | } 28 | } 29 | } 30 | }) 31 | console.log(response) 32 | ---- 33 | 34 | -------------------------------------------------------------------------------- /docs/doc_examples/34efeade38445b2834749ced59782e25.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | genres: { 10 | terms: { 11 | field: 'genre', 12 | order: { 13 | 'playback_stats.max': 'desc' 14 | } 15 | }, 16 | aggs: { 17 | playback_stats: { 18 | stats: { 19 | field: 'play_count' 20 | } 21 | } 22 | } 23 | } 24 | } 25 | } 26 | }) 27 | console.log(response) 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /docs/doc_examples/cd5bc5bf7cd58d7b1492c9c298b345f6.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | actors: { 10 | terms: { 11 | field: 'actors', 12 | size: 10, 13 | collect_mode: 'breadth_first' 14 | }, 15 | aggs: { 16 | costars: { 17 | terms: { 18 | field: 'actors', 19 | size: 5 20 | } 21 | } 22 | } 23 | } 24 | } 25 | } 26 | }) 27 | console.log(response) 28 | ---- 29 | 30 | -------------------------------------------------------------------------------- /docs/doc_examples/1da77e114459e0b77d78a3dcc8fae429.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.indices.create({ 7 | index: 'twitter-1' 8 | }) 9 | console.log(response0) 10 | 11 | const response1 = await client.indices.create({ 12 | index: 'twitter-2' 13 | }) 14 | console.log(response1) 15 | 16 | const response2 = await client.indices.putMapping({ 17 | index: 'twitter-1,twitter-2', 18 | body: { 19 | properties: { 20 | user_name: { 21 | type: 'text' 22 | } 23 | } 24 | } 25 | }) 26 | console.log(response2) 27 | ---- 28 | 29 | -------------------------------------------------------------------------------- /docs/doc_examples/04fe1e3a0047b0cdb10987b79fc3f3f3.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | term: { 10 | user: 'kimchy' 11 | } 12 | }, 13 | sort: { 14 | _script: { 15 | type: 'number', 16 | script: { 17 | lang: 'painless', 18 | source: "doc['field_name'].value * params.factor", 19 | params: { 20 | factor: 1.1 21 | } 22 | }, 23 | order: 'asc' 24 | } 25 | } 26 | } 27 | }) 28 | console.log(response) 29 | ---- 30 | 31 | -------------------------------------------------------------------------------- /docs/doc_examples/1b8caf0a6741126c6d0ad83b56fce290.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putTemplate({ 7 | name: 'template_1', 8 | body: { 9 | index_patterns: [ 10 | 'te*' 11 | ], 12 | settings: { 13 | number_of_shards: 1 14 | }, 15 | aliases: { 16 | alias1: {}, 17 | alias2: { 18 | filter: { 19 | term: { 20 | user: 'kimchy' 21 | } 22 | }, 23 | routing: 'kimchy' 24 | }, 25 | '{index}-alias': {} 26 | } 27 | } 28 | }) 29 | console.log(response) 30 | ---- 31 | 32 | -------------------------------------------------------------------------------- /docs/doc_examples/645796e8047967ca4a7635a22a876f4c.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | index: 'bank', 8 | body: { 9 | size: 0, 10 | aggs: { 11 | group_by_state: { 12 | terms: { 13 | field: 'state.keyword', 14 | order: { 15 | average_balance: 'desc' 16 | } 17 | }, 18 | aggs: { 19 | average_balance: { 20 | avg: { 21 | field: 'balance' 22 | } 23 | } 24 | } 25 | } 26 | } 27 | } 28 | }) 29 | console.log(response) 30 | ---- 31 | 32 | -------------------------------------------------------------------------------- /docs/doc_examples/98b121bf47cebd85671a2cb519688d28.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | aggs: { 9 | JapaneseCars: { 10 | terms: { 11 | field: 'make', 12 | include: [ 13 | 'mazda', 14 | 'honda' 15 | ] 16 | } 17 | }, 18 | ActiveCarManufacturers: { 19 | terms: { 20 | field: 'make', 21 | exclude: [ 22 | 'rover', 23 | 'jensen' 24 | ] 25 | } 26 | } 27 | } 28 | } 29 | }) 30 | console.log(response) 31 | ---- 32 | 33 | -------------------------------------------------------------------------------- /docs/doc_examples/d17269bb80fb63ec0bf37d219e003dcb.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | sort: [ 9 | { 10 | _geo_distance: { 11 | 'pin.location': [ 12 | -70, 13 | 40 14 | ], 15 | order: 'asc', 16 | unit: 'km', 17 | mode: 'min', 18 | distance_type: 'arc', 19 | ignore_unmapped: true 20 | } 21 | } 22 | ], 23 | query: { 24 | term: { 25 | user: 'kimchy' 26 | } 27 | } 28 | } 29 | }) 30 | console.log(response) 31 | ---- 32 | 33 | -------------------------------------------------------------------------------- /docs/doc_examples/8f0511f8a5cb176ff2afdd4311799a33.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.index({ 7 | index: 'twitter', 8 | id: '1', 9 | refresh: true, 10 | body: { 11 | user: 'kimchy' 12 | } 13 | }) 14 | console.log(response0) 15 | 16 | const response1 = await client.count({ 17 | index: 'twitter', 18 | q: 'user:kimchy' 19 | }) 20 | console.log(response1) 21 | 22 | const response2 = await client.count({ 23 | index: 'twitter', 24 | body: { 25 | query: { 26 | term: { 27 | user: 'kimchy' 28 | } 29 | } 30 | } 31 | }) 32 | console.log(response2) 33 | ---- 34 | 35 | -------------------------------------------------------------------------------- /docs/doc_examples/b68c85fe1b0d2f264dc0d1cbf530f319.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | function_score: { 10 | query: { 11 | match: { 12 | message: 'elasticsearch' 13 | } 14 | }, 15 | script_score: { 16 | script: { 17 | params: { 18 | a: 5, 19 | b: 1.2 20 | }, 21 | source: "params.a / Math.pow(params.b, doc['likes'].value)" 22 | } 23 | } 24 | } 25 | } 26 | } 27 | }) 28 | console.log(response) 29 | ---- 30 | 31 | -------------------------------------------------------------------------------- /docs/doc_examples/ba0b4081c98f3387f76b77847c52ee9a.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.indices.close({ 7 | index: 'twitter' 8 | }) 9 | console.log(response0) 10 | 11 | const response1 = await client.indices.putSettings({ 12 | index: 'twitter', 13 | body: { 14 | analysis: { 15 | analyzer: { 16 | content: { 17 | type: 'custom', 18 | tokenizer: 'whitespace' 19 | } 20 | } 21 | } 22 | } 23 | }) 24 | console.log(response1) 25 | 26 | const response2 = await client.indices.open({ 27 | index: 'twitter' 28 | }) 29 | console.log(response2) 30 | ---- 31 | 32 | -------------------------------------------------------------------------------- /docs/doc_examples/77243bbf92f2a55e0fca6c2a349a1c15.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | sort: [ 9 | { 10 | _geo_distance: { 11 | 'pin.location': [ 12 | [ 13 | -70, 14 | 40 15 | ], 16 | [ 17 | -71, 18 | 42 19 | ] 20 | ], 21 | order: 'asc', 22 | unit: 'km' 23 | } 24 | } 25 | ], 26 | query: { 27 | term: { 28 | user: 'kimchy' 29 | } 30 | } 31 | } 32 | }) 33 | console.log(response) 34 | ---- 35 | 36 | -------------------------------------------------------------------------------- /docs/doc_examples/de139866a220124360e5e27d1a736ea4.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | term: { 10 | product: 'chocolate' 11 | } 12 | }, 13 | sort: [ 14 | { 15 | 'offer.price': { 16 | mode: 'avg', 17 | order: 'asc', 18 | nested: { 19 | path: 'offer', 20 | filter: { 21 | term: { 22 | 'offer.color': 'blue' 23 | } 24 | } 25 | } 26 | } 27 | } 28 | ] 29 | } 30 | }) 31 | console.log(response) 32 | ---- 33 | 34 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /docs/doc_examples/0d664883151008b1051ef2c9ab2d0373.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.updateByQuery({ 7 | index: 'twitter', 8 | body: { 9 | slice: { 10 | id: 0, 11 | max: 2 12 | }, 13 | script: { 14 | source: "ctx._source['extra'] = 'test'" 15 | } 16 | } 17 | }) 18 | console.log(response0) 19 | 20 | const response1 = await client.updateByQuery({ 21 | index: 'twitter', 22 | body: { 23 | slice: { 24 | id: 1, 25 | max: 2 26 | }, 27 | script: { 28 | source: "ctx._source['extra'] = 'test'" 29 | } 30 | } 31 | }) 32 | console.log(response1) 33 | ---- 34 | 35 | -------------------------------------------------------------------------------- /docs/doc_examples/6bbc613bd4f9aec1bbdbabf5db021d28.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | query: { 9 | bool: { 10 | should: [ 11 | { 12 | match: { 13 | title: 'quick brown fox' 14 | } 15 | }, 16 | { 17 | match: { 18 | 'title.original': 'quick brown fox' 19 | } 20 | }, 21 | { 22 | match: { 23 | 'title.shingles': 'quick brown fox' 24 | } 25 | } 26 | ] 27 | } 28 | } 29 | } 30 | }) 31 | console.log(response) 32 | ---- 33 | 34 | -------------------------------------------------------------------------------- /docs/examples/exists.asciidoc: -------------------------------------------------------------------------------- 1 | [[exists_examples]] 2 | == Exists 3 | 4 | Check that the document `/game-of-thrones/1` exists. 5 | 6 | NOTE: Since this API uses the `HEAD` method, the body value will be boolean. 7 | 8 | [source,js] 9 | --------- 10 | 'use strict' 11 | 12 | const { Client } = require('@elastic/elasticsearch') 13 | const client = new Client({ node: 'http://localhost:9200' }) 14 | 15 | async function run () { 16 | await client.index({ 17 | index: 'game-of-thrones', 18 | id: '1', 19 | body: { 20 | character: 'Ned Stark', 21 | quote: 'Winter is coming.' 22 | } 23 | }) 24 | 25 | const { body } = await client.exists({ 26 | index: 'game-of-thrones', 27 | id: 1 28 | }) 29 | 30 | console.log(body) // true 31 | } 32 | 33 | run().catch(console.log) 34 | --------- -------------------------------------------------------------------------------- /docs/doc_examples/1b8655e6ba99fe39933c6eafe78728b7.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.reindex({ 7 | body: { 8 | source: { 9 | index: 'twitter', 10 | slice: { 11 | id: 0, 12 | max: 2 13 | } 14 | }, 15 | dest: { 16 | index: 'new_twitter' 17 | } 18 | } 19 | }) 20 | console.log(response0) 21 | 22 | const response1 = await client.reindex({ 23 | body: { 24 | source: { 25 | index: 'twitter', 26 | slice: { 27 | id: 1, 28 | max: 2 29 | } 30 | }, 31 | dest: { 32 | index: 'new_twitter' 33 | } 34 | } 35 | }) 36 | console.log(response1) 37 | ---- 38 | 39 | -------------------------------------------------------------------------------- /docs/doc_examples/de176bc4788ea286fff9e92418a43ea8.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.indices.create({ 7 | index: 'test' 8 | }) 9 | console.log(response0) 10 | 11 | const response1 = await client.indices.create({ 12 | index: 'test_2' 13 | }) 14 | console.log(response1) 15 | 16 | const response2 = await client.indices.updateAliases({ 17 | body: { 18 | actions: [ 19 | { 20 | add: { 21 | index: 'test_2', 22 | alias: 'test' 23 | } 24 | }, 25 | { 26 | remove_index: { 27 | index: 'test' 28 | } 29 | } 30 | ] 31 | } 32 | }) 33 | console.log(response2) 34 | ---- 35 | 36 | -------------------------------------------------------------------------------- /docs/doc_examples/b997885974522ef439d5e345924cc5ba.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.index({ 7 | index: 'my_index', 8 | id: '1', 9 | refresh: true, 10 | body: { 11 | product: 'chocolate', 12 | price: [ 13 | 20, 14 | 4 15 | ] 16 | } 17 | }) 18 | console.log(response0) 19 | 20 | const response1 = await client.search({ 21 | body: { 22 | query: { 23 | term: { 24 | product: 'chocolate' 25 | } 26 | }, 27 | sort: [ 28 | { 29 | price: { 30 | order: 'asc', 31 | mode: 'avg' 32 | } 33 | } 34 | ] 35 | } 36 | }) 37 | console.log(response1) 38 | ---- 39 | 40 | -------------------------------------------------------------------------------- /docs/doc_examples/e5f50b31f165462d883ecbff45f74985.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.indices.putTemplate({ 7 | name: 'template_1', 8 | body: { 9 | index_patterns: [ 10 | 'te*', 11 | 'bar*' 12 | ], 13 | settings: { 14 | number_of_shards: 1 15 | }, 16 | mappings: { 17 | _source: { 18 | enabled: false 19 | }, 20 | properties: { 21 | host_name: { 22 | type: 'keyword' 23 | }, 24 | created_at: { 25 | type: 'date', 26 | format: 'EEE MMM dd HH:mm:ss Z yyyy' 27 | } 28 | } 29 | } 30 | } 31 | }) 32 | console.log(response) 33 | ---- 34 | 35 | -------------------------------------------------------------------------------- /docs/doc_examples/1027ab1ca767ac1428176ef4f84bfbcf.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.search({ 7 | index: 'twitter', 8 | scroll: '1m', 9 | body: { 10 | slice: { 11 | id: 0, 12 | max: 2 13 | }, 14 | query: { 15 | match: { 16 | title: 'elasticsearch' 17 | } 18 | } 19 | } 20 | }) 21 | console.log(response0) 22 | 23 | const response1 = await client.search({ 24 | index: 'twitter', 25 | scroll: '1m', 26 | body: { 27 | slice: { 28 | id: 1, 29 | max: 2 30 | }, 31 | query: { 32 | match: { 33 | title: 'elasticsearch' 34 | } 35 | } 36 | } 37 | }) 38 | console.log(response1) 39 | ---- 40 | 41 | -------------------------------------------------------------------------------- /docs/doc_examples/804a97ff4d0613e6568e4efb19c52021.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.cluster.putSettings({ 7 | body: { 8 | persistent: { 9 | 'action.auto_create_index': 'twitter,index10,-index1*,+ind*' 10 | } 11 | } 12 | }) 13 | console.log(response0) 14 | 15 | const response1 = await client.cluster.putSettings({ 16 | body: { 17 | persistent: { 18 | 'action.auto_create_index': 'false' 19 | } 20 | } 21 | }) 22 | console.log(response1) 23 | 24 | const response2 = await client.cluster.putSettings({ 25 | body: { 26 | persistent: { 27 | 'action.auto_create_index': 'true' 28 | } 29 | } 30 | }) 31 | console.log(response2) 32 | ---- 33 | 34 | -------------------------------------------------------------------------------- /docs/doc_examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.bulk({ 7 | body: [ 8 | { 9 | update: { 10 | _id: '5', 11 | _index: 'index1' 12 | } 13 | }, 14 | { 15 | doc: { 16 | my_field: 'foo' 17 | } 18 | }, 19 | { 20 | update: { 21 | _id: '6', 22 | _index: 'index1' 23 | } 24 | }, 25 | { 26 | doc: { 27 | my_field: 'foo' 28 | } 29 | }, 30 | { 31 | create: { 32 | _id: '7', 33 | _index: 'index1' 34 | } 35 | }, 36 | { 37 | my_field: 'foo' 38 | } 39 | ] 40 | }) 41 | console.log(response) 42 | ---- 43 | 44 | -------------------------------------------------------------------------------- /docs/doc_examples/5d9d7b84e2fec7ecd832145cbb951cf1.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response = await client.search({ 7 | body: { 8 | size: 0, 9 | aggs: { 10 | expired_sessions: { 11 | terms: { 12 | field: 'account_id', 13 | include: { 14 | partition: 0, 15 | num_partitions: 20 16 | }, 17 | size: 10000, 18 | order: { 19 | last_access: 'asc' 20 | } 21 | }, 22 | aggs: { 23 | last_access: { 24 | max: { 25 | field: 'access_date' 26 | } 27 | } 28 | } 29 | } 30 | } 31 | } 32 | }) 33 | console.log(response) 34 | ---- 35 | 36 | -------------------------------------------------------------------------------- /docs/doc_examples/1e49eba5b9042c1900a608fe5105ba43.asciidoc: -------------------------------------------------------------------------------- 1 | // This file is autogenerated, DO NOT EDIT 2 | // Use `node scripts/generate-docs-examples.js` to generate the docs examples 3 | 4 | [source, js] 5 | ---- 6 | const response0 = await client.deleteByQuery({ 7 | index: 'twitter', 8 | body: { 9 | slice: { 10 | id: 0, 11 | max: 2 12 | }, 13 | query: { 14 | range: { 15 | likes: { 16 | lt: 10 17 | } 18 | } 19 | } 20 | } 21 | }) 22 | console.log(response0) 23 | 24 | const response1 = await client.deleteByQuery({ 25 | index: 'twitter', 26 | body: { 27 | slice: { 28 | id: 1, 29 | max: 2 30 | }, 31 | query: { 32 | range: { 33 | likes: { 34 | lt: 10 35 | } 36 | } 37 | } 38 | } 39 | }) 40 | console.log(response1) 41 | ---- 42 | 43 | --------------------------------------------------------------------------------