Compare commits
533 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 496161acdf | |||
| 542c377459 | |||
| 2ea3979e95 | |||
| 5603482c43 | |||
| ba2955947e | |||
| 768295bdb0 | |||
| b159d474b0 | |||
| bda15ca3ca | |||
| 2cc0fd4df9 | |||
| 603e4695cb | |||
| 2c6e0ddb62 | |||
| de27dd9697 | |||
| 295553c249 | |||
| 96b5b8eaba | |||
| eac00e1200 | |||
| 77c1ef36aa | |||
| 720b5b449b | |||
| a298517692 | |||
| 53ccd17dbf | |||
| f6c14b7268 | |||
| 4f1713c894 | |||
| af97ece807 | |||
| 46b2c99b7c | |||
| e0f54c789b | |||
| 6d2774d2a0 | |||
| 25d9afbc0b | |||
| d7e5ff5191 | |||
| 904c3bb28c | |||
| 33c4630a34 | |||
| 3e79c8e825 | |||
| d01582803c | |||
| e7c5b3dafa | |||
| 10277e217c | |||
| 03ecf707c9 | |||
| ca6948fb82 | |||
| 82cf15097d | |||
| 759138c375 | |||
| a0c5c98a99 | |||
| 451a805ecd | |||
| 071a6ba4bb | |||
| 7985aab860 | |||
| 4643a359fe | |||
| e915e4b9af | |||
| 048ad273b2 | |||
| 0fbdf10a68 | |||
| 16cefd8383 | |||
| f718b22e9b | |||
| b3c24659d8 | |||
| 3cfc31902e | |||
| 85d1968ce5 | |||
| 7e84827593 | |||
| 4ad5daeaf4 | |||
| dbfc8fc4d1 | |||
| 194614564a | |||
| 748b45e2ca | |||
| fbaee7f54f | |||
| e9b905f042 | |||
| ae3ea3013f | |||
| d6fb2ca569 | |||
| 288f377dae | |||
| 76659b604f | |||
| 88933ad39e | |||
| bf317be2a7 | |||
| 853fe27505 | |||
| f53c74e1a2 | |||
| a5a0a1c589 | |||
| 185697b6fe | |||
| 78c038d307 | |||
| a397d708a3 | |||
| 2a2fa720e4 | |||
| 8db750d1b0 | |||
| 529742ac1f | |||
| 66222f0111 | |||
| 702e71ec18 | |||
| 57608103fb | |||
| 0ad96fb921 | |||
| a761539ee5 | |||
| 5af2d6cd4d | |||
| 8c1504ff01 | |||
| 9af0ea8e1b | |||
| 3418c2ee6c | |||
| 5fc8dd9f59 | |||
| 4cf1fc6cd4 | |||
| 79b0a2f13c | |||
| 0b965c8c4d | |||
| 6dfd66ad06 | |||
| 63542d807f | |||
| 87ce166df1 | |||
| 4ae687416b | |||
| 1e1ac6a203 | |||
| 6aeeb48928 | |||
| 898fac2ec1 | |||
| 875f969ef8 | |||
| 0e35840e1b | |||
| dc74a80402 | |||
| 23633a1802 | |||
| 4492532727 | |||
| 070b9d75b9 | |||
| 8fffae2f76 | |||
| dfddfecfb2 | |||
| a26692c7e4 | |||
| 1a227459f0 | |||
| 4c72b981cd | |||
| 3feda5d9f6 | |||
| f28c93fe13 | |||
| de99b80816 | |||
| 212c3c4ffe | |||
| f7b653dff6 | |||
| b67d42cb5f | |||
| f981c273d6 | |||
| acb77fa3d1 | |||
| 470bc84eb7 | |||
| 8156252598 | |||
| ee50a8e770 | |||
| a7658b2a66 | |||
| a9b62049cd | |||
| 5447acb534 | |||
| a0dcace7cd | |||
| f161946984 | |||
| 77bf94a500 | |||
| f891fd53a2 | |||
| 4ae38ca7f0 | |||
| 969decde28 | |||
| 08b80844da | |||
| 5dab5d0abd | |||
| 2e70f7ba81 | |||
| 7814527439 | |||
| def28e33d1 | |||
| 498199ca60 | |||
| c100edcca2 | |||
| 7c59eda3db | |||
| 516f52e303 | |||
| 2d1505eb2b | |||
| b0a7a21f72 | |||
| 728868f3ea | |||
| 6686316433 | |||
| 28e57dd2e4 | |||
| 34571a94f8 | |||
| 304d251c3f | |||
| ff98e6310c | |||
| 17c744ed80 | |||
| 76f5845ac1 | |||
| 3137780d6b | |||
| d2ce46b8e0 | |||
| cab8d8be38 | |||
| 4073d60b97 | |||
| 101a13f63e | |||
| f2d8cf7d34 | |||
| 9bf3fdf8f1 | |||
| 4933e3b9be | |||
| 249118fac6 | |||
| 102520c304 | |||
| 894a33ce86 | |||
| 4e6ae5d2e8 | |||
| 5292fcae03 | |||
| c64152b9b3 | |||
| 507ed99e74 | |||
| c34a6690ba | |||
| b4b45459c8 | |||
| 728215f3c0 | |||
| 12ce270239 | |||
| c8851b86f4 | |||
| bf02b3d0e5 | |||
| 8d7136241a | |||
| 52d68a0e83 | |||
| 791f2168a3 | |||
| 7b87db49ae | |||
| 623bd72910 | |||
| ce6c459eab | |||
| d5f61c7833 | |||
| dc2de57bd3 | |||
| 147560ba44 | |||
| 0d1e1c2613 | |||
| 265eb2b225 | |||
| d1a5fc7cfa | |||
| 04c56fe269 | |||
| d2f77e9944 | |||
| d188e24626 | |||
| e3c15d39de | |||
| 6a6d8bc566 | |||
| 6464fc69f1 | |||
| cb78bb408b | |||
| b22558f047 | |||
| d7d55e1146 | |||
| 4102a28a0b | |||
| 7fdfa4834f | |||
| 052e138fbd | |||
| 226d0e3498 | |||
| 9fa1e12bd3 | |||
| 7a3cfe7e23 | |||
| f86a79cb26 | |||
| 430de17007 | |||
| 609da06fef | |||
| c96c41dc43 | |||
| ab3e809fc2 | |||
| 6a30cd9955 | |||
| 36eaed6466 | |||
| 22ece32c5c | |||
| f2204c5722 | |||
| 059a2c91ce | |||
| f150872726 | |||
| ab5d8997b8 | |||
| 7801b2cc13 | |||
| 8311a4ad04 | |||
| 973a98180a | |||
| 2b084dbadc | |||
| 79658b1784 | |||
| 19acc4f9d0 | |||
| 2409bd09e4 | |||
| 9e3072f621 | |||
| 2494f08ad2 | |||
| 883ef386e3 | |||
| 618b244473 | |||
| b0769bec11 | |||
| a91c55b1f8 | |||
| 5ed2548433 | |||
| 8aedb79419 | |||
| 61eee69424 | |||
| 4cace4c234 | |||
| 33035901cf | |||
| 9fea1aedc0 | |||
| 1398086f76 | |||
| 16901798f9 | |||
| 8cbb54016a | |||
| 502509cabc | |||
| 959aee5903 | |||
| 2cf3438cca | |||
| 90f6003dd7 | |||
| 66a4739018 | |||
| edd4f78bad | |||
| a62e26e901 | |||
| 797ef471f1 | |||
| cf48d9a690 | |||
| fc3883a181 | |||
| 87805fc17f | |||
| 3d664def25 | |||
| 505f748dba | |||
| 580364392e | |||
| 8ec40547fb | |||
| ea009da3b6 | |||
| 5682e680d1 | |||
| aaeadee940 | |||
| b8940533a9 | |||
| f5ea8ff5cd | |||
| 37983cba99 | |||
| 4792203b8f | |||
| 772fad09cc | |||
| 93990b88fb | |||
| 88ef53b0ef | |||
| 7b11152a12 | |||
| a064f0f357 | |||
| 19f570f067 | |||
| d211a9cb11 | |||
| 2894f14b7c | |||
| d6d7aeffb3 | |||
| 147ec0155d | |||
| 009ecc442f | |||
| 7f317d3321 | |||
| 96a54d0539 | |||
| f15ecd8477 | |||
| e86d38087e | |||
| 02ed45f76b | |||
| 858616d6c6 | |||
| ba39e8a440 | |||
| cf172d7937 | |||
| a4370cb28d | |||
| 26238634a7 | |||
| 629894adba | |||
| 51ab5b0b00 | |||
| 944dee219a | |||
| 58117792de | |||
| e6a4050b0b | |||
| 1e8bcbebfe | |||
| 5572939268 | |||
| 530f50be95 | |||
| 1592c4d575 | |||
| 39cf023426 | |||
| 1a7727588e | |||
| 9d30778614 | |||
| fa760f44b5 | |||
| 1a7968aba3 | |||
| d6c84f1a5d | |||
| 34a9176fbf | |||
| 8d7859d2e2 | |||
| 8c4042d913 | |||
| aa7d7b02ad | |||
| 71a74be321 | |||
| 33a4e4dc31 | |||
| 4711cf6d70 | |||
| 4b2cbdb809 | |||
| d16781e379 | |||
| 148f2fd864 | |||
| 83e5147d9d | |||
| b4d0dc87d3 | |||
| 04d082cb49 | |||
| 8e077b46a7 | |||
| b0e96f9644 | |||
| 59ab125f48 | |||
| 3efb63b34e | |||
| 7dfaa6c5b4 | |||
| 3751f50774 | |||
| 1d9238b432 | |||
| 80817a00f9 | |||
| dbbee273d9 | |||
| 1a25b623b0 | |||
| 84217fc737 | |||
| d1ad7bd22b | |||
| ac2d1dad53 | |||
| 803739b4cb | |||
| 4659b9849c | |||
| 8835d5af64 | |||
| 6f4127d87d | |||
| e3e4be3a5e | |||
| 191b8fb9fb | |||
| 22de806b67 | |||
| b109f60763 | |||
| 0d5c7a880f | |||
| 5db574a576 | |||
| 292218f946 | |||
| 9b4d2c13b0 | |||
| 5cd67ddbe2 | |||
| 50ffb5592f | |||
| dc998fdd87 | |||
| 3ab7712a8b | |||
| ae8ac21060 | |||
| 17959a41e1 | |||
| fd8f02b9df | |||
| 203bab278d | |||
| cfc21f56c2 | |||
| 0e659031e3 | |||
| 7717799ca6 | |||
| 8522f303ee | |||
| f6677c05cf | |||
| 6779f3b11a | |||
| e67b55d163 | |||
| d10e8bb9f3 | |||
| 27a8e2a9bf | |||
| 953a8033ab | |||
| df17fb99d0 | |||
| bdd38597d8 | |||
| bb28276553 | |||
| 1d24147ada | |||
| 2963fa6e0b | |||
| da35f71f2d | |||
| f913f7d2d2 | |||
| 85616b07ef | |||
| f99fe71b67 | |||
| 8de88b0154 | |||
| 153bc26b39 | |||
| d7836a16af | |||
| 6c82a4967e | |||
| a80f510a9a | |||
| 1b638d6992 | |||
| 354c13c033 | |||
| ed74570bc2 | |||
| 87579e4ca9 | |||
| 7f19628907 | |||
| b374fe9967 | |||
| 7e51d4cd8c | |||
| f1fcf4746d | |||
| 9a9057db9e | |||
| 6bf04473c9 | |||
| 41cc8a6d04 | |||
| 5445f0b22b | |||
| 030c5e8c43 | |||
| 94d4ac7525 | |||
| 58a2618f4c | |||
| 54ec923491 | |||
| 1c03ccc7af | |||
| 43ee0445fc | |||
| 0f2b79159e | |||
| db89df7b5c | |||
| 508aa362e6 | |||
| 7b7c9130f3 | |||
| 6d50c9fa30 | |||
| 32f3fef14f | |||
| 15ba60a0ec | |||
| fec4e837ac | |||
| 18a87fca82 | |||
| 6261dd7909 | |||
| d621d31d39 | |||
| b2c85f7797 | |||
| 0c4875aa6d | |||
| 6e7385a478 | |||
| 28205e97cf | |||
| 41927914bb | |||
| d701516dda | |||
| 4b54013248 | |||
| d2bc399d9b | |||
| 87ccc196a0 | |||
| 93d24dcc5b | |||
| 7945b68693 | |||
| ebb96e95bf | |||
| 5f1edbb199 | |||
| 416ace2e30 | |||
| 01b233428f | |||
| bc970a75f3 | |||
| acff983fc0 | |||
| b18cc25a0f | |||
| f3ccf7baa3 | |||
| 3953a2c542 | |||
| ec81ee40f8 | |||
| daf30653f1 | |||
| 2e33680047 | |||
| 7478913d6c | |||
| 436f1c891d | |||
| c548055886 | |||
| fc5156dbff | |||
| 8e113271b5 | |||
| 2abd2a8e7f | |||
| 8215327a03 | |||
| 185cfa394b | |||
| 6cef0aff18 | |||
| 59559f7200 | |||
| 01e045f491 | |||
| c69db0ba08 | |||
| e2ba0634bf | |||
| a174ea4721 | |||
| bb4b40b3fd | |||
| 0f1746014c | |||
| 1e1252383d | |||
| 177aae20e6 | |||
| c40eaab038 | |||
| e8aebeef57 | |||
| f3b044e60c | |||
| b439b6cb5a | |||
| def4be92c6 | |||
| 850a40b116 | |||
| 7ab9813995 | |||
| 28c3cd6f49 | |||
| 9866153ae7 | |||
| 99ba31df84 | |||
| e098f77a23 | |||
| 7ab5894331 | |||
| 5263c56fda | |||
| 82b6c2005b | |||
| c13d7c7847 | |||
| 7fef37cf90 | |||
| 90ad163151 | |||
| ce584b3211 | |||
| 69247496ce | |||
| 4ff1bd5110 | |||
| f7be49f2ba | |||
| ce90db86cf | |||
| dde40511cc | |||
| af6ea76a13 | |||
| 57ef613d9c | |||
| 34e440b9f8 | |||
| 4c1eaa5a54 | |||
| 2d2aea25ac | |||
| aab74299b4 | |||
| 9142b27d9e | |||
| 2e77a7d042 | |||
| 1f1b4c29fa | |||
| a948a98be6 | |||
| fa07de3284 | |||
| dd8491d723 | |||
| 032ec73dbd | |||
| 0039fad487 | |||
| 7c5992131b | |||
| db3ff14680 | |||
| 36a1666cc8 | |||
| 35b54bb673 | |||
| e93f94521c | |||
| 0ebbd71e9a | |||
| 24e674469e | |||
| 62e7ba5653 | |||
| 2bd1c66e6d | |||
| a752ea7403 | |||
| 45672e89f7 | |||
| b66064358a | |||
| 56931a426b | |||
| 6e3f88906b | |||
| ce16f28e8f | |||
| 33bc37b34c | |||
| 6c8b99f78a | |||
| ea3cd7dd58 | |||
| a3eb4d2874 | |||
| 1a3dbeb94b | |||
| d00564722e | |||
| eadf9a77e8 | |||
| 2186396570 | |||
| ca50f580f4 | |||
| a1ca9cdda0 | |||
| 097ecc5159 | |||
| f037e8115e | |||
| ff9904da03 | |||
| 930703b9eb | |||
| 95007b8c9d | |||
| 844206ec9d | |||
| ea1ecad13c | |||
| 7f77250ed5 | |||
| c76d0249c0 | |||
| 2f92b28bce | |||
| 37f11281aa | |||
| bde19d604d | |||
| 24bfff5e69 | |||
| 82a0a110b5 | |||
| 4fc4699a4d | |||
| 27610a76de | |||
| 802f7902a4 | |||
| 215cc036c3 | |||
| 269c0fc96a | |||
| 1261e60d41 | |||
| 6f4fb16200 | |||
| 9320ef939d | |||
| 8e8b7fbdee | |||
| 2f76b366ce | |||
| 349b832d2b | |||
| 928746d19f | |||
| e3a0e9ed56 | |||
| c35eb421cb | |||
| 2f665054f1 | |||
| c6ce062822 | |||
| 72fda2bdd5 | |||
| 28c0f2eeae | |||
| a21281fc48 | |||
| 2919f93b73 | |||
| 0d65274de3 | |||
| 5af9ec1040 | |||
| 5794ad54e4 | |||
| aea1ecfe15 | |||
| 52cd07eca3 | |||
| 373957c55c | |||
| 02e24ea981 | |||
| 0073756d3a | |||
| c92b156473 | |||
| e98edffd02 | |||
| 22d65e54ac | |||
| fb73b4b08d | |||
| f260549a4f | |||
| 5bc57b03bf | |||
| ad6f56c3f1 |
@ -1,9 +1,13 @@
|
||||
ARG NODE_JS_VERSION=10
|
||||
ARG NODE_JS_VERSION=16
|
||||
FROM node:${NODE_JS_VERSION}
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
RUN apt-get clean -y
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y zip
|
||||
|
||||
# Install app dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDSTCCAjGgAwIBAgIUIwN+0zglsexRKwE1RGHvlCcmrdwwDQYJKoZIhvcNAQEL
|
||||
BQAwNDEyMDAGA1UEAxMpRWxhc3RpYyBDZXJ0aWZpY2F0ZSBUb29sIEF1dG9nZW5l
|
||||
cmF0ZWQgQ0EwHhcNMTkwMjEzMDcyMjQwWhcNMjIwMjEyMDcyMjQwWjA0MTIwMAYD
|
||||
VQQDEylFbGFzdGljIENlcnRpZmljYXRlIFRvb2wgQXV0b2dlbmVyYXRlZCBDQTCC
|
||||
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANILs0JO0e7x29zeVx21qalK
|
||||
XKdX+AMlGJPH75wWO/Jq6YHtxt1wYIg762krOBXfG6JsFSOIwIv5VrzGGRGjSPt9
|
||||
OXQyXrDDiQvsBT3rpzLNdDs7KMl2tZswwv7w9ujgud0cYnS1MOpn81rfPc73DvMg
|
||||
xuhplofDx6fn3++PjVRU2FNiIVWyEoaxRjCeGPMBubKZYaYbQA6vYM4Z+ByG727B
|
||||
AyAER3t7xmvYti/EoO2hv2HQk5zgcj/Oq3AJKhnt8LH8fnfm3TnYNM1htvXqhN05
|
||||
vsvhvm2PHfnA5qLlSr/3W0aI/U/PqfsFDCgyRV097sMIaKkmavb0Ue7aQ7lgtp0C
|
||||
AwEAAaNTMFEwHQYDVR0OBBYEFDRKlCMowWR1rwxE0d1lTEQe5O71MB8GA1UdIwQY
|
||||
MBaAFDRKlCMowWR1rwxE0d1lTEQe5O71MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
|
||||
hvcNAQELBQADggEBAKbCJ95EBpeuvF70KEt6QU70k/SH1NRvM9YzKryV0D975Jvu
|
||||
HOSm9HgSTULeAUFZIa4oYyf3QUfVoI+2T/aQrfXA3gfrJWsHURkyNmiHOFAbYHqi
|
||||
xA6i249G2GTEjc1+le/M2N2CcDKAmurW6vSGK4upXQbPd6KmnhHREX74zkWjnOa+
|
||||
+tibbSSOCT4Tmja2DbBxAPuivU9IB1g/hIUmbYQqKffQrBJA0658tz6w63a/Q7xN
|
||||
pCvvbSgiMZ6qcVIcJkBT2IooYie+ax45pQECHthgIUcQAzfmIfqlU0Qfl8rDgAmn
|
||||
0c1o6HQjKGU2aVGgSRuaaiHaSZjbPIZVS51sOoI=
|
||||
MIIDSjCCAjKgAwIBAgIVAJQLm8V2LcaCTHUcoIfO+KL63nG3MA0GCSqGSIb3DQEB
|
||||
CwUAMDQxMjAwBgNVBAMTKUVsYXN0aWMgQ2VydGlmaWNhdGUgVG9vbCBBdXRvZ2Vu
|
||||
ZXJhdGVkIENBMB4XDTIwMDIyNjA1NTA1N1oXDTIzMDIyNTA1NTA1N1owNDEyMDAG
|
||||
A1UEAxMpRWxhc3RpYyBDZXJ0aWZpY2F0ZSBUb29sIEF1dG9nZW5lcmF0ZWQgQ0Ew
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDYyajkPvGtUOE5M1OowQfB
|
||||
kWVrWjo1+LIxzgCeRHp0YztLtdVJ0sk2xoSrt2uZpxcPepdyOseLTjFJex1D2yCR
|
||||
AEniIqcFif4G72nDih2LlbhpUe/+/MTryj8ZTkFTzI+eMmbQi5FFMaH+kwufmdt/
|
||||
5/w8YazO18SxxJUlzMqzfNUrhM8vvvVdxgboU7PWhk28wZHCMHQovomHmzclhRpF
|
||||
N0FMktA98vHHeRjH19P7rNhifSd7hZzoH3H148HVAKoPgqnZ6vW2O2YfAWOP6ulq
|
||||
cyszr57p8fS9B2wSdlWW7nVHU1JuKcYD67CxbBS23BeGFgCj4tiNrmxO8S5Yf85v
|
||||
AgMBAAGjUzBRMB0GA1UdDgQWBBSWAlip9eoPmnG4p4OFZeOUBlAbNDAfBgNVHSME
|
||||
GDAWgBSWAlip9eoPmnG4p4OFZeOUBlAbNDAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
|
||||
SIb3DQEBCwUAA4IBAQA19qqrMTWl7YyId+LR/QIHDrP4jfxmrEELrAL58q5Epc1k
|
||||
XxZLzOBSXoBfBrPdv+3XklWqXrZjKWfdkux0Xmjnl4qul+srrZDLJVZG3I7IrITh
|
||||
AmQUmL9MuPiMnAcxoGZp1xpijtW8Qmd2qnambbljWfkuVaa4hcVRfrAX6TciIQ21
|
||||
bS5aeLGrPqR14h30YzDp0RMmTujEa1o6ExN0+RSTkE9m89Q6WdM69az8JW7YkWqm
|
||||
I+UCG3TcLd3TXmN1zNQkq4y2ObDK4Sxy/2p6yFPI1Fds5w/zLfBOvvPQY61vEqs8
|
||||
SCCcQIe7f6NDpIRIBlty1C9IaEHj7edyHjF6rtYb
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
27
.ci/certs/ca.key
Normal file
27
.ci/certs/ca.key
Normal file
@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpgIBAAKCAQEA2Mmo5D7xrVDhOTNTqMEHwZFla1o6NfiyMc4AnkR6dGM7S7XV
|
||||
SdLJNsaEq7drmacXD3qXcjrHi04xSXsdQ9sgkQBJ4iKnBYn+Bu9pw4odi5W4aVHv
|
||||
/vzE68o/GU5BU8yPnjJm0IuRRTGh/pMLn5nbf+f8PGGsztfEscSVJczKs3zVK4TP
|
||||
L771XcYG6FOz1oZNvMGRwjB0KL6Jh5s3JYUaRTdBTJLQPfLxx3kYx9fT+6zYYn0n
|
||||
e4Wc6B9x9ePB1QCqD4Kp2er1tjtmHwFjj+rpanMrM6+e6fH0vQdsEnZVlu51R1NS
|
||||
binGA+uwsWwUttwXhhYAo+LYja5sTvEuWH/ObwIDAQABAoIBAQC8QDGnMnmPdWJ+
|
||||
13FYY3cmwel+FXXjFDk5QpgK15A2rUz6a8XxO1d7d1wR+U84uH4v9Na6XQyWjaoD
|
||||
EyPQnuJiyAtgkZLUHoY244PGR5NsePEQlBSCKmGeF5w/j1LvP/2e9EmP4wKdQYJY
|
||||
nLxFNcgEBCFnFbKIU5n8fKa/klybCrwlBokenyBro02tqH4LL7h1YMRRrl97fv1V
|
||||
e/y/0WcMN+KnMglfz6haimBRV2yamCCHHmBImC+wzOgT/quqlxPfI+a3ScHxuA65
|
||||
3QyCavaqlPh+T3lXnN/Na4UWqFtzMmwgJX2x1zM5qiln46/JoDiXtagvV43L3rNs
|
||||
LhPRFeIRAoGBAPhEB7nNpEDNjIRUL6WpebWS9brKAVY7gYn7YQrKGhhCyftyaiBZ
|
||||
zYgxPaJdqYXf+DmkWlANGoYiwEs40QwkR/FZrvO4+Xh3n3dgtl59ZmieuoQvDsG+
|
||||
RYIj+TfBaqhewhZNMMl7dxz7DeyQhyRCdsvl3VqJM0RuOsIrzrhCIEItAoGBAN+K
|
||||
lgWI7swDpOEaLmu+IWMkGImh1LswXoZqIgi/ywZ7htZjPzidOIeUsMi+lrYsKojG
|
||||
uU3sBxASsf9kYXDnuUuUbGT5M/N2ipXERt7klUAA/f5sg1IKlTrabaN/HGs/uNtf
|
||||
Efa8v/h2VyTurdPCJ17TNpbOMDwX1qGM62tyt2CLAoGBAIHCnP8iWq18QeuQTO8b
|
||||
a3/Z9hHRL22w4H4MI6aOB6GSlxuTq6CJD4IVqo9IwSg17fnCy2l3z9s4IqWuZqUf
|
||||
+XJOW8ELd2jdrT2qEOfGR1Z7UCVyqxXcq1vgDYx0zZh/HpalddB5dcJx/c8do2Ty
|
||||
UEE2PcHqYB9uNcvzNbLc7RtpAoGBALbuU0yePUTI6qGnajuTcQEPpeDjhRHWSFRZ
|
||||
ABcG1N8uMS66Mx9iUcNp462zgeP8iqY5caUZtMHreqxT+gWKK7F0+as7386pwElF
|
||||
QPXgO18QMMqHBIQb0vlBjJ1SRPBjSiSDTVEML1DljvTTOX7kEJHh6HdKrmBO5b54
|
||||
cqMQUo53AoGBAPVWRPUXCqlBz914xKna0ZUh2aesRBg5BvOoq9ey9c52EIU5PXL5
|
||||
0Isk8sWSsvhl3tjDPBH5WuL5piKgnCTqkVbEHmWu9s1T57Mw6NuxlPMLBWvyv4c6
|
||||
tB9brOxv0ui3qGMuBsBoDKbkNnwXyOXLyFg7O+H4l016A3mLQzJM+NGV
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@ -1,19 +1,19 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDIjCCAgqgAwIBAgIUI4QU6jA1dYSCbdIA6oAb2TBEluowDQYJKoZIhvcNAQEL
|
||||
BQAwNDEyMDAGA1UEAxMpRWxhc3RpYyBDZXJ0aWZpY2F0ZSBUb29sIEF1dG9nZW5l
|
||||
cmF0ZWQgQ0EwHhcNMTkwMjEzMDcyMzEzWhcNMjIwMjEyMDcyMzEzWjATMREwDwYD
|
||||
VQQDEwhpbnN0YW5jZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJeT
|
||||
yOy6EAScZxrULKjHePciiz38grivCrhFFV+dThaRCcl3DhDzb9Eny5q5iEw3WvLQ
|
||||
Rqmf01jncNIhaocTt66VqveXaMubbE8O0LcG6e4kpFO+JtnVF8JTARTc+ux/1uD6
|
||||
hO1VG/HItM7WQrQxh4hfB2u1AX2YQtoqEtXXEC+UHWfl4QzuzXjBnKCkO/L9/6Tf
|
||||
yNFQWXxKnIiTs8Xm9sEhhSCBJPlLTQu+MX4vR2Uwj5XZmflDUr+ZTenl9qYxL6b3
|
||||
SWhh/qEl4GAj1+tS7ZZOxE0237mUh3IIFYSWSaMm8K2m/BYHkLNWL5B1dMic0lsv
|
||||
osSoYrQuCef4HQMCitsCAwEAAaNNMEswHQYDVR0OBBYEFFMg4l1GLW8lYbwASY+r
|
||||
YeWYRzIiMB8GA1UdIwQYMBaAFDRKlCMowWR1rwxE0d1lTEQe5O71MAkGA1UdEwQC
|
||||
MAAwDQYJKoZIhvcNAQELBQADggEBAEQrgh1xALpumQTzsjxFRGque/vlKTgRs5Kh
|
||||
xtgapr6wjIbdq7dagee+4yNOKzS5lGVXCgwrJlHESv9qY0uumT/33vK2uduJ7NAd
|
||||
fR2ZzyBnhMX+mkYhmGrGYCTUMUIwOIQYa4Evis4W+LHmCIDG03l7gLHfdIBe9VMO
|
||||
pDZum8f6ng0MM49s8/rXODNYKw8kFyUhnfChqMi/2yggb1uUIfKlJJIchkgYjE13
|
||||
zuC+fjo029Pq1jeMIdxugLf/7I/8NiW1Yj9aCXevUXG1qzHFEuKAinBXYOZO/vWS
|
||||
LaEqOhwrzNynwgGpYAr7Rfgv4AflltYIIav4PZT03P7fbyAAf8s=
|
||||
MIIDIzCCAgugAwIBAgIVAMTO6uVx9dLox2t0lY4IcBKZXb5WMA0GCSqGSIb3DQEB
|
||||
CwUAMDQxMjAwBgNVBAMTKUVsYXN0aWMgQ2VydGlmaWNhdGUgVG9vbCBBdXRvZ2Vu
|
||||
ZXJhdGVkIENBMB4XDTIwMDIyNjA1NTA1OVoXDTIzMDIyNTA1NTA1OVowEzERMA8G
|
||||
A1UEAxMIaW5zdGFuY2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDK
|
||||
YLTOikVENiN/qYupOsoXd7VYYnryyfCC/dK4FC2aozkbqjFzBdvPGAasoc4yEiH5
|
||||
CGeXMgJuOjk1maqetmdIsw00j4oHJviYsnGXzxxS5swhD7spcW4Uk4V4tAUzrbfT
|
||||
vW/2WW/yYCLe5phVb2chz0jL+WYb4bBmdfs/t6RtP9RqsplYAmVp3gZ6lt2YNtvE
|
||||
k9gz0TVk3DuO1TquIClfRYUjuywS6xDSvxJ8Jl91EfDWM8QU+9F+YAtiv74xl2U3
|
||||
P0wwMqNvMxf9/3ak3lTQGsgO4L6cwbKpVLMMzxSVunZz/sgl19xy3qHHz1Qr2MjJ
|
||||
/2c2J7vahUL4NPRkjJClAgMBAAGjTTBLMB0GA1UdDgQWBBS2Wn8E2VZv4oenY+pR
|
||||
O8G3zfQXhzAfBgNVHSMEGDAWgBSWAlip9eoPmnG4p4OFZeOUBlAbNDAJBgNVHRME
|
||||
AjAAMA0GCSqGSIb3DQEBCwUAA4IBAQAvwPvCiJJ6v9jYcyvYY8I3gP0oCwrylpRL
|
||||
n91UlgRSHUmuAObyOoVN5518gSV/bTU2SDrstcLkLFxHvnfpoGJoxsQEHuGxwDRI
|
||||
nhYNd62EKLerehNM/F9ILKmvTh8f6QPCzjUuExTXv+63l2Sr6dBS7FHsGs6UKUYO
|
||||
llM/y9wMZ1LCuZuBg9RhtgpFXRSgDM9Z7Begu0d/BPX9od/qAeZg9Arz4rwUiCN4
|
||||
IJOMEBEPi5q1tgeS0Fb1Grpqd0Uz5tZKtEHNKzLG+zSMmkneL62Nk2HsmEFZKwzg
|
||||
u2pU42UaUE596G6o78s1aLn9ICcElPHTjiuZNSiyuu9IzvFDjGQw
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpQIBAAKCAQEAl5PI7LoQBJxnGtQsqMd49yKLPfyCuK8KuEUVX51OFpEJyXcO
|
||||
EPNv0SfLmrmITDda8tBGqZ/TWOdw0iFqhxO3rpWq95doy5tsTw7Qtwbp7iSkU74m
|
||||
2dUXwlMBFNz67H/W4PqE7VUb8ci0ztZCtDGHiF8Ha7UBfZhC2ioS1dcQL5QdZ+Xh
|
||||
DO7NeMGcoKQ78v3/pN/I0VBZfEqciJOzxeb2wSGFIIEk+UtNC74xfi9HZTCPldmZ
|
||||
+UNSv5lN6eX2pjEvpvdJaGH+oSXgYCPX61Ltlk7ETTbfuZSHcggVhJZJoybwrab8
|
||||
FgeQs1YvkHV0yJzSWy+ixKhitC4J5/gdAwKK2wIDAQABAoIBAQCRFTJna/xy/WUu
|
||||
59FLR4qAOj8++JgCwACpue4oU7/vl6nffSYokWoAr2+RzG4qTX2vFi3cpA8+dGCn
|
||||
sLZvTi8tWzKGxBTZdg2oakzaMzLr74SeZ052iCGyrZJGbvF6Ny7srr1XEXSq6+os
|
||||
ZCb6pMHOhO7saBdiKMAsY8MdjTl/33AduuE6ztqv+L92xTr2g4QlbT1KvWlEgppU
|
||||
k4Gy7zdETkPBTSH/17ZwyGJoJICIAhbL4IpmOM4dPIg8nFkVPPpy6p0z4uGjtgnK
|
||||
nreZ2EKMzCafBaHn7A77gpi0OrQdl6pe0fsGqv/323YjCJPbwwl5TsoNq44DzwiX
|
||||
3M7XiVJxAoGBAOCne56vdN4uZmCgLVGT2JSUNVPOu4bfjrxWH6cslzrPT2Zhp3lO
|
||||
M4axZ3gmcervV252YEZXntXDHHCSfrECllRN1WFD63XmyQ/CkhuvZkkeRHfzL1TE
|
||||
EdqHOTqs4sRETZ7+RITFC81DZQkWWOKeyXMjyPBqd7RnThQHijB1c8Y5AoGBAKy6
|
||||
CVKBx+zz5crVD0tz4UhOmz1wRNN0CL0l+FXRuFSgbzMIvwpfiqe25crgeLHe2M2/
|
||||
TogdWbjZ2nUZQTzoRsSkQ6cKHpj+G/gWurp/UcHHXFVwgLSPF7c3KHDtiYq7Vqw0
|
||||
bvmhM03LI6+ZIPRV7hLBr7WP7UmpAiREMF7tTnmzAoGBAIkx3w3WywFQxtblmyeB
|
||||
qbd7F2IaE23XoxyjX+tBEQ4qQqwcoSE0v8TXHIBEwjceeX+NLVhn9ClJYVniLRq+
|
||||
oL3VVqVyzB4RleJZCc98e3PV1yyFx/b1Uo3pHOsXX9lKeTjKwV9v0rhFGzPEgP3M
|
||||
yOvXA8TG0FnM6OLUg/D6GX0JAoGAMuHS4TVOGeV3ahr9mHKYiN5vKNgrzka+VEod
|
||||
L9rJ/FQOrfADpyCiDen5I5ygsXU+VM3oanyK88NpcVlxOGoMft0M+OYoQVWKE7lO
|
||||
ZKYhBX6fGqQ7pfUJPXXIOgwfmni5fZ0sm+j63g3bg10OsiumKGxaQJgXhL1+3gQg
|
||||
Y7ZwibUCgYEAlZoFFvkMLjpOSaHk1z5ZZnt19X0QUIultBwkumSqMPm+Ks7+uDrx
|
||||
thGUCoz4ecr/ci4bIUY7mB+zfAbqnBOMxreJqCRbAIuRypo1IlWkTp8DywoDOfMW
|
||||
NfzjVmzJ7EJu44nGmVAi1jw4Pbseivvi1ujMCoPgaE8I1uSh144bwN8=
|
||||
MIIEogIBAAKCAQEAymC0zopFRDYjf6mLqTrKF3e1WGJ68snwgv3SuBQtmqM5G6ox
|
||||
cwXbzxgGrKHOMhIh+QhnlzICbjo5NZmqnrZnSLMNNI+KByb4mLJxl88cUubMIQ+7
|
||||
KXFuFJOFeLQFM623071v9llv8mAi3uaYVW9nIc9Iy/lmG+GwZnX7P7ekbT/UarKZ
|
||||
WAJlad4GepbdmDbbxJPYM9E1ZNw7jtU6riApX0WFI7ssEusQ0r8SfCZfdRHw1jPE
|
||||
FPvRfmALYr++MZdlNz9MMDKjbzMX/f92pN5U0BrIDuC+nMGyqVSzDM8Ulbp2c/7I
|
||||
Jdfcct6hx89UK9jIyf9nNie72oVC+DT0ZIyQpQIDAQABAoIBADAh7f7NjgnaInlD
|
||||
ds8KB3SraPsbeQhzlPtiqRJU4j/MIFH/GYG03AGWQkget67a9y+GmzSvlTpoKKEh
|
||||
6h2TXl9BDpv4o6ht0WRn1HJ5tM/Wyqf2WNpTew3zxCPgFPikkXsPrChYPzLTQJfp
|
||||
GkP/mfTFmxfAOlPZSp4j41zVLYs53eDkAegFPVfKSr1XNNJ3QODLPcIBfxBYsiC9
|
||||
oU+jRW8xYuj31cEl5k5UqrChJ1rm3mt6cguqXKbISuoSvi13gXI6DccqhuLAU+Kr
|
||||
ib2XYrRP+pWocZo/pM9WUVoNGtFxfY88sAQtvG6gDKo2AURtFyq84Ow0h9mdixV/
|
||||
gRIDPcECgYEA5nEqE3OKuG9WuUFGXvjtn4C0F6JjflYWh7AbX51S4F6LKrW6/XHL
|
||||
Rg4BtF+XReT7OQ6llsV8kZeUxsUckkgDLzSaA8lysNDV5KkhAWHfRqH//QKFbqZi
|
||||
JL9t3x63Qt81US8s2hQk3khPYTRM8ZB3xHiXvZYSGC/0x/DxfEO3QJECgYEA4NK5
|
||||
sxtrat8sFz6SK9nWEKimPjDVzxJ0hxdX4tRq/JdOO5RncawVqt6TNP9gTuxfBvhW
|
||||
MhJYEsQj8iUoL1dxo9d1eP8HEANNV0iX5OBvJNmgBp+2OyRSyr+PA55+wAxYuAE7
|
||||
QKaitOjW57fpArNRt2hQyiSzTuqUFRWTWJHCWNUCgYAEurPTXF6vdFGCUc2g61jt
|
||||
GhYYGhQSpq+lrz6Qksj9o9MVWE9zHh++21C7o+6V16I0RJGva3QoBMVf4vG4KtQt
|
||||
5tV2WG8LI+4P2Ey+G4UajP6U8bVNVQrUmD0oBBhcvfn5JY+1Fg6/pRpD82/U0VMz
|
||||
7AmpMWhDqNBMPiymkTk0kQKBgCuWb05cSI0ly4SOKwS5bRk5uVFhYnKNH255hh6C
|
||||
FGP4acB/WzbcqC7CjEPAJ0nl5d6SExQOHmk1AcsWjR3wlCWxxiK5PwNJwJrlhh1n
|
||||
reS1FKN0H36D4lFQpkeLWQOe4Sx7gKNeKzlr0w6Fx3Uwku0+Gju2tdTdAey8jB6l
|
||||
08opAoGAEe1AuR/OFp2xw6V8TH9UHkkpGxy+OrXI6PX6tgk29PgB+uiMu4RwbjVz
|
||||
1di1KKq2XecAilVbnyqY+edADxYGbSnci9x5wQRIebfMi3VXKtV8NQBv2as6qwtW
|
||||
JDcQUWotOHjpdvmfJWWkcBhbAKrgX8ukww00ZI/lC3/rmkGnBBg=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
||||
20
.ci/certs/testnode_san.crt
Normal file
20
.ci/certs/testnode_san.crt
Normal file
@ -0,0 +1,20 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDVjCCAj6gAwIBAgIULh42yRefYlRRl1hvt055LrUH0HwwDQYJKoZIhvcNAQEL
|
||||
BQAwNDEyMDAGA1UEAxMpRWxhc3RpYyBDZXJ0aWZpY2F0ZSBUb29sIEF1dG9nZW5l
|
||||
cmF0ZWQgQ0EwHhcNMjAwMjI4MDMzNzIwWhcNMjMwMjI3MDMzNzIwWjATMREwDwYD
|
||||
VQQDEwhpbnN0YW5jZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAIUP
|
||||
t267NN21z+3ukajej8eojSXwP6zHxy7CUAp+sQ7bTq2XCKxkYX3CW9ThcS4cV9mL
|
||||
ayYdWEYnbEDGYPQDo7Wk3Ih5OEXTMZb/yNEx5D4S2lGMOS5bCDdYx6GvwCMG4jNx
|
||||
aMktosaxpprAJiHh2oLgQk0hQc/a9JfMo6kJKtuhjxsxjxLwcOHhuaUD7NS0Pjop
|
||||
CJkSYcrL+nnQPQjKe4uLhAbSyiX914h4QX0CJ0e4z1ccdDX2PFWTrwaIf//vQhCR
|
||||
wP2YKdfjR0JB4oDAlu85GsIs2cFLPysM5ufuNZO4fCr8uOwloKI8zZ2HhlIfBEcY
|
||||
Gcy4g9N/9epmxMXZlGcCAwEAAaOBgDB+MB0GA1UdDgQWBBRefYm8DHHDdkTPHhS1
|
||||
HEUwTb2uiDAfBgNVHSMEGDAWgBSWAlip9eoPmnG4p4OFZeOUBlAbNDAxBgNVHREE
|
||||
KjAogglsb2NhbGhvc3SHBH8AAAGHEAAAAAAAAAAAAAAAAAAAAAGCA2VzMTAJBgNV
|
||||
HRMEAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQC+pauqM2wJjQaHyHu+kIm59P4b/5Oj
|
||||
IH1cYCQfMB7Y2UMLxp0ew+f7o7zzE2DA52YYFDWy6J5DVWtSBPyeFGgX+RH+aA+9
|
||||
Iv4cc9QpAs6aFjncorHrzNOrWLgCHIeRAxTR0CAkeP2dUZfDBuMpRyP6rAsYzyLH
|
||||
Rb3/BfYJSI5vxgt5Ke49Y/ljDKFJTyDmAVrHQ4JWrseYE1UZ2eDkBXeiRlYE/QtB
|
||||
YsrUSqdL6zvFZyUcilxDUUabNcA+GgeGZ2lAEA90F8vwi62QwRXo3Iv1Hz+6xc43
|
||||
nFofDK9D8/qkrUD9iuhpx1974QwPhwWyjn9RZRpbZA4ngRL+szdRXR4N
|
||||
-----END CERTIFICATE-----
|
||||
27
.ci/certs/testnode_san.key
Normal file
27
.ci/certs/testnode_san.key
Normal file
@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEogIBAAKCAQEAhQ+3brs03bXP7e6RqN6Px6iNJfA/rMfHLsJQCn6xDttOrZcI
|
||||
rGRhfcJb1OFxLhxX2YtrJh1YRidsQMZg9AOjtaTciHk4RdMxlv/I0THkPhLaUYw5
|
||||
LlsIN1jHoa/AIwbiM3FoyS2ixrGmmsAmIeHaguBCTSFBz9r0l8yjqQkq26GPGzGP
|
||||
EvBw4eG5pQPs1LQ+OikImRJhysv6edA9CMp7i4uEBtLKJf3XiHhBfQInR7jPVxx0
|
||||
NfY8VZOvBoh//+9CEJHA/Zgp1+NHQkHigMCW7zkawizZwUs/Kwzm5+41k7h8Kvy4
|
||||
7CWgojzNnYeGUh8ERxgZzLiD03/16mbExdmUZwIDAQABAoIBAEwhjulLMVc9JEfV
|
||||
PP/qv0cUOBYh3LzF3T/yq4slq7Z9YgnOJYdFM8aZgqNNjc09KEJvE5JOLeiNu9Ff
|
||||
768Nugg+2HM5MCo7SN9FYCfZLOcbMFCCM2FDcnMAV9A512vzD08xryuT8dNPZ6yZ
|
||||
DfhK2hQRrb2lrpr3gwSrcGRRu3THqvq7X1RIjpLV3teDMeP8rQPAlpj8fmP+kdVV
|
||||
5y1ihiDIo87McihG9FMavJtBDXQkUEuVw6eIeir8L/zHHD/ZwhYjNHZGWbrB88sz
|
||||
CkJkfWh/FlA63tCVdJzkmnERALLTVy9mR0Sq6sUlnFhFNO2BRdWgYLrcp9McfTJC
|
||||
e8+WsSECgYEAuwQ3nAaFL0jqYu1AREyKT/f3WUenf2UsX7dwwV2/yFtQvkzW7ji4
|
||||
uZLnfUnZBojtHf35dRo+hDgtvhZhgZNAuPPsbOl/EIMTcbChEqV/3CSTFlhLFM1d
|
||||
hfM9PoM+Bt/pyUNabjD1sWM0X7WeUhzcddshY3S4daBsNsLuOzweRRcCgYEAtiSS
|
||||
4qiiGafYsY7gOHuAlOhs/00+1uWIFEHKgoHM9vzCxDN3LCmBdynHk8ZE2TAdhw+l
|
||||
7xpu6LUxKQDfGmVZa9Epg0kQmVq9c54oQP57pJ3tR+68++insEkfnaZH8jblfq2s
|
||||
sSkFrY3pdS19edq60nuft64kswKRUUkamCXTXTECgYBdoSfiMpV9bekC7DsPtq5M
|
||||
iR3KEgi2zEViCmomNTRuL+GF1NyKWdWJ+xVwcYd5MRZdvKimyyPfeGzWTUg14i42
|
||||
KtEEWgZmkukqMz8BIeCYq6sENeIpIQQgqv3PjU+Bi5r1S4Y7wsFPNRakkD4aaB6r
|
||||
1rCppWcwZMeoxwEUoO2aswKBgBdDIIdWJi3EpAY5SyWrkEZ0UMdiZC4p7nE33ddB
|
||||
IJ5CtdU9BXFcc652ZYjX/58FaCABvZ2F8LhDu92SwOusGfmNIxIjWL1dO2jywA1c
|
||||
8wmZKd7P/M7nbdMz45fMzs9+d1zwbWfK53C8+R4AC1BuwQF0zHc3BHTgVRLelUjt
|
||||
O8thAoGAdO2gHIqEsZzTgbvLbsh52eVbumjfNGnrnEv1fjb+o+/wAol8dymcmzbL
|
||||
bZCRzoyA0qwU9kdPFgX46H6so6o1tUM2GQtVFoT6kDnPv7EkLQK0C4cDh6OOHxDU
|
||||
NPvr/9fHhQd9EDWDvS1JnVMAdKDO6ELp3SoKGGmCXR2QplnqWAk=
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@ -1,94 +0,0 @@
|
||||
version: '3.2'
|
||||
services:
|
||||
client-oss:
|
||||
image: docker.elastic.co/clients/elasticsearch-js:${NODE_JS_VERSION:-10}
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: .ci/Dockerfile
|
||||
args:
|
||||
NODE_JS_VERSION: ${NODE_JS_VERSION:-10}
|
||||
CODECOV_TOKEN: ${CODECOV_TOKEN}
|
||||
environment:
|
||||
- "TEST_ES_SERVER=http://elasticsearch-oss:9200"
|
||||
volumes:
|
||||
- ..:/usr/src/app
|
||||
# This will mount the node_modules directory
|
||||
# to the host machine using the buildtime directory.
|
||||
- /usr/src/app/node_modules
|
||||
- esvol:/tmp
|
||||
networks:
|
||||
- esnet-oss
|
||||
depends_on:
|
||||
- elasticsearch-oss
|
||||
|
||||
elasticsearch-oss:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.0.0-beta1}
|
||||
volumes:
|
||||
- esvol:/tmp
|
||||
networks:
|
||||
- esnet-oss
|
||||
environment:
|
||||
- path.repo=/tmp
|
||||
- "repositories.url.allowed_urls=http://snapshot.*"
|
||||
- node.attr.testattr=test
|
||||
- bootstrap.memory_lock=false
|
||||
- "discovery.type=single-node"
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
client-platinum:
|
||||
image: docker.elastic.co/clients/elasticsearch-js:${NODE_JS_VERSION:-10}
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: .ci/Dockerfile
|
||||
args:
|
||||
NODE_JS_VERSION: ${NODE_JS_VERSION:-10}
|
||||
environment:
|
||||
- "TEST_ES_SERVER=https://elastic:changeme@elasticsearch-platinum:9200"
|
||||
volumes:
|
||||
- ..:/usr/src/app
|
||||
# This will mount the node_modules directory
|
||||
# to the host machine using the buildtime directory.
|
||||
- /usr/src/app/node_modules
|
||||
- esvol:/tmp
|
||||
networks:
|
||||
- esnet-platinum
|
||||
depends_on:
|
||||
- elasticsearch-platinum
|
||||
# there is not need to run again also the unit test
|
||||
command: ["npm", "run", "test:integration"]
|
||||
|
||||
elasticsearch-platinum:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION:-7.0.0-beta1}
|
||||
ports:
|
||||
- "9200:9200"
|
||||
networks:
|
||||
- esnet-platinum
|
||||
environment:
|
||||
- "node.attr.testattr=test"
|
||||
- "path.repo=/tmp"
|
||||
- "repositories.url.allowed_urls=http://snapshot.*"
|
||||
- "discovery.type=single-node"
|
||||
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
|
||||
- "ELASTIC_PASSWORD=changeme"
|
||||
- "xpack.security.enabled=true"
|
||||
- "xpack.license.self_generated.type=trial"
|
||||
- "xpack.security.http.ssl.enabled=true"
|
||||
- "xpack.security.http.ssl.verification_mode=certificate"
|
||||
- "xpack.security.http.ssl.key=certs/testnode.key"
|
||||
- "xpack.security.http.ssl.certificate=certs/testnode.crt"
|
||||
- "xpack.security.http.ssl.certificate_authorities=certs/ca.crt"
|
||||
- "xpack.security.transport.ssl.enabled=true"
|
||||
- "xpack.security.transport.ssl.key=certs/testnode.key"
|
||||
- "xpack.security.transport.ssl.certificate=certs/testnode.crt"
|
||||
- "xpack.security.transport.ssl.certificate_authorities=certs/ca.crt"
|
||||
volumes:
|
||||
- "./certs/testnode.crt:/usr/share/elasticsearch/config/certs/testnode.crt"
|
||||
- "./certs/testnode.key:/usr/share/elasticsearch/config/certs/testnode.key"
|
||||
- "./certs/ca.crt:/usr/share/elasticsearch/config/certs/ca.crt"
|
||||
|
||||
networks:
|
||||
# we need two networks otherwise the two ES instances will join each other
|
||||
esnet-oss:
|
||||
esnet-platinum:
|
||||
volumes:
|
||||
esvol:
|
||||
7
.ci/docker/Dockerfile
Normal file
7
.ci/docker/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
ARG NODE_JS_VERSION=10
|
||||
FROM node:${NODE_JS_VERSION}-alpine
|
||||
|
||||
RUN apk --no-cache add git
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /usr/src/app
|
||||
67
.ci/functions/cleanup.sh
Normal file
67
.ci/functions/cleanup.sh
Normal file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Shared cleanup routines between different steps
|
||||
#
|
||||
# Please source .ci/functions/imports.sh as a whole not just this file
|
||||
#
|
||||
# Version 1.0.0
|
||||
# - Initial version after refactor
|
||||
|
||||
function cleanup_volume {
|
||||
if [[ "$(docker volume ls -q -f name=$1)" ]]; then
|
||||
echo -e "\033[34;1mINFO:\033[0m Removing volume $1\033[0m"
|
||||
(docker volume rm "$1") || true
|
||||
fi
|
||||
}
|
||||
function container_running {
|
||||
if [[ "$(docker ps -q -f name=$1)" ]]; then
|
||||
return 0;
|
||||
else return 1;
|
||||
fi
|
||||
}
|
||||
function cleanup_node {
|
||||
if container_running "$1"; then
|
||||
echo -e "\033[34;1mINFO:\033[0m Removing container $1\033[0m"
|
||||
(docker container rm --force --volumes "$1") || true
|
||||
fi
|
||||
if [[ -n "$1" ]]; then
|
||||
echo -e "\033[34;1mINFO:\033[0m Removing volume $1-${suffix}-data\033[0m"
|
||||
cleanup_volume "$1-${suffix}-data"
|
||||
fi
|
||||
}
|
||||
function cleanup_network {
|
||||
if [[ "$(docker network ls -q -f name=$1)" ]]; then
|
||||
echo -e "\033[34;1mINFO:\033[0m Removing network $1\033[0m"
|
||||
(docker network rm "$1") || true
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup_trap {
|
||||
status=$?
|
||||
set +x
|
||||
if [[ "$DETACH" != "true" ]]; then
|
||||
echo -e "\033[34;1mINFO:\033[0m clean the network if not detached (start and exit)\033[0m"
|
||||
cleanup_all_in_network "$1"
|
||||
fi
|
||||
# status is 0 or SIGINT
|
||||
if [[ "$status" == "0" || "$status" == "130" ]]; then
|
||||
echo -e "\n\033[32;1mSUCCESS run-tests\033[0m"
|
||||
exit 0
|
||||
else
|
||||
echo -e "\n\033[31;1mFAILURE during run-tests\033[0m"
|
||||
exit ${status}
|
||||
fi
|
||||
};
|
||||
function cleanup_all_in_network {
|
||||
|
||||
if [[ -z "$(docker network ls -q -f name="^$1\$")" ]]; then
|
||||
echo -e "\033[34;1mINFO:\033[0m $1 is already deleted\033[0m"
|
||||
return 0
|
||||
fi
|
||||
containers=$(docker network inspect -f '{{ range $key, $value := .Containers }}{{ printf "%s\n" .Name}}{{ end }}' $1)
|
||||
while read -r container; do
|
||||
cleanup_node "$container"
|
||||
done <<< "$containers"
|
||||
cleanup_network $1
|
||||
echo -e "\033[32;1mSUCCESS:\033[0m Cleaned up and exiting\033[0m"
|
||||
};
|
||||
60
.ci/functions/imports.sh
Normal file
60
.ci/functions/imports.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Sets up all the common variables and imports relevant functions
|
||||
#
|
||||
# Version 1.0.1
|
||||
# - Initial version after refactor
|
||||
# - Validate STACK_VERSION asap
|
||||
|
||||
function require_stack_version() {
|
||||
if [[ -z $STACK_VERSION ]]; then
|
||||
echo -e "\033[31;1mERROR:\033[0m Required environment variable [STACK_VERSION] not set\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
require_stack_version
|
||||
|
||||
if [[ -z $es_node_name ]]; then
|
||||
# only set these once
|
||||
set -euo pipefail
|
||||
export TEST_SUITE=${TEST_SUITE-free}
|
||||
export RUNSCRIPTS=${RUNSCRIPTS-}
|
||||
export DETACH=${DETACH-false}
|
||||
export CLEANUP=${CLEANUP-false}
|
||||
|
||||
export es_node_name=instance
|
||||
export elastic_password=changeme
|
||||
export elasticsearch_image=elasticsearch
|
||||
export elasticsearch_scheme="https"
|
||||
if [[ $TEST_SUITE != "platinum" ]]; then
|
||||
export elasticsearch_scheme="http"
|
||||
fi
|
||||
export elasticsearch_url=${elasticsearch_scheme}://elastic:${elastic_password}@${es_node_name}:9200
|
||||
export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost}
|
||||
export elasticsearch_container="${elasticsearch_image}:${STACK_VERSION}"
|
||||
|
||||
export suffix=rest-test
|
||||
export moniker=$(echo "$elasticsearch_container" | tr -C "[:alnum:]" '-')
|
||||
export network_name=${moniker}${suffix}
|
||||
|
||||
export ssl_cert="${script_path}/certs/testnode.crt"
|
||||
export ssl_key="${script_path}/certs/testnode.key"
|
||||
export ssl_ca="${script_path}/certs/ca.crt"
|
||||
|
||||
fi
|
||||
|
||||
export script_path=$(dirname $(realpath -s $0))
|
||||
source $script_path/functions/cleanup.sh
|
||||
source $script_path/functions/wait-for-container.sh
|
||||
trap "cleanup_trap ${network_name}" EXIT
|
||||
|
||||
|
||||
if [[ "$CLEANUP" == "true" ]]; then
|
||||
cleanup_all_in_network $network_name
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "\033[34;1mINFO:\033[0m Creating network $network_name if it does not exist already \033[0m"
|
||||
docker network inspect "$network_name" > /dev/null 2>&1 || docker network create "$network_name"
|
||||
|
||||
36
.ci/functions/wait-for-container.sh
Normal file
36
.ci/functions/wait-for-container.sh
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Exposes a routine scripts can call to wait for a container if that container set up a health command
|
||||
#
|
||||
# Please source .ci/functions/imports.sh as a whole not just this file
|
||||
#
|
||||
# Version 1.0.1
|
||||
# - Initial version after refactor
|
||||
# - Make sure wait_for_contiainer is silent
|
||||
|
||||
function wait_for_container {
|
||||
set +x
|
||||
until ! container_running "$1" || (container_running "$1" && [[ "$(docker inspect -f "{{.State.Health.Status}}" ${1})" != "starting" ]]); do
|
||||
echo ""
|
||||
docker inspect -f "{{range .State.Health.Log}}{{.Output}}{{end}}" ${1}
|
||||
echo -e "\033[34;1mINFO:\033[0m waiting for node $1 to be up\033[0m"
|
||||
sleep 2;
|
||||
done;
|
||||
|
||||
# Always show logs if the container is running, this is very useful both on CI as well as while developing
|
||||
if container_running $1; then
|
||||
docker logs $1
|
||||
fi
|
||||
|
||||
if ! container_running $1 || [[ "$(docker inspect -f "{{.State.Health.Status}}" ${1})" != "healthy" ]]; then
|
||||
cleanup_all_in_network $2
|
||||
echo
|
||||
echo -e "\033[31;1mERROR:\033[0m Failed to start $1 in detached mode beyond health checks\033[0m"
|
||||
echo -e "\033[31;1mERROR:\033[0m dumped the docker log before shutting the node down\033[0m"
|
||||
return 1
|
||||
else
|
||||
echo
|
||||
echo -e "\033[32;1mSUCCESS:\033[0m Detached and healthy: ${1} on docker network: ${network_name}\033[0m"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
@ -12,6 +12,12 @@
|
||||
logrotate:
|
||||
daysToKeep: 30
|
||||
numToKeep: 100
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/main
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
properties:
|
||||
- github:
|
||||
url: https://github.com/elastic/elasticsearch-js/
|
||||
@ -27,6 +33,7 @@
|
||||
branches:
|
||||
- ${branch_specifier}
|
||||
url: https://github.com/elastic/elasticsearch-js.git
|
||||
basedir: ''
|
||||
wipe-workspace: 'True'
|
||||
triggers:
|
||||
- github
|
||||
@ -42,26 +49,33 @@
|
||||
- axis:
|
||||
type: yaml
|
||||
filename: .ci/test-matrix.yml
|
||||
name: ELASTICSEARCH_VERSION
|
||||
name: STACK_VERSION
|
||||
- axis:
|
||||
type: yaml
|
||||
filename: .ci/test-matrix.yml
|
||||
name: NODE_JS_VERSION
|
||||
- axis:
|
||||
type: yaml
|
||||
filename: .ci/test-matrix.yml
|
||||
name: TEST_SUITE
|
||||
yaml-strategy:
|
||||
exclude-key: exclude
|
||||
filename: .ci/test-matrix.yml
|
||||
wrappers:
|
||||
- ansicolor
|
||||
- timeout:
|
||||
type: absolute
|
||||
timeout: 120
|
||||
fail: true
|
||||
- timestamps
|
||||
- workspace-cleanup
|
||||
- ansicolor
|
||||
- timeout:
|
||||
type: absolute
|
||||
timeout: 120
|
||||
fail: true
|
||||
- timestamps
|
||||
- workspace-cleanup
|
||||
builders:
|
||||
- shell: |-
|
||||
#!/usr/local/bin/runbld
|
||||
.ci/run-tests
|
||||
- shell: |-
|
||||
#!/usr/local/bin/runbld
|
||||
.ci/run-tests
|
||||
publishers:
|
||||
- email:
|
||||
recipients: infra-root+build@elastic.co
|
||||
- email:
|
||||
recipients: build-lang-clients@elastic.co
|
||||
- junit:
|
||||
results: "**/*-junit.xml"
|
||||
allow-empty-results: true
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
---
|
||||
- job:
|
||||
name: elastic+elasticsearch-js+5.x
|
||||
display-name: 'elastic / elasticsearch-js # 5.x'
|
||||
description: Testing the elasticsearch-js 5.x branch.
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/5.x
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
triggers:
|
||||
- github
|
||||
- timed: '@weekly'
|
||||
@ -1,14 +0,0 @@
|
||||
---
|
||||
- job:
|
||||
name: elastic+elasticsearch-js+6.x
|
||||
display-name: 'elastic / elasticsearch-js # 6.x'
|
||||
description: Testing the elasticsearch-js 6.x branch.
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/6.x
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
triggers:
|
||||
- github
|
||||
- timed: '@weekly'
|
||||
15
.ci/jobs/elastic+elasticsearch-js+7.17.yml
Normal file
15
.ci/jobs/elastic+elasticsearch-js+7.17.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
- job:
|
||||
name: elastic+elasticsearch-js+7.17
|
||||
display-name: 'elastic / elasticsearch-js # 7.17'
|
||||
description: Testing the elasticsearch-js 7.17 branch.
|
||||
junit_results: "*-junit.xml"
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/7.17
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
triggers:
|
||||
- github
|
||||
- timed: 'H */12 * * *'
|
||||
@ -1,14 +0,0 @@
|
||||
---
|
||||
- job:
|
||||
name: elastic+elasticsearch-js+7.x
|
||||
display-name: 'elastic / elasticsearch-js # 7.x'
|
||||
description: Testing the elasticsearch-js 7.x branch.
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/7.x
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
triggers:
|
||||
- github
|
||||
- timed: '@weekly'
|
||||
15
.ci/jobs/elastic+elasticsearch-js+8.0.yml
Normal file
15
.ci/jobs/elastic+elasticsearch-js+8.0.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
- job:
|
||||
name: elastic+elasticsearch-js+8.0
|
||||
display-name: 'elastic / elasticsearch-js # 8.0'
|
||||
description: Testing the elasticsearch-js 8.0 branch.
|
||||
junit_results: "*-junit.xml"
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/8.0
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
triggers:
|
||||
- github
|
||||
- timed: 'H */12 * * *'
|
||||
15
.ci/jobs/elastic+elasticsearch-js+8.1.yml
Normal file
15
.ci/jobs/elastic+elasticsearch-js+8.1.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
- job:
|
||||
name: elastic+elasticsearch-js+8.1
|
||||
display-name: 'elastic / elasticsearch-js # 8.1'
|
||||
description: Testing the elasticsearch-js 8.1 branch.
|
||||
junit_results: "*-junit.xml"
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/8.1
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
triggers:
|
||||
- github
|
||||
- timed: 'H */12 * * *'
|
||||
15
.ci/jobs/elastic+elasticsearch-js+main.yml
Normal file
15
.ci/jobs/elastic+elasticsearch-js+main.yml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
- job:
|
||||
name: elastic+elasticsearch-js+main
|
||||
display-name: 'elastic / elasticsearch-js # main'
|
||||
description: Testing the elasticsearch-js main branch.
|
||||
junit_results: "*-junit.xml"
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/main
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
triggers:
|
||||
- github
|
||||
- timed: 'H */12 * * *'
|
||||
@ -1,14 +0,0 @@
|
||||
---
|
||||
- job:
|
||||
name: elastic+elasticsearch-js+master
|
||||
display-name: 'elastic / elasticsearch-js # master'
|
||||
description: Testing the elasticsearch-js master branch.
|
||||
parameters:
|
||||
- string:
|
||||
name: branch_specifier
|
||||
default: refs/heads/master
|
||||
description: the Git branch specifier to build (<branchName>, <tagName>,
|
||||
<commitId>, etc.)
|
||||
triggers:
|
||||
- github
|
||||
- timed: '@daily'
|
||||
@ -3,6 +3,7 @@
|
||||
name: elastic+elasticsearch-js+pull-request
|
||||
display-name: 'elastic / elasticsearch-js # pull-request'
|
||||
description: Testing of elasticsearch-js pull requests.
|
||||
junit_results: "*-junit.xml"
|
||||
scm:
|
||||
- git:
|
||||
branches:
|
||||
@ -16,4 +17,3 @@
|
||||
github-hooks: true
|
||||
status-context: clients-ci
|
||||
cancel-builds-on-update: true
|
||||
publishers: []
|
||||
|
||||
125
.ci/make.mjs
Normal file
125
.ci/make.mjs
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/* global $ argv */
|
||||
|
||||
'use strict'
|
||||
|
||||
import 'zx/globals'
|
||||
|
||||
import { readFile, writeFile } from 'fs/promises'
|
||||
import assert from 'assert'
|
||||
import { join } from 'desm'
|
||||
import semver from 'semver'
|
||||
|
||||
assert(typeof argv.task === 'string', 'Missing task parameter')
|
||||
|
||||
switch (argv.task) {
|
||||
case 'release':
|
||||
release(argv._).catch(onError)
|
||||
break
|
||||
case 'bump':
|
||||
bump(argv._).catch(onError)
|
||||
break
|
||||
case 'codegen':
|
||||
codegen(argv._).catch(onError)
|
||||
break
|
||||
default:
|
||||
console.log(`Unknown task: ${argv.task}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
async function release (args) {
|
||||
assert(args.length === 2, 'Release task expects two parameters')
|
||||
let [version, outputFolder] = args
|
||||
|
||||
if (process.env.WORKFLOW === 'snapshot' && !version.endsWith('SNAPSHOT')) {
|
||||
version = `${version}-SNAPSHOT`
|
||||
}
|
||||
|
||||
await bump([version])
|
||||
|
||||
const packageJson = JSON.parse(await readFile(
|
||||
join(import.meta.url, '..', 'package.json'),
|
||||
'utf8'
|
||||
))
|
||||
|
||||
await $`npm run build`
|
||||
await $`npm pack`
|
||||
await $`zip elasticsearch-js-${version}.zip elastic-elasticsearch-${packageJson.version}.tgz`
|
||||
await $`rm elastic-elasticsearch-${packageJson.version}.tgz`
|
||||
await $`mv ${join(import.meta.url, '..', `elasticsearch-js-${version}.zip`)} ${join(import.meta.url, '..', outputFolder, `elasticsearch-js-${version}.zip`)}`
|
||||
}
|
||||
|
||||
async function bump (args) {
|
||||
assert(args.length === 1, 'Bump task expects one parameter')
|
||||
const [version] = args
|
||||
const packageJson = JSON.parse(await readFile(
|
||||
join(import.meta.url, '..', 'package.json'),
|
||||
'utf8'
|
||||
))
|
||||
|
||||
const cleanVersion = semver.clean(version.includes('SNAPSHOT') ? version.split('-')[0] : version)
|
||||
assert(semver.valid(cleanVersion))
|
||||
packageJson.version = cleanVersion
|
||||
packageJson.versionCanary = `${cleanVersion}-canary.0`
|
||||
|
||||
await writeFile(
|
||||
join(import.meta.url, '..', 'package.json'),
|
||||
JSON.stringify(packageJson, null, 2),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
const testMatrix = await readFile(join(import.meta.url, 'test-matrix.yml'), 'utf8')
|
||||
await writeFile(
|
||||
join(import.meta.url, 'test-matrix.yml'),
|
||||
testMatrix.replace(/STACK_VERSION:\s+\- "[0-9]+[0-9\.]*[0-9](?:\-SNAPSHOT)?"/, `STACK_VERSION:\n - "${cleanVersion}-SNAPSHOT"`), // eslint-disable-line
|
||||
'utf8'
|
||||
)
|
||||
}
|
||||
|
||||
// this command can only be executed locally for now
|
||||
async function codegen (args) {
|
||||
assert(args.length === 1, 'Bump task expects one parameter')
|
||||
const clientGeneratorPath = join(import.meta.url, '..', '..', 'elastic-client-generator-js')
|
||||
const [version] = args
|
||||
|
||||
const isGeneratorCloned = await $`[[ -d ${clientGeneratorPath} ]]`.exitCode === 0
|
||||
assert(isGeneratorCloned, 'You must clone the elastic-client-generator-js first')
|
||||
|
||||
await $`npm install --prefix ${clientGeneratorPath}`
|
||||
// this command will take a while!
|
||||
if (version === 'main') {
|
||||
await $`npm run elasticsearch --prefix ${clientGeneratorPath} -- --version main`
|
||||
} else {
|
||||
await $`npm run elasticsearch --prefix ${clientGeneratorPath} -- --version ${version.split('.').slice(0, 2).join('.')}`
|
||||
}
|
||||
await $`npm run lint --prefix ${clientGeneratorPath}`
|
||||
|
||||
await $`rm -rf ${join(import.meta.url, '..', 'src', 'api')}`
|
||||
await $`mkdir ${join(import.meta.url, '..', 'src', 'api')}`
|
||||
await $`cp -R ${join(import.meta.url, '..', '..', 'elastic-client-generator-js', 'output')}/* ${join(import.meta.url, '..', 'src', 'api')}`
|
||||
await $`mv ${join(import.meta.url, '..', 'src', 'api', 'reference.asciidoc')} ${join(import.meta.url, '..', 'docs', 'reference.asciidoc')}`
|
||||
await $`npm run build`
|
||||
}
|
||||
|
||||
function onError (err) {
|
||||
console.log(err)
|
||||
process.exit(1)
|
||||
}
|
||||
180
.ci/make.sh
Executable file
180
.ci/make.sh
Executable file
@ -0,0 +1,180 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ------------------------------------------------------- #
|
||||
#
|
||||
# Skeleton for common build entry script for all elastic
|
||||
# clients. Needs to be adapted to individual client usage.
|
||||
#
|
||||
# Must be called: ./.ci/make.sh <target> <params>
|
||||
#
|
||||
# Version: 1.1.0
|
||||
#
|
||||
# Targets:
|
||||
# ---------------------------
|
||||
# assemble <VERSION> : build client artefacts with version
|
||||
# bump <VERSION> : bump client internals to version
|
||||
# codegen <VERSION> : generate endpoints
|
||||
# docsgen <VERSION> : generate documentation
|
||||
# examplegen : generate the doc examples
|
||||
# clean : clean workspace
|
||||
#
|
||||
# ------------------------------------------------------- #
|
||||
|
||||
# ------------------------------------------------------- #
|
||||
# Bootstrap
|
||||
# ------------------------------------------------------- #
|
||||
|
||||
script_path=$(dirname "$(realpath -s "$0")")
|
||||
repo=$(realpath "$script_path/../")
|
||||
generator=$(realpath "$script_path/../../elastic-client-generator-js")
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
CMD=$1
|
||||
TASK=$1
|
||||
TASK_ARGS=()
|
||||
VERSION=$2
|
||||
STACK_VERSION=$VERSION
|
||||
NODE_JS_VERSION=16
|
||||
WORKFLOW=${WORKFLOW-staging}
|
||||
set -euo pipefail
|
||||
|
||||
product="elastic/elasticsearch-js"
|
||||
output_folder=".ci/output"
|
||||
OUTPUT_DIR="$repo/${output_folder}"
|
||||
REPO_BINDING="${OUTPUT_DIR}:/sln/${output_folder}"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
echo -e "\033[34;1mINFO:\033[0m PRODUCT ${product}\033[0m"
|
||||
echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m"
|
||||
echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m"
|
||||
|
||||
# ------------------------------------------------------- #
|
||||
# Parse Command
|
||||
# ------------------------------------------------------- #
|
||||
|
||||
case $CMD in
|
||||
clean)
|
||||
echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m"
|
||||
rm -rf "$output_folder"
|
||||
echo -e "\033[32;1mdone.\033[0m"
|
||||
exit 0
|
||||
;;
|
||||
assemble)
|
||||
if [ -v $VERSION ]; then
|
||||
echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "\033[36;1mTARGET: assemble artefact $VERSION\033[0m"
|
||||
TASK=release
|
||||
TASK_ARGS=("$VERSION" "$output_folder")
|
||||
;;
|
||||
codegen)
|
||||
if [ -v $VERSION ]; then
|
||||
echo -e "\033[31;1mTARGET: codegen -> missing version parameter\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "\033[36;1mTARGET: codegen API v$VERSION\033[0m"
|
||||
TASK=codegen
|
||||
# VERSION is BRANCH here for now
|
||||
TASK_ARGS=("$VERSION")
|
||||
;;
|
||||
docsgen)
|
||||
if [ -v $VERSION ]; then
|
||||
echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m"
|
||||
TASK=codegen
|
||||
# VERSION is BRANCH here for now
|
||||
TASK_ARGS=("$VERSION" "$codegen_folder")
|
||||
;;
|
||||
examplesgen)
|
||||
echo -e "\033[36;1mTARGET: generate examples\033[0m"
|
||||
TASK=codegen
|
||||
# VERSION is BRANCH here for now
|
||||
TASK_ARGS=("$VERSION" "$codegen_folder")
|
||||
;;
|
||||
bump)
|
||||
if [ -v $VERSION ]; then
|
||||
echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m"
|
||||
TASK=bump
|
||||
# VERSION is BRANCH here for now
|
||||
TASK_ARGS=("$VERSION")
|
||||
;;
|
||||
*)
|
||||
echo -e "\nUsage:\n\t $CMD is not supported right now\n"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
||||
# ------------------------------------------------------- #
|
||||
# Build Container
|
||||
# ------------------------------------------------------- #
|
||||
|
||||
echo -e "\033[34;1mINFO: building $product container\033[0m"
|
||||
|
||||
docker build \
|
||||
--file .ci/Dockerfile \
|
||||
--tag ${product} \
|
||||
--build-arg NODE_JS_VERSION=${NODE_JS_VERSION} \
|
||||
--build-arg USER_ID="$(id -u)" \
|
||||
--build-arg GROUP_ID="$(id -g)" \
|
||||
.
|
||||
|
||||
# ------------------------------------------------------- #
|
||||
# Run the Container
|
||||
# ------------------------------------------------------- #
|
||||
|
||||
echo -e "\033[34;1mINFO: running $product container\033[0m"
|
||||
|
||||
docker run \
|
||||
--volume $repo:/usr/src/app \
|
||||
--volume $generator:/usr/src/elastic-client-generator-js \
|
||||
--volume /usr/src/app/node_modules \
|
||||
--env "WORKFLOW=${WORKFLOW}" \
|
||||
--name make-elasticsearch-js \
|
||||
--rm \
|
||||
$product \
|
||||
node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}
|
||||
|
||||
# ------------------------------------------------------- #
|
||||
# Post Command tasks & checks
|
||||
# ------------------------------------------------------- #
|
||||
|
||||
if [[ "$CMD" == "assemble" ]]; then
|
||||
if compgen -G ".ci/output/*" > /dev/null; then
|
||||
echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m"
|
||||
else
|
||||
echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$CMD" == "bump" ]]; then
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo -e "\033[32;1mTARGET: successfully bumped client v$VERSION\033[0m"
|
||||
else
|
||||
echo -e "\033[31;1mTARGET: failed bumped client v$VERSION\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$CMD" == "codegen" ]]; then
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo -e "\033[32;1mTARGET: successfully generated client v$VERSION\033[0m"
|
||||
else
|
||||
echo -e "\033[31;1mTARGET: failed generating client v$VERSION\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$CMD" == "docsgen" ]]; then
|
||||
echo "TODO"
|
||||
fi
|
||||
|
||||
if [[ "$CMD" == "examplesgen" ]]; then
|
||||
echo "TODO"
|
||||
fi
|
||||
14
.ci/packer_cache.sh
Normal file
14
.ci/packer_cache.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /usr/local/bin/bash_standard_lib.sh
|
||||
|
||||
DOCKER_IMAGES="node:17-alpine
|
||||
node:16-alpine
|
||||
node:14-alpine
|
||||
"
|
||||
|
||||
for di in ${DOCKER_IMAGES}
|
||||
do
|
||||
(retry 2 docker pull "${di}") || echo "Error pulling ${di} Docker image, we continue"
|
||||
done
|
||||
|
||||
143
.ci/run-elasticsearch.sh
Executable file
143
.ci/run-elasticsearch.sh
Executable file
@ -0,0 +1,143 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Launch one or more Elasticsearch nodes via the Docker image,
|
||||
# to form a cluster suitable for running the REST API tests.
|
||||
#
|
||||
# Export the STACK_VERSION variable, eg. '8.0.0-SNAPSHOT'.
|
||||
# Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'.
|
||||
# Export the NUMBER_OF_NODES variable to start more than 1 node
|
||||
|
||||
# Version 1.6.1
|
||||
# - Initial version of the run-elasticsearch.sh script
|
||||
# - Deleting the volume should not dependent on the container still running
|
||||
# - Fixed `ES_JAVA_OPTS` config
|
||||
# - Moved to STACK_VERSION and TEST_VERSION
|
||||
# - Refactored into functions and imports
|
||||
# - Support NUMBER_OF_NODES
|
||||
# - Added 5 retries on docker pull for fixing transient network errors
|
||||
# - Added flags to make local CCR configurations work
|
||||
# - Added action.destructive_requires_name=false as the default will be true in v8
|
||||
# - Added ingest.geoip.downloader.enabled=false as it causes false positives in testing
|
||||
# - Moved ELASTIC_PASSWORD and xpack.security.enabled to the base arguments for "Security On by default"
|
||||
# - Use https only when TEST_SUITE is "platinum", when "free" use http
|
||||
# - Set xpack.security.enabled=false for "free" and xpack.security.enabled=true for "platinum"
|
||||
|
||||
script_path=$(dirname $(realpath -s $0))
|
||||
source $script_path/functions/imports.sh
|
||||
set -euo pipefail
|
||||
|
||||
echo -e "\033[34;1mINFO:\033[0m Take down node if called twice with the same arguments (DETACH=true) or on seperate terminals \033[0m"
|
||||
cleanup_node $es_node_name
|
||||
|
||||
master_node_name=${es_node_name}
|
||||
cluster_name=${moniker}${suffix}
|
||||
|
||||
declare -a volumes
|
||||
environment=($(cat <<-END
|
||||
--env ELASTIC_PASSWORD=$elastic_password
|
||||
--env node.name=$es_node_name
|
||||
--env cluster.name=$cluster_name
|
||||
--env cluster.initial_master_nodes=$master_node_name
|
||||
--env discovery.seed_hosts=$master_node_name
|
||||
--env cluster.routing.allocation.disk.threshold_enabled=false
|
||||
--env bootstrap.memory_lock=true
|
||||
--env node.attr.testattr=test
|
||||
--env path.repo=/tmp
|
||||
--env repositories.url.allowed_urls=http://snapshot.test*
|
||||
--env action.destructive_requires_name=false
|
||||
--env ingest.geoip.downloader.enabled=false
|
||||
--env cluster.deprecation_indexing.enabled=false
|
||||
END
|
||||
))
|
||||
if [[ "$TEST_SUITE" == "platinum" ]]; then
|
||||
environment+=($(cat <<-END
|
||||
--env xpack.security.enabled=true
|
||||
--env xpack.license.self_generated.type=trial
|
||||
--env xpack.security.http.ssl.enabled=true
|
||||
--env xpack.security.http.ssl.verification_mode=certificate
|
||||
--env xpack.security.http.ssl.key=certs/testnode.key
|
||||
--env xpack.security.http.ssl.certificate=certs/testnode.crt
|
||||
--env xpack.security.http.ssl.certificate_authorities=certs/ca.crt
|
||||
--env xpack.security.transport.ssl.enabled=true
|
||||
--env xpack.security.transport.ssl.verification_mode=certificate
|
||||
--env xpack.security.transport.ssl.key=certs/testnode.key
|
||||
--env xpack.security.transport.ssl.certificate=certs/testnode.crt
|
||||
--env xpack.security.transport.ssl.certificate_authorities=certs/ca.crt
|
||||
END
|
||||
))
|
||||
volumes+=($(cat <<-END
|
||||
--volume $ssl_cert:/usr/share/elasticsearch/config/certs/testnode.crt
|
||||
--volume $ssl_key:/usr/share/elasticsearch/config/certs/testnode.key
|
||||
--volume $ssl_ca:/usr/share/elasticsearch/config/certs/ca.crt
|
||||
END
|
||||
))
|
||||
else
|
||||
environment+=($(cat <<-END
|
||||
--env xpack.security.enabled=false
|
||||
--env xpack.security.http.ssl.enabled=false
|
||||
END
|
||||
))
|
||||
fi
|
||||
|
||||
cert_validation_flags=""
|
||||
if [[ "$TEST_SUITE" == "platinum" ]]; then
|
||||
cert_validation_flags="--insecure --cacert /usr/share/elasticsearch/config/certs/ca.crt --resolve ${es_node_name}:443:127.0.0.1"
|
||||
fi
|
||||
|
||||
# Pull the container, retry on failures up to 5 times with
|
||||
# short delays between each attempt. Fixes most transient network errors.
|
||||
docker_pull_attempts=0
|
||||
until [ "$docker_pull_attempts" -ge 5 ]
|
||||
do
|
||||
docker pull docker.elastic.co/elasticsearch/"$elasticsearch_container" && break
|
||||
docker_pull_attempts=$((docker_pull_attempts+1))
|
||||
echo "Failed to pull image, retrying in 10 seconds (retry $docker_pull_attempts/5)..."
|
||||
sleep 10
|
||||
done
|
||||
|
||||
NUMBER_OF_NODES=${NUMBER_OF_NODES-1}
|
||||
http_port=9200
|
||||
for (( i=0; i<$NUMBER_OF_NODES; i++, http_port++ )); do
|
||||
node_name=${es_node_name}$i
|
||||
node_url=${external_elasticsearch_url/9200/${http_port}}$i
|
||||
if [[ "$i" == "0" ]]; then node_name=$es_node_name; fi
|
||||
environment+=($(cat <<-END
|
||||
--env node.name=$node_name
|
||||
END
|
||||
))
|
||||
echo "$i: $http_port $node_url "
|
||||
volume_name=${node_name}-${suffix}-data
|
||||
volumes+=($(cat <<-END
|
||||
--volume $volume_name:/usr/share/elasticsearch/data${i}
|
||||
END
|
||||
))
|
||||
|
||||
# make sure we detach for all but the last node if DETACH=false (default) so all nodes are started
|
||||
local_detach="true"
|
||||
if [[ "$i" == "$((NUMBER_OF_NODES-1))" ]]; then local_detach=$DETACH; fi
|
||||
echo -e "\033[34;1mINFO:\033[0m Starting container $node_name \033[0m"
|
||||
set -x
|
||||
docker run \
|
||||
--name "$node_name" \
|
||||
--network "$network_name" \
|
||||
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g -da:org.elasticsearch.xpack.ccr.index.engine.FollowingEngineAssertions" \
|
||||
"${environment[@]}" \
|
||||
"${volumes[@]}" \
|
||||
--publish "$http_port":9200 \
|
||||
--ulimit nofile=65536:65536 \
|
||||
--ulimit memlock=-1:-1 \
|
||||
--detach="$local_detach" \
|
||||
--health-cmd="curl $cert_validation_flags --fail $elasticsearch_url/_cluster/health || exit 1" \
|
||||
--health-interval=2s \
|
||||
--health-retries=20 \
|
||||
--health-timeout=2s \
|
||||
--rm \
|
||||
docker.elastic.co/elasticsearch/"$elasticsearch_container";
|
||||
|
||||
set +x
|
||||
if wait_for_container "$es_node_name" "$network_name"; then
|
||||
echo -e "\033[32;1mSUCCESS:\033[0m Running on: $node_url\033[0m"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
43
.ci/run-repository.sh
Executable file
43
.ci/run-repository.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# parameters are available to this script
|
||||
|
||||
# STACK_VERSION -- version e.g Major.Minor.Patch(-Prelease)
|
||||
# TEST_SUITE -- which test suite to run: free or platinum
|
||||
# ELASTICSEARCH_URL -- The url at which elasticsearch is reachable, a default is composed based on STACK_VERSION and TEST_SUITE
|
||||
# NODE_JS_VERSION -- node js version (defined in test-matrix.yml, a default is hardcoded here)
|
||||
script_path=$(dirname $(realpath -s $0))
|
||||
source $script_path/functions/imports.sh
|
||||
set -euo pipefail
|
||||
|
||||
NODE_JS_VERSION=${NODE_JS_VERSION-16}
|
||||
ELASTICSEARCH_URL=${ELASTICSEARCH_URL-"$elasticsearch_url"}
|
||||
elasticsearch_container=${elasticsearch_container-}
|
||||
|
||||
echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m"
|
||||
echo -e "\033[34;1mINFO:\033[0m TEST_SUITE ${TEST_SUITE}\033[0m"
|
||||
echo -e "\033[34;1mINFO:\033[0m URL ${ELASTICSEARCH_URL}\033[0m"
|
||||
echo -e "\033[34;1mINFO:\033[0m CONTAINER ${elasticsearch_container}\033[0m"
|
||||
echo -e "\033[34;1mINFO:\033[0m NODE_JS_VERSION ${NODE_JS_VERSION}\033[0m"
|
||||
|
||||
echo -e "\033[1m>>>>> Build docker container >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
|
||||
docker build \
|
||||
--file .ci/Dockerfile \
|
||||
--tag elastic/elasticsearch-js \
|
||||
--build-arg NODE_JS_VERSION=${NODE_JS_VERSION} \
|
||||
.
|
||||
|
||||
echo -e "\033[1m>>>>> NPM run test:integration >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
|
||||
repo=$(realpath $(dirname $(realpath -s $0))/../)
|
||||
|
||||
docker run \
|
||||
--network=${network_name} \
|
||||
--env "TEST_ES_SERVER=${ELASTICSEARCH_URL}" \
|
||||
--env "TEST_SUITE=${TEST_SUITE}" \
|
||||
--volume $repo:/usr/src/app \
|
||||
--volume /usr/src/app/node_modules \
|
||||
--name elasticsearch-js \
|
||||
--rm \
|
||||
elastic/elasticsearch-js \
|
||||
npm run test:integration
|
||||
123
.ci/run-tests
123
.ci/run-tests
@ -1,110 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Runs the client tests via Docker with the expectation that the required
|
||||
# environment variables have already been exported before running this script.
|
||||
#
|
||||
# The required environment variables include:
|
||||
#
|
||||
# - $ELASTICSEARCH_VERSION
|
||||
# - $NODE_JS_VERSION
|
||||
#
|
||||
# Version 1.1
|
||||
# - Moved to .ci folder and seperated out `run-repository.sh`
|
||||
# - Add `$RUNSCRIPTS` env var for running Elasticsearch dependent products
|
||||
script_path=$(dirname $(realpath -s $0))
|
||||
source $script_path/functions/imports.sh
|
||||
set -euo pipefail
|
||||
|
||||
set -eo pipefail
|
||||
echo -e "\033[1m>>>>> Start [$STACK_VERSION container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
DETACH=true bash .ci/run-elasticsearch.sh
|
||||
|
||||
set +x
|
||||
export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID" secret_id="$VAULT_SECRET_ID")
|
||||
export CODECOV_TOKEN=$(vault read -field=token secret/clients-ci/elasticsearch-js/codecov)
|
||||
unset VAULT_ROLE_ID VAULT_SECRET_ID VAULT_TOKEN
|
||||
set -x
|
||||
|
||||
function cleanup {
|
||||
docker container rm --force --volumes elasticsearch-oss > /dev/null 2>&1 || true
|
||||
docker container rm --force --volumes elasticsearch-platinum > /dev/null 2>&1 || true
|
||||
docker container rm --force --volumes elasticsearch-js-oss > /dev/null 2>&1 || true
|
||||
docker container rm --force --volumes elasticsearch-js-platinum > /dev/null 2>&1 || true
|
||||
docker network rm esnet-oss > /dev/null
|
||||
docker network rm esnet-platinum > /dev/null
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# create network and volume
|
||||
docker network create esnet-oss
|
||||
docker network create esnet-platinum
|
||||
|
||||
# create client image
|
||||
docker build \
|
||||
--file .ci/Dockerfile \
|
||||
--tag elastic/elasticsearch-js \
|
||||
--build-arg NODE_JS_VERSION=${NODE_JS_VERSION} \
|
||||
.
|
||||
|
||||
# run elasticsearch oss
|
||||
docker run \
|
||||
--rm \
|
||||
--env "node.attr.testattr=test" \
|
||||
--env "path.repo=/tmp" \
|
||||
--env "repositories.url.allowed_urls=http://snapshot.*" \
|
||||
--env "discovery.type=single-node" \
|
||||
--network=esnet-oss \
|
||||
--name=elasticsearch-oss \
|
||||
--detach \
|
||||
docker.elastic.co/elasticsearch/elasticsearch-oss:${ELASTICSEARCH_VERSION}
|
||||
|
||||
# run elasticsearch platinum
|
||||
repo=$(pwd)
|
||||
testnodecrt="/.ci/certs/testnode.crt"
|
||||
testnodekey="/.ci/certs/testnode.key"
|
||||
cacrt="/.ci/certs/ca.crt"
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
--env "node.attr.testattr=test" \
|
||||
--env "path.repo=/tmp" \
|
||||
--env "repositories.url.allowed_urls=http://snapshot.*" \
|
||||
--env "discovery.type=single-node" \
|
||||
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
|
||||
--env "ELASTIC_PASSWORD=changeme" \
|
||||
--env "xpack.security.enabled=true" \
|
||||
--env "xpack.license.self_generated.type=trial" \
|
||||
--env "xpack.security.http.ssl.enabled=true" \
|
||||
--env "xpack.security.http.ssl.verification_mode=certificate" \
|
||||
--env "xpack.security.http.ssl.key=certs/testnode.key" \
|
||||
--env "xpack.security.http.ssl.certificate=certs/testnode.crt" \
|
||||
--env "xpack.security.http.ssl.certificate_authorities=certs/ca.crt" \
|
||||
--env "xpack.security.transport.ssl.enabled=true" \
|
||||
--env "xpack.security.transport.ssl.key=certs/testnode.key" \
|
||||
--env "xpack.security.transport.ssl.certificate=certs/testnode.crt" \
|
||||
--env "xpack.security.transport.ssl.certificate_authorities=certs/ca.crt" \
|
||||
--volume "$repo$testnodecrt:/usr/share/elasticsearch/config/certs/testnode.crt" \
|
||||
--volume "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \
|
||||
--volume "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \
|
||||
--network=esnet-platinum \
|
||||
--name=elasticsearch-platinum \
|
||||
--detach \
|
||||
docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION}
|
||||
|
||||
# run the client unit and oss integration test
|
||||
docker run \
|
||||
--network=esnet-oss \
|
||||
--env "TEST_ES_SERVER=http://elasticsearch-oss:9200" \
|
||||
--env "CODECOV_TOKEN" \
|
||||
--volume $repo:/usr/src/app \
|
||||
--volume /usr/src/app/node_modules \
|
||||
--name elasticsearch-js-oss \
|
||||
--rm \
|
||||
elastic/elasticsearch-js \
|
||||
npm run ci
|
||||
|
||||
# run the client platinium integration test
|
||||
docker run \
|
||||
--network=esnet-platinum \
|
||||
--env "TEST_ES_SERVER=https://elastic:changeme@elasticsearch-platinum:9200" \
|
||||
--volume $repo:/usr/src/app \
|
||||
--volume /usr/src/app/node_modules \
|
||||
--name elasticsearch-js-platinum \
|
||||
--rm \
|
||||
elastic/elasticsearch-js \
|
||||
npm run test:integration
|
||||
if [[ -n "$RUNSCRIPTS" ]]; then
|
||||
for RUNSCRIPT in ${RUNSCRIPTS//,/ } ; do
|
||||
echo -e "\033[1m>>>>> Running run-$RUNSCRIPT.sh >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
CONTAINER_NAME=${RUNSCRIPT} \
|
||||
DETACH=true \
|
||||
bash .ci/run-${RUNSCRIPT}.sh
|
||||
done
|
||||
fi
|
||||
|
||||
echo -e "\033[1m>>>>> Repository specific tests >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
|
||||
bash .ci/run-repository.sh
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
---
|
||||
ELASTICSEARCH_VERSION:
|
||||
- 7.0.0-beta1
|
||||
STACK_VERSION:
|
||||
- "8.2.0-SNAPSHOT"
|
||||
|
||||
NODE_JS_VERSION:
|
||||
- 11
|
||||
- 10
|
||||
- 8
|
||||
- 6
|
||||
- 18
|
||||
- 16
|
||||
- 14
|
||||
|
||||
TEST_SUITE:
|
||||
- free
|
||||
- platinum
|
||||
|
||||
exclude: ~
|
||||
|
||||
2
.github/ISSUE_TEMPLATE.md
vendored
2
.github/ISSUE_TEMPLATE.md
vendored
@ -3,7 +3,7 @@
|
||||
#### You have already researched for similar issues?
|
||||
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.
|
||||
|
||||
#### Are you sure this is an issue with @elastic/elasticsearch or are you just looking for some help?
|
||||
#### Are you sure this is an issue with `@elastic/elasticsearch` or are you just looking for some help?
|
||||
|
||||
Issues should only be posted in this repository after you have been able to reproduce them and confirm that they are a bug or incorrect/missing information in the [docs](https://github.com/elastic/elasticsearch-js/docs).
|
||||
|
||||
|
||||
10
.github/ISSUE_TEMPLATE/bug.md
vendored
10
.github/ISSUE_TEMPLATE/bug.md
vendored
@ -23,6 +23,14 @@ Paste your code here:
|
||||
|
||||
```
|
||||
|
||||
<!--
|
||||
In some cases, it might be challenging to reproduce the bug in a few lines of code.
|
||||
You can fork the following repository, which contains all the configuration needed
|
||||
to spin up a three nodes Elasticsearch cluster with security enabled.
|
||||
The repository also contains a preconfigured client instance that you can use to reproduce the issue.
|
||||
https://github.com/delvedor/es-reproduce-issue
|
||||
--->
|
||||
|
||||
## Expected behavior
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
@ -36,6 +44,6 @@ Paste the results here:
|
||||
## Your Environment
|
||||
|
||||
- *node version*: 6,8,10
|
||||
- *@elastic/elasticsearch version*: >=7.0.0
|
||||
- `@elastic/elasticsearch` *version*: >=7.0.0
|
||||
- *os*: Mac, Windows, Linux
|
||||
- *any other relevant information*
|
||||
|
||||
11
.github/ISSUE_TEMPLATE/regression.md
vendored
11
.github/ISSUE_TEMPLATE/regression.md
vendored
@ -29,6 +29,14 @@ Paste your code here:
|
||||
|
||||
```
|
||||
|
||||
<!--
|
||||
In some cases, it might be challenging to reproduce the bug in a few lines of code.
|
||||
You can fork the following repository, which contains all the configuration needed
|
||||
to spin up a three nodes Elasticsearch cluster with security enabled.
|
||||
The repository also contains a preconfigured client instance that you can use to reproduce the issue.
|
||||
https://github.com/delvedor/es-reproduce-issue
|
||||
--->
|
||||
|
||||
## Expected behavior
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
@ -42,6 +50,7 @@ Paste the results here:
|
||||
## Your Environment
|
||||
|
||||
- *node version*: 6,8,10
|
||||
- *@elastic/elasticsearch version*: >=7.0.0
|
||||
- `@elastic/elasticsearch` *version*: >=7.0.0
|
||||
- *typescript version*: 4.x (if applicable)
|
||||
- *os*: Mac, Windows, Linux
|
||||
- *any other relevant information*
|
||||
|
||||
2
.github/stale.yml
vendored
2
.github/stale.yml
vendored
@ -9,6 +9,8 @@ exemptLabels:
|
||||
- "discussion"
|
||||
- "feature request"
|
||||
- "bug"
|
||||
- "todo"
|
||||
- "good first issue"
|
||||
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
|
||||
16
.github/workflows/backport.yml
vendored
Normal file
16
.github/workflows/backport.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
name: Backport
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
backport:
|
||||
runs-on: ubuntu-latest
|
||||
name: Backport
|
||||
steps:
|
||||
- name: Backport
|
||||
uses: tibdex/backport@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
195
.github/workflows/nodejs.yml
vendored
Normal file
195
.github/workflows/nodejs.yml
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
name: Node CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x, 16.x, 18.x]
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
npm run lint
|
||||
|
||||
- name: Unit test
|
||||
run: |
|
||||
npm run test:unit
|
||||
|
||||
# - name: Acceptance test
|
||||
# run: |
|
||||
# npm run test:acceptance
|
||||
|
||||
# helpers-integration-test:
|
||||
# name: Helpers integration test
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# strategy:
|
||||
# matrix:
|
||||
# node-version: [12.x, 14.x, 16.x]
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
|
||||
# - name: Configure sysctl limits
|
||||
# run: |
|
||||
# sudo swapoff -a
|
||||
# sudo sysctl -w vm.swappiness=1
|
||||
# sudo sysctl -w fs.file-max=262144
|
||||
# sudo sysctl -w vm.max_map_count=262144
|
||||
|
||||
# - name: Runs Elasticsearch
|
||||
# uses: elastic/elastic-github-actions/elasticsearch@master
|
||||
# with:
|
||||
# stack-version: 8.0.0-SNAPSHOT
|
||||
|
||||
# - name: Use Node.js ${{ matrix.node-version }}
|
||||
# uses: actions/setup-node@v1
|
||||
# with:
|
||||
# node-version: ${{ matrix.node-version }}
|
||||
|
||||
# - name: Install
|
||||
# run: |
|
||||
# npm install
|
||||
|
||||
# - name: Integration test
|
||||
# run: |
|
||||
# npm run test:integration:helpers
|
||||
|
||||
# bundler-support:
|
||||
# name: Bundler support
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
|
||||
# - name: Configure sysctl limits
|
||||
# run: |
|
||||
# sudo swapoff -a
|
||||
# sudo sysctl -w vm.swappiness=1
|
||||
# sudo sysctl -w fs.file-max=262144
|
||||
# sudo sysctl -w vm.max_map_count=262144
|
||||
|
||||
# - name: Runs Elasticsearch
|
||||
# uses: elastic/elastic-github-actions/elasticsearch@master
|
||||
# with:
|
||||
# stack-version: 8.0.0-SNAPSHOT
|
||||
|
||||
# - name: Use Node.js 14.x
|
||||
# uses: actions/setup-node@v1
|
||||
# with:
|
||||
# node-version: 14.x
|
||||
|
||||
# - name: Install
|
||||
# run: |
|
||||
# npm install
|
||||
# npm install --prefix test/bundlers/parcel-test
|
||||
# npm install --prefix test/bundlers/rollup-test
|
||||
# npm install --prefix test/bundlers/webpack-test
|
||||
|
||||
# - name: Build
|
||||
# run: |
|
||||
# npm run build --prefix test/bundlers/parcel-test
|
||||
# npm run build --prefix test/bundlers/rollup-test
|
||||
# npm run build --prefix test/bundlers/webpack-test
|
||||
|
||||
# - name: Run bundle
|
||||
# run: |
|
||||
# npm start --prefix test/bundlers/parcel-test
|
||||
# npm start --prefix test/bundlers/rollup-test
|
||||
# npm start --prefix test/bundlers/webpack-test
|
||||
|
||||
# mock-support:
|
||||
# name: Mock support
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
|
||||
# - name: Use Node.js 14.x
|
||||
# uses: actions/setup-node@v1
|
||||
# with:
|
||||
# node-version: 14.x
|
||||
|
||||
# - name: Install
|
||||
# run: |
|
||||
# npm install
|
||||
# npm install --prefix test/mock
|
||||
|
||||
# - name: Run test
|
||||
# run: |
|
||||
# npm test --prefix test/mock
|
||||
|
||||
# code-coverage:
|
||||
# name: Code coverage
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# strategy:
|
||||
# matrix:
|
||||
# node-version: [14.x]
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
|
||||
# - name: Use Node.js ${{ matrix.node-version }}
|
||||
# uses: actions/setup-node@v1
|
||||
# with:
|
||||
# node-version: ${{ matrix.node-version }}
|
||||
|
||||
# - name: Install
|
||||
# run: |
|
||||
# npm install
|
||||
|
||||
# - name: Code coverage report
|
||||
# run: |
|
||||
# npm run test:coverage-report
|
||||
|
||||
# - name: Upload coverage to Codecov
|
||||
# uses: codecov/codecov-action@v1
|
||||
# with:
|
||||
# file: ./coverage.lcov
|
||||
# fail_ci_if_error: true
|
||||
|
||||
# - name: Code coverage 100%
|
||||
# run: |
|
||||
# npm run test:coverage-100
|
||||
|
||||
license:
|
||||
name: License check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
npm install
|
||||
|
||||
- name: License checker
|
||||
run: |
|
||||
npm run license-checker
|
||||
16
.gitignore
vendored
16
.gitignore
vendored
@ -45,13 +45,21 @@ jspm_packages
|
||||
# vim swap files
|
||||
*.swp
|
||||
|
||||
#Jetbrains editor folder
|
||||
.idea
|
||||
|
||||
package-lock.json
|
||||
|
||||
# elasticsearch repo or binary files
|
||||
elasticsearch*
|
||||
|
||||
# Generated typings, we don't commit them
|
||||
# because we should copy them in the main .d.ts file
|
||||
api/generated.d.ts
|
||||
|
||||
test/benchmarks/macro/fixtures/*
|
||||
|
||||
*-junit.xml
|
||||
|
||||
.cache
|
||||
|
||||
test/bundlers/**/bundle.js
|
||||
test/bundlers/parcel-test/.parcel-cache
|
||||
|
||||
lib
|
||||
|
||||
@ -67,3 +67,8 @@ scripts
|
||||
.ci
|
||||
.travis.yml
|
||||
certs
|
||||
.github
|
||||
CODE_OF_CONDUCT.md
|
||||
CONTRIBUTING.md
|
||||
|
||||
src
|
||||
|
||||
31
.travis.yml
31
.travis.yml
@ -1,31 +0,0 @@
|
||||
dist: trusty
|
||||
|
||||
sudo: required
|
||||
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "10"
|
||||
- "8"
|
||||
- "6"
|
||||
|
||||
env:
|
||||
global:
|
||||
- ELASTICSEARCH_VERSION=7.0.0-beta1
|
||||
- QUIET=true
|
||||
|
||||
before_install:
|
||||
- wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz
|
||||
- tar -xzf elasticsearch-${ELASTICSEARCH_VERSION}-linux-x86_64.tar.gz
|
||||
- ./elasticsearch-${ELASTICSEARCH_VERSION}/bin/elasticsearch -Enode.attr.testattr=test -Epath.repo=/tmp -Erepositories.url.allowed_urls='http://snapshot.*' &> /dev/null &
|
||||
|
||||
install:
|
||||
- npm install
|
||||
|
||||
script:
|
||||
- npm run ci
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
on_failure: always
|
||||
3
CHANGELOG.md
Normal file
3
CHANGELOG.md
Normal file
@ -0,0 +1,3 @@
|
||||
303 See Other
|
||||
|
||||
Location: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/changelog-client.html
|
||||
3
CODE_OF_CONDUCT.md
Normal file
3
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,3 @@
|
||||
303 See Other
|
||||
|
||||
Location: https://www.elastic.co/community/codeofconduct
|
||||
100
CONTRIBUTING.md
Normal file
100
CONTRIBUTING.md
Normal file
@ -0,0 +1,100 @@
|
||||
# Contributing to the Elasticsearch Node.js client
|
||||
|
||||
The Elasticsearch Node.js client is open source and we love to receive contributions from our community — you!
|
||||
|
||||
There are many ways to contribute,
|
||||
from writing tutorials or blog posts,
|
||||
improving the documentation,
|
||||
submitting bug reports and feature requests or writing code.
|
||||
|
||||
## Repository structure
|
||||
The `master` branch is considered unstable, and it's compatible with Elasticsearch master. Unless you are patching an issue, new features should always be sent to the `master` branch, in case of a bugfix, it depends if the bug affects all the release lines.<br/>
|
||||
There is a branch for every supported release line, such as `7.x` or `6.x`. We release bugfixes as soon as possible, while minor and major releases are published at the same time of the Elastic Stack.
|
||||
|
||||
Usually for every release line there will be a *published* version and a *next* version. Eg: the `7.x` branch contains the version published on npm, and bugfixes should be sent there, while `7.2` *(assuming that 7.1.x is released)* contains the next version, and new features should be sent there.
|
||||
|
||||
## Code contributions
|
||||
|
||||
If you have a bugfix or new feature that you would like to contribute,
|
||||
please find or open an issue about it first.
|
||||
Talk about what you would like to do.
|
||||
It may be that somebody is already working on it,
|
||||
or that there are particular issues that you should know about before implementing the change.
|
||||
|
||||
Note that we strictly follow the [Elastic EOL schedule](https://www.elastic.co/support/eol).
|
||||
|
||||
### Submitting your changes
|
||||
|
||||
Generally, we require that you test any code you are adding or modifying.
|
||||
Once your changes are ready to submit for review:
|
||||
|
||||
1. Test your changes
|
||||
|
||||
Run the test suite to make sure that nothing is broken.
|
||||
Usually run `npm test` is enough, our CI will take care of running the integration test. If you want to run the integration test yourself, see the *Testing* section below.
|
||||
|
||||
2. Submit a pull request
|
||||
|
||||
Push your local changes to your forked copy of the repository and [submit a pull request](https://help.github.com/articles/using-pull-requests).
|
||||
In the pull request,
|
||||
choose a title which sums up the changes that you have made,
|
||||
and in the body provide more details about what your changes do.
|
||||
Also mention the number of the issue where discussion has taken place,
|
||||
eg "Closes #123".
|
||||
|
||||
3. Sign the Contributor License Agreement
|
||||
|
||||
Please make sure you have signed our [Contributor License Agreement](https://www.elastic.co/contributor-agreement/).
|
||||
We are not asking you to assign copyright to us,
|
||||
but to give us the right to distribute your code without restriction.
|
||||
We ask this of all contributors in order to assure our users of the origin and continuing existence of the code.
|
||||
You only need to sign the CLA once.
|
||||
|
||||
4. Be patient
|
||||
|
||||
We might not be able to review your code as fast as we would like to,
|
||||
but we'll do our best to dedicate it the attention it deserves.
|
||||
Your effort is much appreciated!
|
||||
|
||||
### Code generation
|
||||
|
||||
The entire content of the API folder is generated as well as the `docs/reference.asciidoc` file.<br/>
|
||||
If you want to run the code generation you should run the following command:
|
||||
```sh
|
||||
node scripts/generate --tag <tag name>
|
||||
# or
|
||||
node scripts/generate --branch <branch name>
|
||||
```
|
||||
Then you should copy the content of `api/generated.d.ts` into the `index.d.ts` file *(automate this step would be a nice pr!)*.
|
||||
|
||||
### Testing
|
||||
There are different test scripts, usually during development you only need to run `npm test`, but if you want you can run just a part of the suite, following you will find all the testing scripts and what they do.
|
||||
|
||||
| Script | Description |
|
||||
|---|---|
|
||||
| `npm run test:unit` | Runs the content of the `test/unit` folder. |
|
||||
| `npm run test:behavior` | Runs the content of the `test/behavior` folder. |
|
||||
| `npm run test:types` | Runs the content of the `test/types` folder. |
|
||||
| `npm run test:unit -- --cov --coverage-report=html` | Runs the content of the `test/unit` folder and calculates the code coverage. |
|
||||
| `npm run test:integration` | Runs the integration test runner.<br/>*Note: it requires a living instance of Elasticsearch.* |
|
||||
| `npm run lint` | Run the [linter](https://standardjs.com/). |
|
||||
| `npm run lint:fix` | Fixes the lint errors. |
|
||||
| `npm test` | Runs lint, unit, behavior, and types test. |
|
||||
|
||||
#### Integration test
|
||||
The integration test are generated on the fly by the runner you will find inside `test/integration`, once you execute it, it will clone the Elasticsearch repository and checkout the correct version to grab the [OSS yaml files](https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/test) and the [Elastic licensed yaml files](https://github.com/elastic/elasticsearch/tree/master/x-pack/plugin/src/test/resources/rest-api-spec/test) that will be used for generating the test.
|
||||
|
||||
Usually this step is executed by CI since it takes some time, but you can easily run this yourself! Just follow this steps:
|
||||
1. Boot an Elasticsearch instance, you can do that by running `./scripts/es-docker.sh` or `./scripts/es-docker-platinum.sh`, the first one will work only with the OSS APIs, while the second will work also with the Elastic licensed APIs;
|
||||
1. If you are running the OSS test, you should use `npm run test:integration`, otherwise use `TEST_ES_SERVER=https://elastic:changeme@localhost:9200 npm run test:integration`. You can also pass a `-b` parameter if you want the test to bail out at the first failure: `npm run test:integration -- -b`;
|
||||
1. Grab a coffee, it will take some time ;)
|
||||
|
||||
### Releasing
|
||||
|
||||
If you have access to make releases, the process is as follows:
|
||||
|
||||
1. Update the version in `package.json` according to the scale of the change. (major, minor or patch)
|
||||
1. Commit changes with message `Bumped vx.y.z` where `x.y.z` is the version in `package.json`
|
||||
1. Create a release via the GitHub UI.
|
||||
1. Wait for CI to finish running the test.
|
||||
1. Publish to npm with `npm publish` *(see [publish](https://docs.npmjs.com/cli/publish) and [dist-tag](https://docs.npmjs.com/cli/dist-tag) docs)*
|
||||
2
LICENSE
2
LICENSE
@ -187,7 +187,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2020 Elastic and contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
2
NOTICE.txt
Normal file
2
NOTICE.txt
Normal file
@ -0,0 +1,2 @@
|
||||
Elasticsearch JavaScript Client
|
||||
Copyright 2022 Elasticsearch B.V.
|
||||
261
README.md
261
README.md
@ -1,15 +1,8 @@
|
||||
<img align="right" width="auto" height="auto" src="https://www.elastic.co/static-res/images/elastic-logo-200.png">
|
||||
|
||||
# @elastic/elasticsearch
|
||||
# Elasticsearch Node.js client
|
||||
|
||||
[](http://standardjs.com/) [](https://clients-ci.elastic.co/job/elastic+elasticsearch-js+master/) [](https://codecov.io/gh/elastic/elasticsearch-js) [](https://www.npmjs.com/package/@elastic/elasticsearch)
|
||||
|
||||
---
|
||||
|
||||
**Note:** In the past months we have worked on the new Elasticsearch Node.js client, we will announce it soon!
|
||||
If you want you can already try it by following the instructions below, while if you're going to use the legacy one or report an issue, please check out [elastic/elasticsearch-js-legacy](https://github.com/elastic/elasticsearch-js-legacy).
|
||||
|
||||
---
|
||||
[](http://standardjs.com/) [](https://clients-ci.elastic.co/view/JavaScript/job/elastic+elasticsearch-js+main/) [](https://github.com/elastic/elasticsearch-js/actions/workflows/nodejs.yml) [](https://codecov.io/gh/elastic/elasticsearch-js) [](https://www.npmjs.com/package/@elastic/elasticsearch)
|
||||
|
||||
The official Node.js client for Elasticsearch.
|
||||
|
||||
@ -18,7 +11,8 @@ The official Node.js client for Elasticsearch.
|
||||
- Generalized, pluggable architecture.
|
||||
- Configurable, automatic discovery of cluster nodes.
|
||||
- Persistent, Keep-Alive connections.
|
||||
- Load balancing (with pluggable selection strategy) across all available nodes.
|
||||
- Load balancing across all available nodes.
|
||||
- Child client support.
|
||||
- TypeScript support out of the box.
|
||||
|
||||
## Install
|
||||
@ -26,128 +20,167 @@ The official Node.js client for Elasticsearch.
|
||||
npm install @elastic/elasticsearch
|
||||
```
|
||||
|
||||
### Node.js support
|
||||
|
||||
NOTE: The minimum supported version of Node.js is `v14`.
|
||||
|
||||
The client versioning follows the Elastic Stack versioning, this means that
|
||||
major, minor, and patch releases are done following a precise schedule that
|
||||
often does not coincide with the [Node.js release](https://nodejs.org/en/about/releases/) times.
|
||||
|
||||
To avoid support insecure and unsupported versions of Node.js, the
|
||||
client **will drop the support of EOL versions of Node.js between minor releases**.
|
||||
Typically, as soon as a Node.js version goes into EOL, the client will continue
|
||||
to support that version for at least another minor release. If you are using the client
|
||||
with a version of Node.js that will be unsupported soon, you will see a warning
|
||||
in your logs (the client will start logging the warning with two minors in advance).
|
||||
|
||||
Unless you are **always** using a supported version of Node.js,
|
||||
we recommend defining the client dependency in your
|
||||
`package.json` with the `~` instead of `^`. In this way, you will lock the
|
||||
dependency on the minor release and not the major. (for example, `~7.10.0` instead
|
||||
of `^7.10.0`).
|
||||
|
||||
| Node.js Version | Node.js EOL date | End of support |
|
||||
| --------------- |------------------| ---------------------- |
|
||||
| `8.x` | `December 2019` | `7.11` (early 2021) |
|
||||
| `10.x` | `April 2021` | `7.12` (mid 2021) |
|
||||
| `12.x` | `April 2022` | `8.2` (early 2022) |
|
||||
| `14.x` | `April 2023` | `8.8` (early 2023) |
|
||||
|
||||
### Compatibility
|
||||
|
||||
---
|
||||
Language clients are forward compatible; meaning that clients support communicating with greater or equal minor versions of Elasticsearch.
|
||||
Elasticsearch language clients are only backwards compatible with default distributions and without guarantees made.
|
||||
|
||||
**Warning:** currently on npm you will only find a beta release that works with Elasticsearch 7, we will add the support for Elasticsearch 5, 6, and 7 once we release the final version of this library.
|
||||
| Elasticsearch Version | Client Version |
|
||||
| --------------------- |----------------|
|
||||
| `8.x` | `8.x` |
|
||||
| `7.x` | `7.x` |
|
||||
| `6.x` | `6.x` |
|
||||
| `5.x` | `5.x` |
|
||||
|
||||
---
|
||||
|
||||
The library is compatible with all Elasticsearch versions since 5.x, but you should use the same major version of the Elasticsearch instance that you are using.
|
||||
To install a specific major of the client, run the following command:
|
||||
```
|
||||
# Elasticsearch 7.x
|
||||
@elastic/elasticsearch@7
|
||||
|
||||
# Elasticsearch 6.x
|
||||
@elastic/elasticsearch@6
|
||||
|
||||
# Elasticsearch 5.x
|
||||
@elastic/elasticsearch@5
|
||||
npm install @elastic/elasticsearch@<major>
|
||||
```
|
||||
|
||||
## Usage
|
||||
You can find the full documentation in the [docs](https://github.com/elastic/elasticsearch-js/tree/master/docs) folder.
|
||||
#### Browser
|
||||
|
||||
WARNING: There is no official support for the browser environment. It exposes your Elasticsearch instance to everyone, which could lead to security issues.
|
||||
We recommend that you write a lightweight proxy that uses this client instead, you can see a proxy example [here](./docs/examples/proxy).
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Introduction](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/introduction.html)
|
||||
- [Usage](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-connecting.html#client-usage)
|
||||
- [Client configuration](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-configuration.html)
|
||||
- [API reference](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html)
|
||||
- [Authentication](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-connecting.html#authentication)
|
||||
- [Observability](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/observability.html)
|
||||
- [Creating a child client](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/child.html)
|
||||
- [Client helpers](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-helpers.html)
|
||||
- [Typescript support](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/typescript.html)
|
||||
- [Testing](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-testing.html)
|
||||
- [Examples](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/examples.html)
|
||||
|
||||
## Quick start
|
||||
|
||||
```js
|
||||
'use strict'
|
||||
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
const client = new Client({ node: 'http://localhost:9200' })
|
||||
|
||||
// promise API
|
||||
const result = await client.search({
|
||||
index: 'my-index',
|
||||
body: { foo: 'bar' }
|
||||
const client = new Client({
|
||||
cloud: { id: '<cloud-id>' },
|
||||
auth: { apiKey: 'base64EncodedKey' }
|
||||
})
|
||||
|
||||
// callback API
|
||||
client.search({
|
||||
index: 'my-index',
|
||||
body: { foo: 'bar' }
|
||||
}, (err, result) => {
|
||||
if (err) console.log(err)
|
||||
})
|
||||
```
|
||||
The returned value of **every** API call is formed as follows:
|
||||
```ts
|
||||
{
|
||||
body: object | boolean
|
||||
statusCode: number
|
||||
headers: object
|
||||
warnings: [string]
|
||||
meta: object
|
||||
}
|
||||
```
|
||||
### Client options
|
||||
The client is designed to be easily configured as you see fit for your needs, following you can see all the possible options that you can use to configure it.
|
||||
```ts
|
||||
{
|
||||
// the Elasticsearch endpoint to use
|
||||
node: string | string[];
|
||||
// alias of above
|
||||
nodes: string | string[];
|
||||
// custom connection class
|
||||
Connection: typeof Connection;
|
||||
// custom connection pool class
|
||||
ConnectionPool: typeof ConnectionPool;
|
||||
// custom transport class
|
||||
Transport: typeof Transport;
|
||||
// custom serializer class
|
||||
Serializer: typeof Serializer;
|
||||
// max number of retries for each request
|
||||
maxRetries: number;
|
||||
// max request timeout for each request
|
||||
requestTimeout: number;
|
||||
// max ping timeout for each request
|
||||
pingTimeout: number;
|
||||
// perform a sniff operation every `n` milliseconds
|
||||
sniffInterval: number;
|
||||
// perform a sniff once the client is started
|
||||
sniffOnStart: boolean;
|
||||
// custom sniff endpoint, defaults `_nodes/_all/http`
|
||||
sniffEndpoint: string;
|
||||
// perform a sniff on connection fault
|
||||
sniffOnConnectionFault: boolean;
|
||||
// configurethe node resurrection strategy, default `ping`
|
||||
resurrectStrategy: 'ping' | 'optimistic' | 'none';
|
||||
// adds `accept-encoding` header to every request
|
||||
suggestCompression: boolean;
|
||||
// enable gzip request body compression
|
||||
compression: 'gzip';
|
||||
// ssl configuraton
|
||||
ssl: http.SecureContextOptions;
|
||||
// http agent options
|
||||
agent: http.AgentOptions;
|
||||
// filters which node not to use for a request
|
||||
nodeFilter: nodeFilterFn;
|
||||
// custom selection strategy, defaults `round-robin`
|
||||
nodeSelector: nodeSelectorFn | string;
|
||||
async function run () {
|
||||
// Let's start by indexing some data
|
||||
await client.index({
|
||||
index: 'game-of-thrones',
|
||||
document: {
|
||||
character: 'Ned Stark',
|
||||
quote: 'Winter is coming.'
|
||||
}
|
||||
})
|
||||
|
||||
await client.index({
|
||||
index: 'game-of-thrones',
|
||||
document: {
|
||||
character: 'Daenerys Targaryen',
|
||||
quote: 'I am the blood of the dragon.'
|
||||
}
|
||||
})
|
||||
|
||||
await client.index({
|
||||
index: 'game-of-thrones',
|
||||
document: {
|
||||
character: 'Tyrion Lannister',
|
||||
quote: 'A mind needs books like a sword needs a whetstone.'
|
||||
}
|
||||
})
|
||||
|
||||
// here we are forcing an index refresh, otherwise we will not
|
||||
// get any result in the consequent search
|
||||
await client.indices.refresh({ index: 'game-of-thrones' })
|
||||
|
||||
// Let's search!
|
||||
const result= await client.search({
|
||||
index: 'game-of-thrones',
|
||||
query: {
|
||||
match: { quote: 'winter' }
|
||||
}
|
||||
})
|
||||
|
||||
console.log(result.hits.hits)
|
||||
}
|
||||
|
||||
run().catch(console.log)
|
||||
```
|
||||
|
||||
### Request specific options
|
||||
If needed you can pass request specific options in a second object:
|
||||
## Install multiple versions
|
||||
If you are using multiple versions of Elasticsearch, you need to use multiple versions of the client. In the past, install multiple versions of the same package was not possible, but with `npm v6.9`, you can do that via aliasing.
|
||||
|
||||
The command you must run to install different version of the client is:
|
||||
```sh
|
||||
npm install <alias>@npm:@elastic/elasticsearch@<version>
|
||||
```
|
||||
So for example if you need to install `7.x` and `6.x`, you will run
|
||||
```sh
|
||||
npm install es6@npm:@elastic/elasticsearch@6
|
||||
npm install es7@npm:@elastic/elasticsearch@7
|
||||
```
|
||||
And your `package.json` will look like the following:
|
||||
```json
|
||||
"dependencies": {
|
||||
"es6": "npm:@elastic/elasticsearch@^6.7.0",
|
||||
"es7": "npm:@elastic/elasticsearch@^7.0.0"
|
||||
}
|
||||
```
|
||||
You will require the packages from your code by using the alias you have defined.
|
||||
```js
|
||||
// promise API
|
||||
const result = await client.search({
|
||||
index: 'my-index',
|
||||
body: { foo: 'bar' }
|
||||
}, {
|
||||
ignore: [404],
|
||||
maxRetries: 3
|
||||
const { Client: Client6 } = require('es6')
|
||||
const { Client: Client7 } = require('es7')
|
||||
|
||||
const client6 = new Client6({
|
||||
cloud: { id: '<cloud-id>' },
|
||||
auth: { apiKey: 'base64EncodedKey' }
|
||||
})
|
||||
const client7 = new Client7({
|
||||
cloud: { id: '<cloud-id>' },
|
||||
auth: { apiKey: 'base64EncodedKey' }
|
||||
})
|
||||
|
||||
client6.info().then(console.log, console.log)
|
||||
client7.info().then(console.log, console.log)
|
||||
```
|
||||
The supported *request specific options* are:
|
||||
```ts
|
||||
{
|
||||
ignore: [number], // default `null`
|
||||
requestTimeout: number, // client default
|
||||
maxRetries: number, // default `5`
|
||||
asStream: boolean, // default `false`
|
||||
compression: string, // default `false`
|
||||
headers: object, // default `null`
|
||||
querystring: object // default `null`
|
||||
}
|
||||
|
||||
Finally, if you want to install the client for the next version of Elasticsearch *(the one that lives in Elasticsearch’s main branch)*, you can use the following command:
|
||||
```sh
|
||||
npm install esmain@github:elastic/elasticsearch-js
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This software is licensed under the [Apache 2 license](./LICENSE).
|
||||
This software is licensed under the [Apache License 2.0](./LICENSE).
|
||||
|
||||
162
api/api/bulk.js
162
api/api/bulk.js
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildBulk (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [bulk](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request
|
||||
*
|
||||
* @param {string} index - Default index for items which don't provide one
|
||||
* @param {string} type - Default document type for items which don't provide one
|
||||
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|
||||
* @param {enum} refresh - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|
||||
* @param {string} routing - Specific routing value
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
* @param {string} type - Default document type for items which don't provide one
|
||||
* @param {list} _source - True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request
|
||||
* @param {list} _source_excludes - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
|
||||
* @param {list} _source_includes - Default list of fields to extract and return from the _source field, can be overridden on each sub-request
|
||||
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
|
||||
* @param {object} body - The operation definition and data (action-data pairs), separated by newlines
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'wait_for_active_shards',
|
||||
'refresh',
|
||||
'routing',
|
||||
'timeout',
|
||||
'type',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'pipeline',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
waitForActiveShards: 'wait_for_active_shards',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function bulk (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_bulk'
|
||||
} else if ((index) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_bulk'
|
||||
} else {
|
||||
path = '/' + '_bulk'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
bulkBody: body,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildBulk
|
||||
@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatAliases (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html) request
|
||||
*
|
||||
* @param {list} name - A comma-separated list of alias names to return
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catAliases (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, name } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'name'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((name) != null) {
|
||||
path = '/' + '_cat' + '/' + 'aliases' + '/' + encodeURIComponent(name)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'aliases'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatAliases
|
||||
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatAllocation (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.allocation](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html) request
|
||||
*
|
||||
* @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {enum} bytes - The unit in which to display byte values
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'bytes',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catAllocation (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, nodeId, node_id } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((node_id || nodeId) != null) {
|
||||
path = '/' + '_cat' + '/' + 'allocation' + '/' + encodeURIComponent(node_id || nodeId)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'allocation'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatAllocation
|
||||
@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatCount (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.count](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names to limit the returned information
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catCount (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
path = '/' + '_cat' + '/' + 'count' + '/' + encodeURIComponent(index)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'count'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatCount
|
||||
@ -1,150 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatFielddata (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.fielddata](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html) request
|
||||
*
|
||||
* @param {list} fields - A comma-separated list of fields to return the fielddata size
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {enum} bytes - The unit in which to display byte values
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
* @param {list} fields - A comma-separated list of fields to return in the output
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'bytes',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'fields',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catFielddata (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, fields } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'fields'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((fields) != null) {
|
||||
path = '/' + '_cat' + '/' + 'fielddata' + '/' + encodeURIComponent(fields)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'fielddata'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatFielddata
|
||||
@ -1,143 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatHealth (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html) request
|
||||
*
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} ts - Set to false to disable timestamping
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'ts',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catHealth (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'health'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatHealth
|
||||
@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatHelp (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.help](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html) request
|
||||
*
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'help',
|
||||
's',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catHelp (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatHelp
|
||||
@ -1,152 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatIndices (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.indices](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names to limit the returned information
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {enum} bytes - The unit in which to display byte values
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {enum} health - A health status ("green", "yellow", or "red" to filter only indices matching the specified health status
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {boolean} pri - Set to true to return stats only for primary shards
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'bytes',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'health',
|
||||
'help',
|
||||
'pri',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catIndices (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
path = '/' + '_cat' + '/' + 'indices' + '/' + encodeURIComponent(index)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'indices'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatIndices
|
||||
@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatMaster (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.master](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html) request
|
||||
*
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catMaster (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'master'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatMaster
|
||||
@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatNodeattrs (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.nodeattrs](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html) request
|
||||
*
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catNodeattrs (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'nodeattrs'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatNodeattrs
|
||||
@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatNodes (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.nodes](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html) request
|
||||
*
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} full_id - Return the full node ID instead of the shortened version (default: false)
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'full_id',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
fullId: 'full_id',
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catNodes (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'nodes'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatNodes
|
||||
@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatPendingTasks (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html) request
|
||||
*
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catPendingTasks (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'pending_tasks'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatPendingTasks
|
||||
@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatPlugins (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.plugins](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html) request
|
||||
*
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catPlugins (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'plugins'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatPlugins
|
||||
@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatRecovery (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names to limit the returned information
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {enum} bytes - The unit in which to display byte values
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'bytes',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catRecovery (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
path = '/' + '_cat' + '/' + 'recovery' + '/' + encodeURIComponent(index)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'recovery'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatRecovery
|
||||
@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatRepositories (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.repositories](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html) request
|
||||
*
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catRepositories (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'repositories'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatRepositories
|
||||
@ -1,143 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatSegments (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names to limit the returned information
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {enum} bytes - The unit in which to display byte values
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'bytes',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catSegments (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
path = '/' + '_cat' + '/' + 'segments' + '/' + encodeURIComponent(index)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'segments'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatSegments
|
||||
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatShards (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names to limit the returned information
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {enum} bytes - The unit in which to display byte values
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'bytes',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catShards (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
path = '/' + '_cat' + '/' + 'shards' + '/' + encodeURIComponent(index)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'shards'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatShards
|
||||
@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatSnapshots (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html) request
|
||||
*
|
||||
* @param {list} repository - Name of repository from which to fetch the snapshot information
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} ignore_unavailable - Set to true to ignore unavailable snapshots
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'ignore_unavailable',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
ignoreUnavailable: 'ignore_unavailable',
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catSnapshots (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, repository } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'repository'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((repository) != null) {
|
||||
path = '/' + '_cat' + '/' + 'snapshots' + '/' + encodeURIComponent(repository)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'snapshots'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatSnapshots
|
||||
@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatTasks (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request
|
||||
*
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
|
||||
* @param {list} actions - A comma-separated list of actions that should be returned. Leave empty to return all.
|
||||
* @param {boolean} detailed - Return detailed task information (default: false)
|
||||
* @param {number} parent_task - Return tasks with specified parent task id. Set to -1 to return all.
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'node_id',
|
||||
'actions',
|
||||
'detailed',
|
||||
'parent_task',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
nodeId: 'node_id',
|
||||
parentTask: 'parent_task',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catTasks (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cat' + '/' + 'tasks'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatTasks
|
||||
@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatTemplates (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.templates](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html) request
|
||||
*
|
||||
* @param {string} name - A pattern that returned template names must match
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catTemplates (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, name } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'name'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((name) != null) {
|
||||
path = '/' + '_cat' + '/' + 'templates' + '/' + encodeURIComponent(name)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'templates'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatTemplates
|
||||
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatThreadPool (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.thread_pool](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request
|
||||
*
|
||||
* @param {list} thread_pool_patterns - A comma-separated list of regular-expressions to filter the thread pools in the output
|
||||
* @param {string} format - a short version of the Accept header, e.g. json, yaml
|
||||
* @param {enum} size - The multiplier in which to display values
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {list} h - Comma-separated list of column names to display
|
||||
* @param {boolean} help - Return help information
|
||||
* @param {list} s - Comma-separated list of column names or column aliases to sort by
|
||||
* @param {boolean} v - Verbose mode. Display column headers
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'format',
|
||||
'size',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'v',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function catThreadPool (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, threadPoolPatterns, thread_pool_patterns } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'threadPoolPatterns', 'thread_pool_patterns'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((thread_pool_patterns || threadPoolPatterns) != null) {
|
||||
path = '/' + '_cat' + '/' + 'thread_pool' + '/' + encodeURIComponent(thread_pool_patterns || threadPoolPatterns)
|
||||
} else {
|
||||
path = '/' + '_cat' + '/' + 'thread_pool'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatThreadPool
|
||||
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrDeleteAutoFollowPattern (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.delete_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html) request
|
||||
*
|
||||
* @param {string} name - The name of the auto follow pattern.
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrDeleteAutoFollowPattern (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['name'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, name } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'name'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'DELETE'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrDeleteAutoFollowPattern
|
||||
@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrFollow (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html) request
|
||||
*
|
||||
* @param {string} index - The name of the follower index
|
||||
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before returning. Defaults to 0. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|
||||
* @param {object} body - The name of the leader index and other optional ccr related parameters
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'wait_for_active_shards'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
waitForActiveShards: 'wait_for_active_shards'
|
||||
}
|
||||
|
||||
return function ccrFollow (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'PUT'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'follow'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrFollow
|
||||
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrFollowInfo (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.follow_info](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index patterns; use `_all` to perform the operation on all indices
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrFollowInfo (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'info'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrFollowInfo
|
||||
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrFollowStats (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.follow_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index patterns; use `_all` to perform the operation on all indices
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrFollowStats (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'stats'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrFollowStats
|
||||
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrGetAutoFollowPattern (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.get_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html) request
|
||||
*
|
||||
* @param {string} name - The name of the auto follow pattern.
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrGetAutoFollowPattern (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, name } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'name'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((name) != null) {
|
||||
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name)
|
||||
} else {
|
||||
path = '/' + '_ccr' + '/' + 'auto_follow'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrGetAutoFollowPattern
|
||||
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrPauseFollow (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.pause_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html) request
|
||||
*
|
||||
* @param {string} index - The name of the follower index that should pause following its leader index.
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrPauseFollow (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'pause_follow'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrPauseFollow
|
||||
@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrPutAutoFollowPattern (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.put_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html) request
|
||||
*
|
||||
* @param {string} name - The name of the auto follow pattern.
|
||||
* @param {object} body - The specification of the auto follow pattern
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrPutAutoFollowPattern (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['name'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, name } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'name'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'PUT'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ccr' + '/' + 'auto_follow' + '/' + encodeURIComponent(name)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrPutAutoFollowPattern
|
||||
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrResumeFollow (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.resume_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html) request
|
||||
*
|
||||
* @param {string} index - The name of the follow index to resume following.
|
||||
* @param {object} body - The name of the leader index and other optional ccr related parameters
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrResumeFollow (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'resume_follow'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrResumeFollow
|
||||
@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrStats (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html) request
|
||||
*
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrStats (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ccr' + '/' + 'stats'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrStats
|
||||
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCcrUnfollow (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.unfollow](http://www.elastic.co/guide/en/elasticsearch/reference/current) request
|
||||
*
|
||||
* @param {string} index - The name of the follower index that should be turned into a regular index.
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ccrUnfollow (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_ccr' + '/' + 'unfollow'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCcrUnfollow
|
||||
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClearScroll (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request
|
||||
*
|
||||
* @param {list} scroll_id - A comma-separated list of scroll IDs to clear
|
||||
* @param {object} body - A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clearScroll (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, scrollId, scroll_id } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'scrollId', 'scroll_id'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'DELETE'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((scroll_id || scrollId) != null) {
|
||||
path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId)
|
||||
} else {
|
||||
path = '/' + '_search' + '/' + 'scroll'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClearScroll
|
||||
@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterAllocationExplain (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.allocation_explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html) request
|
||||
*
|
||||
* @param {boolean} include_yes_decisions - Return 'YES' decisions in explanation (default: false)
|
||||
* @param {boolean} include_disk_info - Return information about disk usage and shard sizes (default: false)
|
||||
* @param {object} body - The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard'
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'include_yes_decisions',
|
||||
'include_disk_info',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
includeYesDecisions: 'include_yes_decisions',
|
||||
includeDiskInfo: 'include_disk_info',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterAllocationExplain (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = body == null ? 'GET' : 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'allocation' + '/' + 'explain'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterAllocationExplain
|
||||
@ -1,137 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterGetSettings (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request
|
||||
*
|
||||
* @param {boolean} flat_settings - Return settings in flat format (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
* @param {boolean} include_defaults - Whether to return all default clusters setting.
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'flat_settings',
|
||||
'master_timeout',
|
||||
'timeout',
|
||||
'include_defaults',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
flatSettings: 'flat_settings',
|
||||
masterTimeout: 'master_timeout',
|
||||
includeDefaults: 'include_defaults',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterGetSettings (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'settings'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterGetSettings
|
||||
@ -1,158 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterHealth (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request
|
||||
*
|
||||
* @param {list} index - Limit the information returned to a specific index
|
||||
* @param {enum} level - Specify the level of detail for returned information
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
* @param {string} wait_for_active_shards - Wait until the specified number of shards is active
|
||||
* @param {string} wait_for_nodes - Wait until the specified number of nodes is available
|
||||
* @param {enum} wait_for_events - Wait until all currently queued events with the given priority are processed
|
||||
* @param {boolean} wait_for_no_relocating_shards - Whether to wait until there are no relocating shards in the cluster
|
||||
* @param {boolean} wait_for_no_initializing_shards - Whether to wait until there are no initializing shards in the cluster
|
||||
* @param {enum} wait_for_status - Wait until cluster is in a specific state
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'level',
|
||||
'local',
|
||||
'master_timeout',
|
||||
'timeout',
|
||||
'wait_for_active_shards',
|
||||
'wait_for_nodes',
|
||||
'wait_for_events',
|
||||
'wait_for_no_relocating_shards',
|
||||
'wait_for_no_initializing_shards',
|
||||
'wait_for_status',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
waitForActiveShards: 'wait_for_active_shards',
|
||||
waitForNodes: 'wait_for_nodes',
|
||||
waitForEvents: 'wait_for_events',
|
||||
waitForNoRelocatingShards: 'wait_for_no_relocating_shards',
|
||||
waitForNoInitializingShards: 'wait_for_no_initializing_shards',
|
||||
waitForStatus: 'wait_for_status',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterHealth (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
path = '/' + '_cluster' + '/' + 'health' + '/' + encodeURIComponent(index)
|
||||
} else {
|
||||
path = '/' + '_cluster' + '/' + 'health'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterHealth
|
||||
@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterPendingTasks (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html) request
|
||||
*
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Specify timeout for connection to master
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'local',
|
||||
'master_timeout',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterPendingTasks (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'pending_tasks'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterPendingTasks
|
||||
@ -1,135 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterPutSettings (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request
|
||||
*
|
||||
* @param {boolean} flat_settings - Return settings in flat format (default: false)
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
* @param {object} body - The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart).
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'flat_settings',
|
||||
'master_timeout',
|
||||
'timeout',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
flatSettings: 'flat_settings',
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterPutSettings (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'PUT'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'settings'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterPutSettings
|
||||
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterRemoteInfo (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html) request
|
||||
*
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterRemoteInfo (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_remote' + '/' + 'info'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterRemoteInfo
|
||||
@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterReroute (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.reroute](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html) request
|
||||
*
|
||||
* @param {boolean} dry_run - Simulate the operation only and return the resulting state
|
||||
* @param {boolean} explain - Return an explanation of why the commands can or cannot be executed
|
||||
* @param {boolean} retry_failed - Retries allocation of shards that are blocked due to too many subsequent allocation failures
|
||||
* @param {list} metric - Limit the information returned to the specified metrics. Defaults to all but metadata
|
||||
* @param {time} master_timeout - Explicit operation timeout for connection to master node
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
* @param {object} body - The definition of `commands` to perform (`move`, `cancel`, `allocate`)
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'dry_run',
|
||||
'explain',
|
||||
'retry_failed',
|
||||
'metric',
|
||||
'master_timeout',
|
||||
'timeout',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
dryRun: 'dry_run',
|
||||
retryFailed: 'retry_failed',
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterReroute (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body } = params
|
||||
var querystring = semicopy(params, ['method', 'body'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_cluster' + '/' + 'reroute'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterReroute
|
||||
@ -1,163 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterState (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.state](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
||||
* @param {list} metric - Limit the information returned to the specified metrics
|
||||
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
|
||||
* @param {time} master_timeout - Specify timeout for connection to master
|
||||
* @param {boolean} flat_settings - Return settings in flat format (default: false)
|
||||
* @param {number} wait_for_metadata_version - Wait for the metadata version to be equal or greater than the specified metadata version
|
||||
* @param {time} wait_for_timeout - The maximum time to wait for wait_for_metadata_version before timing out
|
||||
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'local',
|
||||
'master_timeout',
|
||||
'flat_settings',
|
||||
'wait_for_metadata_version',
|
||||
'wait_for_timeout',
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
flatSettings: 'flat_settings',
|
||||
waitForMetadataVersion: 'wait_for_metadata_version',
|
||||
waitForTimeout: 'wait_for_timeout',
|
||||
ignoreUnavailable: 'ignore_unavailable',
|
||||
allowNoIndices: 'allow_no_indices',
|
||||
expandWildcards: 'expand_wildcards',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterState (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['index'] != null && (params['metric'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: metric')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index, metric } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index', 'metric'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((metric) != null && (index) != null) {
|
||||
path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index)
|
||||
} else if ((metric) != null) {
|
||||
path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric)
|
||||
} else {
|
||||
path = '/' + '_cluster' + '/' + 'state'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterState
|
||||
@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildClusterStats (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html) request
|
||||
*
|
||||
* @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes
|
||||
* @param {boolean} flat_settings - Return settings in flat format (default: false)
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'flat_settings',
|
||||
'timeout',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
flatSettings: 'flat_settings',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function clusterStats (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, nodeId, node_id } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'nodeId', 'node_id'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((node_id || nodeId) != null) {
|
||||
path = '/' + '_cluster' + '/' + 'stats' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId)
|
||||
} else {
|
||||
path = '/' + '_cluster' + '/' + 'stats'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildClusterStats
|
||||
171
api/api/count.js
171
api/api/count.js
@ -1,171 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCount (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [count](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of indices to restrict the results
|
||||
* @param {list} type - A comma-separated list of types to restrict the results
|
||||
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
* @param {boolean} ignore_throttled - Whether specified concrete, expanded or aliased indices should be ignored when throttled
|
||||
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
||||
* @param {number} min_score - Include only documents with a specific `_score` value in the result
|
||||
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {list} routing - A comma-separated list of specific routing values
|
||||
* @param {string} q - Query in the Lucene query string syntax
|
||||
* @param {string} analyzer - The analyzer to use for the query string
|
||||
* @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false)
|
||||
* @param {enum} default_operator - The default operator for query string query (AND or OR)
|
||||
* @param {string} df - The field to use as default where no field prefix is given in the query string
|
||||
* @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
|
||||
* @param {number} terminate_after - The maximum count for each shard, upon reaching which the query execution will terminate early
|
||||
* @param {object} body - A query to restrict the results specified with the Query DSL (optional)
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'ignore_unavailable',
|
||||
'ignore_throttled',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'min_score',
|
||||
'preference',
|
||||
'routing',
|
||||
'q',
|
||||
'analyzer',
|
||||
'analyze_wildcard',
|
||||
'default_operator',
|
||||
'df',
|
||||
'lenient',
|
||||
'terminate_after',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
ignoreUnavailable: 'ignore_unavailable',
|
||||
ignoreThrottled: 'ignore_throttled',
|
||||
allowNoIndices: 'allow_no_indices',
|
||||
expandWildcards: 'expand_wildcards',
|
||||
minScore: 'min_score',
|
||||
analyzeWildcard: 'analyze_wildcard',
|
||||
defaultOperator: 'default_operator',
|
||||
terminateAfter: 'terminate_after',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function count (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = body == null ? 'GET' : 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count'
|
||||
} else if ((index) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_count'
|
||||
} else {
|
||||
path = '/' + '_count'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCount
|
||||
@ -1,160 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCreate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [create](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request
|
||||
*
|
||||
* @param {string} id - Document ID
|
||||
* @param {string} index - The name of the index
|
||||
* @param {string} type - The type of the document
|
||||
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|
||||
* @param {string} parent - ID of the parent document
|
||||
* @param {enum} refresh - If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|
||||
* @param {string} routing - Specific routing value
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
* @param {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
|
||||
* @param {object} body - The document
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'wait_for_active_shards',
|
||||
'parent',
|
||||
'refresh',
|
||||
'routing',
|
||||
'timeout',
|
||||
'version',
|
||||
'version_type',
|
||||
'pipeline',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
waitForActiveShards: 'wait_for_active_shards',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function create (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'PUT'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCreate
|
||||
@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildDelete (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html) request
|
||||
*
|
||||
* @param {string} id - The document ID
|
||||
* @param {string} index - The name of the index
|
||||
* @param {string} type - The type of the document
|
||||
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|
||||
* @param {string} parent - ID of parent document
|
||||
* @param {enum} refresh - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
|
||||
* @param {string} routing - Specific routing value
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
* @param {number} if_seq_no - only perform the delete operation if the last operation that has changed the document has the specified sequence number
|
||||
* @param {number} if_primary_term - only perform the delete operation if the last operation that has changed the document has the specified primary term
|
||||
* @param {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'wait_for_active_shards',
|
||||
'parent',
|
||||
'refresh',
|
||||
'routing',
|
||||
'timeout',
|
||||
'if_seq_no',
|
||||
'if_primary_term',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
waitForActiveShards: 'wait_for_active_shards',
|
||||
ifSeqNo: 'if_seq_no',
|
||||
ifPrimaryTerm: 'if_primary_term',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function _delete (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['id'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'DELETE'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDelete
|
||||
@ -1,222 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildDeleteByQuery (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
|
||||
* @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types
|
||||
* @param {string} analyzer - The analyzer to use for the query string
|
||||
* @param {boolean} analyze_wildcard - Specify whether wildcard and prefix queries should be analyzed (default: false)
|
||||
* @param {enum} default_operator - The default operator for query string query (AND or OR)
|
||||
* @param {string} df - The field to use as default where no field prefix is given in the query string
|
||||
* @param {number} from - Starting offset (default: 0)
|
||||
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
* @param {enum} conflicts - What to do when the delete by query hits version conflicts?
|
||||
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
||||
* @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
|
||||
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {string} q - Query in the Lucene query string syntax
|
||||
* @param {list} routing - A comma-separated list of specific routing values
|
||||
* @param {time} scroll - Specify how long a consistent view of the index should be maintained for scrolled search
|
||||
* @param {enum} search_type - Search operation type
|
||||
* @param {time} search_timeout - Explicit timeout for each search request. Defaults to no timeout.
|
||||
* @param {number} size - Number of hits to return (default: 10)
|
||||
* @param {list} sort - A comma-separated list of <field>:<direction> pairs
|
||||
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
|
||||
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
|
||||
* @param {list} _source_includes - A list of fields to extract and return from the _source field
|
||||
* @param {number} terminate_after - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
|
||||
* @param {list} stats - Specific 'tag' of the request for logging and statistical purposes
|
||||
* @param {boolean} version - Specify whether to return document version as part of a hit
|
||||
* @param {boolean} request_cache - Specify if request cache should be used for this request or not, defaults to index level setting
|
||||
* @param {boolean} refresh - Should the effected indexes be refreshed?
|
||||
* @param {time} timeout - Time each individual bulk request should wait for shards that are unavailable.
|
||||
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
|
||||
* @param {number} scroll_size - Size on the scroll request powering the delete by query
|
||||
* @param {boolean} wait_for_completion - Should the request should block until the delete by query is complete.
|
||||
* @param {number} requests_per_second - The throttle for this request in sub-requests per second. -1 means no throttle.
|
||||
* @param {number} slices - The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.
|
||||
* @param {object} body - The search definition using the Query DSL
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'analyzer',
|
||||
'analyze_wildcard',
|
||||
'default_operator',
|
||||
'df',
|
||||
'from',
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'conflicts',
|
||||
'expand_wildcards',
|
||||
'lenient',
|
||||
'preference',
|
||||
'q',
|
||||
'routing',
|
||||
'scroll',
|
||||
'search_type',
|
||||
'search_timeout',
|
||||
'size',
|
||||
'sort',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'terminate_after',
|
||||
'stats',
|
||||
'version',
|
||||
'request_cache',
|
||||
'refresh',
|
||||
'timeout',
|
||||
'wait_for_active_shards',
|
||||
'scroll_size',
|
||||
'wait_for_completion',
|
||||
'requests_per_second',
|
||||
'slices',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
analyzeWildcard: 'analyze_wildcard',
|
||||
defaultOperator: 'default_operator',
|
||||
ignoreUnavailable: 'ignore_unavailable',
|
||||
allowNoIndices: 'allow_no_indices',
|
||||
expandWildcards: 'expand_wildcards',
|
||||
searchType: 'search_type',
|
||||
searchTimeout: 'search_timeout',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
terminateAfter: 'terminate_after',
|
||||
requestCache: 'request_cache',
|
||||
waitForActiveShards: 'wait_for_active_shards',
|
||||
scrollSize: 'scroll_size',
|
||||
waitForCompletion: 'wait_for_completion',
|
||||
requestsPerSecond: 'requests_per_second',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function deleteByQuery (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDeleteByQuery
|
||||
@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildDeleteByQueryRethrottle (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [delete_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html) request
|
||||
*
|
||||
* @param {string} task_id - The task id to rethrottle
|
||||
* @param {number} requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'requests_per_second',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
requestsPerSecond: 'requests_per_second',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function deleteByQueryRethrottle (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['task_id'] == null && params['taskId'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: task_id or taskId')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['requests_per_second'] == null && params['requestsPerSecond'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: requests_per_second or requestsPerSecond')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, taskId, task_id } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'taskId', 'task_id'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_delete_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDeleteByQueryRethrottle
|
||||
@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildDeleteScript (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [delete_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request
|
||||
*
|
||||
* @param {string} id - Script ID
|
||||
* @param {time} timeout - Explicit operation timeout
|
||||
* @param {time} master_timeout - Specify timeout for connection to master
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'timeout',
|
||||
'master_timeout',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function deleteScript (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'DELETE'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_scripts' + '/' + encodeURIComponent(id)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildDeleteScript
|
||||
@ -1,167 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildExists (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
|
||||
*
|
||||
* @param {string} id - The document ID
|
||||
* @param {string} index - The name of the index
|
||||
* @param {string} type - The type of the document (use `_all` to fetch the first document matching the ID across all types)
|
||||
* @param {list} stored_fields - A comma-separated list of stored fields to return in the response
|
||||
* @param {string} parent - The ID of the parent document
|
||||
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
|
||||
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
|
||||
* @param {string} routing - Specific routing value
|
||||
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
|
||||
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
|
||||
* @param {list} _source_includes - A list of fields to extract and return from the _source field
|
||||
* @param {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'stored_fields',
|
||||
'parent',
|
||||
'preference',
|
||||
'realtime',
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
storedFields: 'stored_fields',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function exists (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'HEAD'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildExists
|
||||
@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildExistsSource (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [exists_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
|
||||
*
|
||||
* @param {string} id - The document ID
|
||||
* @param {string} index - The name of the index
|
||||
* @param {string} type - The type of the document; deprecated and optional starting with 7.0
|
||||
* @param {string} parent - The ID of the parent document
|
||||
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
|
||||
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
|
||||
* @param {string} routing - Specific routing value
|
||||
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
|
||||
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
|
||||
* @param {list} _source_includes - A list of fields to extract and return from the _source field
|
||||
* @param {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'parent',
|
||||
'preference',
|
||||
'realtime',
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function existsSource (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['id'] != null && (params['type'] == null || params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: type, index')
|
||||
return handleError(err, callback)
|
||||
} else if (params['type'] != null && (params['index'] == null)) {
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'HEAD'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildExistsSource
|
||||
@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildExplain (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html) request
|
||||
*
|
||||
* @param {string} id - The document ID
|
||||
* @param {string} index - The name of the index
|
||||
* @param {string} type - The type of the document
|
||||
* @param {boolean} analyze_wildcard - Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false)
|
||||
* @param {string} analyzer - The analyzer for the query string query
|
||||
* @param {enum} default_operator - The default operator for query string query (AND or OR)
|
||||
* @param {string} df - The default field for query string query (default: _all)
|
||||
* @param {list} stored_fields - A comma-separated list of stored fields to return in the response
|
||||
* @param {boolean} lenient - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
|
||||
* @param {string} parent - The ID of the parent document
|
||||
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {string} q - Query in the Lucene query string syntax
|
||||
* @param {string} routing - Specific routing value
|
||||
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
|
||||
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
|
||||
* @param {list} _source_includes - A list of fields to extract and return from the _source field
|
||||
* @param {object} body - The query definition using the Query DSL
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'analyze_wildcard',
|
||||
'analyzer',
|
||||
'default_operator',
|
||||
'df',
|
||||
'stored_fields',
|
||||
'lenient',
|
||||
'parent',
|
||||
'preference',
|
||||
'q',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
analyzeWildcard: 'analyze_wildcard',
|
||||
defaultOperator: 'default_operator',
|
||||
storedFields: 'stored_fields',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function explain (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = body == null ? 'GET' : 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildExplain
|
||||
@ -1,142 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildFieldCaps (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [field_caps](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html) request
|
||||
*
|
||||
* @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
||||
* @param {list} fields - A comma-separated list of field names
|
||||
* @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
* @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
* @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both.
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'fields',
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
ignoreUnavailable: 'ignore_unavailable',
|
||||
allowNoIndices: 'allow_no_indices',
|
||||
expandWildcards: 'expand_wildcards',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function fieldCaps (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = body == null ? 'GET' : 'POST'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_field_caps'
|
||||
} else {
|
||||
path = '/' + '_field_caps'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildFieldCaps
|
||||
173
api/api/get.js
173
api/api/get.js
@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildGet (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [get](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
|
||||
*
|
||||
* @param {string} id - The document ID
|
||||
* @param {string} index - The name of the index
|
||||
* @param {string} type - The type of the document (use `_all` to fetch the first document matching the ID across all types)
|
||||
* @param {list} stored_fields - A comma-separated list of stored fields to return in the response
|
||||
* @param {string} parent - The ID of the parent document
|
||||
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
|
||||
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
|
||||
* @param {string} routing - Specific routing value
|
||||
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
|
||||
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
|
||||
* @param {list} _source_includes - A list of fields to extract and return from the _source field
|
||||
* @param {list} _source_exclude - A list of fields to exclude from the returned _source field
|
||||
* @param {list} _source_include - A list of fields to extract and return from the _source field
|
||||
* @param {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'stored_fields',
|
||||
'parent',
|
||||
'preference',
|
||||
'realtime',
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'_source_exclude',
|
||||
'_source_include',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
storedFields: 'stored_fields',
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
_sourceExclude: '_source_exclude',
|
||||
_sourceInclude: '_source_include',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function get (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildGet
|
||||
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildGetScript (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [get_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request
|
||||
*
|
||||
* @param {string} id - Script ID
|
||||
* @param {time} master_timeout - Specify timeout for connection to master
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'master_timeout',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function getScript (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_scripts' + '/' + encodeURIComponent(id)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildGetScript
|
||||
@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildGetSource (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [get_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
|
||||
*
|
||||
* @param {string} id - The document ID
|
||||
* @param {string} index - The name of the index
|
||||
* @param {string} type - The type of the document; deprecated and optional starting with 7.0
|
||||
* @param {string} parent - The ID of the parent document
|
||||
* @param {string} preference - Specify the node or shard the operation should be performed on (default: random)
|
||||
* @param {boolean} realtime - Specify whether to perform the operation in realtime or search mode
|
||||
* @param {boolean} refresh - Refresh the shard containing the document before performing the operation
|
||||
* @param {string} routing - Specific routing value
|
||||
* @param {list} _source - True or false to return the _source field or not, or a list of fields to return
|
||||
* @param {list} _source_excludes - A list of fields to exclude from the returned _source field
|
||||
* @param {list} _source_includes - A list of fields to extract and return from the _source field
|
||||
* @param {number} version - Explicit version number for concurrency control
|
||||
* @param {enum} version_type - Specific version type
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'parent',
|
||||
'preference',
|
||||
'realtime',
|
||||
'refresh',
|
||||
'routing',
|
||||
'_source',
|
||||
'_source_excludes',
|
||||
'_source_includes',
|
||||
'version',
|
||||
'version_type',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
_sourceExcludes: '_source_excludes',
|
||||
_sourceIncludes: '_source_includes',
|
||||
versionType: 'version_type',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
return function getSource (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, id, index, type } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'id', 'index', 'type'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null && (type) != null && (id) != null) {
|
||||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
|
||||
} else {
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildGetSource
|
||||
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildIlmDeleteLifecycle (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.delete_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html) request
|
||||
*
|
||||
* @param {string} policy - The name of the index lifecycle policy
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ilmDeleteLifecycle (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, policy } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'policy'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'DELETE'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + '_ilm' + '/' + 'policy' + '/' + encodeURIComponent(policy)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: '',
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmDeleteLifecycle
|
||||
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildIlmExplainLifecycle (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request
|
||||
*
|
||||
* @param {string} index - The name of the index to explain
|
||||
* @param {boolean} human - Return data such as dates in a human readable format
|
||||
*/
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'human'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
return function ilmExplainLifecycle (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
var { method, body, index } = params
|
||||
var querystring = semicopy(params, ['method', 'body', 'index'])
|
||||
|
||||
if (method == null) {
|
||||
method = 'GET'
|
||||
}
|
||||
|
||||
var ignore = options.ignore || null
|
||||
if (typeof ignore === 'number') {
|
||||
ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_ilm' + '/' + 'explain'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
const requestOptions = {
|
||||
ignore,
|
||||
requestTimeout: options.requestTimeout || null,
|
||||
maxRetries: options.maxRetries || null,
|
||||
asStream: options.asStream || false,
|
||||
headers: options.headers || null,
|
||||
querystring: options.querystring || null,
|
||||
compression: options.compression || false,
|
||||
warnings
|
||||
}
|
||||
|
||||
return makeRequest(request, requestOptions, callback)
|
||||
|
||||
function semicopy (obj, exclude) {
|
||||
var target = {}
|
||||
var keys = Object.keys(obj)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
if (exclude.indexOf(key) === -1) {
|
||||
target[snakeCase[key] || key] = obj[key]
|
||||
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
|
||||
warnings = warnings || []
|
||||
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
|
||||
}
|
||||
}
|
||||
}
|
||||
return target
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIlmExplainLifecycle
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user