Compare commits

...

23 Commits

Author SHA1 Message Date
cd7f55ab9a Update changelog for 8.8.1 2023-06-12 16:28:09 -05:00
bf3a5c449a Bump canary to 8.8.1-canary.2 2023-06-12 16:08:27 -05:00
d85529e929 [Backport 8.8] Add test to verify bulk helper index drift fix (#1916)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2023-06-12 16:04:02 -05:00
936bcee72d [Backport 8.8] Stop running integration tests on PRs (#1911)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2023-06-08 12:22:35 -05:00
1f925676ed [Backport 8.8] add link to elasticsearch-specification github repository in typescript documentation (#1907) (#1909)
Co-authored-by: Nathan Reese <reese.nathan@gmail.com>
2023-06-08 11:55:08 -05:00
8072097170 [Backport 8.8] Upgrade transport to 8.3.2 (#1908)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2023-06-08 11:48:46 -05:00
0e983bd2c3 [Backport 8.8] fix: keep track of indexSlice explicitly in bulk helper response handling loop (#1759) (#1903)
Co-authored-by: Karl Riis <karlriis97@gmail.com>
2023-06-07 15:19:00 -05:00
9c000df8a1 [Backport 8.8] Fix broken Github action on Node 14.x (#1905)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-06-07 14:29:04 -05:00
c6ae866d1a Update APIs for 8.8.1 2023-06-02 15:42:27 -05:00
1fb44787cc [Backport 8.8] Update changelog for 8.7 and 8.8 (#1898)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-05-26 13:21:13 -05:00
4a1860b29c Update APIs to 8.8.0 2023-05-26 12:15:32 -05:00
26e04997eb [Backport 8.8] Drop Jenkins jobs (#1877) (#1892) 2023-05-12 16:16:53 -05:00
295e3ed48c [Backport 8.8] Update scroll.asciidoc (#1763) (#1887)
Co-authored-by: Mario Bašić <mario@laravelista.hr>
2023-05-11 12:40:49 -05:00
cbf46454f2 [Backport 8.8] Upgrade backport workflow to v2 (#1886)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-05-11 12:19:36 -05:00
678e9d9f70 Bump canary version to 8.8.0-canary.2 2023-05-11 12:14:03 -05:00
9cb5ac4f93 Fix estypesWithBody definition (#1784) 2023-05-11 12:01:46 -05:00
588d080710 Bump canary version to 8.8.0-canary.1 2023-05-05 14:30:46 -05:00
087c26568f Update APIs to latest 8.8.0-SNAPSHOT 2023-05-05 14:19:08 -05:00
7ab6fa9624 [Backport 8.8] Buildkite pipeline for integration tests (#1875)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-05-05 13:35:42 -05:00
a33c7af5e8 [Backport 8.8] Use correct user-agent header by default (#1867)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-05-05 11:10:40 -05:00
4a4624b3ad [Backport 8.8] Fix integration test runner for 8.8 (#1862)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-05-02 10:00:03 -05:00
28f56835fe [Backport 8.8] Add CI job for 8.8 branch (#1858)
Co-authored-by: Josh Mock <josh@joshmock.com>
2023-05-01 11:17:26 -05:00
d5904a8bb1 Update APIs to 8.8.0 2023-05-01 10:19:54 -05:00
65 changed files with 3224 additions and 1404 deletions

14
.buildkite/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
ARG NODE_VERSION=${NODE_VERSION:-18}
FROM node:$NODE_VERSION
# Install required tools
RUN apt-get clean -y && \
apt-get -qy update && \
apt-get -y install zip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /usr/src/app
COPY . .
RUN npm install --production=false

21
.buildkite/certs/testnode.crt Executable file
View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDYjCCAkqgAwIBAgIVAIClHav09e9XGWJrnshywAjUHTnXMA0GCSqGSIb3DQEB
CwUAMDQxMjAwBgNVBAMTKUVsYXN0aWMgQ2VydGlmaWNhdGUgVG9vbCBBdXRvZ2Vu
ZXJhdGVkIENBMB4XDTIzMDMyODE3MDIzOVoXDTI2MDMyNzE3MDIzOVowEzERMA8G
A1UEAxMIaW5zdGFuY2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
+t5/g6u2r3awCtzqp17KG0hRxzkVoJoF8DYzVh+Rv9ymxQW0C/U8dQihAjkZHaIA
n49lSyNLkwWtmqQgPcimV4d6XuTYx2ahDixXYtjmoOSwH5dRtovKPCNKDPkUj9Vq
NwMW0uB1VxniMKI4DnYFqBgHL9kQKhQqvas6Gx0X6ptGRCLYCtVxeFcau6nnkZJt
urb+HNV5waOh0uTmsqnnslK3NjCQ/f030vPKxM5fOqOU5ajUHpZFJ6ZFmS32074H
l+mZoRT/GtbnVtIg+CJXsWThF3/L4iBImv+rkY9MKX5fyMLJgmIJG68S90IQGR8c
Z2lZYzC0J7zjMsYlODbDAgMBAAGjgYswgYgwHQYDVR0OBBYEFIDIcECn3AVHc3jk
MpQ4r7Kc3WCsMB8GA1UdIwQYMBaAFJYCWKn16g+acbing4Vl45QGUBs0MDsGA1Ud
EQQ0MDKCCWxvY2FsaG9zdIIIaW5zdGFuY2WHBH8AAAGHEAAAAAAAAAAAAAAAAAAA
AAGCA2VzMTAJBgNVHRMEAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQBtX3RQ5ATpfORM
lrnhaUPGOWkjnb3p3BrdAWUaWoh136QhaXqxKiALQQhTtTerkXOcuquy9MmAyYvS
9fDdGvLCAO8pPCXjnzonCHerCLGdS7f/eqvSFWCdy7LPHzTAFYfVWVvbZed+83TL
bDY63AMwIexj34vJEStMapuFwWx05fstE8qZWIbYCL87sF5H/MRhzlz3ScAhQ1N7
tODH7zvLzSxFGGEzCIKZ0iPFKbd3Y0wE6SptDSKhOqlnC8kkNeI2GjWsqVfHKsoF
pDFmri7IfOucuvalXJ6xiHPr9RDbuxEXs0u8mteT5nFQo7EaEGdHpg1pNGbfBOzP
lmj/dRS9
-----END CERTIFICATE-----

27
.buildkite/certs/testnode.key Executable file
View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAlfref4Ortq92sArc6qdeyhtIUcc5FaCaBfA2M1Yfkb/cpsUF
tAv1PHUIoQI5GR2iAJ+PZUsjS5MFrZqkID3IpleHel7k2MdmoQ4sV2LY5qDksB+X
UbaLyjwjSgz5FI/VajcDFtLgdVcZ4jCiOA52BagYBy/ZECoUKr2rOhsdF+qbRkQi
2ArVcXhXGrup55GSbbq2/hzVecGjodLk5rKp57JStzYwkP39N9LzysTOXzqjlOWo
1B6WRSemRZkt9tO+B5fpmaEU/xrW51bSIPgiV7Fk4Rd/y+IgSJr/q5GPTCl+X8jC
yYJiCRuvEvdCEBkfHGdpWWMwtCe84zLGJTg2wwIDAQABAoIBAAEP7HYNNnDWdYMD
+WAtYM12X/W5s/wUP94juaBI4u4iZH2EZodlixEdZUCTXgq43WsDUhxX05s7cE+p
H5DuSCHtoo2WHvGKAposwRDm2f3YVWQ2Xyb2ahNt69LYHHWrO+XQ60YYTa3r8Gn3
7dFR3I016/jyn5DeEVaglvS1dfj2UG4ybR4KkMfcKd94X0rKvz3wzAhHIh+hwMtv
sVk7V4vSnKf2mJXwIVECTolnEJEkCjWjjymgUJYKT8yN7JnAsHRcvMa6kWwIGrLp
oQCEaJwYM6ynCRS989pLt3vA2iu5VkYhiHXJ9Ds/5b5yzhzmj+ymzKbFKrrUUrmn
+2Jp1K0CgYEAw8BchALsD/+JuoXjinA14MH7PZjIsXyhtPk+c4pk42iMNyg1J8XF
Y/ITepLYsl2bZqQI1jOJdDqsTwIsva9r749lsmkYI3VOxhi7+qBK0sThR66C87lX
iU2QpnZ9NloC6ort4a3MEvZ/gRQcXdBrNlNoza2p7PHAVDTnsdSrNKUCgYEAxCQV
uo85oZyfnMufn/gcI9IeYOgiB0tO3a8cAFX2wQW1y935t6Z13ApUQc4EnCOH7ZBc
td5kT+xGdRWnfPZ38FM1dd5MBdGE69s3q8pJDUExSgNLqaF6/5bD32qui66L3ugu
eMjxrzqJsc2uQTPCs18SGsyRmf54DpY8HglOmUcCgYAGRDgx+a347SNJl1OrcOAo
q80RMbzrAaRjmL8JD9se9I/YjC73cPtasbsx51WMkDaTWJj30nqJ//7YIKeyAtWf
u6Vzyq19JRo6eTw7T7pVePwFQW7rwnks6hDBY3WqscL6IyxuVxP7X2zBgxVNY4ir
Gox2WSLhdPPFPlRUewxoCQKBgAJvqE1u5fpZ5ame5dao0ECppXLyrymEB/C88g4X
Az+WgJGNqkJbsO8QuccvdeMylcefmWcw4fIULzPZFwF4VjkH74wNPMh9t7buPBzI
IGwnuSMAM3ph5RMzni8yNgTKIDaej6U0abwRcBBjS5zHtc1giusGS3CsNnWH7Cs7
VlyVAoGBAK+prq9t9x3tC3NfCZH8/Wfs/X0T1qm11RiL5+tOhmbguWAqSSBy8OjX
Yh8AOXrFuMGldcaTXxMeiKvI2cyybnls1MFsPoeV/fSMJbex7whdeJeTi66NOSKr
oftUHvkHS0Vv/LicMEOufFGslb4T9aPJ7oyhoSlz9CfAutDWk/q/
-----END RSA PRIVATE KEY-----

View File

View File

View File

@ -1,3 +1,30 @@
steps:
- label: ":js: Greetings"
command: "echo 'Hello, world!'"
- label: ":elasticsearch: :javascript: ES JavaScript ({{ matrix.nodejs }}) Test Suite: {{ matrix.suite }}"
agents:
provider: "gcp"
env:
NODE_VERSION: "{{ matrix.nodejs }}"
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.8.0-SNAPSHOT
matrix:
setup:
suite:
- "free"
- "platinum"
nodejs:
- "16"
- "18"
- "20"
command: ./.buildkite/run-tests.sh
artifact_paths: "./junit-output/junit-*.xml"
- wait: ~
continue_on_failure: true
- label: ":junit: Test results"
agents:
provider: "gcp"
image: family/core-ubuntu-2204
plugins:
- junit-annotate#v2.4.1:
artifacts: "junit-output/junit-*.xml"
job-uuid-file-pattern: 'junit-(.*).xml'
fail-build-on-error: true

31
.buildkite/run-client.sh Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# Once called Elasticsearch should be up and running
#
script_path=$(dirname "$(realpath -s "$0")")
set -euo pipefail
repo=$(pwd)
export NODE_VERSION=${NODE_VERSION:-18}
echo "--- :javascript: Building Docker image"
docker build \
--file "$script_path/Dockerfile" \
--tag elastic/elasticsearch-js \
--build-arg NODE_VERSION="$NODE_VERSION" \
.
echo "--- :javascript: Running $TEST_SUITE tests"
mkdir -p "$repo/junit-output"
docker run \
--network="${network_name}" \
--env "TEST_ES_SERVER=${elasticsearch_url}" \
--env "ELASTIC_PASSWORD=${elastic_password}" \
--env "TEST_SUITE=${TEST_SUITE}" \
--env "ELASTIC_USER=elastic" \
--env "BUILDKITE=true" \
--volume "$repo/junit-output:/junit-output" \
--name elasticsearch-js \
--rm \
elastic/elasticsearch-js \
bash -c "npm run test:integration; [ -f ./$TEST_SUITE-report-junit.xml ] && mv ./$TEST_SUITE-report-junit.xml /junit-output/junit-$BUILDKITE_JOB_ID.xml || echo 'No JUnit artifact found'"

View File

@ -22,16 +22,19 @@
# - 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"
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 separate terminals \033[0m"
cleanup_node "$es_node_name"
cleanup_node $es_node_name
master_node_name=${es_node_name}
cluster_name=${moniker}${suffix}
# Set vm.max_map_count kernel setting to 262144
sudo sysctl -w vm.max_map_count=262144
declare -a volumes
environment=($(cat <<-END
--env ELASTIC_PASSWORD=$elastic_password
@ -73,6 +76,7 @@ END
))
else
environment+=($(cat <<-END
--env node.roles=data,data_cold,data_content,data_frozen,data_hot,data_warm,ingest,master,ml,remote_cluster_client,transform
--env xpack.security.enabled=false
--env xpack.security.http.ssl.enabled=false
END
@ -84,6 +88,13 @@ 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
echo "--- :elasticsearch: Environment setup"
echo "TEST_SUITE: $TEST_SUITE"
echo "Elasticsearch URL: $elasticsearch_url"
echo "Elasticsearch External URL: $external_elasticsearch_url"
echo "--- :elasticsearch: Running container"
# 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
@ -138,6 +149,4 @@ END
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

16
.buildkite/run-tests.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# Script to run Elasticsearch container and Elasticsearch client integration tests on Buildkite
#
# Version 0.1
#
script_path=$(dirname "$(realpath -s "$0")")
source "$script_path/functions/imports.sh"
set -euo pipefail
echo "--- :elasticsearch: Starting Elasticsearch"
DETACH=true bash "$script_path/run-elasticsearch.sh"
echo "+++ :javascript: Run Client"
bash "$script_path/run-client.sh"

View File

@ -1,19 +0,0 @@
-----BEGIN CERTIFICATE-----
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-----

View File

@ -1,27 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
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-----

View File

@ -1,7 +0,0 @@
ARG NODE_JS_VERSION=10
FROM node:${NODE_JS_VERSION}-alpine
RUN apk --no-cache add git
# Create app directory
WORKDIR /usr/src/app

View File

@ -1,81 +0,0 @@
---
##### GLOBAL METADATA
- meta:
cluster: clients-ci
##### JOB DEFAULTS
- job:
project-type: matrix
logrotate:
daysToKeep: 30
numToKeep: 100
parameters:
- string:
name: branch_specifier
default: refs/heads/main
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
properties:
- github:
url: https://github.com/elastic/elasticsearch-js/
- inject:
properties-content: HOME=$JENKINS_HOME
concurrent: true
node: flyweight
scm:
- git:
name: origin
credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba
reference-repo: /var/lib/jenkins/.git-references/elasticsearch-js.git
branches:
- ${branch_specifier}
url: https://github.com/elastic/elasticsearch-js.git
basedir: ''
wipe-workspace: 'True'
triggers:
- github
vault:
# vault read auth/approle/role/clients-ci/role-id
role_id: ddbd0d44-0e51-105b-177a-c8fdfd445126
axes:
- axis:
type: slave
name: label
values:
- linux
- axis:
type: yaml
filename: .ci/test-matrix.yml
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
builders:
- shell: |-
#!/usr/local/bin/runbld
.ci/run-tests
publishers:
- email:
recipients: build-lang-clients@elastic.co
- junit:
results: "**/*-junit.xml"
allow-empty-results: true

View File

@ -1,15 +0,0 @@
---
- 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 (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,15 +0,0 @@
---
- 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 (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,15 +0,0 @@
---
- job:
name: elastic+elasticsearch-js+8.2
display-name: 'elastic / elasticsearch-js # 8.2'
description: Testing the elasticsearch-js 8.2 branch.
junit_results: "*-junit.xml"
parameters:
- string:
name: branch_specifier
default: refs/heads/8.2
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,15 +0,0 @@
---
- job:
name: elastic+elasticsearch-js+8.3
display-name: 'elastic / elasticsearch-js # 8.3'
description: Testing the elasticsearch-js 8.3 branch.
junit_results: "*-junit.xml"
parameters:
- string:
name: branch_specifier
default: refs/heads/8.3
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,15 +0,0 @@
---
- job:
name: elastic+elasticsearch-js+8.4
display-name: 'elastic / elasticsearch-js # 8.3'
description: Testing the elasticsearch-js 8.4 branch.
junit_results: "*-junit.xml"
parameters:
- string:
name: branch_specifier
default: refs/heads/8.4
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,15 +0,0 @@
---
- job:
name: elastic+elasticsearch-js+8.5
display-name: 'elastic / elasticsearch-js # 8.5'
description: Testing the elasticsearch-js 8.5 branch.
junit_results: "*-junit.xml"
parameters:
- string:
name: branch_specifier
default: refs/heads/8.5
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,15 +0,0 @@
---
- job:
name: elastic+elasticsearch-js+8.6
display-name: 'elastic / elasticsearch-js # 8.6'
description: Testing the elasticsearch-js 8.6 branch.
junit_results: "*-junit.xml"
parameters:
- string:
name: branch_specifier
default: refs/heads/8.6
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,15 +0,0 @@
---
- job:
name: elastic+elasticsearch-js+8.7
display-name: 'elastic / elasticsearch-js # 8.7'
description: Testing the elasticsearch-js 8.7 branch.
junit_results: "*-junit.xml"
parameters:
- string:
name: branch_specifier
default: refs/heads/8.7
description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,15 +0,0 @@
---
- 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 (&lt;branchName&gt;, &lt;tagName&gt;,
&lt;commitId&gt;, etc.)
triggers:
- github
- timed: 'H */12 * * *'

View File

@ -1,19 +0,0 @@
---
- job:
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:
- ${ghprbActualCommit}
refspec: +refs/pull/*:refs/remotes/origin/pr/*
triggers:
- github-pull-request:
org-list:
- elastic
allow-whitelist-orgs-as-admins: true
github-hooks: true
status-context: clients-ci
cancel-builds-on-update: true

View File

@ -86,10 +86,10 @@ async function bump (args) {
'utf8'
)
const testMatrix = await readFile(join(import.meta.url, 'test-matrix.yml'), 'utf8')
const pipeline = await readFile(join(import.meta.url, '..', '.buildkite', 'pipeline.yml'))
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
join(import.meta.url, '..', '.buildkite', 'pipeline.yml'),
pipeline.replace(/STACK_VERSION: [0-9]+[0-9\.]*[0-9](?:\-SNAPSHOT)?/, `STACK_VERSION: - ${cleanVersion}-SNAPSHOT`), // eslint-disable-line
'utf8'
)
}

View File

@ -1,14 +0,0 @@
#!/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

View File

@ -1,43 +0,0 @@
#!/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

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
#
# Version 1.1
# - Moved to .ci folder and separated 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
echo -e "\033[1m>>>>> Start [$STACK_VERSION container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
DETACH=true bash .ci/run-elasticsearch.sh
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

View File

@ -1,14 +0,0 @@
---
STACK_VERSION:
- "8.8.0-SNAPSHOT"
NODE_JS_VERSION:
- 18
- 16
- 14
TEST_SUITE:
- free
- platinum
exclude: ~

View File

@ -11,6 +11,6 @@ jobs:
name: Backport
steps:
- name: Backport
uses: tibdex/backport@v1
uses: tibdex/backport@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,3 +1,4 @@
---
name: Node CI
on: [push, pull_request]
@ -8,167 +9,37 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
npm install
# workaround for failing tests on Node.js 14.x
# see https://github.com/actions/setup-node/issues/411
- name: Force install specific npm version
run: |
npm install --global npm@8.3.1
npm install --global npm@9.7.1
- name: Lint
run: |
npm run lint
- name: Install
run: |
npm install
- name: Unit test
run: |
npm run test:unit
- name: Lint
run: |
npm run lint
# - 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@v3
# - 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@v3
# 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@v3
# - 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@v3
# 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@v3
# - name: Use Node.js 14.x
# uses: actions/setup-node@v3
# 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@v3
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# 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
- name: Unit test
run: |
npm run test:unit
license:
name: License check
@ -176,20 +47,20 @@ jobs:
strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: |
npm install
- name: Install
run: |
npm install
- name: License checker
run: |
npm run license-checker
- name: License checker
run: |
npm run license-checker

49
catalog-info.yaml Normal file
View File

@ -0,0 +1,49 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/catalog-info.json
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: elasticsearch-js
spec:
type: library
owner: group:clients-team
lifecycle: production
---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: elasticsearch-js-integration-tests
description: Elasticsearch JavaScript client integration tests
spec:
type: buildkite-pipeline
owner: group:clients-team
system: buildkite
implementation:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: Elasticsearch JavaScript client integration tests
spec:
repository: elastic/elasticsearch-js
pipeline_file: .buildkite/pipeline.yml
teams:
clients-team:
access_level: MANAGE_BUILD_AND_READ
everyone:
access_level: READ_ONLY
provider_settings:
build_pull_requests: false
cancel_intermediate_builds: true
cancel_intermediate_builds_branch_filter: '!main'
schedules:
main_semi_daily:
branch: 'main'
cronline: '*/12 * * *'
8_8_semi_daily:
branch: '8.8'
cronline: '*/12 * * *'
8_7_daily:
branch: '8.7'
cronline: '@daily'

View File

@ -1,6 +1,56 @@
[[changelog-client]]
== Release notes
[discrete]
=== 8.8.1
===== Support for Elasticsearch `v8.8.1`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/release-notes-8.8.1.html[here].
[discrete]
==== Fixes
[discrete]
===== Fix index drift bug in bulk helper https://github.com/elastic/elasticsearch-js/pull/1759[#1759]
Fixes a bug in the bulk helper that would cause `onDrop` to send back the wrong JSON document or error on a nonexistent document when an error occurred on a bulk HTTP request that contained a `delete` action.
[discrete]
===== Fix a memory leak caused by an outdated version of Undici https://github.com/elastic/elasticsearch-js/pull/1902[#1902]
Undici 5.5.1, used by https://github.com/elastic/elastic-transport-js[elastic-transport-js], could create a memory leak when a high volume of requests created too many HTTP `abort` listeners. Upgrading Undici to 5.22.1 removed the memory leak.
[discrete]
=== 8.8.0
[discrete]
==== Features
[discrete]
===== Support for Elasticsearch `v8.8.0`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/release-notes-8.8.0.html[here].
[discrete]
==== Fixes
[discrete]
===== Fix type declarations for legacy types with a body key https://github.com/elastic/elasticsearch-js/pull/1784[#1784]
Prior releases contained a bug where type declarations for legacy types that include a `body` key were not actually importing the type that includes the `body` key.
[discrete]
=== 8.7.0
[discrete]
===== Support for Elasticsearch `v8.7.0`
You can find all the API changes
https://www.elastic.co/guide/en/elasticsearch/reference/8.7/release-notes-8.7.0.html[here].
[discrete]
=== 8.6.0

View File

@ -103,7 +103,7 @@ async function run () {
// get the next response if there are more quotes to fetch
responseQueue.push(
await client.scroll({
scrollId: body._scroll_id,
scroll_id: body._scroll_id,
scroll: '30s'
})
)
@ -146,7 +146,7 @@ async function * scrollSearch (params) {
}
response = await client.scroll({
scrollId: response._scroll_id,
scroll_id: response._scroll_id,
scroll: params.scroll
})
}

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@ of type definitions of Elasticsearch's API surface.
The types are not 100% complete yet. Some APIs are missing (the newest ones, e.g. EQL),
and others may contain some errors, but we are continuously pushing fixes & improvements.
Contribute type fixes and improvements to https://github.com/elastic/elasticsearch-specification[elasticsearch-specification github repository].
NOTE: The client is developed against the https://www.npmjs.com/package/typescript?activeTab=versions[latest]
version of TypeScript. Furthermore, unless you have set `skipLibCheck` to `true`,

2
index.d.ts vendored
View File

@ -22,6 +22,6 @@ import SniffingTransport from './lib/sniffingTransport'
export * from '@elastic/transport'
export * as estypes from './lib/api/types'
export * as estypesWithBody from './lib/api/types'
export * as estypesWithBody from './lib/api/typesWithBodyKey'
export { Client, SniffingTransport }
export type { ClientOptions, NodeOptions } from './lib/client'

View File

@ -1,7 +1,7 @@
{
"name": "@elastic/elasticsearch",
"version": "8.8.0",
"versionCanary": "8.8.0-canary.0",
"version": "8.8.1",
"versionCanary": "8.8.1-canary.2",
"description": "The official Elasticsearch client for Node.js",
"main": "index.js",
"types": "index.d.ts",
@ -86,7 +86,7 @@
"zx": "^6.1.0"
},
"dependencies": {
"@elastic/transport": "^8.3.1",
"@elastic/transport": "^8.3.2",
"tslib": "^2.4.0"
},
"tap": {

View File

@ -279,7 +279,7 @@ export default class Cluster {
async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest | TB.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise<T.ClusterPutComponentTemplateResponse>
async putComponentTemplate (this: That, params: T.ClusterPutComponentTemplateRequest | TB.ClusterPutComponentTemplateRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['template', 'aliases', 'mappings', 'settings', 'version', '_meta']
const acceptedBody: string[] = ['template', 'version', '_meta', 'allow_auto_create']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body

View File

@ -37,12 +37,12 @@ import * as T from '../types'
import * as TB from '../typesWithBodyKey'
interface That { transport: Transport }
export default async function FieldCapsApi (this: That, params: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.FieldCapsResponse>
export default async function FieldCapsApi (this: That, params: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FieldCapsResponse, unknown>>
export default async function FieldCapsApi (this: That, params: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise<T.FieldCapsResponse>
export default async function FieldCapsApi (this: That, params: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise<any> {
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.FieldCapsResponse>
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.FieldCapsResponse, unknown>>
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise<T.FieldCapsResponse>
export default async function FieldCapsApi (this: That, params?: T.FieldCapsRequest | TB.FieldCapsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['index_filter', 'runtime_mappings']
const acceptedBody: string[] = ['fields', 'index_filter', 'runtime_mappings']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
@ -53,6 +53,7 @@ export default async function FieldCapsApi (this: That, params: T.FieldCapsReque
body = userBody != null ? { ...userBody } : undefined
}
params = params ?? {}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}

View File

@ -0,0 +1,68 @@
/*
* 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.
*/
/* eslint-disable import/export */
/* eslint-disable @typescript-eslint/no-misused-new */
/* eslint-disable @typescript-eslint/no-extraneous-class */
/* eslint-disable @typescript-eslint/no-unused-vars */
// This file was automatically generated by elastic/elastic-client-generator-js
// DO NOT MODIFY IT BY HAND. Instead, modify the source open api file,
// and elastic/elastic-client-generator-js to regenerate this file again.
import {
Transport,
TransportRequestOptions,
TransportRequestOptionsWithMeta,
TransportRequestOptionsWithOutMeta,
TransportResult
} from '@elastic/transport'
import * as T from '../types'
import * as TB from '../typesWithBodyKey'
interface That { transport: Transport }
export default async function HealthReportApi (this: That, params?: T.HealthReportRequest | TB.HealthReportRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.HealthReportResponse>
export default async function HealthReportApi (this: That, params?: T.HealthReportRequest | TB.HealthReportRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.HealthReportResponse, unknown>>
export default async function HealthReportApi (this: That, params?: T.HealthReportRequest | TB.HealthReportRequest, options?: TransportRequestOptions): Promise<T.HealthReportResponse>
export default async function HealthReportApi (this: That, params?: T.HealthReportRequest | TB.HealthReportRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['feature']
const querystring: Record<string, any> = {}
const body = undefined
params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
let method = ''
let path = ''
if (params.feature != null) {
method = 'GET'
path = `/_health_report/${encodeURIComponent(params.feature.toString())}`
} else {
method = 'GET'
path = '/_health_report'
}
return await this.transport.request({ path, method, querystring, body }, options)
}

View File

@ -330,6 +330,28 @@ export default class Indices {
return await this.transport.request({ path, method, querystring, body }, options)
}
async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesDeleteDataLifecycleResponse>
async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesDeleteDataLifecycleResponse, unknown>>
async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptions): Promise<T.IndicesDeleteDataLifecycleResponse>
async deleteDataLifecycle (this: That, params: T.IndicesDeleteDataLifecycleRequest | TB.IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const querystring: Record<string, any> = {}
const body = undefined
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'DELETE'
const path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
return await this.transport.request({ path, method, querystring, body }, options)
}
async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest | TB.IndicesDeleteDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesDeleteDataStreamResponse>
async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest | TB.IndicesDeleteDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesDeleteDataStreamResponse, unknown>>
async deleteDataStream (this: That, params: T.IndicesDeleteDataStreamRequest | TB.IndicesDeleteDataStreamRequest, options?: TransportRequestOptions): Promise<T.IndicesDeleteDataStreamResponse>
@ -540,6 +562,28 @@ export default class Indices {
return await this.transport.request({ path, method, querystring, body }, options)
}
async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesExplainDataLifecycleResponse>
async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesExplainDataLifecycleResponse, unknown>>
async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptions): Promise<T.IndicesExplainDataLifecycleResponse>
async explainDataLifecycle (this: That, params: T.IndicesExplainDataLifecycleRequest | TB.IndicesExplainDataLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const querystring: Record<string, any> = {}
const body = undefined
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'GET'
const path = `/${encodeURIComponent(params.index.toString())}/_lifecycle/explain`
return await this.transport.request({ path, method, querystring, body }, options)
}
async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesFieldUsageStatsResponse>
async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesFieldUsageStatsResponse, unknown>>
async fieldUsageStats (this: That, params: T.IndicesFieldUsageStatsRequest | TB.IndicesFieldUsageStatsRequest, options?: TransportRequestOptions): Promise<T.IndicesFieldUsageStatsResponse>
@ -680,6 +724,28 @@ export default class Indices {
return await this.transport.request({ path, method, querystring, body }, options)
}
async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesGetDataLifecycleResponse>
async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesGetDataLifecycleResponse, unknown>>
async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptions): Promise<T.IndicesGetDataLifecycleResponse>
async getDataLifecycle (this: That, params: T.IndicesGetDataLifecycleRequest | TB.IndicesGetDataLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const querystring: Record<string, any> = {}
const body = undefined
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'GET'
const path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
return await this.transport.request({ path, method, querystring, body }, options)
}
async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest | TB.IndicesGetDataStreamRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesGetDataStreamResponse>
async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest | TB.IndicesGetDataStreamRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesGetDataStreamResponse, unknown>>
async getDataStream (this: That, params?: T.IndicesGetDataStreamRequest | TB.IndicesGetDataStreamRequest, options?: TransportRequestOptions): Promise<T.IndicesGetDataStreamResponse>
@ -1006,6 +1072,40 @@ export default class Indices {
return await this.transport.request({ path, method, querystring, body }, options)
}
async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesPutDataLifecycleResponse>
async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesPutDataLifecycleResponse, unknown>>
async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptions): Promise<T.IndicesPutDataLifecycleResponse>
async putDataLifecycle (this: That, params: T.IndicesPutDataLifecycleRequest | TB.IndicesPutDataLifecycleRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['data_retention']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
let body: Record<string, any> | string
if (typeof userBody === 'string') {
body = userBody
} else {
body = userBody != null ? { ...userBody } : undefined
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'PUT'
const path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_lifecycle`
return await this.transport.request({ path, method, querystring, body }, options)
}
async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.IndicesPutIndexTemplateResponse>
async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.IndicesPutIndexTemplateResponse, unknown>>
async putIndexTemplate (this: That, params: T.IndicesPutIndexTemplateRequest | TB.IndicesPutIndexTemplateRequest, options?: TransportRequestOptions): Promise<T.IndicesPutIndexTemplateResponse>

View File

@ -135,10 +135,10 @@ export default class License {
return await this.transport.request({ path, method, querystring, body }, options)
}
async post (this: That, params: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.LicensePostResponse>
async post (this: That, params: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicensePostResponse, unknown>>
async post (this: That, params: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptions): Promise<T.LicensePostResponse>
async post (this: That, params: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptions): Promise<any> {
async post (this: That, params?: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.LicensePostResponse>
async post (this: That, params?: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.LicensePostResponse, unknown>>
async post (this: That, params?: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptions): Promise<T.LicensePostResponse>
async post (this: That, params?: T.LicensePostRequest | TB.LicensePostRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const acceptedBody: string[] = ['license', 'licenses']
const querystring: Record<string, any> = {}
@ -151,6 +151,7 @@ export default class License {
body = userBody != null ? { ...userBody } : undefined
}
params = params ?? {}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}

View File

@ -82,8 +82,15 @@ export default class Logstash {
}
}
const method = 'GET'
const path = `/_logstash/pipeline/${encodeURIComponent(params.id.toString())}`
let method = ''
let path = ''
if (params.id != null) {
method = 'GET'
path = `/_logstash/pipeline/${encodeURIComponent(params.id.toString())}`
} else {
method = 'GET'
path = '/_logstash/pipeline'
}
return await this.transport.request({ path, method, querystring, body }, options)
}

View File

@ -43,19 +43,19 @@ export default class Ml {
this.transport = transport
}
async clearTrainedModelDeploymentCache (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async clearTrainedModelDeploymentCache (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async clearTrainedModelDeploymentCache (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async clearTrainedModelDeploymentCache (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
async clearTrainedModelDeploymentCache (this: That, params: T.MlClearTrainedModelDeploymentCacheRequest | TB.MlClearTrainedModelDeploymentCacheRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.MlClearTrainedModelDeploymentCacheResponse>
async clearTrainedModelDeploymentCache (this: That, params: T.MlClearTrainedModelDeploymentCacheRequest | TB.MlClearTrainedModelDeploymentCacheRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MlClearTrainedModelDeploymentCacheResponse, unknown>>
async clearTrainedModelDeploymentCache (this: That, params: T.MlClearTrainedModelDeploymentCacheRequest | TB.MlClearTrainedModelDeploymentCacheRequest, options?: TransportRequestOptions): Promise<T.MlClearTrainedModelDeploymentCacheResponse>
async clearTrainedModelDeploymentCache (this: That, params: T.MlClearTrainedModelDeploymentCacheRequest | TB.MlClearTrainedModelDeploymentCacheRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['model_id']
const querystring: Record<string, any> = {}
const body = undefined
params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
@ -710,7 +710,7 @@ export default class Ml {
path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/categories/${encodeURIComponent(params.category_id.toString())}`
} else {
method = body != null ? 'POST' : 'GET'
path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/categories/`
path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/categories`
}
return await this.transport.request({ path, method, querystring, body }, options)
}
@ -2006,7 +2006,7 @@ export default class Ml {
async updateDatafeed (this: That, params: T.MlUpdateDatafeedRequest | TB.MlUpdateDatafeedRequest, options?: TransportRequestOptions): Promise<T.MlUpdateDatafeedResponse>
async updateDatafeed (this: That, params: T.MlUpdateDatafeedRequest | TB.MlUpdateDatafeedRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['datafeed_id']
const acceptedBody: string[] = ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size']
const acceptedBody: string[] = ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
@ -2074,7 +2074,7 @@ export default class Ml {
async updateJob (this: That, params: T.MlUpdateJobRequest | TB.MlUpdateJobRequest, options?: TransportRequestOptions): Promise<T.MlUpdateJobResponse>
async updateJob (this: That, params: T.MlUpdateJobRequest | TB.MlUpdateJobRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['job_id']
const acceptedBody: string[] = ['allow_lazy_open', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'categorization_filters', 'description', 'model_plot_config', 'daily_model_snapshot_retention_after_days', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_retention_days', 'groups', 'detectors', 'per_partition_categorization']
const acceptedBody: string[] = ['allow_lazy_open', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'categorization_filters', 'description', 'model_plot_config', 'model_prune_window', 'daily_model_snapshot_retention_after_days', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_retention_days', 'groups', 'detectors', 'per_partition_categorization']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
@ -2137,6 +2137,28 @@ export default class Ml {
return await this.transport.request({ path, method, querystring, body }, options)
}
async updateTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async updateTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async updateTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async updateTrainedModelDeployment (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['model_id']
const querystring: Record<string, any> = {}
const body = undefined
params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
querystring[key] = params[key]
}
}
const method = 'POST'
const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_update`
return await this.transport.request({ path, method, querystring, body }, options)
}
async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest | TB.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.MlUpgradeJobSnapshotResponse>
async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest | TB.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.MlUpgradeJobSnapshotResponse, unknown>>
async upgradeJobSnapshot (this: That, params: T.MlUpgradeJobSnapshotRequest | TB.MlUpgradeJobSnapshotRequest, options?: TransportRequestOptions): Promise<T.MlUpgradeJobSnapshotResponse>

View File

@ -90,7 +90,7 @@ export default class Rollup {
path = `/_rollup/job/${encodeURIComponent(params.id.toString())}`
} else {
method = 'GET'
path = '/_rollup/job/'
path = '/_rollup/job'
}
return await this.transport.request({ path, method, querystring, body }, options)
}
@ -120,7 +120,7 @@ export default class Rollup {
path = `/_rollup/data/${encodeURIComponent(params.id.toString())}`
} else {
method = 'GET'
path = '/_rollup/data/'
path = '/_rollup/data'
}
return await this.transport.request({ path, method, querystring, body }, options)
}

View File

@ -42,7 +42,7 @@ export default async function SearchApi<TDocument = unknown, TAggregations = Rec
export default async function SearchApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.SearchRequest | TB.SearchRequest, options?: TransportRequestOptions): Promise<T.SearchResponse<TDocument, TAggregations>>
export default async function SearchApi<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params?: T.SearchRequest | TB.SearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
const acceptedBody: string[] = ['aggregations', 'aggs', 'collapse', 'explain', 'ext', 'from', 'highlight', 'track_total_hits', 'indices_boost', 'docvalue_fields', 'knn', 'rank', 'min_score', 'post_filter', 'profile', 'query', 'rescore', 'script_fields', 'search_after', 'size', 'slice', 'sort', '_source', 'fields', 'suggest', 'terminate_after', 'timeout', 'track_scores', 'version', 'seq_no_primary_term', 'stored_fields', 'pit', 'runtime_mappings', 'stats']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body

View File

@ -0,0 +1,269 @@
/*
* 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.
*/
/* eslint-disable import/export */
/* eslint-disable @typescript-eslint/no-misused-new */
/* eslint-disable @typescript-eslint/no-extraneous-class */
/* eslint-disable @typescript-eslint/no-unused-vars */
// This file was automatically generated by elastic/elastic-client-generator-js
// DO NOT MODIFY IT BY HAND. Instead, modify the source open api file,
// and elastic/elastic-client-generator-js to regenerate this file again.
import {
Transport,
TransportRequestOptions,
TransportRequestOptionsWithMeta,
TransportRequestOptionsWithOutMeta,
TransportResult
} from '@elastic/transport'
import * as T from '../types'
import * as TB from '../typesWithBodyKey'
interface That { transport: Transport }
export default class SearchApplication {
transport: Transport
constructor (transport: Transport) {
this.transport = transport
}
async delete (this: That, params: T.SearchApplicationDeleteRequest | TB.SearchApplicationDeleteRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationDeleteResponse>
async delete (this: That, params: T.SearchApplicationDeleteRequest | TB.SearchApplicationDeleteRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationDeleteResponse, unknown>>
async delete (this: That, params: T.SearchApplicationDeleteRequest | TB.SearchApplicationDeleteRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationDeleteResponse>
async delete (this: That, params: T.SearchApplicationDeleteRequest | TB.SearchApplicationDeleteRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const querystring: Record<string, any> = {}
const body = undefined
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'DELETE'
const path = `/_application/search_application/${encodeURIComponent(params.name.toString())}`
return await this.transport.request({ path, method, querystring, body }, options)
}
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationDeleteBehavioralAnalyticsResponse>
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationDeleteBehavioralAnalyticsResponse, unknown>>
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationDeleteBehavioralAnalyticsResponse>
async deleteBehavioralAnalytics (this: That, params: T.SearchApplicationDeleteBehavioralAnalyticsRequest | TB.SearchApplicationDeleteBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const querystring: Record<string, any> = {}
const body = undefined
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'DELETE'
const path = `/_application/analytics/${encodeURIComponent(params.name.toString())}`
return await this.transport.request({ path, method, querystring, body }, options)
}
async get (this: That, params: T.SearchApplicationGetRequest | TB.SearchApplicationGetRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationGetResponse>
async get (this: That, params: T.SearchApplicationGetRequest | TB.SearchApplicationGetRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationGetResponse, unknown>>
async get (this: That, params: T.SearchApplicationGetRequest | TB.SearchApplicationGetRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationGetResponse>
async get (this: That, params: T.SearchApplicationGetRequest | TB.SearchApplicationGetRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const querystring: Record<string, any> = {}
const body = undefined
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'GET'
const path = `/_application/search_application/${encodeURIComponent(params.name.toString())}`
return await this.transport.request({ path, method, querystring, body }, options)
}
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationGetBehavioralAnalyticsResponse>
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationGetBehavioralAnalyticsResponse, unknown>>
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationGetBehavioralAnalyticsResponse>
async getBehavioralAnalytics (this: That, params?: T.SearchApplicationGetBehavioralAnalyticsRequest | TB.SearchApplicationGetBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const querystring: Record<string, any> = {}
const body = undefined
params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
let method = ''
let path = ''
if (params.name != null) {
method = 'GET'
path = `/_application/analytics/${encodeURIComponent(params.name.toString())}`
} else {
method = 'GET'
path = '/_application/analytics'
}
return await this.transport.request({ path, method, querystring, body }, options)
}
async list (this: That, params?: T.SearchApplicationListRequest | TB.SearchApplicationListRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationListResponse>
async list (this: That, params?: T.SearchApplicationListRequest | TB.SearchApplicationListRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationListResponse, unknown>>
async list (this: That, params?: T.SearchApplicationListRequest | TB.SearchApplicationListRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationListResponse>
async list (this: That, params?: T.SearchApplicationListRequest | TB.SearchApplicationListRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const querystring: Record<string, any> = {}
const body = undefined
params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'GET'
const path = '/_application/search_application'
return await this.transport.request({ path, method, querystring, body }, options)
}
async postBehavioralAnalyticsEvent (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async postBehavioralAnalyticsEvent (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async postBehavioralAnalyticsEvent (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async postBehavioralAnalyticsEvent (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['collection_name', 'event_type']
const querystring: Record<string, any> = {}
const body = undefined
params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
querystring[key] = params[key]
}
}
const method = 'POST'
const path = `/_application/analytics/${encodeURIComponent(params.collection_name.toString())}/event/${encodeURIComponent(params.event_type.toString())}`
return await this.transport.request({ path, method, querystring, body }, options)
}
async put (this: That, params: T.SearchApplicationPutRequest | TB.SearchApplicationPutRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationPutResponse>
async put (this: That, params: T.SearchApplicationPutRequest | TB.SearchApplicationPutRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationPutResponse, unknown>>
async put (this: That, params: T.SearchApplicationPutRequest | TB.SearchApplicationPutRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationPutResponse>
async put (this: That, params: T.SearchApplicationPutRequest | TB.SearchApplicationPutRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['search_application']
const querystring: Record<string, any> = {}
// @ts-expect-error
let body: any = params.body ?? undefined
for (const key in params) {
if (acceptedBody.includes(key)) {
// @ts-expect-error
body = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'PUT'
const path = `/_application/search_application/${encodeURIComponent(params.name.toString())}`
return await this.transport.request({ path, method, querystring, body }, options)
}
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationPutBehavioralAnalyticsResponse>
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationPutBehavioralAnalyticsResponse, unknown>>
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationPutBehavioralAnalyticsResponse>
async putBehavioralAnalytics (this: That, params: T.SearchApplicationPutBehavioralAnalyticsRequest | TB.SearchApplicationPutBehavioralAnalyticsRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const querystring: Record<string, any> = {}
const body = undefined
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'PUT'
const path = `/_application/analytics/${encodeURIComponent(params.name.toString())}`
return await this.transport.request({ path, method, querystring, body }, options)
}
async search<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.SearchApplicationSearchRequest | TB.SearchApplicationSearchRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.SearchApplicationSearchResponse<TDocument, TAggregations>>
async search<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.SearchApplicationSearchRequest | TB.SearchApplicationSearchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.SearchApplicationSearchResponse<TDocument, TAggregations>, unknown>>
async search<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.SearchApplicationSearchRequest | TB.SearchApplicationSearchRequest, options?: TransportRequestOptions): Promise<T.SearchApplicationSearchResponse<TDocument, TAggregations>>
async search<TDocument = unknown, TAggregations = Record<T.AggregateName, T.AggregationsAggregate>> (this: That, params: T.SearchApplicationSearchRequest | TB.SearchApplicationSearchRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['name']
const acceptedBody: string[] = ['params']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body
let body: Record<string, any> | string
if (typeof userBody === 'string') {
body = userBody
} else {
body = userBody != null ? { ...userBody } : undefined
}
for (const key in params) {
if (acceptedBody.includes(key)) {
body = body ?? {}
// @ts-expect-error
body[key] = params[key]
} else if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = body != null ? 'POST' : 'GET'
const path = `/_application/search_application/${encodeURIComponent(params.name.toString())}/_search`
return await this.transport.request({ path, method, querystring, body }, options)
}
}

View File

@ -42,7 +42,7 @@ export default async function SearchMvtApi (this: That, params: T.SearchMvtReque
export default async function SearchMvtApi (this: That, params: T.SearchMvtRequest | TB.SearchMvtRequest, options?: TransportRequestOptions): Promise<T.SearchMvtResponse>
export default async function SearchMvtApi (this: That, params: T.SearchMvtRequest | TB.SearchMvtRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['index', 'field', 'zoom', 'x', 'y']
const acceptedBody: string[] = ['aggs', 'exact_bounds', 'extent', 'fields', 'grid_precision', 'grid_type', 'query', 'runtime_mappings', 'size', 'sort', 'track_total_hits']
const acceptedBody: string[] = ['aggs', 'buffer', 'exact_bounds', 'extent', 'fields', 'grid_agg', 'grid_precision', 'grid_type', 'query', 'runtime_mappings', 'size', 'sort', 'track_total_hits', 'with_labels']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body

View File

@ -1155,7 +1155,7 @@ export default class Security {
}
const method = 'PUT'
const path = '/_security/privilege/'
const path = '/_security/privilege'
return await this.transport.request({ path, method, querystring, body }, options)
}

View File

@ -290,7 +290,7 @@ export default class Snapshot {
async restore (this: That, params: T.SnapshotRestoreRequest | TB.SnapshotRestoreRequest, options?: TransportRequestOptions): Promise<T.SnapshotRestoreResponse>
async restore (this: That, params: T.SnapshotRestoreRequest | TB.SnapshotRestoreRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['repository', 'snapshot']
const acceptedBody: string[] = ['ignore_index_settings', 'ignore_unavailable', 'include_aliases', 'include_global_state', 'index_settings', 'indices', 'partial', 'rename_pattern', 'rename_replacement']
const acceptedBody: string[] = ['feature_states', 'ignore_index_settings', 'ignore_unavailable', 'include_aliases', 'include_global_state', 'index_settings', 'indices', 'partial', 'rename_pattern', 'rename_replacement']
const querystring: Record<string, any> = {}
// @ts-expect-error
const userBody: any = params?.body

View File

@ -215,6 +215,28 @@ export default class Transform {
return await this.transport.request({ path, method, querystring, body }, options)
}
async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest | TB.TransformScheduleNowTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.TransformScheduleNowTransformResponse>
async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest | TB.TransformScheduleNowTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformScheduleNowTransformResponse, unknown>>
async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest | TB.TransformScheduleNowTransformRequest, options?: TransportRequestOptions): Promise<T.TransformScheduleNowTransformResponse>
async scheduleNowTransform (this: That, params: T.TransformScheduleNowTransformRequest | TB.TransformScheduleNowTransformRequest, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = ['transform_id']
const querystring: Record<string, any> = {}
const body = undefined
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
// @ts-expect-error
querystring[key] = params[key]
}
}
const method = 'POST'
const path = `/_transform/${encodeURIComponent(params.transform_id.toString())}/_schedule_now`
return await this.transport.request({ path, method, querystring, body }, options)
}
async startTransform (this: That, params: T.TransformStartTransformRequest | TB.TransformStartTransformRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.TransformStartTransformResponse>
async startTransform (this: That, params: T.TransformStartTransformRequest | TB.TransformStartTransformRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TransformStartTransformResponse, unknown>>
async startTransform (this: That, params: T.TransformStartTransformRequest | TB.TransformStartTransformRequest, options?: TransportRequestOptions): Promise<T.TransformStartTransformResponse>

View File

@ -180,6 +180,28 @@ export default class Watcher {
return await this.transport.request({ path, method, querystring, body }, options)
}
async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async getSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const querystring: Record<string, any> = {}
const body = undefined
params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
querystring[key] = params[key]
}
}
const method = 'GET'
const path = '/_watcher/settings'
return await this.transport.request({ path, method, querystring, body }, options)
}
async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptionsWithOutMeta): Promise<T.WatcherGetWatchResponse>
async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.WatcherGetWatchResponse, unknown>>
async getWatch (this: That, params: T.WatcherGetWatchRequest | TB.WatcherGetWatchRequest, options?: TransportRequestOptions): Promise<T.WatcherGetWatchResponse>
@ -346,4 +368,26 @@ export default class Watcher {
const path = '/_watcher/_stop'
return await this.transport.request({ path, method, querystring, body }, options)
}
async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithOutMeta): Promise<T.TODO>
async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptionsWithMeta): Promise<TransportResult<T.TODO, unknown>>
async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<T.TODO>
async updateSettings (this: That, params?: T.TODO | TB.TODO, options?: TransportRequestOptions): Promise<any> {
const acceptedPath: string[] = []
const querystring: Record<string, any> = {}
const body = undefined
params = params ?? {}
for (const key in params) {
if (acceptedPath.includes(key)) {
continue
} else if (key !== 'body') {
querystring[key] = params[key]
}
}
const method = 'PUT'
const path = '/_watcher/settings'
return await this.transport.request({ path, method, querystring, body }, options)
}
}

View File

@ -55,6 +55,7 @@ import getScriptContextApi from './api/get_script_context'
import getScriptLanguagesApi from './api/get_script_languages'
import getSourceApi from './api/get_source'
import GraphApi from './api/graph'
import healthReportApi from './api/health_report'
import IlmApi from './api/ilm'
import indexApi from './api/index'
import IndicesApi from './api/indices'
@ -82,6 +83,7 @@ import RollupApi from './api/rollup'
import scriptsPainlessExecuteApi from './api/scripts_painless_execute'
import scrollApi from './api/scroll'
import searchApi from './api/search'
import SearchApplicationApi from './api/search_application'
import searchMvtApi from './api/search_mvt'
import searchShardsApi from './api/search_shards'
import searchTemplateApi from './api/search_template'
@ -134,6 +136,7 @@ export default interface API {
getScriptLanguages: typeof getScriptLanguagesApi
getSource: typeof getSourceApi
graph: GraphApi
healthReport: typeof healthReportApi
ilm: IlmApi
index: typeof indexApi
indices: IndicesApi
@ -161,6 +164,7 @@ export default interface API {
scriptsPainlessExecute: typeof scriptsPainlessExecuteApi
scroll: typeof scrollApi
search: typeof searchApi
searchApplication: SearchApplicationApi
searchMvt: typeof searchMvtApi
searchShards: typeof searchShardsApi
searchTemplate: typeof searchTemplateApi
@ -204,6 +208,7 @@ const kMl = Symbol('Ml')
const kMonitoring = Symbol('Monitoring')
const kNodes = Symbol('Nodes')
const kRollup = Symbol('Rollup')
const kSearchApplication = Symbol('SearchApplication')
const kSearchableSnapshots = Symbol('SearchableSnapshots')
const kSecurity = Symbol('Security')
const kShutdown = Symbol('Shutdown')
@ -239,6 +244,7 @@ export default class API {
[kMonitoring]: symbol | null
[kNodes]: symbol | null
[kRollup]: symbol | null
[kSearchApplication]: symbol | null
[kSearchableSnapshots]: symbol | null
[kSecurity]: symbol | null
[kShutdown]: symbol | null
@ -273,6 +279,7 @@ export default class API {
this[kMonitoring] = null
this[kNodes] = null
this[kRollup] = null
this[kSearchApplication] = null
this[kSearchableSnapshots] = null
this[kSecurity] = null
this[kShutdown] = null
@ -306,6 +313,7 @@ API.prototype.getScript = getScriptApi
API.prototype.getScriptContext = getScriptContextApi
API.prototype.getScriptLanguages = getScriptLanguagesApi
API.prototype.getSource = getSourceApi
API.prototype.healthReport = healthReportApi
API.prototype.index = indexApi
API.prototype.info = infoApi
API.prototype.knnSearch = knnSearchApi
@ -396,6 +404,9 @@ Object.defineProperties(API.prototype, {
rollup: {
get () { return this[kRollup] === null ? (this[kRollup] = new RollupApi(this.transport)) : this[kRollup] }
},
searchApplication: {
get () { return this[kSearchApplication] === null ? (this[kSearchApplication] = new SearchApplicationApi(this.transport)) : this[kSearchApplication] }
},
searchableSnapshots: {
get () { return this[kSearchableSnapshots] === null ? (this[kSearchableSnapshots] = new SearchableSnapshotsApi(this.transport)) : this[kSearchableSnapshots] }
},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@
import { ConnectionOptions as TlsConnectionOptions } from 'tls'
import { URL } from 'url'
import buffer from 'buffer'
import os from 'os'
import {
Transport,
UndiciConnection,
@ -173,7 +174,9 @@ export default class Client extends API {
tls: null,
caFingerprint: null,
agent: null,
headers: {},
headers: {
'user-agent': `elasticsearch-js/${clientVersion} Node.js ${nodeVersion}; Transport ${transportVersion}; (${os.platform()} ${os.release()} ${os.arch()})`
},
nodeFilter: null,
generateRequestId: null,
name: 'elasticsearch-js',

View File

@ -823,13 +823,13 @@ export default class Helpers {
}
const retry = []
const { items } = result
let indexSlice = 0
for (let i = 0, len = items.length; i < len; i++) {
const action = items[i]
const operation = Object.keys(action)[0]
// @ts-expect-error
const responseItem = action[operation as keyof T.BulkResponseItemContainer]
assert(responseItem !== undefined, 'The responseItem is undefined, please file a bug report')
const indexSlice = operation !== 'delete' ? i * 2 : i
if (responseItem.status >= 400) {
// 429 is the only staus code where we might want to retry
@ -857,6 +857,7 @@ export default class Helpers {
} else {
stats.successful += 1
}
operation === 'delete' ? indexSlice += 1 : indexSlice += 2
}
callback(null, retry)
})

View File

@ -85,7 +85,11 @@ function build (opts = {}) {
)
// remove 'x_pack_rest_user', used in some xpack test
await client.security.deleteUser({ username: 'x_pack_rest_user' }, { ignore: [404] })
try {
await client.security.deleteUser({ username: 'x_pack_rest_user' }, { ignore: [404] })
} catch {
// do nothing
}
const searchableSnapshotIndices = await client.cluster.state({
metric: 'metadata',
@ -137,7 +141,11 @@ function build (opts = {}) {
const body = await client.cluster.getComponentTemplate()
const components = body.component_templates.filter(c => !isXPackTemplate(c.name)).map(c => c.name)
if (components.length > 0) {
await client.cluster.deleteComponentTemplate({ name: components.join(',') }, { ignore: [404] })
try {
await client.cluster.deleteComponentTemplate({ name: components.join(',') }, { ignore: [404] })
} catch {
// do nothing
}
}
// Remove any cluster setting
@ -157,9 +165,25 @@ function build (opts = {}) {
if (isXPack) {
// delete ilm policies
const preserveIlmPolicies = [
'ilm-history-ilm-policy', 'slm-history-ilm-policy',
'watch-history-ilm-policy', 'ml-size-based-ilm-policy',
'logs', 'metrics'
"ilm-history-ilm-policy",
"slm-history-ilm-policy",
"watch-history-ilm-policy",
"watch-history-ilm-policy-16",
"ml-size-based-ilm-policy",
"logs",
"metrics",
"synthetics",
"7-days-default",
"30-days-default",
"90-days-default",
"180-days-default",
"365-days-default",
".fleet-actions-results-ilm-policy",
".fleet-file-data-ilm-policy",
".fleet-files-ilm-policy",
".deprecation-indexing-ilm-policy",
".monitoring-8-ilm-policy",
"behavioral_analytics-events-default_policy",
]
const policies = await client.ilm.getLifecycle()
for (const policy in policies) {
@ -257,7 +281,7 @@ function build (opts = {}) {
* - cleanup
* @param {object} setup (null if not needed)
* @param {object} test
* @oaram {object} teardown (null if not needed)
* @param {object} teardown (null if not needed)
* @returns {Promise}
*/
async function run (setup, test, teardown, stats, junit) {

View File

@ -432,3 +432,12 @@ test('caFingerprint can\'t be configured over http / 2', t => {
)
t.end()
})
test('user agent is in the correct format', t => {
const client = new Client({ node: 'http://localhost:9200' })
const agentRaw = client.transport[symbols.kHeaders]['user-agent'] || ''
const agentSplit = agentRaw.split(/\s+/)
t.equal(agentSplit[0].split('/')[0], 'elasticsearch-js')
t.ok(/^\d+\.\d+\.\d+/.test(agentSplit[0].split('/')[1]))
t.end()
})

View File

@ -1070,6 +1070,7 @@ test('bulk delete', t => {
const [{ port }, server] = await buildServer(handler)
const client = new Client({ node: `http://localhost:${port}` })
let id = 0
const result = await client.helpers.bulk({
datasource: dataset.slice(),
flushBytes: 1,
@ -1106,6 +1107,70 @@ test('bulk delete', t => {
server.stop()
})
t.test('Should call onDrop on the correct document when doing a mix of operations that includes deletes', async t => {
// checks to ensure onDrop doesn't provide the wrong document when some operations are deletes
// see https://github.com/elastic/elasticsearch-js/issues/1751
async function handler (req: http.IncomingMessage, res: http.ServerResponse) {
res.setHeader('content-type', 'application/json')
res.end(JSON.stringify({
took: 0,
errors: true,
items: [
{ delete: { status: 200 } },
{ index: { status: 429 } },
{ index: { status: 200 } }
]
}))
}
const [{ port }, server] = await buildServer(handler)
const client = new Client({ node: `http://localhost:${port}` })
let counter = 0
const result = await client.helpers.bulk({
datasource: dataset.slice(),
concurrency: 1,
wait: 10,
retries: 0,
onDocument (doc) {
counter++
if (counter === 1) {
return {
delete: {
_index: 'test',
_id: String(counter)
}
}
} else {
return {
index: {
_index: 'test',
}
}
}
},
onDrop (doc) {
t.same(doc, {
status: 429,
error: null,
operation: { index: { _index: 'test' } },
document: { user: "arya", age: 18 },
retried: false,
})
}
})
t.type(result.time, 'number')
t.type(result.bytes, 'number')
t.match(result, {
total: 3,
successful: 2,
retry: 0,
failed: 1,
aborted: false
})
server.stop()
})
t.end()
})