diff --git a/.buildkite/Dockerfile b/.buildkite/Dockerfile index 7b0eb2e8e..a68ad997d 100644 --- a/.buildkite/Dockerfile +++ b/.buildkite/Dockerfile @@ -1,4 +1,4 @@ -ARG PYTHON_VERSION=3.12 +ARG PYTHON_VERSION=3.13 FROM python:${PYTHON_VERSION} # Default UID/GID to 1000 diff --git a/.buildkite/certs/README.md b/.buildkite/certs/README.md new file mode 100644 index 000000000..63453aa1f --- /dev/null +++ b/.buildkite/certs/README.md @@ -0,0 +1,26 @@ +# CI certificates + +This directory contains certificates that can be used to test against Elasticsearch in CI + +## Generating new certificates using the Certificate Authority cert and key + +Before adding support for Python 3.13, we generated certificates with +[`elasticsearch-certutil`](https://www.elastic.co/guide/en/elasticsearch/reference/current/certutil.html). +However, those certificates are not compliant with RFC 5280, and Python now +enforces compliance by enabling the VERIFY_X509_STRICT flag by default. + +If you need to generate new certificates, you can do so with +[trustme](https://trustme.readthedocs.io/en/latest/) as follows: + +``` +```bash +pip install trustme +python -m trustme --identities instance +# Use the filenames expected by our tests +mv client.pem ca.crt +mv server.pem testnode.crt +mv server.key testnode.key +``` + +For more control over the generated certificates, trustme also offers a Python +API, but we have not needed it so far. diff --git a/.buildkite/certs/ca.crt b/.buildkite/certs/ca.crt old mode 100755 new mode 100644 index 5ed1c9853..f39d4c4a9 --- a/.buildkite/certs/ca.crt +++ b/.buildkite/certs/ca.crt @@ -1,20 +1,12 @@ -----BEGIN CERTIFICATE----- -MIIDSTCCAjGgAwIBAgIUHTeTPPuZIX3wdyudMsllXa9yZ1kwDQYJKoZIhvcNAQEL -BQAwNDEyMDAGA1UEAxMpRWxhc3RpYyBDZXJ0aWZpY2F0ZSBUb29sIEF1dG9nZW5l -cmF0ZWQgQ0EwHhcNMjMwODIxMTcyNTMyWhcNMjYwODIwMTcyNTMyWjA0MTIwMAYD -VQQDEylFbGFzdGljIENlcnRpZmljYXRlIFRvb2wgQXV0b2dlbmVyYXRlZCBDQTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMZs7DXbV7ovFvQ/CiqvHHZ/ -40rLyAcBQMhVBke2VVCQk3hIOPpHYt3xZgb61Oyrf14lFxny483beXaUqGThZ67Y -RsxzSOS8NUi21OLZ3xaE+p+Yx9Xe6lTMQJM4RpD/A5V35uikji1K4+F0ooJghELq -Fndmark/7SQFh6Bg8/aaf6Hpyar3WOWdQjHXgszNAv1Ez7+pPlfnCS8XNjYB5Y2n -gAayb1krMRW/3E6hRVZAig3I2H8mezL5tF8iS5aJW1WLpw4oYnbH0DdS+gpCK1lT -8GZd8Dk0QbNGpXNTu67BravVhgEoprBVMz6G1C4MiuVcBy7gA671/f46S4Tgb10C -AwEAAaNTMFEwHQYDVR0OBBYEFHVhRrHXbd5QFEgk3RFn4Y4LYo9PMB8GA1UdIwQY -MBaAFHVhRrHXbd5QFEgk3RFn4Y4LYo9PMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI -hvcNAQELBQADggEBACoGVPqeYE3IPRdSAtihIq071BfGA8vgfJWv0qiI0T+gYetX -dnebmQc5EccdEIrxD0bLKPgzd5c3ILwQy5+uo03ua7PrplwPVdeNXnU1LodAQ0Zb -GmTixXqgj8AMcvRsA7qARjXvf6w3Yyb7GO3FXRIGtqk12Vb1qnJg894CSIWrHiw0 -hRO5b7eJyrOy2s6QA6FucM/scM1Z/8D9tHfgwmrKM875VGerJORwfHCaCvF1YvBj -cIpYNnw2vFzDvRevh63sSQbZ9q3nbtD27AZSN9LKEbipSEOoBZMKG2zgDTT/Olzx -EQJ2t+Z487UuFX6+WaLZMteL2F4eh9OFWIYM3EI= +MIIByTCCAW+gAwIBAgIUIYClYWXiTsB8aMrEEMrzdrk5rOswCgYIKoZIzj0EAwIw +QDEXMBUGA1UECgwOdHJ1c3RtZSB2MS4yLjAxJTAjBgNVBAsMHFRlc3RpbmcgQ0Eg +I2JpdzFXYzEwbHBxQ0ZRTDUwIBcNMDAwMTAxMDAwMDAwWhgPMzAwMDAxMDEwMDAw +MDBaMEAxFzAVBgNVBAoMDnRydXN0bWUgdjEuMi4wMSUwIwYDVQQLDBxUZXN0aW5n +IENBICNiaXcxV2MxMGxwcUNGUUw1MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE +SN7++A76LmOR0tKKra1M6VVzGUljjL9fVPxOEIblOOJJhA7mKLQguNzEHjucNV23 +LcDzMX/M/oUBGdYZBbAv4qNFMEMwHQYDVR0OBBYEFCrGGcO9v0UAWSsD93P/x2MT +NiJbMBIGA1UdEwEB/wQIMAYBAf8CAQkwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49 +BAMCA0gAMEUCIQDGyO21zIAwmARtoc2atVmmqZdPVkegHkCKCFY4P+KeEAIgKMCz +aU8LPCVyA+ZF9K+tcqkNK5h/5s7wlQ5DSeKSuE8= -----END CERTIFICATE----- diff --git a/.buildkite/certs/ca.pem b/.buildkite/certs/ca.pem deleted file mode 100644 index 5ed1c9853..000000000 --- a/.buildkite/certs/ca.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDSTCCAjGgAwIBAgIUHTeTPPuZIX3wdyudMsllXa9yZ1kwDQYJKoZIhvcNAQEL -BQAwNDEyMDAGA1UEAxMpRWxhc3RpYyBDZXJ0aWZpY2F0ZSBUb29sIEF1dG9nZW5l -cmF0ZWQgQ0EwHhcNMjMwODIxMTcyNTMyWhcNMjYwODIwMTcyNTMyWjA0MTIwMAYD -VQQDEylFbGFzdGljIENlcnRpZmljYXRlIFRvb2wgQXV0b2dlbmVyYXRlZCBDQTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMZs7DXbV7ovFvQ/CiqvHHZ/ -40rLyAcBQMhVBke2VVCQk3hIOPpHYt3xZgb61Oyrf14lFxny483beXaUqGThZ67Y -RsxzSOS8NUi21OLZ3xaE+p+Yx9Xe6lTMQJM4RpD/A5V35uikji1K4+F0ooJghELq -Fndmark/7SQFh6Bg8/aaf6Hpyar3WOWdQjHXgszNAv1Ez7+pPlfnCS8XNjYB5Y2n -gAayb1krMRW/3E6hRVZAig3I2H8mezL5tF8iS5aJW1WLpw4oYnbH0DdS+gpCK1lT -8GZd8Dk0QbNGpXNTu67BravVhgEoprBVMz6G1C4MiuVcBy7gA671/f46S4Tgb10C -AwEAAaNTMFEwHQYDVR0OBBYEFHVhRrHXbd5QFEgk3RFn4Y4LYo9PMB8GA1UdIwQY -MBaAFHVhRrHXbd5QFEgk3RFn4Y4LYo9PMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI -hvcNAQELBQADggEBACoGVPqeYE3IPRdSAtihIq071BfGA8vgfJWv0qiI0T+gYetX -dnebmQc5EccdEIrxD0bLKPgzd5c3ILwQy5+uo03ua7PrplwPVdeNXnU1LodAQ0Zb -GmTixXqgj8AMcvRsA7qARjXvf6w3Yyb7GO3FXRIGtqk12Vb1qnJg894CSIWrHiw0 -hRO5b7eJyrOy2s6QA6FucM/scM1Z/8D9tHfgwmrKM875VGerJORwfHCaCvF1YvBj -cIpYNnw2vFzDvRevh63sSQbZ9q3nbtD27AZSN9LKEbipSEOoBZMKG2zgDTT/Olzx -EQJ2t+Z487UuFX6+WaLZMteL2F4eh9OFWIYM3EI= ------END CERTIFICATE----- diff --git a/.buildkite/certs/testnode.crt b/.buildkite/certs/testnode.crt old mode 100755 new mode 100644 index 39eb092fa..74ab6da26 --- a/.buildkite/certs/testnode.crt +++ b/.buildkite/certs/testnode.crt @@ -1,20 +1,14 @@ -----BEGIN CERTIFICATE----- -MIIDODCCAiCgAwIBAgIVAKLWEcNzTd4B0NqnrJL0xAKaS8DWMA0GCSqGSIb3DQEB -CwUAMDQxMjAwBgNVBAMTKUVsYXN0aWMgQ2VydGlmaWNhdGUgVG9vbCBBdXRvZ2Vu -ZXJhdGVkIENBMB4XDTIzMDgyMTE3MjcwMloXDTI2MDgyMDE3MjcwMlowEzERMA8G -A1UEAxMIaW5zdGFuY2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8 -eLXL3ZX5v8JlHcfg+96Bpq24EeiqV+7RPPKbcH80ODjkETqYUpam+TcOl2gt23p/ -rpiPSSpOX8pFdmY78wTmxo2GCQZ/db2h0gZOOYpb8HQku+hJ4bAmtzizrqWW76Wz -csen3DSUkT0bKkJTjUMmwVhRaMpfv8EIcUbrHAwc3VCj7grnFL0kdAuQa6iyBH4I -lTUYOIOVyEJ8zZ7R4BJO3QU+TRuJ5+w/QiZMeDqxtrdDL37vYQHPW7L/XISCCOMp -sA3avzFphoQXBQ8mjdB8Txkd4sH7mJTqnRp5ILhRzVpcPPgQYFeIB567B+kFeSau -aJJmc0EVgOcK5aSMtOH3AgMBAAGjYjBgMB0GA1UdDgQWBBQsZbZDudZ63h52FlU5 -N2g3pznkETAfBgNVHSMEGDAWgBR1YUax123eUBRIJN0RZ+GOC2KPTzATBgNVHREE -DDAKgghpbnN0YW5jZTAJBgNVHRMEAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQAyv0Cw -OrvZn7FHHS8TJI5vTi1F43R/eSNMNL/+q/nK93KaxWJH1T4zrJhrJ9KpzkFcalXP -bu02oTh28b3o3QpS2wdwMv/Q3NLoMBEmQlG2UrELFvV43nS8LCiwCX3o11L1HZP3 -1Z/rclwxbA4OQ/ZkPcol++TDZQTM/8WkIdZmTL4UDb/ppDjX24nTOitkMRZlYAOY -mid9GGExhKrUJ0I9/A3w1hWRA1Hwc+1TFDcPphl2x2uQ9HJFBueAvuFXmIjDki1x -qrvnFZ+mneI9kR4m82MX900WF15KS35GzmMui0tsf0wbfy3Jh+WnpMlIIa2OQXw7 -prbkg9tScQSsvhC8 +MIICKzCCAdKgAwIBAgIUZeLIKR7XTP5Gx/moiuzcWcfHaSswCgYIKoZIzj0EAwIw +QDEXMBUGA1UECgwOdHJ1c3RtZSB2MS4yLjAxJTAjBgNVBAsMHFRlc3RpbmcgQ0Eg +I2JpdzFXYzEwbHBxQ0ZRTDUwIBcNMDAwMTAxMDAwMDAwWhgPMzAwMDAxMDEwMDAw +MDBaMEIxFzAVBgNVBAoMDnRydXN0bWUgdjEuMi4wMScwJQYDVQQLDB5UZXN0aW5n +IGNlcnQgIzNPWkpxTWh0WmxrNGlDMm0wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AASp6UadRZ0ZP3F2KeEkIUOf0B8GOTX55B91RO/PLUQb26wZcWmHGPOJ0HAy9F2E +Y+rJ1zDUnfB5msowei/iuoaMo4GlMIGiMB0GA1UdDgQWBBSP5z3h8b13ul407YOd +kyjKNcf/vTAMBgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFCrGGcO9v0UAWSsD93P/ +x2MTNiJbMBYGA1UdEQEB/wQMMAqCCGluc3RhbmNlMA4GA1UdDwEB/wQEAwIFoDAq +BgNVHSUBAf8EIDAeBggrBgEFBQcDAgYIKwYBBQUHAwEGCCsGAQUFBwMDMAoGCCqG +SM49BAMCA0cAMEQCIHPP7chQolK+N+GZ+rJ49euoTSzb2YIU5vnCY/bFEWO+AiBC +OTFYhR9Mw/e+WdJVZO78XZYKy5uA28JwsZuu7E0kZA== -----END CERTIFICATE----- diff --git a/.buildkite/certs/testnode.key b/.buildkite/certs/testnode.key old mode 100755 new mode 100644 index b7458996a..0c7522cd0 --- a/.buildkite/certs/testnode.key +++ b/.buildkite/certs/testnode.key @@ -1,27 +1,5 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAvHi1y92V+b/CZR3H4PvegaatuBHoqlfu0Tzym3B/NDg45BE6 -mFKWpvk3DpdoLdt6f66Yj0kqTl/KRXZmO/ME5saNhgkGf3W9odIGTjmKW/B0JLvo -SeGwJrc4s66llu+ls3LHp9w0lJE9GypCU41DJsFYUWjKX7/BCHFG6xwMHN1Qo+4K -5xS9JHQLkGuosgR+CJU1GDiDlchCfM2e0eASTt0FPk0biefsP0ImTHg6sba3Qy9+ -72EBz1uy/1yEggjjKbAN2r8xaYaEFwUPJo3QfE8ZHeLB+5iU6p0aeSC4Uc1aXDz4 -EGBXiAeeuwfpBXkmrmiSZnNBFYDnCuWkjLTh9wIDAQABAoIBAAU0iEDTI9s78pB8 -XBLYofKOuemFhRl/SDc7KbAlUT4N93RFDYs7bLG73Eto3xW1JBL2rXv3l1WGy71T -YctyEMaW4T28bhODGvOnK0lpyWp0n6CMGARCWW0YTlaYEjay866bEuyN5l3cDQX9 -Csvn8NzXJitJa51tXFVxW3YO1j7Nyc/M59oyBZ1ARYYmQqFYLEu6lvJOW0cKDFkZ -AcMVlOIxZQL/Mf+RO72aQGVuYNjqxlLIXLuE9zFR2gDFM2+l3FMUWDGHGBDFyjKU -iMk4+sSlOTFXqO9VQzua6FLFMsQT6m5PFD4uPY92KR6CPfH/NrWqwqr+jpjaU+gs -3U9GN+ECgYEA58qX7tKPk7CWdk3kyk5NsNcs/qib+heXWEubfhoU8LmSnbBQhOAz -wi//r/xm0OHGj84y66+G3T347iudrLjhr07oGM1QfjYT3kb90efLjwAfCECtyVYL -EQrWO5UeoTnmrhlB1mGL3sWaVAsVqNLz8i2H5c7sj0hxHsvM62159r8CgYEA0Cff -opJqmUpMpHm3sgjMWctylVrHBuQe5cl5Ad80pbd6mvtt4TvGXbUGNdzURfyve9DS -x1CVlj4Sz8VuelFQgYL+7/qUqZoms1aSgJpxWv8ou+wUHmlF3kVO8VKt3BNHV+8J -euSB6NG91BGguBoHgnOoVcjbDGdhJGRTojCNWskCgYEA1jE3nwDCnrbTA3XNk0ky -r9TXhmgm4r+EIpqTkL7nVOAXZVJ1xaQtECgsveKe3C2WwHLKSVMFbFMFQonZha+/ -FbHz9l9cH5U3XPL7QEpTp8xz4LtsHJ4/UbtS5vJQwKnxyjYaydGQYAb4KuunUz/F -H6kFaM6DeZB2v/+SWIfs6Z8CgYARUdAEyeP+vzTjVpFXSe4e5pOxI619wEtl2T6t -TjImO78C2DrLS9r0fxR2NNqgvCapybVQCj94EdAk44uOt+dX71thAluORRpFP8XO -14rpBGQSRtFhumaq2N95quR2dFAyW9xREmRQx+rgk1rpFplbXF48TQsU3CE0Evj2 -fM22KQKBgDhob7M9sWvXecxoyy3J17jUTcFqmqKcqGnx3ZJ7Q9CgAfjYqNNQws27 -wTuaJB0PEuCOu4t+lUHEBMIjGkBfo1bHd4EZaW04Xgbfn2j8MK2e+9GlRtedxxFg -c1JdRb5+eTgPwLcDsmMWIW357PDW7RDEI07G1ZB4SqxGTKkU7JOW ------END RSA PRIVATE KEY----- +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIN+K8+F47YchiH+7gA8KBG8u35PWcOJN+Fszv8TPEEpdoAoGCCqGSM49 +AwEHoUQDQgAEqelGnUWdGT9xdinhJCFDn9AfBjk1+eQfdUTvzy1EG9usGXFphxjz +idBwMvRdhGPqydcw1J3weZrKMHov4rqGjA== +-----END EC PRIVATE KEY----- diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index ff911719e..bf835be3b 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,11 +1,11 @@ steps: - - label: ":elasticsearch: :python: ES Python ({{ matrix.python }}) {{ matrix.nox_session }} " + - label: ":elasticsearch: :python: ES Python {{ matrix.python }} {{ matrix.nox_session }} ({{ matrix.connection }})" agents: provider: "gcp" env: PYTHON_VERSION: "{{ matrix.python }}" TEST_SUITE: "platinum" - STACK_VERSION: "8.11.0-SNAPSHOT" + STACK_VERSION: "8.17.0-SNAPSHOT" PYTHON_CONNECTION_CLASS: "{{ matrix.connection }}" NOX_SESSION: "{{ matrix.nox_session }}" matrix: @@ -16,6 +16,7 @@ steps: - "3.10" - "3.11" - "3.12" + - "3.13" connection: - "urllib3" - "requests" @@ -27,7 +28,7 @@ steps: connection: "urllib3" nox_session: "test_otel" - with: - python: "3.12" + python: "3.13" connection: "urllib3" nox_session: "test_otel" command: ./.buildkite/run-tests diff --git a/.buildkite/run-repository.sh b/.buildkite/run-repository.sh index 2f1f3c263..ce9344e8d 100755 --- a/.buildkite/run-repository.sh +++ b/.buildkite/run-repository.sh @@ -43,6 +43,7 @@ docker run \ --env "TEST_SUITE=${TEST_SUITE}" \ --env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \ --env "TEST_TYPE=server" \ + --env "FORCE_COLOR=1" \ --name elasticsearch-py \ --rm \ elastic/elasticsearch-py \ diff --git a/.buildkite/run-tests b/.buildkite/run-tests index 7e7339fb6..5d6b38039 100755 --- a/.buildkite/run-tests +++ b/.buildkite/run-tests @@ -7,7 +7,7 @@ # Default environment variables export STACK_VERSION="${STACK_VERSION:=8.0.0-SNAPSHOT}" export TEST_SUITE="${TEST_SUITE:=platinum}" -export PYTHON_VERSION="${PYTHON_VERSION:=3.9}" +export PYTHON_VERSION="${PYTHON_VERSION:=3.13}" export PYTHON_CONNECTION_CLASS="${PYTHON_CONNECTION_CLASS:=urllib3}" script_path=$(dirname $(realpath -s $0)) @@ -18,7 +18,7 @@ echo "--- :elasticsearch: Starting Elasticsearch" DETACH=true bash $script_path/run-elasticsearch.sh if [[ -n "$RUNSCRIPTS" ]]; then - for RUNSCRIPT in ${RUNSCRIPTS//,/ } ; do + for RUNSCRIPT in ${RUNSCRIPTS//,/ }; do echo -e "\033[1m>>>>> Running run-$RUNSCRIPT.sh >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" CONTAINER_NAME=${RUNSCRIPT} \ DETACH=true \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94c554900..52298bd59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,22 +8,37 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.x - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.x" - name: Install dependencies run: | python3 -m pip install nox - name: Lint the code run: nox -s lint + package: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Set up Python 3.x + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python3 -m pip install build + - name: Build dists + run: python utils/build-dists.py + test-linux: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] nox-session: [""] runs-on: ["ubuntu-latest"] @@ -32,9 +47,9 @@ jobs: continue-on-error: false steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set Up Python - ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install Dependencies diff --git a/.readthedocs.yml b/.readthedocs.yml index eee10c078..bcef38ebe 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,10 +7,14 @@ build: # to set AIOHTTP_NO_EXTENSIONS to 1 but it has to be done in # https://readthedocs.org/dashboard/elasticsearch-py/environmentvariables/ # because of https://github.com/readthedocs/readthedocs.org/issues/6311 - python: "3.12" + python: "3" python: install: - path: . extra_requirements: - "docs" + +sphinx: + configuration: docs/sphinx/conf.py + fail_on_warning: true diff --git a/README.md b/README.md index a86da2a24..3782448c0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- Elastic logo + Elastic logo

# Elasticsearch Python Client diff --git a/docs/examples/00272f75a6afea91f8554ef7cda0c1f2.asciidoc b/docs/examples/00272f75a6afea91f8554ef7cda0c1f2.asciidoc index dc87b0549..6c562c4cb 100644 --- a/docs/examples/00272f75a6afea91f8554ef7cda0c1f2.asciidoc +++ b/docs/examples/00272f75a6afea91f8554ef7cda0c1f2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-cache.asciidoc:69 +// rest-api/security/clear-cache.asciidoc:75 [source, python] ---- diff --git a/docs/examples/004743b9c9f61588926ccf734696b713.asciidoc b/docs/examples/004743b9c9f61588926ccf734696b713.asciidoc index 9e5b1713a..b45ec61fd 100644 --- a/docs/examples/004743b9c9f61588926ccf734696b713.asciidoc +++ b/docs/examples/004743b9c9f61588926ccf734696b713.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/forcemerge.asciidoc:210 +// indices/forcemerge.asciidoc:216 [source, python] ---- diff --git a/docs/examples/008ed823c89e703c447ac89c6b689833.asciidoc b/docs/examples/008ed823c89e703c447ac89c6b689833.asciidoc index 97fa31508..ba5031dda 100644 --- a/docs/examples/008ed823c89e703c447ac89c6b689833.asciidoc +++ b/docs/examples/008ed823c89e703c447ac89c6b689833.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// migration/apis/feature-migration.asciidoc:152 +// migration/apis/feature-migration.asciidoc:158 [source, python] ---- diff --git a/docs/examples/00ad41bde67beac991534ae0e04b1296.asciidoc b/docs/examples/00ad41bde67beac991534ae0e04b1296.asciidoc new file mode 100644 index 000000000..b806eedf1 --- /dev/null +++ b/docs/examples/00ad41bde67beac991534ae0e04b1296.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/data-stream-reindex.asciidoc:273 + +[source, python] +---- +resp = client.indices.get_data_stream( + name="my-data-stream", + filter_path="data_streams.indices.index_name", +) +print(resp) +---- diff --git a/docs/examples/00b3b6d76a368ae71277ea24af318693.asciidoc b/docs/examples/00b3b6d76a368ae71277ea24af318693.asciidoc index 41250b193..83c7b6585 100644 --- a/docs/examples/00b3b6d76a368ae71277ea24af318693.asciidoc +++ b/docs/examples/00b3b6d76a368ae71277ea24af318693.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shard-stores.asciidoc:134 +// indices/shard-stores.asciidoc:140 [source, python] ---- diff --git a/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc b/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc index b7885f45d..c9322a6a6 100644 --- a/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc +++ b/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-elasticsearch.asciidoc:112 +// inference/service-elasticsearch.asciidoc:204 [source, python] ---- diff --git a/docs/examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc b/docs/examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc new file mode 100644 index 000000000..1930760fd --- /dev/null +++ b/docs/examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc @@ -0,0 +1,46 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:1051 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "range": { + "year": { + "gt": 2023 + } + } + } + } + }, + { + "standard": { + "query": { + "term": { + "topic": "elastic" + } + } + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + }, + source=False, + aggs={ + "topics": { + "terms": { + "field": "topic" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc b/docs/examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc new file mode 100644 index 000000000..b716f8df7 --- /dev/null +++ b/docs/examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:1363 + +[source, python] +---- +resp = client.inference.put( + task_type="rerank", + inference_id="my-rerank-model", + inference_config={ + "service": "cohere", + "service_settings": { + "model_id": "rerank-english-v3.0", + "api_key": "{{COHERE_API_KEY}}" + } + }, +) +print(resp) +---- diff --git a/docs/examples/016f3147dae9ff2c3e831257ae470361.asciidoc b/docs/examples/016f3147dae9ff2c3e831257ae470361.asciidoc index b1bdb6ee6..299997ce4 100644 --- a/docs/examples/016f3147dae9ff2c3e831257ae470361.asciidoc +++ b/docs/examples/016f3147dae9ff2c3e831257ae470361.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:52 +// alias.asciidoc:54 [source, python] ---- diff --git a/docs/examples/77113c65e1755313183a8969233a5a07.asciidoc b/docs/examples/01ae196538fac197eedbbf458a4ef31b.asciidoc similarity index 70% rename from docs/examples/77113c65e1755313183a8969233a5a07.asciidoc rename to docs/examples/01ae196538fac197eedbbf458a4ef31b.asciidoc index 2bce7f079..e087a80ec 100644 --- a/docs/examples/77113c65e1755313183a8969233a5a07.asciidoc +++ b/docs/examples/01ae196538fac197eedbbf458a4ef31b.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/keyword.asciidoc:249 +// mapping/types/keyword.asciidoc:260 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "kwd": { "type": "keyword", diff --git a/docs/examples/01b23f09d2b7f140faf649eadbbf3ac3.asciidoc b/docs/examples/01b23f09d2b7f140faf649eadbbf3ac3.asciidoc index b3dcd8bc1..7d37ed747 100644 --- a/docs/examples/01b23f09d2b7f140faf649eadbbf3ac3.asciidoc +++ b/docs/examples/01b23f09d2b7f140faf649eadbbf3ac3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/index-templates.asciidoc:83 +// indices/index-templates.asciidoc:86 [source, python] ---- diff --git a/docs/examples/01bc0f2ed30eb3dd23511d01ce0ac6e1.asciidoc b/docs/examples/01bc0f2ed30eb3dd23511d01ce0ac6e1.asciidoc index f3c753df4..b10bf0ef1 100644 --- a/docs/examples/01bc0f2ed30eb3dd23511d01ce0ac6e1.asciidoc +++ b/docs/examples/01bc0f2ed30eb3dd23511d01ce0ac6e1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/start-transform.asciidoc:79 +// transform/apis/start-transform.asciidoc:85 [source, python] ---- diff --git a/docs/examples/01cd0ea360282a2c591a366679d7187d.asciidoc b/docs/examples/01cd0ea360282a2c591a366679d7187d.asciidoc new file mode 100644 index 000000000..d52222ef9 --- /dev/null +++ b/docs/examples/01cd0ea360282a2c591a366679d7187d.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// troubleshooting/common-issues/task-queue-backlog.asciidoc:83 + +[source, python] +---- +resp = client.tasks.list( + human=True, + detailed=True, + actions="indices:data/write/bulk", +) +print(resp) +---- diff --git a/docs/examples/01dc7bdc223bd651574ed2d3954a5b1c.asciidoc b/docs/examples/01dc7bdc223bd651574ed2d3954a5b1c.asciidoc index 81e0a9db9..8edde87f0 100644 --- a/docs/examples/01dc7bdc223bd651574ed2d3954a5b1c.asciidoc +++ b/docs/examples/01dc7bdc223bd651574ed2d3954a5b1c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/execute-watch.asciidoc:147 +// rest-api/watcher/execute-watch.asciidoc:153 [source, python] ---- diff --git a/docs/examples/020c95db88ef356093f03be84893ddf9.asciidoc b/docs/examples/020c95db88ef356093f03be84893ddf9.asciidoc index f179d62cb..491db9b18 100644 --- a/docs/examples/020c95db88ef356093f03be84893ddf9.asciidoc +++ b/docs/examples/020c95db88ef356093f03be84893ddf9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/get-follow-stats.asciidoc:35 +// ccr/apis/follow/get-follow-stats.asciidoc:41 [source, python] ---- diff --git a/docs/examples/0246f73cc2ed3dfec577119e8cd15404.asciidoc b/docs/examples/0246f73cc2ed3dfec577119e8cd15404.asciidoc index 71415a0a1..670c9daa3 100644 --- a/docs/examples/0246f73cc2ed3dfec577119e8cd15404.asciidoc +++ b/docs/examples/0246f73cc2ed3dfec577119e8cd15404.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:177 +// indices/put-mapping.asciidoc:183 [source, python] ---- diff --git a/docs/examples/02520ac7816b2c4cf8fb413fd16122f2.asciidoc b/docs/examples/02520ac7816b2c4cf8fb413fd16122f2.asciidoc index 788c4344b..4192c617a 100644 --- a/docs/examples/02520ac7816b2c4cf8fb413fd16122f2.asciidoc +++ b/docs/examples/02520ac7816b2c4cf8fb413fd16122f2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/flush-job.asciidoc:75 +// ml/anomaly-detection/apis/flush-job.asciidoc:81 [source, python] ---- diff --git a/docs/examples/0280247e0cf2e561c548f22c9fb31163.asciidoc b/docs/examples/0280247e0cf2e561c548f22c9fb31163.asciidoc index 10c5d0ce4..113679b3d 100644 --- a/docs/examples/0280247e0cf2e561c548f22c9fb31163.asciidoc +++ b/docs/examples/0280247e0cf2e561c548f22c9fb31163.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-tokens.asciidoc:199 +// rest-api/security/invalidate-tokens.asciidoc:205 [source, python] ---- diff --git a/docs/examples/02f65c6bab8f40bf3ce18160623d1870.asciidoc b/docs/examples/02f65c6bab8f40bf3ce18160623d1870.asciidoc index c34253d87..d36267cb5 100644 --- a/docs/examples/02f65c6bab8f40bf3ce18160623d1870.asciidoc +++ b/docs/examples/02f65c6bab8f40bf3ce18160623d1870.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-index-template-v1.asciidoc:35 +// indices/get-index-template-v1.asciidoc:41 [source, python] ---- diff --git a/docs/examples/0308cbd85281f95fc458042afe3f587d.asciidoc b/docs/examples/0308cbd85281f95fc458042afe3f587d.asciidoc index 7ca4d69ff..43b6a859e 100644 --- a/docs/examples/0308cbd85281f95fc458042afe3f587d.asciidoc +++ b/docs/examples/0308cbd85281f95fc458042afe3f587d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:79 +// docs/get.asciidoc:85 [source, python] ---- diff --git a/docs/examples/032eac56b798bea29390e102538f4a26.asciidoc b/docs/examples/032eac56b798bea29390e102538f4a26.asciidoc index 8f4b0e3ed..36dfb2a73 100644 --- a/docs/examples/032eac56b798bea29390e102538f4a26.asciidoc +++ b/docs/examples/032eac56b798bea29390e102538f4a26.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/refresh.asciidoc:103 +// indices/refresh.asciidoc:109 [source, python] ---- diff --git a/docs/examples/0350ff5ebb8207c004eb771088339cb4.asciidoc b/docs/examples/0350ff5ebb8207c004eb771088339cb4.asciidoc index c815c5834..4cd810a13 100644 --- a/docs/examples/0350ff5ebb8207c004eb771088339cb4.asciidoc +++ b/docs/examples/0350ff5ebb8207c004eb771088339cb4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rrf.asciidoc:121 +// search/rrf.asciidoc:127 [source, python] ---- diff --git a/docs/examples/03891265df2111a38e0b6b24c1b967e1.asciidoc b/docs/examples/03891265df2111a38e0b6b24c1b967e1.asciidoc index f46691025..cf65de095 100644 --- a/docs/examples/03891265df2111a38e0b6b24c1b967e1.asciidoc +++ b/docs/examples/03891265df2111a38e0b6b24c1b967e1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-service-accounts.asciidoc:267 +// rest-api/security/get-service-accounts.asciidoc:320 [source, python] ---- diff --git a/docs/examples/03c4b815bf1e6a8c5cfcc6ddf94bc093.asciidoc b/docs/examples/03c4b815bf1e6a8c5cfcc6ddf94bc093.asciidoc index b8fb76686..985ac93d1 100644 --- a/docs/examples/03c4b815bf1e6a8c5cfcc6ddf94bc093.asciidoc +++ b/docs/examples/03c4b815bf1e6a8c5cfcc6ddf94bc093.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// sql/apis/sql-search-api.asciidoc:11 +// sql/apis/sql-search-api.asciidoc:17 [source, python] ---- diff --git a/docs/examples/04412d11783dac25b5fd2ec5407078a3.asciidoc b/docs/examples/04412d11783dac25b5fd2ec5407078a3.asciidoc index 639dc270c..613984b02 100644 --- a/docs/examples/04412d11783dac25b5fd2ec5407078a3.asciidoc +++ b/docs/examples/04412d11783dac25b5fd2ec5407078a3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-api-key-id-api.asciidoc:86 +// connector/apis/update-connector-api-key-id-api.asciidoc:93 [source, python] ---- diff --git a/docs/examples/046b2249bbc49e77848c114cee940f17.asciidoc b/docs/examples/046b2249bbc49e77848c114cee940f17.asciidoc index 0289db8e2..4a3b96176 100644 --- a/docs/examples/046b2249bbc49e77848c114cee940f17.asciidoc +++ b/docs/examples/046b2249bbc49e77848c114cee940f17.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/text-expansion-query.asciidoc:157 +// query-dsl/text-expansion-query.asciidoc:164 [source, python] ---- diff --git a/docs/examples/0470d7101637568b9d3d1239f06325a7.asciidoc b/docs/examples/0470d7101637568b9d3d1239f06325a7.asciidoc index b8b157197..b4f0da774 100644 --- a/docs/examples/0470d7101637568b9d3d1239f06325a7.asciidoc +++ b/docs/examples/0470d7101637568b9d3d1239f06325a7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/update-desired-nodes.asciidoc:15 +// cluster/update-desired-nodes.asciidoc:21 [source, python] ---- diff --git a/docs/examples/048652b6abfe195da8ea8cef10ee01b1.asciidoc b/docs/examples/048652b6abfe195da8ea8cef10ee01b1.asciidoc index 26a2e9379..f295c9528 100644 --- a/docs/examples/048652b6abfe195da8ea8cef10ee01b1.asciidoc +++ b/docs/examples/048652b6abfe195da8ea8cef10ee01b1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/reset-transform.asciidoc:61 +// transform/apis/reset-transform.asciidoc:67 [source, python] ---- diff --git a/docs/examples/04d6ce0c903bd468afbecd3aa1c4a78a.asciidoc b/docs/examples/04d6ce0c903bd468afbecd3aa1c4a78a.asciidoc index 1d0483c0f..b2d34865d 100644 --- a/docs/examples/04d6ce0c903bd468afbecd3aa1c4a78a.asciidoc +++ b/docs/examples/04d6ce0c903bd468afbecd3aa1c4a78a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/put-pipeline.asciidoc:120 +// ingest/apis/put-pipeline.asciidoc:126 [source, python] ---- diff --git a/docs/examples/04de2e3a9c00c2056b07bf9cf9e63a99.asciidoc b/docs/examples/04de2e3a9c00c2056b07bf9cf9e63a99.asciidoc index 078edad78..c3086c6d5 100644 --- a/docs/examples/04de2e3a9c00c2056b07bf9cf9e63a99.asciidoc +++ b/docs/examples/04de2e3a9c00c2056b07bf9cf9e63a99.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-google-vertex-ai.asciidoc:107 +// inference/service-google-vertex-ai.asciidoc:133 [source, python] ---- diff --git a/docs/examples/04f5dd677c777bcb15d7d5fa63275fc8.asciidoc b/docs/examples/04f5dd677c777bcb15d7d5fa63275fc8.asciidoc index 115f443da..1191184c0 100644 --- a/docs/examples/04f5dd677c777bcb15d7d5fa63275fc8.asciidoc +++ b/docs/examples/04f5dd677c777bcb15d7d5fa63275fc8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/health.asciidoc:42 +// cluster/health.asciidoc:48 [source, python] ---- diff --git a/docs/examples/0502284d4685c478eb68761f979f4303.asciidoc b/docs/examples/0502284d4685c478eb68761f979f4303.asciidoc index 7a6344c79..4e87cee50 100644 --- a/docs/examples/0502284d4685c478eb68761f979f4303.asciidoc +++ b/docs/examples/0502284d4685c478eb68761f979f4303.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:315 +// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:321 [source, python] ---- diff --git a/docs/examples/05284c8ea91769c09c8db47db8a6629a.asciidoc b/docs/examples/05284c8ea91769c09c8db47db8a6629a.asciidoc index 03dfbf18d..93c297023 100644 --- a/docs/examples/05284c8ea91769c09c8db47db8a6629a.asciidoc +++ b/docs/examples/05284c8ea91769c09c8db47db8a6629a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/repositories.asciidoc:51 +// cat/repositories.asciidoc:57 [source, python] ---- diff --git a/docs/examples/9868ce609f4450702934fcbf4c340bf1.asciidoc b/docs/examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc similarity index 90% rename from docs/examples/9868ce609f4450702934fcbf4c340bf1.asciidoc rename to docs/examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc index af6cc83ab..cea3d0eb3 100644 --- a/docs/examples/9868ce609f4450702934fcbf4c340bf1.asciidoc +++ b/docs/examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="alibabacloud_ai_search_embeddings", + id="alibabacloud_ai_search_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/05f6049c677a156bdf9b83e71a3b87ed.asciidoc b/docs/examples/05f6049c677a156bdf9b83e71a3b87ed.asciidoc index b5222abb1..54ed3cff4 100644 --- a/docs/examples/05f6049c677a156bdf9b83e71a3b87ed.asciidoc +++ b/docs/examples/05f6049c677a156bdf9b83e71a3b87ed.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/ssl.asciidoc:84 +// rest-api/security/ssl.asciidoc:90 [source, python] ---- diff --git a/docs/examples/0601b5cb5328c9ebff30f4be1b210f93.asciidoc b/docs/examples/0601b5cb5328c9ebff30f4be1b210f93.asciidoc index aac12b70e..004b0ae50 100644 --- a/docs/examples/0601b5cb5328c9ebff30f4be1b210f93.asciidoc +++ b/docs/examples/0601b5cb5328c9ebff30f4be1b210f93.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-status-api.asciidoc:327 +// snapshot-restore/apis/get-snapshot-status-api.asciidoc:333 [source, python] ---- diff --git a/docs/examples/06454a8e85e2d3479c90390bb955eb39.asciidoc b/docs/examples/06454a8e85e2d3479c90390bb955eb39.asciidoc index cc543366b..3ecb496e2 100644 --- a/docs/examples/06454a8e85e2d3479c90390bb955eb39.asciidoc +++ b/docs/examples/06454a8e85e2d3479c90390bb955eb39.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-api.asciidoc:583 +// snapshot-restore/apis/get-snapshot-api.asciidoc:589 [source, python] ---- diff --git a/docs/examples/066e0bdcdfa3b8afa5d1e5777f73fccb.asciidoc b/docs/examples/066e0bdcdfa3b8afa5d1e5777f73fccb.asciidoc index 944e2ba95..4de440663 100644 --- a/docs/examples/066e0bdcdfa3b8afa5d1e5777f73fccb.asciidoc +++ b/docs/examples/066e0bdcdfa3b8afa5d1e5777f73fccb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:327 +// indices/rollover-index.asciidoc:333 [source, python] ---- diff --git a/docs/examples/06b5d3d56c4d4e3b61ae42ea26401c40.asciidoc b/docs/examples/06b5d3d56c4d4e3b61ae42ea26401c40.asciidoc index f4be82bcb..5e26ee403 100644 --- a/docs/examples/06b5d3d56c4d4e3b61ae42ea26401c40.asciidoc +++ b/docs/examples/06b5d3d56c4d4e3b61ae42ea26401c40.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/multi-search.asciidoc:10 +// search/multi-search.asciidoc:16 [source, python] ---- diff --git a/docs/examples/611c1e05f4ebb48a1a8c8488238ce34d.asciidoc b/docs/examples/0709a38613d2de90d418ce12b36af30e.asciidoc similarity index 71% rename from docs/examples/611c1e05f4ebb48a1a8c8488238ce34d.asciidoc rename to docs/examples/0709a38613d2de90d418ce12b36af30e.asciidoc index c03987dcd..340a95e60 100644 --- a/docs/examples/611c1e05f4ebb48a1a8c8488238ce34d.asciidoc +++ b/docs/examples/0709a38613d2de90d418ce12b36af30e.asciidoc @@ -1,10 +1,8 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:109 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:113 [source, python] ---- -resp = client.cluster.reroute( - metric="none", -) +resp = client.cluster.reroute() print(resp) ---- diff --git a/docs/examples/0721c8adec544d5ecea3fcc410e45feb.asciidoc b/docs/examples/0721c8adec544d5ecea3fcc410e45feb.asciidoc index 84d5c2622..27e6809d9 100644 --- a/docs/examples/0721c8adec544d5ecea3fcc410e45feb.asciidoc +++ b/docs/examples/0721c8adec544d5ecea3fcc410e45feb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/activate-user-profile.asciidoc:98 +// rest-api/security/activate-user-profile.asciidoc:104 [source, python] ---- diff --git a/docs/examples/0722b302b2b3275a988d858044f99d5d.asciidoc b/docs/examples/0722b302b2b3275a988d858044f99d5d.asciidoc new file mode 100644 index 000000000..abbb65005 --- /dev/null +++ b/docs/examples/0722b302b2b3275a988d858044f99d5d.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:45 + +[source, python] +---- +resp = client.indices.get_mapping( + index="kibana_sample_data_ecommerce", +) +print(resp) +---- diff --git a/docs/examples/0737ebaea33631f001fb3f4226948492.asciidoc b/docs/examples/0737ebaea33631f001fb3f4226948492.asciidoc index 7f7af688a..8b47a2a5b 100644 --- a/docs/examples/0737ebaea33631f001fb3f4226948492.asciidoc +++ b/docs/examples/0737ebaea33631f001fb3f4226948492.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/geoip.asciidoc:235 +// ingest/processors/geoip.asciidoc:237 [source, python] ---- diff --git a/docs/examples/073864d3f52f8f79aafdaa85a88ac46a.asciidoc b/docs/examples/073864d3f52f8f79aafdaa85a88ac46a.asciidoc index bb4580ebf..c89d52af8 100644 --- a/docs/examples/073864d3f52f8f79aafdaa85a88ac46a.asciidoc +++ b/docs/examples/073864d3f52f8f79aafdaa85a88ac46a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-cache.asciidoc:76 +// rest-api/security/clear-cache.asciidoc:82 [source, python] ---- diff --git a/docs/examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc b/docs/examples/074e4602d1ca54412380a40867d078bc.asciidoc similarity index 69% rename from docs/examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc rename to docs/examples/074e4602d1ca54412380a40867d078bc.asciidoc index 9b5028b37..8eab49b0b 100644 --- a/docs/examples/844928da2ff9a1394af5347a5e2e4f78.asciidoc +++ b/docs/examples/074e4602d1ca54412380a40867d078bc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// index-modules/slowlog.asciidoc:133 +// index-modules/slowlog.asciidoc:180 [source, python] ---- @@ -10,7 +10,9 @@ resp = client.indices.put_settings( "index.indexing.slowlog.threshold.index.info": "5s", "index.indexing.slowlog.threshold.index.debug": "2s", "index.indexing.slowlog.threshold.index.trace": "500ms", - "index.indexing.slowlog.source": "1000" + "index.indexing.slowlog.source": "1000", + "index.indexing.slowlog.reformat": True, + "index.indexing.slowlog.include.user": True }, ) print(resp) diff --git a/docs/examples/0755471d7dce4785d2e7ed0c10182ea3.asciidoc b/docs/examples/0755471d7dce4785d2e7ed0c10182ea3.asciidoc index 3e665950b..1b267037f 100644 --- a/docs/examples/0755471d7dce4785d2e7ed0c10182ea3.asciidoc +++ b/docs/examples/0755471d7dce4785d2e7ed0c10182ea3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/get-transform-stats.asciidoc:330 +// transform/apis/get-transform-stats.asciidoc:336 [source, python] ---- diff --git a/docs/examples/07a5fdeb7805cec1d28ba288b28f5ff5.asciidoc b/docs/examples/07a5fdeb7805cec1d28ba288b28f5ff5.asciidoc index 29406d787..99ffe9440 100644 --- a/docs/examples/07a5fdeb7805cec1d28ba288b28f5ff5.asciidoc +++ b/docs/examples/07a5fdeb7805cec1d28ba288b28f5ff5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/stop-job.asciidoc:75 +// rollup/apis/stop-job.asciidoc:81 [source, python] ---- diff --git a/docs/examples/07ba3eaa931f2cf110052e3544db51f8.asciidoc b/docs/examples/07ba3eaa931f2cf110052e3544db51f8.asciidoc index dd35d3388..12cec5a60 100644 --- a/docs/examples/07ba3eaa931f2cf110052e3544db51f8.asciidoc +++ b/docs/examples/07ba3eaa931f2cf110052e3544db51f8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:878 +// docs/reindex.asciidoc:884 [source, python] ---- diff --git a/docs/examples/07c07f6d497b1a3012aa4320f830e09e.asciidoc b/docs/examples/07c07f6d497b1a3012aa4320f830e09e.asciidoc index 9e8d9d9d0..7792f2e29 100644 --- a/docs/examples/07c07f6d497b1a3012aa4320f830e09e.asciidoc +++ b/docs/examples/07c07f6d497b1a3012aa4320f830e09e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/post-forget-follower.asciidoc:133 +// ccr/apis/follow/post-forget-follower.asciidoc:139 [source, python] ---- diff --git a/docs/examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc b/docs/examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc new file mode 100644 index 000000000..33ec4dfcc --- /dev/null +++ b/docs/examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc @@ -0,0 +1,48 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/rank-vectors.asciidoc:64 + +[source, python] +---- +resp = client.indices.create( + index="my-rank-vectors-bit", + mappings={ + "properties": { + "my_vector": { + "type": "rank_vectors", + "element_type": "bit" + } + } + }, +) +print(resp) + +resp1 = client.bulk( + index="my-rank-vectors-bit", + refresh=True, + operations=[ + { + "index": { + "_id": "1" + } + }, + { + "my_vector": [ + 127, + -127, + 0, + 1, + 42 + ] + }, + { + "index": { + "_id": "2" + } + }, + { + "my_vector": "8100012a7f" + } + ], +) +print(resp1) +---- diff --git a/docs/examples/840f8c863c30b04abcf2dd66b846f157.asciidoc b/docs/examples/083b92e8ea264e49bf9fd40fc6a3094b.asciidoc similarity index 86% rename from docs/examples/840f8c863c30b04abcf2dd66b846f157.asciidoc rename to docs/examples/083b92e8ea264e49bf9fd40fc6a3094b.asciidoc index 2ab4931b0..6c94b6da2 100644 --- a/docs/examples/840f8c863c30b04abcf2dd66b846f157.asciidoc +++ b/docs/examples/083b92e8ea264e49bf9fd40fc6a3094b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-elasticsearch.asciidoc:172 +// inference/service-elasticsearch.asciidoc:264 [source, python] ---- @@ -14,6 +14,7 @@ resp = client.inference.put( "min_number_of_allocations": 3, "max_number_of_allocations": 10 }, + "num_threads": 1, "model_id": ".multilingual-e5-small" } }, diff --git a/docs/examples/0881397074d261ccc2db514daf116c31.asciidoc b/docs/examples/0881397074d261ccc2db514daf116c31.asciidoc index 269216db0..c4ffb3c12 100644 --- a/docs/examples/0881397074d261ccc2db514daf116c31.asciidoc +++ b/docs/examples/0881397074d261ccc2db514daf116c31.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:122 +// rest-api/security/get-api-keys.asciidoc:128 [source, python] ---- diff --git a/docs/examples/08c9af9dd519c011deedd406f3061836.asciidoc b/docs/examples/08c9af9dd519c011deedd406f3061836.asciidoc index 43eafcf42..9c456b203 100644 --- a/docs/examples/08c9af9dd519c011deedd406f3061836.asciidoc +++ b/docs/examples/08c9af9dd519c011deedd406f3061836.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/preview-datafeed.asciidoc:151 +// ml/anomaly-detection/apis/preview-datafeed.asciidoc:157 [source, python] ---- diff --git a/docs/examples/08e08feb514b24006e13f258d617d873.asciidoc b/docs/examples/08e08feb514b24006e13f258d617d873.asciidoc index e72e593f0..0659ee723 100644 --- a/docs/examples/08e08feb514b24006e13f258d617d873.asciidoc +++ b/docs/examples/08e08feb514b24006e13f258d617d873.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:229 +// scripting/using.asciidoc:234 [source, python] ---- diff --git a/docs/examples/0957bbd535f58c97b12ffba90813d64c.asciidoc b/docs/examples/0957bbd535f58c97b12ffba90813d64c.asciidoc index b508719c5..adf5b2f2e 100644 --- a/docs/examples/0957bbd535f58c97b12ffba90813d64c.asciidoc +++ b/docs/examples/0957bbd535f58c97b12ffba90813d64c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:361 +// indices/analyze.asciidoc:367 [source, python] ---- diff --git a/docs/examples/095e3f21941a9cc75f398389a075152d.asciidoc b/docs/examples/095e3f21941a9cc75f398389a075152d.asciidoc index 01469ab8e..af9f1554d 100644 --- a/docs/examples/095e3f21941a9cc75f398389a075152d.asciidoc +++ b/docs/examples/095e3f21941a9cc75f398389a075152d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/infer-trained-model.asciidoc:1043 +// ml/trained-models/apis/infer-trained-model.asciidoc:1150 [source, python] ---- diff --git a/docs/examples/09769561f082b50558fb7d8707719963.asciidoc b/docs/examples/09769561f082b50558fb7d8707719963.asciidoc index 9eb29e774..e931567b9 100644 --- a/docs/examples/09769561f082b50558fb7d8707719963.asciidoc +++ b/docs/examples/09769561f082b50558fb7d8707719963.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-stats.asciidoc:2578 +// cluster/nodes-stats.asciidoc:2588 [source, python] ---- diff --git a/docs/examples/099006ab11b52ea99693401dceee8bad.asciidoc b/docs/examples/099006ab11b52ea99693401dceee8bad.asciidoc index 75518ba6e..06f1008ce 100644 --- a/docs/examples/099006ab11b52ea99693401dceee8bad.asciidoc +++ b/docs/examples/099006ab11b52ea99693401dceee8bad.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:215 +// scripting/using.asciidoc:220 [source, python] ---- diff --git a/docs/examples/09cb1b18bf4033b4afafb25bd3dab12c.asciidoc b/docs/examples/09cb1b18bf4033b4afafb25bd3dab12c.asciidoc index 6e910f0cc..7ed47659e 100644 --- a/docs/examples/09cb1b18bf4033b4afafb25bd3dab12c.asciidoc +++ b/docs/examples/09cb1b18bf4033b4afafb25bd3dab12c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/rule-query.asciidoc:65 +// query-dsl/rule-query.asciidoc:71 [source, python] ---- diff --git a/docs/examples/09e6e06ba562f4b9bac59455e9151a80.asciidoc b/docs/examples/09e6e06ba562f4b9bac59455e9151a80.asciidoc index 64f28519d..20e4b07b4 100644 --- a/docs/examples/09e6e06ba562f4b9bac59455e9151a80.asciidoc +++ b/docs/examples/09e6e06ba562f4b9bac59455e9151a80.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:517 +// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:523 [source, python] ---- diff --git a/docs/examples/0a46cc8fe93e372909660a63dc52ae3b.asciidoc b/docs/examples/0a46cc8fe93e372909660a63dc52ae3b.asciidoc index c08ace7f6..bbe7b7ca8 100644 --- a/docs/examples/0a46cc8fe93e372909660a63dc52ae3b.asciidoc +++ b/docs/examples/0a46cc8fe93e372909660a63dc52ae3b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:309 +// indices/rollover-index.asciidoc:315 [source, python] ---- diff --git a/docs/examples/0a650401134f07e40216f0d0d1a66a32.asciidoc b/docs/examples/0a650401134f07e40216f0d0d1a66a32.asciidoc index e9aa27856..7dfc1b717 100644 --- a/docs/examples/0a650401134f07e40216f0d0d1a66a32.asciidoc +++ b/docs/examples/0a650401134f07e40216f0d0d1a66a32.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/allocation.asciidoc:119 +// cat/allocation.asciidoc:126 [source, python] ---- diff --git a/docs/examples/0a758d9dec74d9e942cf41a06499234f.asciidoc b/docs/examples/0a758d9dec74d9e942cf41a06499234f.asciidoc index b44d34496..615755b86 100644 --- a/docs/examples/0a758d9dec74d9e942cf41a06499234f.asciidoc +++ b/docs/examples/0a758d9dec74d9e942cf41a06499234f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:282 +// scripting/using.asciidoc:287 [source, python] ---- diff --git a/docs/examples/0ad8edd10542ec2c4d5d8700d7e2ba97.asciidoc b/docs/examples/0ad8edd10542ec2c4d5d8700d7e2ba97.asciidoc index 25df3cdc2..842ce3b94 100644 --- a/docs/examples/0ad8edd10542ec2c4d5d8700d7e2ba97.asciidoc +++ b/docs/examples/0ad8edd10542ec2c4d5d8700d7e2ba97.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-amazon-bedrock.asciidoc:136 +// inference/service-amazon-bedrock.asciidoc:162 [source, python] ---- diff --git a/docs/examples/0ade87c8cb0e3c188d2e3dce279d5cc2.asciidoc b/docs/examples/0ade87c8cb0e3c188d2e3dce279d5cc2.asciidoc index bf81f55e9..058dd2421 100644 --- a/docs/examples/0ade87c8cb0e3c188d2e3dce279d5cc2.asciidoc +++ b/docs/examples/0ade87c8cb0e3c188d2e3dce279d5cc2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-filtering-api.asciidoc:115 +// connector/apis/update-connector-filtering-api.asciidoc:122 [source, python] ---- diff --git a/docs/examples/0aff04881be21eea45375ec4f4f50e66.asciidoc b/docs/examples/0aff04881be21eea45375ec4f4f50e66.asciidoc index c1a67eca1..ce55cdeaf 100644 --- a/docs/examples/0aff04881be21eea45375ec4f4f50e66.asciidoc +++ b/docs/examples/0aff04881be21eea45375ec4f4f50e66.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-api-keys.asciidoc:83 +// rest-api/security/invalidate-api-keys.asciidoc:89 [source, python] ---- diff --git a/docs/examples/0b615ff4ef5a8847ee8109b2fd11619a.asciidoc b/docs/examples/0b615ff4ef5a8847ee8109b2fd11619a.asciidoc index 573e75fe5..41910d39b 100644 --- a/docs/examples/0b615ff4ef5a8847ee8109b2fd11619a.asciidoc +++ b/docs/examples/0b615ff4ef5a8847ee8109b2fd11619a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:238 +// scripting/using.asciidoc:243 [source, python] ---- diff --git a/docs/examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc b/docs/examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc new file mode 100644 index 000000000..77db1349e --- /dev/null +++ b/docs/examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc @@ -0,0 +1,57 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:812 + +[source, python] +---- +resp = client.search( + index="retrievers_example_nested", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "nested": { + "path": "nested_field", + "inner_hits": { + "name": "nested_vector", + "_source": False, + "fields": [ + "nested_field.paragraph_id" + ] + }, + "query": { + "knn": { + "field": "nested_field.nested_vector", + "query_vector": [ + 1, + 0, + 0.5 + ], + "k": 10 + } + } + } + } + } + }, + { + "standard": { + "query": { + "term": { + "topic": "ai" + } + } + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + }, + source=[ + "topic" + ], +) +print(resp) +---- diff --git a/docs/examples/0bcd380315ef4691b8c79df6ca53a85f.asciidoc b/docs/examples/0bcd380315ef4691b8c79df6ca53a85f.asciidoc index 75c29429f..124a36052 100644 --- a/docs/examples/0bcd380315ef4691b8c79df6ca53a85f.asciidoc +++ b/docs/examples/0bcd380315ef4691b8c79df6ca53a85f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:395 +// search/search-your-data/sort-search-results.asciidoc:397 [source, python] ---- diff --git a/docs/examples/0bee07a581c5776e068f6f4efad5a399.asciidoc b/docs/examples/0bee07a581c5776e068f6f4efad5a399.asciidoc new file mode 100644 index 000000000..5ef14fcc9 --- /dev/null +++ b/docs/examples/0bee07a581c5776e068f6f4efad5a399.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// esql/esql-across-clusters.asciidoc:194 + +[source, python] +---- +resp = client.esql.async_query( + format="json", + query="\n FROM my-index-000001,cluster_one:my-index-000001,cluster_two:my-index*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ", + include_ccs_metadata=True, +) +print(resp) +---- diff --git a/docs/examples/0bef1fdefeb2956d60d52d3f38397cad.asciidoc b/docs/examples/0bef1fdefeb2956d60d52d3f38397cad.asciidoc deleted file mode 100644 index 8cedec16e..000000000 --- a/docs/examples/0bef1fdefeb2956d60d52d3f38397cad.asciidoc +++ /dev/null @@ -1,15 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// mapping/fields/synthetic-source.asciidoc:17 - -[source, python] ----- -resp = client.indices.create( - index="idx", - mappings={ - "_source": { - "mode": "synthetic" - } - }, -) -print(resp) ----- diff --git a/docs/examples/0c2ca704a39dda8b3a7c5806ec6c6cf8.asciidoc b/docs/examples/0c2ca704a39dda8b3a7c5806ec6c6cf8.asciidoc index c2f9ea70e..e9e7a172a 100644 --- a/docs/examples/0c2ca704a39dda8b3a7c5806ec6c6cf8.asciidoc +++ b/docs/examples/0c2ca704a39dda8b3a7c5806ec6c6cf8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1379 +// mapping/runtime.asciidoc:1377 [source, python] ---- diff --git a/docs/examples/0c2d9ac7e3f28d4d802e21cbbbcfeb34.asciidoc b/docs/examples/0c2d9ac7e3f28d4d802e21cbbbcfeb34.asciidoc index 110616292..1ccb32524 100644 --- a/docs/examples/0c2d9ac7e3f28d4d802e21cbbbcfeb34.asciidoc +++ b/docs/examples/0c2d9ac7e3f28d4d802e21cbbbcfeb34.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/recovery.asciidoc:113 +// cat/recovery.asciidoc:118 [source, python] ---- diff --git a/docs/examples/0c464965126cc09e6812716a145991d4.asciidoc b/docs/examples/0c464965126cc09e6812716a145991d4.asciidoc index 0f5465ce3..e3c34eb90 100644 --- a/docs/examples/0c464965126cc09e6812716a145991d4.asciidoc +++ b/docs/examples/0c464965126cc09e6812716a145991d4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-info.asciidoc:301 +// cluster/nodes-info.asciidoc:306 [source, python] ---- diff --git a/docs/examples/160986f49758f4e8345d183a842f6351.asciidoc b/docs/examples/0c52af573c9401a2a687e86a4beb182b.asciidoc similarity index 78% rename from docs/examples/160986f49758f4e8345d183a842f6351.asciidoc rename to docs/examples/0c52af573c9401a2a687e86a4beb182b.asciidoc index 7b460b136..8a7a866b5 100644 --- a/docs/examples/160986f49758f4e8345d183a842f6351.asciidoc +++ b/docs/examples/0c52af573c9401a2a687e86a4beb182b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/attachment.asciidoc:165 +// ingest/processors/attachment.asciidoc:214 [source, python] ---- @@ -10,7 +10,7 @@ resp = client.ingest.put_pipeline( { "attachment": { "field": "data", - "remove_binary": False + "remove_binary": True } } ], diff --git a/docs/examples/0c6f9c9da75293fae69659ac1d6329de.asciidoc b/docs/examples/0c6f9c9da75293fae69659ac1d6329de.asciidoc index 53ac89709..739b8288c 100644 --- a/docs/examples/0c6f9c9da75293fae69659ac1d6329de.asciidoc +++ b/docs/examples/0c6f9c9da75293fae69659ac1d6329de.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-tokens.asciidoc:175 +// rest-api/security/invalidate-tokens.asciidoc:181 [source, python] ---- diff --git a/docs/examples/0c6fc67c2dd1c1771cd866ce471d74e1.asciidoc b/docs/examples/0c6fc67c2dd1c1771cd866ce471d74e1.asciidoc index 3852a2102..a8056bc77 100644 --- a/docs/examples/0c6fc67c2dd1c1771cd866ce471d74e1.asciidoc +++ b/docs/examples/0c6fc67c2dd1c1771cd866ce471d74e1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:206 +// rest-api/security/create-role-mappings.asciidoc:212 [source, python] ---- diff --git a/docs/examples/0c892d328b73d38396aaef6d9cbcd36b.asciidoc b/docs/examples/0c892d328b73d38396aaef6d9cbcd36b.asciidoc index fc37a12ca..157a9b740 100644 --- a/docs/examples/0c892d328b73d38396aaef6d9cbcd36b.asciidoc +++ b/docs/examples/0c892d328b73d38396aaef6d9cbcd36b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/delete.asciidoc:82 +// docs/delete.asciidoc:88 [source, python] ---- diff --git a/docs/examples/0c8be7aec84ea86b243904f5d4162f5a.asciidoc b/docs/examples/0c8be7aec84ea86b243904f5d4162f5a.asciidoc new file mode 100644 index 000000000..455b6a220 --- /dev/null +++ b/docs/examples/0c8be7aec84ea86b243904f5d4162f5a.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:292 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "match": { + "title": { + "query": "fluffy pancakes breakfast", + "minimum_should_match": 2 + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/ce13afc0c976c5e1f424b58e0c97fd64.asciidoc b/docs/examples/0d30077cd34e93377a3a86f2ebd69415.asciidoc similarity index 80% rename from docs/examples/ce13afc0c976c5e1f424b58e0c97fd64.asciidoc rename to docs/examples/0d30077cd34e93377a3a86f2ebd69415.asciidoc index bb8f5780c..abca0eadf 100644 --- a/docs/examples/ce13afc0c976c5e1f424b58e0c97fd64.asciidoc +++ b/docs/examples/0d30077cd34e93377a3a86f2ebd69415.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/create-connector-api.asciidoc:111 +// connector/apis/create-connector-api.asciidoc:118 [source, python] ---- @@ -9,7 +9,7 @@ resp = client.connector.put( name="My Connector", description="My Connector to sync data to Elastic index from Google Drive", service_type="google_drive", - language="english", + language="en", ) print(resp) ---- diff --git a/docs/examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc b/docs/examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc new file mode 100644 index 000000000..89f2a7eeb --- /dev/null +++ b/docs/examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc @@ -0,0 +1,60 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:1191 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "term": { + "topic": "elastic" + } + } + } + }, + { + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "query_string": { + "query": "(information retrieval) OR (artificial intelligence)", + "default_field": "text" + } + } + } + }, + { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + }, + source=False, + size=1, + explain=True, +) +print(resp) +---- diff --git a/docs/examples/0d8063b484a18f8672fb5ed8712c5c97.asciidoc b/docs/examples/0d8063b484a18f8672fb5ed8712c5c97.asciidoc index dd88587e1..882dc89ab 100644 --- a/docs/examples/0d8063b484a18f8672fb5ed8712c5c97.asciidoc +++ b/docs/examples/0d8063b484a18f8672fb5ed8712c5c97.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template.asciidoc:296 +// indices/put-index-template.asciidoc:305 [source, python] ---- diff --git a/docs/examples/0d94d76b7f00d0459d1f8c962c144dcd.asciidoc b/docs/examples/0d94d76b7f00d0459d1f8c962c144dcd.asciidoc index 916b6c7dd..e5bbbd493 100644 --- a/docs/examples/0d94d76b7f00d0459d1f8c962c144dcd.asciidoc +++ b/docs/examples/0d94d76b7f00d0459d1f8c962c144dcd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:308 +// rest-api/security/create-role-mappings.asciidoc:314 [source, python] ---- diff --git a/docs/examples/0da747e9d98bae157d3520ff1b489ad4.asciidoc b/docs/examples/0da747e9d98bae157d3520ff1b489ad4.asciidoc index 259041fa3..95b8034eb 100644 --- a/docs/examples/0da747e9d98bae157d3520ff1b489ad4.asciidoc +++ b/docs/examples/0da747e9d98bae157d3520ff1b489ad4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/repository-s3.asciidoc:41 +// snapshot-restore/repository-s3.asciidoc:45 [source, python] ---- diff --git a/docs/examples/0dd30ffe2f900dde86cc9bb601d5e68e.asciidoc b/docs/examples/0dd30ffe2f900dde86cc9bb601d5e68e.asciidoc index bffcc9942..73b37ee80 100644 --- a/docs/examples/0dd30ffe2f900dde86cc9bb601d5e68e.asciidoc +++ b/docs/examples/0dd30ffe2f900dde86cc9bb601d5e68e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/nodes.asciidoc:378 +// cat/nodes.asciidoc:387 [source, python] ---- diff --git a/docs/examples/0ddf705317d9c5095b4a1419a2e3bace.asciidoc b/docs/examples/0ddf705317d9c5095b4a1419a2e3bace.asciidoc index 24bf20afd..9b024dea4 100644 --- a/docs/examples/0ddf705317d9c5095b4a1419a2e3bace.asciidoc +++ b/docs/examples/0ddf705317d9c5095b4a1419a2e3bace.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-app-privileges.asciidoc:95 +// rest-api/security/get-app-privileges.asciidoc:101 [source, python] ---- diff --git a/docs/examples/0dfa9733c94bc43c6f14c7b6984c98fb.asciidoc b/docs/examples/0dfa9733c94bc43c6f14c7b6984c98fb.asciidoc index 41ae4d4dd..1501cad9e 100644 --- a/docs/examples/0dfa9733c94bc43c6f14c7b6984c98fb.asciidoc +++ b/docs/examples/0dfa9733c94bc43c6f14c7b6984c98fb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/component-templates.asciidoc:107 +// cat/component-templates.asciidoc:113 [source, python] ---- diff --git a/docs/examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc b/docs/examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc index fd7eec55f..eb746abe3 100644 --- a/docs/examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc +++ b/docs/examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc @@ -1,24 +1,22 @@ // This file is autogenerated, DO NOT EDIT -// search-application/apis/search-application-render-query.asciidoc:114 +// search-application/apis/search-application-render-query.asciidoc:119 [source, python] ---- resp = client.search_application.render_query( name="my-app", - body={ - "params": { - "query_string": "my first query", - "text_fields": [ - { - "name": "title", - "boost": 5 - }, - { - "name": "description", - "boost": 1 - } - ] - } + params={ + "query_string": "my first query", + "text_fields": [ + { + "name": "title", + "boost": 5 + }, + { + "name": "description", + "boost": 1 + } + ] }, ) print(resp) diff --git a/docs/examples/0e31b8ad176b31028becf9500989bcbd.asciidoc b/docs/examples/0e31b8ad176b31028becf9500989bcbd.asciidoc new file mode 100644 index 000000000..fed70ff60 --- /dev/null +++ b/docs/examples/0e31b8ad176b31028becf9500989bcbd.asciidoc @@ -0,0 +1,21 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-watsonx-ai.asciidoc:102 + +[source, python] +---- +resp = client.inference.put( + task_type="text_embedding", + inference_id="watsonx-embeddings", + inference_config={ + "service": "watsonxai", + "service_settings": { + "api_key": "", + "url": "", + "model_id": "ibm/slate-30m-english-rtrvr", + "project_id": "", + "api_version": "2024-03-14" + } + }, +) +print(resp) +---- diff --git a/docs/examples/0e5d25c7bb738c42d471020d678e2966.asciidoc b/docs/examples/0e5d25c7bb738c42d471020d678e2966.asciidoc index 3baa81cf2..15393e78e 100644 --- a/docs/examples/0e5d25c7bb738c42d471020d678e2966.asciidoc +++ b/docs/examples/0e5d25c7bb738c42d471020d678e2966.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/start-trained-model-deployment.asciidoc:200 +// ml/trained-models/apis/start-trained-model-deployment.asciidoc:206 [source, python] ---- diff --git a/docs/examples/0e83f140237d75469a428ff403564bb5.asciidoc b/docs/examples/0e83f140237d75469a428ff403564bb5.asciidoc deleted file mode 100644 index 32d3f186a..000000000 --- a/docs/examples/0e83f140237d75469a428ff403564bb5.asciidoc +++ /dev/null @@ -1,15 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// modules/cluster/disk_allocator.asciidoc:162 - -[source, python] ----- -resp = client.cluster.put_settings( - persistent={ - "cluster.routing.allocation.disk.watermark.low": "100gb", - "cluster.routing.allocation.disk.watermark.high": "50gb", - "cluster.routing.allocation.disk.watermark.flood_stage": "10gb", - "cluster.info.update.interval": "1m" - }, -) -print(resp) ----- diff --git a/docs/examples/0ea146b178561bc8b9002bed8a35641f.asciidoc b/docs/examples/0ea146b178561bc8b9002bed8a35641f.asciidoc index ffc82f814..c038b9ec9 100644 --- a/docs/examples/0ea146b178561bc8b9002bed8a35641f.asciidoc +++ b/docs/examples/0ea146b178561bc8b9002bed8a35641f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/get-autoscaling-policy.asciidoc:68 +// autoscaling/apis/get-autoscaling-policy.asciidoc:75 [source, python] ---- diff --git a/docs/examples/0ea2167ce7c87d311b20c4f8c698a8d0.asciidoc b/docs/examples/0ea2167ce7c87d311b20c4f8c698a8d0.asciidoc index bbccc1dc4..b62b18e0c 100644 --- a/docs/examples/0ea2167ce7c87d311b20c4f8c698a8d0.asciidoc +++ b/docs/examples/0ea2167ce7c87d311b20c4f8c698a8d0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/point-in-time-api.asciidoc:190 +// search/point-in-time-api.asciidoc:196 [source, python] ---- diff --git a/docs/examples/0eae571e9e1c40a40cb4b1c9530a8987.asciidoc b/docs/examples/0eae571e9e1c40a40cb4b1c9530a8987.asciidoc index 3741e5dca..bb8bed4b5 100644 --- a/docs/examples/0eae571e9e1c40a40cb4b1c9530a8987.asciidoc +++ b/docs/examples/0eae571e9e1c40a40cb4b1c9530a8987.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/migrate-to-data-tiers.asciidoc:154 +// ilm/apis/migrate-to-data-tiers.asciidoc:160 [source, python] ---- diff --git a/docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc b/docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc index d5e443e7e..5325fc189 100644 --- a/docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc +++ b/docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/cluster/remote-clusters-migration.asciidoc:132 +// modules/cluster/remote-clusters-migration.asciidoc:133 [source, python] ---- diff --git a/docs/examples/0f028f71f04c1d569fab402869565a84.asciidoc b/docs/examples/0f028f71f04c1d569fab402869565a84.asciidoc new file mode 100644 index 000000000..295df000b --- /dev/null +++ b/docs/examples/0f028f71f04c1d569fab402869565a84.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:476 + +[source, python] +---- +resp = client.indices.put_settings( + index=".reindexed-v9-ml-anomalies-custom-example", + settings={ + "index": { + "number_of_replicas": "" + } + }, +) +print(resp) +---- diff --git a/docs/examples/0f2e5e006b663a88ee99b130ab1b4844.asciidoc b/docs/examples/0f2e5e006b663a88ee99b130ab1b4844.asciidoc index c32fb4f97..9b52aa31d 100644 --- a/docs/examples/0f2e5e006b663a88ee99b130ab1b4844.asciidoc +++ b/docs/examples/0f2e5e006b663a88ee99b130ab1b4844.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:570 +// search/search-your-data/sort-search-results.asciidoc:572 [source, python] ---- diff --git a/docs/examples/0f4583c56cfe5bd59eeb35bfba02957c.asciidoc b/docs/examples/0f4583c56cfe5bd59eeb35bfba02957c.asciidoc index b69dcbe47..aaeada4ee 100644 --- a/docs/examples/0f4583c56cfe5bd59eeb35bfba02957c.asciidoc +++ b/docs/examples/0f4583c56cfe5bd59eeb35bfba02957c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rank-eval.asciidoc:312 +// search/rank-eval.asciidoc:318 [source, python] ---- diff --git a/docs/examples/0f7aa40ad26d59a9268630b980a3d594.asciidoc b/docs/examples/0f7aa40ad26d59a9268630b980a3d594.asciidoc index 1efc4dc25..d76d2022a 100644 --- a/docs/examples/0f7aa40ad26d59a9268630b980a3d594.asciidoc +++ b/docs/examples/0f7aa40ad26d59a9268630b980a3d594.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/simulate-template.asciidoc:55 +// indices/simulate-template.asciidoc:61 [source, python] ---- diff --git a/docs/examples/0fa220ee3fb267020382f74aa70eb1e9.asciidoc b/docs/examples/0fa220ee3fb267020382f74aa70eb1e9.asciidoc index c9dab1646..4f9bbfa21 100644 --- a/docs/examples/0fa220ee3fb267020382f74aa70eb1e9.asciidoc +++ b/docs/examples/0fa220ee3fb267020382f74aa70eb1e9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/state.asciidoc:151 +// cluster/state.asciidoc:157 [source, python] ---- diff --git a/docs/examples/0fb7705ddbf1fc2b65d2de2e00fe5769.asciidoc b/docs/examples/0fb7705ddbf1fc2b65d2de2e00fe5769.asciidoc index 5021fce0e..308c9612e 100644 --- a/docs/examples/0fb7705ddbf1fc2b65d2de2e00fe5769.asciidoc +++ b/docs/examples/0fb7705ddbf1fc2b65d2de2e00fe5769.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// aggregations/metrics/scripted-metric-aggregation.asciidoc:61 +// aggregations/metrics/scripted-metric-aggregation.asciidoc:63 [source, python] ---- diff --git a/docs/examples/0fc4b589df5388da784c6d981e769e31.asciidoc b/docs/examples/0fc4b589df5388da784c6d981e769e31.asciidoc index 938f9a3ec..e499f3289 100644 --- a/docs/examples/0fc4b589df5388da784c6d981e769e31.asciidoc +++ b/docs/examples/0fc4b589df5388da784c6d981e769e31.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template-v1.asciidoc:149 +// indices/put-index-template-v1.asciidoc:155 [source, python] ---- diff --git a/docs/examples/0fe74ccd098c742619805a7c0bd0fae6.asciidoc b/docs/examples/0fe74ccd098c742619805a7c0bd0fae6.asciidoc index 1d1721228..ff294eab9 100644 --- a/docs/examples/0fe74ccd098c742619805a7c0bd0fae6.asciidoc +++ b/docs/examples/0fe74ccd098c742619805a7c0bd0fae6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/schedule-now-transform.asciidoc:52 +// transform/apis/schedule-now-transform.asciidoc:58 [source, python] ---- diff --git a/docs/examples/103296e16b4233926ad1f07360385606.asciidoc b/docs/examples/103296e16b4233926ad1f07360385606.asciidoc index 8becee40d..311b42d6c 100644 --- a/docs/examples/103296e16b4233926ad1f07360385606.asciidoc +++ b/docs/examples/103296e16b4233926ad1f07360385606.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1793 +// analysis/analyzers/lang-analyzer.asciidoc:1794 [source, python] ---- diff --git a/docs/examples/10796a4efa3c2a5e9e50b6bdeb08bbb9.asciidoc b/docs/examples/10796a4efa3c2a5e9e50b6bdeb08bbb9.asciidoc index 0b6368d46..c77e550d8 100644 --- a/docs/examples/10796a4efa3c2a5e9e50b6bdeb08bbb9.asciidoc +++ b/docs/examples/10796a4efa3c2a5e9e50b6bdeb08bbb9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/update-desired-nodes.asciidoc:74 +// cluster/update-desired-nodes.asciidoc:80 [source, python] ---- diff --git a/docs/examples/109db8ff7b715aca98de8ef1ab7e44ab.asciidoc b/docs/examples/109db8ff7b715aca98de8ef1ab7e44ab.asciidoc index 0c41f9430..433cdd913 100644 --- a/docs/examples/109db8ff7b715aca98de8ef1ab7e44ab.asciidoc +++ b/docs/examples/109db8ff7b715aca98de8ef1ab7e44ab.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/post-resume-follow.asciidoc:37 +// ccr/apis/follow/post-resume-follow.asciidoc:43 [source, python] ---- diff --git a/docs/examples/10b924bf6298aa6157ed00ce12f8edc1.asciidoc b/docs/examples/10b924bf6298aa6157ed00ce12f8edc1.asciidoc index 0d05f28bd..236094851 100644 --- a/docs/examples/10b924bf6298aa6157ed00ce12f8edc1.asciidoc +++ b/docs/examples/10b924bf6298aa6157ed00ce12f8edc1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/execute-watch.asciidoc:363 +// rest-api/watcher/execute-watch.asciidoc:369 [source, python] ---- diff --git a/docs/examples/10d9da8a3b7061479be908c8c5c76cfb.asciidoc b/docs/examples/10d9da8a3b7061479be908c8c5c76cfb.asciidoc index c1ee092f8..f0d3a5e77 100644 --- a/docs/examples/10d9da8a3b7061479be908c8c5c76cfb.asciidoc +++ b/docs/examples/10d9da8a3b7061479be908c8c5c76cfb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:217 +// rest-api/security/get-api-keys.asciidoc:223 [source, python] ---- diff --git a/docs/examples/10f7a2c0a952ba3bc3d20b7d5f310f41.asciidoc b/docs/examples/10f7a2c0a952ba3bc3d20b7d5f310f41.asciidoc index 076157426..c1bfee71f 100644 --- a/docs/examples/10f7a2c0a952ba3bc3d20b7d5f310f41.asciidoc +++ b/docs/examples/10f7a2c0a952ba3bc3d20b7d5f310f41.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search-application/apis/list-search-applications.asciidoc:94 +// search-application/apis/list-search-applications.asciidoc:99 [source, python] ---- diff --git a/docs/examples/1147a02afa087278e51fa365fb9e06b7.asciidoc b/docs/examples/1147a02afa087278e51fa365fb9e06b7.asciidoc index 6f2b83e31..6b9ea7a99 100644 --- a/docs/examples/1147a02afa087278e51fa365fb9e06b7.asciidoc +++ b/docs/examples/1147a02afa087278e51fa365fb9e06b7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// api-conventions.asciidoc:345 +// api-conventions.asciidoc:355 [source, python] ---- diff --git a/docs/examples/114d470e752efa9672ca68d7290fada8.asciidoc b/docs/examples/114d470e752efa9672ca68d7290fada8.asciidoc index 5c3bcaac2..c37479ac3 100644 --- a/docs/examples/114d470e752efa9672ca68d7290fada8.asciidoc +++ b/docs/examples/114d470e752efa9672ca68d7290fada8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/add-alias.asciidoc:10 +// indices/add-alias.asciidoc:16 [source, python] ---- diff --git a/docs/examples/115529722ba30b0b0d51a7ff87e59198.asciidoc b/docs/examples/115529722ba30b0b0d51a7ff87e59198.asciidoc index f80eab225..b0e58c04f 100644 --- a/docs/examples/115529722ba30b0b0d51a7ff87e59198.asciidoc +++ b/docs/examples/115529722ba30b0b0d51a7ff87e59198.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-roles.asciidoc:58 +// rest-api/security/get-roles.asciidoc:64 [source, python] ---- diff --git a/docs/examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc b/docs/examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc new file mode 100644 index 000000000..409af45c2 --- /dev/null +++ b/docs/examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:437 + +[source, python] +---- +resp = client.perform_request( + "GET", + "/_connector/_sync_job", + params={ + "connector_id": "my-connector-id", + "size": "1" + }, +) +print(resp) +---- diff --git a/docs/examples/11c395d1649733bcab853fe31ec393b2.asciidoc b/docs/examples/11c395d1649733bcab853fe31ec393b2.asciidoc index 0d33f1a71..e1b7fe6cf 100644 --- a/docs/examples/11c395d1649733bcab853fe31ec393b2.asciidoc +++ b/docs/examples/11c395d1649733bcab853fe31ec393b2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// licensing/get-license.asciidoc:56 +// licensing/get-license.asciidoc:62 [source, python] ---- diff --git a/docs/examples/11e772ff5dbb73408ae30a1a367a0d9b.asciidoc b/docs/examples/11e772ff5dbb73408ae30a1a367a0d9b.asciidoc index a3009b49d..3bea63ae5 100644 --- a/docs/examples/11e772ff5dbb73408ae30a1a367a0d9b.asciidoc +++ b/docs/examples/11e772ff5dbb73408ae30a1a367a0d9b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/delete-pipeline.asciidoc:91 +// ingest/apis/delete-pipeline.asciidoc:97 [source, python] ---- diff --git a/docs/examples/11e8d6e14686efabb8634b6522c05cb5.asciidoc b/docs/examples/11e8d6e14686efabb8634b6522c05cb5.asciidoc index 9e854328d..88bee88b3 100644 --- a/docs/examples/11e8d6e14686efabb8634b6522c05cb5.asciidoc +++ b/docs/examples/11e8d6e14686efabb8634b6522c05cb5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:455 +// search/search-your-data/highlighting.asciidoc:467 [source, python] ---- diff --git a/docs/examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc b/docs/examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc new file mode 100644 index 000000000..dd2c9dc6b --- /dev/null +++ b/docs/examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// inference/chat-completion-inference.asciidoc:305 + +[source, python] +---- +resp = client.inference.stream_inference( + task_type="chat_completion", + inference_id="openai-completion", + model="gpt-4o", + messages=[ + { + "role": "user", + "content": "What is Elastic?" + } + ], +) +print(resp) +---- diff --git a/docs/examples/12433d2b637d002e8d5c9a1adce69d3b.asciidoc b/docs/examples/12433d2b637d002e8d5c9a1adce69d3b.asciidoc index 210b477f5..3d588dde2 100644 --- a/docs/examples/12433d2b637d002e8d5c9a1adce69d3b.asciidoc +++ b/docs/examples/12433d2b637d002e8d5c9a1adce69d3b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:100 +// indices/put-mapping.asciidoc:106 [source, python] ---- diff --git a/docs/examples/1259a9c151730e42de35bb2d1ba700c6.asciidoc b/docs/examples/1259a9c151730e42de35bb2d1ba700c6.asciidoc index b9f36704e..71588e2ce 100644 --- a/docs/examples/1259a9c151730e42de35bb2d1ba700c6.asciidoc +++ b/docs/examples/1259a9c151730e42de35bb2d1ba700c6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-mapping.asciidoc:70 +// indices/get-mapping.asciidoc:76 [source, python] ---- diff --git a/docs/examples/128283698535116931dca9d16a16dca2.asciidoc b/docs/examples/128283698535116931dca9d16a16dca2.asciidoc index 70028cd42..905f74f10 100644 --- a/docs/examples/128283698535116931dca9d16a16dca2.asciidoc +++ b/docs/examples/128283698535116931dca9d16a16dca2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-roles.asciidoc:93 +// rest-api/security/get-roles.asciidoc:99 [source, python] ---- diff --git a/docs/examples/1295f51b9e5d4ba9987b02478146b50b.asciidoc b/docs/examples/1295f51b9e5d4ba9987b02478146b50b.asciidoc index 8f63108f6..7c4537814 100644 --- a/docs/examples/1295f51b9e5d4ba9987b02478146b50b.asciidoc +++ b/docs/examples/1295f51b9e5d4ba9987b02478146b50b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/high-jvm-memory-pressure.asciidoc:70 +// troubleshooting/common-issues/high-jvm-memory-pressure.asciidoc:76 [source, python] ---- diff --git a/docs/examples/12adea5d76f73d94d80d42f53f67563f.asciidoc b/docs/examples/12adea5d76f73d94d80d42f53f67563f.asciidoc new file mode 100644 index 000000000..18270ad1c --- /dev/null +++ b/docs/examples/12adea5d76f73d94d80d42f53f67563f.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:393 + +[source, python] +---- +resp = client.indices.add_block( + index=".ml-anomalies-custom-example", + block="read_only", +) +print(resp) +---- diff --git a/docs/examples/12d5ff4b8d3d832b32a7e7e2a520d0bb.asciidoc b/docs/examples/12d5ff4b8d3d832b32a7e7e2a520d0bb.asciidoc index 8b8fe870b..dd56d383e 100644 --- a/docs/examples/12d5ff4b8d3d832b32a7e7e2a520d0bb.asciidoc +++ b/docs/examples/12d5ff4b8d3d832b32a7e7e2a520d0bb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-calendar-event.asciidoc:156 +// ml/anomaly-detection/apis/get-calendar-event.asciidoc:162 [source, python] ---- diff --git a/docs/examples/12e9e758f7f18a6cbf27e9d0aea57a19.asciidoc b/docs/examples/12e9e758f7f18a6cbf27e9d0aea57a19.asciidoc new file mode 100644 index 000000000..19be5e48e --- /dev/null +++ b/docs/examples/12e9e758f7f18a6cbf27e9d0aea57a19.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-managed-service.asciidoc:167 + +[source, python] +---- +resp = client.update( + index=".elastic-connectors", + id="connector_id", + doc={ + "features": { + "native_connector_api_keys": { + "enabled": True + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/135819da3a4bde684357c57a49ad8e85.asciidoc b/docs/examples/135819da3a4bde684357c57a49ad8e85.asciidoc index 90a789649..dae5a72e5 100644 --- a/docs/examples/135819da3a4bde684357c57a49ad8e85.asciidoc +++ b/docs/examples/135819da3a4bde684357c57a49ad8e85.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// migration/apis/deprecation.asciidoc:61 +// migration/apis/deprecation.asciidoc:67 [source, python] ---- diff --git a/docs/examples/136ae86b8d497dda799cf1cb583df929.asciidoc b/docs/examples/136ae86b8d497dda799cf1cb583df929.asciidoc index fbcdd4845..b49a8add3 100644 --- a/docs/examples/136ae86b8d497dda799cf1cb583df929.asciidoc +++ b/docs/examples/136ae86b8d497dda799cf1cb583df929.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-field-mapping.asciidoc:74 +// indices/get-field-mapping.asciidoc:80 [source, python] ---- diff --git a/docs/examples/137709a0a0dc38d6094291c9fc75b804.asciidoc b/docs/examples/137709a0a0dc38d6094291c9fc75b804.asciidoc index 3219eef08..9efbb0b9b 100644 --- a/docs/examples/137709a0a0dc38d6094291c9fc75b804.asciidoc +++ b/docs/examples/137709a0a0dc38d6094291c9fc75b804.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:342 +// docs/get.asciidoc:348 [source, python] ---- diff --git a/docs/examples/138f7703c47ddf63633fdf5ca9bc7fa4.asciidoc b/docs/examples/138f7703c47ddf63633fdf5ca9bc7fa4.asciidoc index 7790b2fca..7c7526192 100644 --- a/docs/examples/138f7703c47ddf63633fdf5ca9bc7fa4.asciidoc +++ b/docs/examples/138f7703c47ddf63633fdf5ca9bc7fa4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:385 +// docs/get.asciidoc:391 [source, python] ---- diff --git a/docs/examples/13d90ba227131aefbf4fcfd5992e662a.asciidoc b/docs/examples/13d90ba227131aefbf4fcfd5992e662a.asciidoc index 4a7ac32aa..fc457fe4e 100644 --- a/docs/examples/13d90ba227131aefbf4fcfd5992e662a.asciidoc +++ b/docs/examples/13d90ba227131aefbf4fcfd5992e662a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/bool-query.asciidoc:156 +// query-dsl/bool-query.asciidoc:159 [source, python] ---- diff --git a/docs/examples/13d91782399ba1f291e103c18b5338cc.asciidoc b/docs/examples/13d91782399ba1f291e103c18b5338cc.asciidoc new file mode 100644 index 000000000..248cdff9a --- /dev/null +++ b/docs/examples/13d91782399ba1f291e103c18b5338cc.asciidoc @@ -0,0 +1,25 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/create-index-from-source.asciidoc:94 + +[source, python] +---- +resp = client.indices.create_from( + source="my-index", + dest="my-new-index", + create_from={ + "settings_override": { + "index": { + "number_of_shards": 5 + } + }, + "mappings_override": { + "properties": { + "field2": { + "type": "boolean" + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/13df08eefc9ba98e311793bbca74133b.asciidoc b/docs/examples/13df08eefc9ba98e311793bbca74133b.asciidoc index 4a3854b00..352868b73 100644 --- a/docs/examples/13df08eefc9ba98e311793bbca74133b.asciidoc +++ b/docs/examples/13df08eefc9ba98e311793bbca74133b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-user-profile.asciidoc:109 +// rest-api/security/get-user-profile.asciidoc:115 [source, python] ---- diff --git a/docs/examples/13ebcb01ebf1b5d2b5c52739db47e30c.asciidoc b/docs/examples/13ebcb01ebf1b5d2b5c52739db47e30c.asciidoc index 29086570d..c2870a215 100644 --- a/docs/examples/13ebcb01ebf1b5d2b5c52739db47e30c.asciidoc +++ b/docs/examples/13ebcb01ebf1b5d2b5c52739db47e30c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/recovery.asciidoc:179 +// indices/recovery.asciidoc:185 [source, python] ---- diff --git a/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc b/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc index fa54e865d..442cbc631 100644 --- a/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc +++ b/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/post-inference.asciidoc:201 +// inference/post-inference.asciidoc:202 [source, python] ---- diff --git a/docs/examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc b/docs/examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc new file mode 100644 index 000000000..c6cd62c44 --- /dev/null +++ b/docs/examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// inference/update-inference.asciidoc:83 + +[source, python] +---- +resp = client.inference.update( + inference_id="my-inference-endpoint", + inference_config={ + "service_settings": { + "api_key": "" + } + }, +) +print(resp) +---- diff --git a/docs/examples/1420a22aa817c7a996baaed0ad366d6f.asciidoc b/docs/examples/1420a22aa817c7a996baaed0ad366d6f.asciidoc deleted file mode 100644 index e6437237a..000000000 --- a/docs/examples/1420a22aa817c7a996baaed0ad366d6f.asciidoc +++ /dev/null @@ -1,22 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// query-dsl/semantic-query.asciidoc:143 - -[source, python] ----- -resp = client.search( - index="test-index", - query={ - "nested": { - "path": "inference_field.inference.chunks", - "query": { - "sparse_vector": { - "field": "inference_field.inference.chunks.embeddings", - "inference_id": "my-inference-id", - "query": "mountain lake" - } - } - } - }, -) -print(resp) ----- diff --git a/docs/examples/146bd22fd0e7be2345619e8f11d3a4cb.asciidoc b/docs/examples/146bd22fd0e7be2345619e8f11d3a4cb.asciidoc index e1ecfa48c..9ad89f39c 100644 --- a/docs/examples/146bd22fd0e7be2345619e8f11d3a4cb.asciidoc +++ b/docs/examples/146bd22fd0e7be2345619e8f11d3a4cb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/hotspotting.asciidoc:247 +// troubleshooting/common-issues/hotspotting.asciidoc:253 [source, python] ---- diff --git a/docs/examples/147d341cb212dcc015c129a9c5dcf9c9.asciidoc b/docs/examples/147d341cb212dcc015c129a9c5dcf9c9.asciidoc index b4f01a0ca..832d1d5d8 100644 --- a/docs/examples/147d341cb212dcc015c129a9c5dcf9c9.asciidoc +++ b/docs/examples/147d341cb212dcc015c129a9c5dcf9c9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/put-trained-models-aliases.asciidoc:82 +// ml/trained-models/apis/put-trained-models-aliases.asciidoc:87 [source, python] ---- diff --git a/docs/examples/14a33c364873c2f930ca83d0a3005389.asciidoc b/docs/examples/14a33c364873c2f930ca83d0a3005389.asciidoc index a609fa01a..140091a2a 100644 --- a/docs/examples/14a33c364873c2f930ca83d0a3005389.asciidoc +++ b/docs/examples/14a33c364873c2f930ca83d0a3005389.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:42 +// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:46 [source, python] ---- diff --git a/docs/examples/14b81f96297952970b78a3216e059596.asciidoc b/docs/examples/14b81f96297952970b78a3216e059596.asciidoc index 11c9b50c0..fbcc88b3c 100644 --- a/docs/examples/14b81f96297952970b78a3216e059596.asciidoc +++ b/docs/examples/14b81f96297952970b78a3216e059596.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/async-search.asciidoc:153 +// search/async-search.asciidoc:159 [source, python] ---- diff --git a/docs/examples/150b5fee5678bf8cdf0932da73eada80.asciidoc b/docs/examples/150b5fee5678bf8cdf0932da73eada80.asciidoc index fb07636cc..034357a7b 100644 --- a/docs/examples/150b5fee5678bf8cdf0932da73eada80.asciidoc +++ b/docs/examples/150b5fee5678bf8cdf0932da73eada80.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-stats.asciidoc:2546 +// cluster/nodes-stats.asciidoc:2556 [source, python] ---- diff --git a/docs/examples/1522a9297151d7046e6345b9b27539ca.asciidoc b/docs/examples/1522a9297151d7046e6345b9b27539ca.asciidoc new file mode 100644 index 000000000..1b3b7fee7 --- /dev/null +++ b/docs/examples/1522a9297151d7046e6345b9b27539ca.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:340 + +[source, python] +---- +resp = client.connector.update_configuration( + connector_id="my-connector-id", + values={ + "host": "127.0.0.1", + "port": 5432, + "username": "myuser", + "password": "mypassword", + "database": "chinook", + "schema": "public", + "tables": "album,artist" + }, +) +print(resp) +---- diff --git a/docs/examples/1570976f7807b88dc8a046b833be057b.asciidoc b/docs/examples/1570976f7807b88dc8a046b833be057b.asciidoc index b5ec59379..fe84afc8a 100644 --- a/docs/examples/1570976f7807b88dc8a046b833be057b.asciidoc +++ b/docs/examples/1570976f7807b88dc8a046b833be057b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/hotspotting.asciidoc:28 +// troubleshooting/common-issues/hotspotting.asciidoc:34 [source, python] ---- diff --git a/docs/examples/15a34bfe0ef8ef6333c8c7b55c011e5d.asciidoc b/docs/examples/15a34bfe0ef8ef6333c8c7b55c011e5d.asciidoc index d6f040464..f5aa74945 100644 --- a/docs/examples/15a34bfe0ef8ef6333c8c7b55c011e5d.asciidoc +++ b/docs/examples/15a34bfe0ef8ef6333c8c7b55c011e5d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:269 +// indices/analyze.asciidoc:275 [source, python] ---- diff --git a/docs/examples/15ac33d641b376d9494075eb1f0d4066.asciidoc b/docs/examples/15ac33d641b376d9494075eb1f0d4066.asciidoc new file mode 100644 index 000000000..b6c8f58d1 --- /dev/null +++ b/docs/examples/15ac33d641b376d9494075eb1f0d4066.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/data-stream-reindex.asciidoc:224 + +[source, python] +---- +resp = client.indices.cancel_migrate_reindex( + index="my-data-stream", +) +print(resp) +---- diff --git a/docs/examples/15f769bbd7b5fddeb3353ae726b71b14.asciidoc b/docs/examples/15f769bbd7b5fddeb3353ae726b71b14.asciidoc new file mode 100644 index 000000000..998ee76a1 --- /dev/null +++ b/docs/examples/15f769bbd7b5fddeb3353ae726b71b14.asciidoc @@ -0,0 +1,64 @@ +// This file is autogenerated, DO NOT EDIT +// vectors/vector-functions.asciidoc:405 + +[source, python] +---- +resp = client.search( + index="my-index-bit-vectors", + query={ + "script_score": { + "query": { + "match_all": {} + }, + "script": { + "source": "dotProduct(params.query_vector, 'my_dense_vector')", + "params": { + "query_vector": [ + 0.23, + 1.45, + 3.67, + 4.89, + -0.56, + 2.34, + 3.21, + 1.78, + -2.45, + 0.98, + -0.12, + 3.45, + 4.56, + 2.78, + 1.23, + 0.67, + 3.89, + 4.12, + -2.34, + 1.56, + 0.78, + 3.21, + 4.12, + 2.45, + -1.67, + 0.34, + -3.45, + 4.56, + -2.78, + 1.23, + -0.67, + 3.89, + -4.34, + 2.12, + -1.56, + 0.78, + -3.21, + 4.45, + 2.12, + 1.67 + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/162b5b693b713f0bfab1209d59443c46.asciidoc b/docs/examples/162b5b693b713f0bfab1209d59443c46.asciidoc index 2f6bf0c47..044c538d9 100644 --- a/docs/examples/162b5b693b713f0bfab1209d59443c46.asciidoc +++ b/docs/examples/162b5b693b713f0bfab1209d59443c46.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/bool-query.asciidoc:130 +// query-dsl/bool-query.asciidoc:133 [source, python] ---- diff --git a/docs/examples/1637ef51d673b35cc8894ee80cd61c87.asciidoc b/docs/examples/1637ef51d673b35cc8894ee80cd61c87.asciidoc index cb4a24a1a..b56c30f38 100644 --- a/docs/examples/1637ef51d673b35cc8894ee80cd61c87.asciidoc +++ b/docs/examples/1637ef51d673b35cc8894ee80cd61c87.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/cpu-usage.asciidoc:14 +// troubleshooting/common-issues/high-cpu-usage.asciidoc:28 [source, python] ---- diff --git a/docs/examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc b/docs/examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc index 4cd3c344a..52b0a6e97 100644 --- a/docs/examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc +++ b/docs/examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc @@ -12,7 +12,7 @@ resp = client.search_application.put( "template": { "script": { "lang": "mustache", - "source": "\n {\n \"query\": {\n \"bool\": {\n \"must\": [\n {{#query}}\n \n {{/query}}\n ],\n \"filter\": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n \"_source\": {\n \"includes\": [\"title\", \"plot\"]\n },\n \"highlight\": {\n \"fields\": {\n \"title\": { \"fragment_size\": 0 },\n \"plot\": { \"fragment_size\": 200 }\n }\n },\n \"aggs\": {{#toJson}}_es_aggs{{/toJson}},\n \"from\": {{from}},\n \"size\": {{size}},\n \"sort\": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ", + "source": "\n {\n \"query\": {\n \"bool\": {\n \"must\": [\n {{#query}}\n {{/query}}\n ],\n \"filter\": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n \"_source\": {\n \"includes\": [\"title\", \"plot\"]\n },\n \"highlight\": {\n \"fields\": {\n \"title\": { \"fragment_size\": 0 },\n \"plot\": { \"fragment_size\": 200 }\n }\n },\n \"aggs\": {{#toJson}}_es_aggs{{/toJson}},\n \"from\": {{from}},\n \"size\": {{size}},\n \"sort\": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ", "params": { "query": "", "_es_filters": {}, diff --git a/docs/examples/166bcfc6d5d39defec7ad6aa44d0914b.asciidoc b/docs/examples/166bcfc6d5d39defec7ad6aa44d0914b.asciidoc index e6e17b4a9..b0fb68c8f 100644 --- a/docs/examples/166bcfc6d5d39defec7ad6aa44d0914b.asciidoc +++ b/docs/examples/166bcfc6d5d39defec7ad6aa44d0914b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:74 +// cluster/tasks.asciidoc:80 [source, python] ---- diff --git a/docs/examples/16985e5b17d2da0955a14fbe02e8dfca.asciidoc b/docs/examples/16985e5b17d2da0955a14fbe02e8dfca.asciidoc index 896661d47..e4a014c33 100644 --- a/docs/examples/16985e5b17d2da0955a14fbe02e8dfca.asciidoc +++ b/docs/examples/16985e5b17d2da0955a14fbe02e8dfca.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:237 +// docs/termvectors.asciidoc:243 [source, python] ---- diff --git a/docs/examples/16a7ce08b4a6b3af269f27eecc71d664.asciidoc b/docs/examples/16a7ce08b4a6b3af269f27eecc71d664.asciidoc new file mode 100644 index 000000000..1e35ec0d9 --- /dev/null +++ b/docs/examples/16a7ce08b4a6b3af269f27eecc71d664.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/getting-started.asciidoc:546 + +[source, python] +---- +resp = client.indices.delete( + index="books", +) +print(resp) + +resp1 = client.indices.delete( + index="my-explicit-mappings-books", +) +print(resp1) +---- diff --git a/docs/examples/172155ca4bf6dfcbd489453f50739396.asciidoc b/docs/examples/172155ca4bf6dfcbd489453f50739396.asciidoc index dcf168990..872e66960 100644 --- a/docs/examples/172155ca4bf6dfcbd489453f50739396.asciidoc +++ b/docs/examples/172155ca4bf6dfcbd489453f50739396.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-api.asciidoc:402 +// snapshot-restore/apis/get-snapshot-api.asciidoc:408 [source, python] ---- diff --git a/docs/examples/17266cee5eaaddf08e5534bf580a1910.asciidoc b/docs/examples/17266cee5eaaddf08e5534bf580a1910.asciidoc index 3cc4afa13..595478934 100644 --- a/docs/examples/17266cee5eaaddf08e5534bf580a1910.asciidoc +++ b/docs/examples/17266cee5eaaddf08e5534bf580a1910.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/stats.asciidoc:84 +// rest-api/watcher/stats.asciidoc:90 [source, python] ---- diff --git a/docs/examples/17316a81c9dbdd120b7754116bf0461c.asciidoc b/docs/examples/17316a81c9dbdd120b7754116bf0461c.asciidoc new file mode 100644 index 000000000..cd2b37009 --- /dev/null +++ b/docs/examples/17316a81c9dbdd120b7754116bf0461c.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/_connectors-create-native-api-key.asciidoc:12 + +[source, python] +---- +resp = client.security.create_api_key( + name="my-connector-api-key", + role_descriptors={ + "my-connector-connector-role": { + "cluster": [ + "monitor", + "manage_connector" + ], + "indices": [ + { + "names": [ + "my-index_name", + ".search-acl-filter-my-index_name", + ".elastic-connectors*" + ], + "privileges": [ + "all" + ], + "allow_restricted_indices": False + } + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/1745ac9e6d22a2ffe7ac381f9ba238f9.asciidoc b/docs/examples/1745ac9e6d22a2ffe7ac381f9ba238f9.asciidoc deleted file mode 100644 index 3b131eced..000000000 --- a/docs/examples/1745ac9e6d22a2ffe7ac381f9ba238f9.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/high-cpu-usage.asciidoc:26 - -[source, python] ----- -resp = client.nodes.hot_threads( - node_id="my-node,my-other-node", -) -print(resp) ----- diff --git a/docs/examples/174b93c323aa8e9cc8ee2a3df5736810.asciidoc b/docs/examples/174b93c323aa8e9cc8ee2a3df5736810.asciidoc new file mode 100644 index 000000000..db5b5eda0 --- /dev/null +++ b/docs/examples/174b93c323aa8e9cc8ee2a3df5736810.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// rest-api/security/delegate-pki-authentication.asciidoc:83 + +[source, python] +---- +resp = client.security.delegate_pki( + x509_certificate_chain=[ + "MIIDeDCCAmCgAwIBAgIUBzj/nGGKxP2iXawsSquHmQjCJmMwDQYJKoZIhvcNAQELBQAwUzErMCkGA1UEAxMiRWxhc3RpY3NlYXJjaCBUZXN0IEludGVybWVkaWF0ZSBDQTEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMB4XDTIzMDcxODE5MjkwNloXDTQzMDcxMzE5MjkwNlowSjEiMCAGA1UEAxMZRWxhc3RpY3NlYXJjaCBUZXN0IENsaWVudDEWMBQGA1UECxMNRWxhc3RpY3NlYXJjaDEMMAoGA1UEChMDb3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAllHL4pQkkfwAm/oLkxYYO+r950DEy1bjH+4viCHzNADLCTWO+lOZJVlNx7QEzJE3QGMdif9CCBBxQFMapA7oUFCLq84fPSQQu5AnvvbltVD9nwVtCs+9ZGDjMKsz98RhSLMFIkxdxi6HkQ3Lfa4ZSI4lvba4oo+T/GveazBDS+NgmKyq00EOXt3tWi1G9vEVItommzXWfv0agJWzVnLMldwkPqsw0W7zrpyT7FZS4iLbQADGceOW8fiauOGMkscu9zAnDR/SbWl/chYioQOdw6ndFLn1YIFPd37xL0WsdsldTpn0vH3YfzgLMffT/3P6YlwBegWzsx6FnM/93Ecb4wIDAQABo00wSzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQKNRwjW+Ad/FN1Rpoqme/5+jrFWzAfBgNVHSMEGDAWgBRcya0c0x/PaI7MbmJVIylWgLqXNjANBgkqhkiG9w0BAQsFAAOCAQEACZ3PF7Uqu47lplXHP6YlzYL2jL0D28hpj5lGtdha4Muw1m/BjDb0Pu8l0NQ1z3AP6AVcvjNDkQq6Y5jeSz0bwQlealQpYfo7EMXjOidrft1GbqOMFmTBLpLA9SvwYGobSTXWTkJzonqVaTcf80HpMgM2uEhodwTcvz6v1WEfeT/HMjmdIsq4ImrOL9RNrcZG6nWfw0HR3JNOgrbfyEztEI471jHznZ336OEcyX7gQuvHE8tOv5+oD1d7s3Xg1yuFp+Ynh+FfOi3hPCuaHA+7F6fLmzMDLVUBAllugst1C3U+L/paD7tqIa4ka+KNPCbSfwazmJrt4XNiivPR4hwH5g==" + ], +) +print(resp) +---- diff --git a/docs/examples/17566e23c191f1004a2719f2c4242307.asciidoc b/docs/examples/17566e23c191f1004a2719f2c4242307.asciidoc index 0c0a031e1..28428b6a7 100644 --- a/docs/examples/17566e23c191f1004a2719f2c4242307.asciidoc +++ b/docs/examples/17566e23c191f1004a2719f2c4242307.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/get-autoscaling-capacity.asciidoc:262 +// autoscaling/apis/get-autoscaling-capacity.asciidoc:268 [source, python] ---- diff --git a/docs/examples/178c920d5e8ec0071f77290fa059802c.asciidoc b/docs/examples/178c920d5e8ec0071f77290fa059802c.asciidoc index b95beb841..4f7a123ae 100644 --- a/docs/examples/178c920d5e8ec0071f77290fa059802c.asciidoc +++ b/docs/examples/178c920d5e8ec0071f77290fa059802c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/update-settings.asciidoc:132 +// indices/update-settings.asciidoc:138 [source, python] ---- diff --git a/docs/examples/17a1e308761afd3282f13d44d7be008a.asciidoc b/docs/examples/17a1e308761afd3282f13d44d7be008a.asciidoc index ee6770cd1..4fcdf8ed5 100644 --- a/docs/examples/17a1e308761afd3282f13d44d7be008a.asciidoc +++ b/docs/examples/17a1e308761afd3282f13d44d7be008a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:687 +// search/search-your-data/highlighting.asciidoc:699 [source, python] ---- diff --git a/docs/examples/c02c2916b97b6fa7db82dbc7f0378310.asciidoc b/docs/examples/17b1647c8509543f2388c886f2584a20.asciidoc similarity index 82% rename from docs/examples/c02c2916b97b6fa7db82dbc7f0378310.asciidoc rename to docs/examples/17b1647c8509543f2388c886f2584a20.asciidoc index bf854843c..bd99a92db 100644 --- a/docs/examples/c02c2916b97b6fa7db82dbc7f0378310.asciidoc +++ b/docs/examples/17b1647c8509543f2388c886f2584a20.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/retrievers-reranking/semantic-reranking.asciidoc:109 +// reranking/semantic-reranking.asciidoc:107 [source, python] ---- @@ -16,7 +16,7 @@ resp = client.search( } }, "field": "text", - "inference_id": "my-cohere-rerank-model", + "inference_id": "elastic-rerank", "inference_text": "How often does the moon hide the sun?", "rank_window_size": 100, "min_score": 0.5 diff --git a/docs/examples/17c2b0a6b0305804ff3b7fd3b4a68df3.asciidoc b/docs/examples/17c2b0a6b0305804ff3b7fd3b4a68df3.asciidoc index 06dbd0899..94f19586c 100644 --- a/docs/examples/17c2b0a6b0305804ff3b7fd3b4a68df3.asciidoc +++ b/docs/examples/17c2b0a6b0305804ff3b7fd3b4a68df3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/simulate-pipeline.asciidoc:217 +// ingest/apis/simulate-pipeline.asciidoc:223 [source, python] ---- diff --git a/docs/examples/182df084f028479ecbe8d7648ddad892.asciidoc b/docs/examples/182df084f028479ecbe8d7648ddad892.asciidoc index 7a7bde5c4..d6f5ea695 100644 --- a/docs/examples/182df084f028479ecbe8d7648ddad892.asciidoc +++ b/docs/examples/182df084f028479ecbe8d7648ddad892.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/get-status.asciidoc:60 +// tab-widgets/troubleshooting/data/start-ilm.asciidoc:84 [source, python] ---- diff --git a/docs/examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc b/docs/examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc index 34fce2eb6..b64153dde 100644 --- a/docs/examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc +++ b/docs/examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:546 +// docs/update-by-query.asciidoc:552 [source, python] ---- diff --git a/docs/examples/18de6782bd18f4a9baec2feec8c02a8b.asciidoc b/docs/examples/18de6782bd18f4a9baec2feec8c02a8b.asciidoc deleted file mode 100644 index 999873e69..000000000 --- a/docs/examples/18de6782bd18f4a9baec2feec8c02a8b.asciidoc +++ /dev/null @@ -1,18 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// migration/migrate_8_0/migrate_to_java_time.asciidoc:268 - -[source, python] ----- -resp = client.indices.create( - index="my-index-000002", - mappings={ - "properties": { - "datetime": { - "type": "date", - "format": "uuuu/MM/dd HH:mm:ss||uuuu/MM/dd||epoch_millis" - } - } - }, -) -print(resp) ----- diff --git a/docs/examples/190a21e32db2125ddaea0f634e126a84.asciidoc b/docs/examples/190a21e32db2125ddaea0f634e126a84.asciidoc index be5b2b5c9..97747b9ec 100644 --- a/docs/examples/190a21e32db2125ddaea0f634e126a84.asciidoc +++ b/docs/examples/190a21e32db2125ddaea0f634e126a84.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/clone-index.asciidoc:91 +// indices/clone-index.asciidoc:97 [source, python] ---- diff --git a/docs/examples/192fa1f6f51dfb640e9e15bb5cd7eebc.asciidoc b/docs/examples/192fa1f6f51dfb640e9e15bb5cd7eebc.asciidoc index e33ee65ec..e53c1cce6 100644 --- a/docs/examples/192fa1f6f51dfb640e9e15bb5cd7eebc.asciidoc +++ b/docs/examples/192fa1f6f51dfb640e9e15bb5cd7eebc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/error-handling.asciidoc:144 +// ilm/error-handling.asciidoc:148 [source, python] ---- diff --git a/docs/examples/193704020a19714dec390452a4e75e8d.asciidoc b/docs/examples/193704020a19714dec390452a4e75e8d.asciidoc new file mode 100644 index 000000000..dc757c835 --- /dev/null +++ b/docs/examples/193704020a19714dec390452a4e75e8d.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/getting-started.asciidoc:54 + +[source, python] +---- +resp = client.indices.create( + index="books", +) +print(resp) +---- diff --git a/docs/examples/194bbac15e709174ac85b681f3a3d137.asciidoc b/docs/examples/194bbac15e709174ac85b681f3a3d137.asciidoc index e1a1a265e..6c8c37a22 100644 --- a/docs/examples/194bbac15e709174ac85b681f3a3d137.asciidoc +++ b/docs/examples/194bbac15e709174ac85b681f3a3d137.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template.asciidoc:186 +// indices/put-index-template.asciidoc:195 [source, python] ---- diff --git a/docs/examples/196aed02b11def364bab84e455c1a073.asciidoc b/docs/examples/196aed02b11def364bab84e455c1a073.asciidoc index 4b37db9ca..bdc7e4d76 100644 --- a/docs/examples/196aed02b11def364bab84e455c1a073.asciidoc +++ b/docs/examples/196aed02b11def364bab84e455c1a073.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template.asciidoc:324 +// indices/put-index-template.asciidoc:333 [source, python] ---- diff --git a/docs/examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc b/docs/examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc index b41aa69e7..0789a399a 100644 --- a/docs/examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc +++ b/docs/examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc @@ -1,27 +1,25 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/simulate-ingest.asciidoc:205 +// ingest/apis/simulate-ingest.asciidoc:279 [source, python] ---- resp = client.simulate.ingest( - body={ - "docs": [ - { - "_index": "my-index", - "_id": "123", - "_source": { - "foo": "bar" - } - }, - { - "_index": "my-index", - "_id": "456", - "_source": { - "foo": "rab" - } + docs=[ + { + "_index": "my-index", + "_id": "123", + "_source": { + "foo": "bar" } - ] - }, + }, + { + "_index": "my-index", + "_id": "456", + "_source": { + "foo": "rab" + } + } + ], ) print(resp) ---- diff --git a/docs/examples/19d60e4890cc57151d596326484d9076.asciidoc b/docs/examples/19d60e4890cc57151d596326484d9076.asciidoc deleted file mode 100644 index 62e24dbbd..000000000 --- a/docs/examples/19d60e4890cc57151d596326484d9076.asciidoc +++ /dev/null @@ -1,11 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// ingest/apis/delete-geoip-database.asciidoc:10 - -[source, python] ----- -resp = client.perform_request( - "DELETE", - "/_ingest/geoip/database/my-database-id", -) -print(resp) ----- diff --git a/docs/examples/1a1f3421717ff744ed83232729289bb0.asciidoc b/docs/examples/1a1f3421717ff744ed83232729289bb0.asciidoc index 03648bd41..09e201a7b 100644 --- a/docs/examples/1a1f3421717ff744ed83232729289bb0.asciidoc +++ b/docs/examples/1a1f3421717ff744ed83232729289bb0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-delete.asciidoc:65 +// slm/apis/slm-delete.asciidoc:71 [source, python] ---- diff --git a/docs/examples/1a3897cfb4f974c09d0d847baac8aa6d.asciidoc b/docs/examples/1a3897cfb4f974c09d0d847baac8aa6d.asciidoc index 8fdcf6d8a..d122e4ea3 100644 --- a/docs/examples/1a3897cfb4f974c09d0d847baac8aa6d.asciidoc +++ b/docs/examples/1a3897cfb4f974c09d0d847baac8aa6d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/hotspotting.asciidoc:190 +// troubleshooting/common-issues/hotspotting.asciidoc:196 [source, python] ---- diff --git a/docs/examples/1a3a4b8a4bfee4ab84ddd13d8835f560.asciidoc b/docs/examples/1a3a4b8a4bfee4ab84ddd13d8835f560.asciidoc index 94c618bb8..1c3d79093 100644 --- a/docs/examples/1a3a4b8a4bfee4ab84ddd13d8835f560.asciidoc +++ b/docs/examples/1a3a4b8a4bfee4ab84ddd13d8835f560.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/start-dfanalytics.asciidoc:82 +// ml/df-analytics/apis/start-dfanalytics.asciidoc:88 [source, python] ---- diff --git a/docs/examples/1a56df055b94466ca76818e0858752c6.asciidoc b/docs/examples/1a56df055b94466ca76818e0858752c6.asciidoc index e45764af1..d861ad7b6 100644 --- a/docs/examples/1a56df055b94466ca76818e0858752c6.asciidoc +++ b/docs/examples/1a56df055b94466ca76818e0858752c6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/inference-api/infer-api-task.asciidoc:89 +// tab-widgets/inference-api/infer-api-task.asciidoc:97 [source, python] ---- diff --git a/docs/examples/1a7483796087053ba55029d0dc2ab356.asciidoc b/docs/examples/1a7483796087053ba55029d0dc2ab356.asciidoc new file mode 100644 index 000000000..c48bf98b9 --- /dev/null +++ b/docs/examples/1a7483796087053ba55029d0dc2ab356.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// esql/multivalued-fields.asciidoc:191 + +[source, python] +---- +resp = client.index( + index="mv", + refresh=True, + document={ + "a": [ + 2, + None, + 1 + ] + }, +) +print(resp) + +resp1 = client.esql.query( + query="FROM mv | LIMIT 1", +) +print(resp1) +---- diff --git a/docs/examples/1a8d92e93481c432a91f7c213099800a.asciidoc b/docs/examples/1a8d92e93481c432a91f7c213099800a.asciidoc index 8f5bbf405..6a6e71c2d 100644 --- a/docs/examples/1a8d92e93481c432a91f7c213099800a.asciidoc +++ b/docs/examples/1a8d92e93481c432a91f7c213099800a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/query-api-key.asciidoc:290 +// rest-api/security/query-api-key.asciidoc:295 [source, python] ---- diff --git a/docs/examples/1a9e03ce0355872a7db27fedc783fbec.asciidoc b/docs/examples/1a9e03ce0355872a7db27fedc783fbec.asciidoc index e0431da95..8de0fcb9a 100644 --- a/docs/examples/1a9e03ce0355872a7db27fedc783fbec.asciidoc +++ b/docs/examples/1a9e03ce0355872a7db27fedc783fbec.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-google-vertex-ai.asciidoc:125 +// inference/service-google-vertex-ai.asciidoc:151 [source, python] ---- diff --git a/docs/examples/1a9efb56adb2cd84faa9825a129381b9.asciidoc b/docs/examples/1a9efb56adb2cd84faa9825a129381b9.asciidoc index 590880dfc..e0d883c89 100644 --- a/docs/examples/1a9efb56adb2cd84faa9825a129381b9.asciidoc +++ b/docs/examples/1a9efb56adb2cd84faa9825a129381b9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-search.asciidoc:213 +// rollup/apis/rollup-search.asciidoc:222 [source, python] ---- diff --git a/docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc b/docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc index fc3519cf1..17dc48f5e 100644 --- a/docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc +++ b/docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/bulk.asciidoc:632 +// docs/bulk.asciidoc:642 [source, python] ---- diff --git a/docs/examples/1aa96eeaf63fc967e166d1a2fcdccccc.asciidoc b/docs/examples/1aa96eeaf63fc967e166d1a2fcdccccc.asciidoc index f2acde7ac..6ae6ba615 100644 --- a/docs/examples/1aa96eeaf63fc967e166d1a2fcdccccc.asciidoc +++ b/docs/examples/1aa96eeaf63fc967e166d1a2fcdccccc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/params/subobjects.asciidoc:130 +// mapping/params/subobjects.asciidoc:131 [source, python] ---- diff --git a/docs/examples/1b076ceb1ead9f6897c2f351f0e45f74.asciidoc b/docs/examples/1b076ceb1ead9f6897c2f351f0e45f74.asciidoc index 937867c30..d2cf9d555 100644 --- a/docs/examples/1b076ceb1ead9f6897c2f351f0e45f74.asciidoc +++ b/docs/examples/1b076ceb1ead9f6897c2f351f0e45f74.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-api-keys.asciidoc:220 +// rest-api/security/create-api-keys.asciidoc:226 [source, python] ---- diff --git a/docs/examples/1b0b29e5cd7550c648d0892378e93804.asciidoc b/docs/examples/1b0b29e5cd7550c648d0892378e93804.asciidoc index f5f77f18a..f6c38af80 100644 --- a/docs/examples/1b0b29e5cd7550c648d0892378e93804.asciidoc +++ b/docs/examples/1b0b29e5cd7550c648d0892378e93804.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-calendar-job.asciidoc:36 +// ml/anomaly-detection/apis/delete-calendar-job.asciidoc:42 [source, python] ---- diff --git a/docs/examples/1b0dc9d076bbb58c6a2953ef4323d2fc.asciidoc b/docs/examples/1b0dc9d076bbb58c6a2953ef4323d2fc.asciidoc index b6018227b..080538e48 100644 --- a/docs/examples/1b0dc9d076bbb58c6a2953ef4323d2fc.asciidoc +++ b/docs/examples/1b0dc9d076bbb58c6a2953ef4323d2fc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/ack-watch.asciidoc:190 +// rest-api/watcher/ack-watch.asciidoc:196 [source, python] ---- diff --git a/docs/examples/1b2ab75d3c8064fac6ecc63104396c02.asciidoc b/docs/examples/1b2ab75d3c8064fac6ecc63104396c02.asciidoc index f06ba7169..1bb8b3564 100644 --- a/docs/examples/1b2ab75d3c8064fac6ecc63104396c02.asciidoc +++ b/docs/examples/1b2ab75d3c8064fac6ecc63104396c02.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/put-calendar-job.asciidoc:36 +// ml/anomaly-detection/apis/put-calendar-job.asciidoc:42 [source, python] ---- diff --git a/docs/examples/1b3762712c14a19e8c2956b4f530d327.asciidoc b/docs/examples/1b3762712c14a19e8c2956b4f530d327.asciidoc index 9756e7301..a93efc331 100644 --- a/docs/examples/1b3762712c14a19e8c2956b4f530d327.asciidoc +++ b/docs/examples/1b3762712c14a19e8c2956b4f530d327.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/put-follow.asciidoc:108 +// ccr/apis/follow/put-follow.asciidoc:114 [source, python] ---- diff --git a/docs/examples/1b37e2237c9e3aaf84d56cc5c0bdb9ec.asciidoc b/docs/examples/1b37e2237c9e3aaf84d56cc5c0bdb9ec.asciidoc index 827fafa03..ebcd04ea5 100644 --- a/docs/examples/1b37e2237c9e3aaf84d56cc5c0bdb9ec.asciidoc +++ b/docs/examples/1b37e2237c9e3aaf84d56cc5c0bdb9ec.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/error-handling.asciidoc:15 +// ilm/error-handling.asciidoc:19 [source, python] ---- diff --git a/docs/examples/1ba7afe23a26fe9ac7856d8c5bc1059d.asciidoc b/docs/examples/1ba7afe23a26fe9ac7856d8c5bc1059d.asciidoc index dc02df84d..67df96154 100644 --- a/docs/examples/1ba7afe23a26fe9ac7856d8c5bc1059d.asciidoc +++ b/docs/examples/1ba7afe23a26fe9ac7856d8c5bc1059d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1501 +// analysis/analyzers/lang-analyzer.asciidoc:1502 [source, python] ---- diff --git a/docs/examples/be30ea12f605fd61acba689b68e00bbe.asciidoc b/docs/examples/1c330f0fc9eac19d0edeb8c4017b9b93.asciidoc similarity index 91% rename from docs/examples/be30ea12f605fd61acba689b68e00bbe.asciidoc rename to docs/examples/1c330f0fc9eac19d0edeb8c4017b9b93.asciidoc index 936d4c7a2..e222ea879 100644 --- a/docs/examples/be30ea12f605fd61acba689b68e00bbe.asciidoc +++ b/docs/examples/1c330f0fc9eac19d0edeb8c4017b9b93.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="hugging_face_embeddings", + id="hugging_face_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/1c3e3c4f2d268f1826a9b417e1868a58.asciidoc b/docs/examples/1c3e3c4f2d268f1826a9b417e1868a58.asciidoc index 059651182..6134ccb03 100644 --- a/docs/examples/1c3e3c4f2d268f1826a9b417e1868a58.asciidoc +++ b/docs/examples/1c3e3c4f2d268f1826a9b417e1868a58.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:312 +// scripting/using.asciidoc:317 [source, python] ---- diff --git a/docs/examples/1c8b6768c4eefc76fcb38708152f561b.asciidoc b/docs/examples/1c8b6768c4eefc76fcb38708152f561b.asciidoc index aa1420b78..1d350ebc2 100644 --- a/docs/examples/1c8b6768c4eefc76fcb38708152f561b.asciidoc +++ b/docs/examples/1c8b6768c4eefc76fcb38708152f561b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/delete-dfanalytics.asciidoc:51 +// ml/df-analytics/apis/delete-dfanalytics.asciidoc:57 [source, python] ---- diff --git a/docs/examples/1c9dac4183a3532c91dbd1a46907729b.asciidoc b/docs/examples/1c9dac4183a3532c91dbd1a46907729b.asciidoc new file mode 100644 index 000000000..08cabd096 --- /dev/null +++ b/docs/examples/1c9dac4183a3532c91dbd1a46907729b.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:459 + +[source, python] +---- +resp = client.indices.delete( + index="music", +) +print(resp) +---- diff --git a/docs/examples/7c63a1d2fbec5283e913ff39fafd0604.asciidoc b/docs/examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc similarity index 91% rename from docs/examples/7c63a1d2fbec5283e913ff39fafd0604.asciidoc rename to docs/examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc index 8bcc50f7f..7a1d92818 100644 --- a/docs/examples/7c63a1d2fbec5283e913ff39fafd0604.asciidoc +++ b/docs/examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="google_vertex_ai_embeddings", + id="google_vertex_ai_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/1cecd4d87a92427175157d41859df2af.asciidoc b/docs/examples/1cecd4d87a92427175157d41859df2af.asciidoc index 5e73037d0..593c0dd4e 100644 --- a/docs/examples/1cecd4d87a92427175157d41859df2af.asciidoc +++ b/docs/examples/1cecd4d87a92427175157d41859df2af.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/allocation-explain.asciidoc:10 +// cluster/allocation-explain.asciidoc:16 [source, python] ---- diff --git a/docs/examples/1d252d9217c61c2c1cbe7a92f77b078f.asciidoc b/docs/examples/1d252d9217c61c2c1cbe7a92f77b078f.asciidoc index 442eae70f..2e758afa8 100644 --- a/docs/examples/1d252d9217c61c2c1cbe7a92f77b078f.asciidoc +++ b/docs/examples/1d252d9217c61c2c1cbe7a92f77b078f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/query-api-key.asciidoc:608 +// rest-api/security/query-api-key.asciidoc:613 [source, python] ---- diff --git a/docs/examples/1d918e206ad8dab916e59183da24d9ec.asciidoc b/docs/examples/1d918e206ad8dab916e59183da24d9ec.asciidoc deleted file mode 100644 index 236c5a03f..000000000 --- a/docs/examples/1d918e206ad8dab916e59183da24d9ec.asciidoc +++ /dev/null @@ -1,13 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// watcher/how-watcher-works.asciidoc:156 - -[source, python] ----- -resp = client.indices.put_settings( - index=".watches", - settings={ - "index.routing.allocation.include.role": "watcher" - }, -) -print(resp) ----- diff --git a/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc b/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc index 78c452868..753a4b9d6 100644 --- a/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc +++ b/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-azure-ai-studio.asciidoc:142 +// inference/service-azure-ai-studio.asciidoc:168 [source, python] ---- diff --git a/docs/examples/1db715eb00832686ecddb6603684fc26.asciidoc b/docs/examples/1db715eb00832686ecddb6603684fc26.asciidoc index 9e6c2b2c5..7c5a300e6 100644 --- a/docs/examples/1db715eb00832686ecddb6603684fc26.asciidoc +++ b/docs/examples/1db715eb00832686ecddb6603684fc26.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/enroll-kibana.asciidoc:28 +// rest-api/security/enroll-kibana.asciidoc:34 [source, python] ---- diff --git a/docs/examples/1e08e054c761353f99211cd18e8ca47b.asciidoc b/docs/examples/1e08e054c761353f99211cd18e8ca47b.asciidoc index c4ff7e042..abd862bc3 100644 --- a/docs/examples/1e08e054c761353f99211cd18e8ca47b.asciidoc +++ b/docs/examples/1e08e054c761353f99211cd18e8ca47b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-snapshot.asciidoc:43 +// ml/anomaly-detection/apis/delete-snapshot.asciidoc:49 [source, python] ---- diff --git a/docs/examples/1e0b85750d4e63ebbc927d4627c44bf8.asciidoc b/docs/examples/1e0b85750d4e63ebbc927d4627c44bf8.asciidoc index 7083e786e..b4d009c90 100644 --- a/docs/examples/1e0b85750d4e63ebbc927d4627c44bf8.asciidoc +++ b/docs/examples/1e0b85750d4e63ebbc927d4627c44bf8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:601 +// how-to/size-your-shards.asciidoc:604 [source, python] ---- diff --git a/docs/examples/1e26353d546d733634187b8c3a7837a7.asciidoc b/docs/examples/1e26353d546d733634187b8c3a7837a7.asciidoc index 588151968..37cc447f6 100644 --- a/docs/examples/1e26353d546d733634187b8c3a7837a7.asciidoc +++ b/docs/examples/1e26353d546d733634187b8c3a7837a7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connectors-api.asciidoc:100 +// connector/apis/list-connectors-api.asciidoc:110 [source, python] ---- diff --git a/docs/examples/1e3384bc255729b65a6f0fc8011ff733.asciidoc b/docs/examples/1e3384bc255729b65a6f0fc8011ff733.asciidoc index e0a2d183c..f37ae1db0 100644 --- a/docs/examples/1e3384bc255729b65a6f0fc8011ff733.asciidoc +++ b/docs/examples/1e3384bc255729b65a6f0fc8011ff733.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/segments.asciidoc:12 +// indices/segments.asciidoc:18 [source, python] ---- diff --git a/docs/examples/1e3553a73da487017f7a95088b6aa957.asciidoc b/docs/examples/1e3553a73da487017f7a95088b6aa957.asciidoc index 2b259046e..f481e9086 100644 --- a/docs/examples/1e3553a73da487017f7a95088b6aa957.asciidoc +++ b/docs/examples/1e3553a73da487017f7a95088b6aa957.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-roles-cache.asciidoc:56 +// rest-api/security/clear-roles-cache.asciidoc:62 [source, python] ---- diff --git a/docs/examples/1e547696f54582840040b1aa6661760c.asciidoc b/docs/examples/1e547696f54582840040b1aa6661760c.asciidoc index 3166b147c..ef5d0cf52 100644 --- a/docs/examples/1e547696f54582840040b1aa6661760c.asciidoc +++ b/docs/examples/1e547696f54582840040b1aa6661760c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:226 +// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:400 [source, python] ---- diff --git a/docs/examples/1ead35c954963e83f89872048dabdbe9.asciidoc b/docs/examples/1ead35c954963e83f89872048dabdbe9.asciidoc new file mode 100644 index 000000000..dc8dd1106 --- /dev/null +++ b/docs/examples/1ead35c954963e83f89872048dabdbe9.asciidoc @@ -0,0 +1,21 @@ +// This file is autogenerated, DO NOT EDIT +// rest-api/security/query-role.asciidoc:137 + +[source, python] +---- +resp = client.security.query_role( + query={ + "bool": { + "must_not": { + "term": { + "metadata._reserved": True + } + } + } + }, + sort=[ + "name" + ], +) +print(resp) +---- diff --git a/docs/examples/1ed26c7b445ab1c167bd9385e1f0066f.asciidoc b/docs/examples/1ed26c7b445ab1c167bd9385e1f0066f.asciidoc index fcf34c209..cd92b0ba4 100644 --- a/docs/examples/1ed26c7b445ab1c167bd9385e1f0066f.asciidoc +++ b/docs/examples/1ed26c7b445ab1c167bd9385e1f0066f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// sql/apis/delete-async-sql-search-api.asciidoc:12 +// sql/apis/delete-async-sql-search-api.asciidoc:18 [source, python] ---- diff --git a/docs/examples/1ef5119db55a6f2b6fc0ab92f36e7f8e.asciidoc b/docs/examples/1ef5119db55a6f2b6fc0ab92f36e7f8e.asciidoc index 6456d8322..7de69a88a 100644 --- a/docs/examples/1ef5119db55a6f2b6fc0ab92f36e7f8e.asciidoc +++ b/docs/examples/1ef5119db55a6f2b6fc0ab92f36e7f8e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:61 +// search/search-your-data/sort-search-results.asciidoc:63 [source, python] ---- diff --git a/docs/examples/1f3dd84ab11bae09d3f99b1b3536e239.asciidoc b/docs/examples/1f3dd84ab11bae09d3f99b1b3536e239.asciidoc index 2f5859098..221b65d39 100644 --- a/docs/examples/1f3dd84ab11bae09d3f99b1b3536e239.asciidoc +++ b/docs/examples/1f3dd84ab11bae09d3f99b1b3536e239.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/create-snapshot-api.asciidoc:25 +// snapshot-restore/apis/create-snapshot-api.asciidoc:31 [source, python] ---- diff --git a/docs/examples/1f673e1a0de2970dc648618d5425a994.asciidoc b/docs/examples/1f673e1a0de2970dc648618d5425a994.asciidoc index 6f79d3872..1a19d1004 100644 --- a/docs/examples/1f673e1a0de2970dc648618d5425a994.asciidoc +++ b/docs/examples/1f673e1a0de2970dc648618d5425a994.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:267 +// docs/reindex.asciidoc:273 [source, python] ---- diff --git a/docs/examples/1f6a190fa1aade1fb66680388f184ef9.asciidoc b/docs/examples/1f6a190fa1aade1fb66680388f184ef9.asciidoc index 130a7178d..0457f7d8f 100644 --- a/docs/examples/1f6a190fa1aade1fb66680388f184ef9.asciidoc +++ b/docs/examples/1f6a190fa1aade1fb66680388f184ef9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/validate.asciidoc:266 +// search/validate.asciidoc:272 [source, python] ---- diff --git a/docs/examples/1fb2c77c0988bc6545040b20e3afa7e9.asciidoc b/docs/examples/1fb2c77c0988bc6545040b20e3afa7e9.asciidoc new file mode 100644 index 000000000..14366fbc8 --- /dev/null +++ b/docs/examples/1fb2c77c0988bc6545040b20e3afa7e9.asciidoc @@ -0,0 +1,41 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/dls-e2e-guide.asciidoc:139 + +[source, python] +---- +resp = client.security.create_api_key( + name="john-api-key", + expiration="1d", + role_descriptors={ + "sharepoint-online-role": { + "index": [ + { + "names": [ + "sharepoint-search-application" + ], + "privileges": [ + "read" + ], + "query": { + "template": { + "params": { + "access_control": [ + "john@example.co", + "Engineering Members" + ] + }, + "source": "\n {\n \"bool\": {\n \"should\": [\n {\n \"bool\": {\n \"must_not\": {\n \"exists\": {\n \"field\": \"_allow_access_control\"\n }\n }\n }\n },\n {\n \"terms\": {\n \"_allow_access_control.enum\": {{#toJson}}access_control{{/toJson}}\n }\n }\n ]\n }\n }\n " + } + } + } + ], + "restriction": { + "workflows": [ + "search_application_query" + ] + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/1ff12523efbd59c213c676937757c460.asciidoc b/docs/examples/1ff12523efbd59c213c676937757c460.asciidoc index 244ccbbe6..9a18e3091 100644 --- a/docs/examples/1ff12523efbd59c213c676937757c460.asciidoc +++ b/docs/examples/1ff12523efbd59c213c676937757c460.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-api-keys.asciidoc:110 +// rest-api/security/invalidate-api-keys.asciidoc:116 [source, python] ---- diff --git a/docs/examples/20005d8a6555b259b299d862cd218701.asciidoc b/docs/examples/20005d8a6555b259b299d862cd218701.asciidoc index 93d00d236..0a4219e1e 100644 --- a/docs/examples/20005d8a6555b259b299d862cd218701.asciidoc +++ b/docs/examples/20005d8a6555b259b299d862cd218701.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/match-query.asciidoc:186 +// query-dsl/match-query.asciidoc:190 [source, python] ---- diff --git a/docs/examples/200f6d4cc7b9c300b8962a119e03873f.asciidoc b/docs/examples/200f6d4cc7b9c300b8962a119e03873f.asciidoc index 9548b036a..1714999be 100644 --- a/docs/examples/200f6d4cc7b9c300b8962a119e03873f.asciidoc +++ b/docs/examples/200f6d4cc7b9c300b8962a119e03873f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-data-stream.asciidoc:280 +// indices/get-data-stream.asciidoc:286 [source, python] ---- diff --git a/docs/examples/20e3b181114e00c943a27a9bbcf85f15.asciidoc b/docs/examples/20e3b181114e00c943a27a9bbcf85f15.asciidoc index b4083b135..b4ef16609 100644 --- a/docs/examples/20e3b181114e00c943a27a9bbcf85f15.asciidoc +++ b/docs/examples/20e3b181114e00c943a27a9bbcf85f15.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-record.asciidoc:280 +// ml/anomaly-detection/apis/get-record.asciidoc:286 [source, python] ---- diff --git a/docs/examples/20f62d0540bf6261549bd286416eae28.asciidoc b/docs/examples/20f62d0540bf6261549bd286416eae28.asciidoc index 0dc048650..2d27949a9 100644 --- a/docs/examples/20f62d0540bf6261549bd286416eae28.asciidoc +++ b/docs/examples/20f62d0540bf6261549bd286416eae28.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/enrich/put-enrich-policy.asciidoc:25 +// ingest/apis/enrich/put-enrich-policy.asciidoc:30 [source, python] ---- diff --git a/docs/examples/2105f2d1d81977054a93163a175793ce.asciidoc b/docs/examples/2105f2d1d81977054a93163a175793ce.asciidoc index 3212ee5bf..d18bcdd76 100644 --- a/docs/examples/2105f2d1d81977054a93163a175793ce.asciidoc +++ b/docs/examples/2105f2d1d81977054a93163a175793ce.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-status-api.asciidoc:75 +// snapshot-restore/apis/get-snapshot-status-api.asciidoc:81 [source, python] ---- diff --git a/docs/examples/2155c920d7d860f3ee7542f2211b4fec.asciidoc b/docs/examples/2155c920d7d860f3ee7542f2211b4fec.asciidoc index d478f5eb2..b4c25f594 100644 --- a/docs/examples/2155c920d7d860f3ee7542f2211b4fec.asciidoc +++ b/docs/examples/2155c920d7d860f3ee7542f2211b4fec.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/text-expansion-query.asciidoc:18 +// query-dsl/text-expansion-query.asciidoc:25 [source, python] ---- diff --git a/docs/examples/3fab530a2e43807929c0ef3ebf7d268c.asciidoc b/docs/examples/216e24f05cbb82c1718713fbab8623d2.asciidoc similarity index 87% rename from docs/examples/3fab530a2e43807929c0ef3ebf7d268c.asciidoc rename to docs/examples/216e24f05cbb82c1718713fbab8623d2.asciidoc index 1d8590c21..9ddf0fe44 100644 --- a/docs/examples/3fab530a2e43807929c0ef3ebf7d268c.asciidoc +++ b/docs/examples/216e24f05cbb82c1718713fbab8623d2.asciidoc @@ -1,11 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/geoip.asciidoc:134 +// ingest/processors/geoip.asciidoc:136 [source, python] ---- resp = client.ingest.put_pipeline( id="geoip", - description="Add geoip info", + description="Add ip geolocation info", processors=[ { "geoip": { diff --git a/docs/examples/218b9009f120e8ad33f710e019179562.asciidoc b/docs/examples/218b9009f120e8ad33f710e019179562.asciidoc index 6a6c45d49..a5f7af03b 100644 --- a/docs/examples/218b9009f120e8ad33f710e019179562.asciidoc +++ b/docs/examples/218b9009f120e8ad33f710e019179562.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-repo-api.asciidoc:119 +// snapshot-restore/apis/get-repo-api.asciidoc:125 [source, python] ---- diff --git a/docs/examples/21c1e6ee886140ce0cd67184dd19b981.asciidoc b/docs/examples/21c1e6ee886140ce0cd67184dd19b981.asciidoc index 96e791f0b..1858a055a 100644 --- a/docs/examples/21c1e6ee886140ce0cd67184dd19b981.asciidoc +++ b/docs/examples/21c1e6ee886140ce0cd67184dd19b981.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/dangling-indices-list.asciidoc:13 +// indices/dangling-indices-list.asciidoc:19 [source, python] ---- diff --git a/docs/examples/21cd01cb90d3ea1acd0ab22d7edd2c88.asciidoc b/docs/examples/21cd01cb90d3ea1acd0ab22d7edd2c88.asciidoc index 00a052e0f..23c92bf91 100644 --- a/docs/examples/21cd01cb90d3ea1acd0ab22d7edd2c88.asciidoc +++ b/docs/examples/21cd01cb90d3ea1acd0ab22d7edd2c88.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/inference-api/infer-api-task.asciidoc:154 +// tab-widgets/inference-api/infer-api-task.asciidoc:162 [source, python] ---- diff --git a/docs/examples/983a867c90e63e070518f2f709f659ee.asciidoc b/docs/examples/21d41e8cbd107fbdf0901f885834dafc.asciidoc similarity index 67% rename from docs/examples/983a867c90e63e070518f2f709f659ee.asciidoc rename to docs/examples/21d41e8cbd107fbdf0901f885834dafc.asciidoc index 23a1b1dd5..4ce3834f3 100644 --- a/docs/examples/983a867c90e63e070518f2f709f659ee.asciidoc +++ b/docs/examples/21d41e8cbd107fbdf0901f885834dafc.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/wildcard.asciidoc:141 +// mapping/types/wildcard.asciidoc:139 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "card": { "type": "wildcard" diff --git a/docs/examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc b/docs/examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc index 496e9e9b5..45a2461c9 100644 --- a/docs/examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc +++ b/docs/examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:313 +// search/search-your-data/sort-search-results.asciidoc:315 [source, python] ---- diff --git a/docs/examples/22b176a184517cf1b5801f5eb4f17f97.asciidoc b/docs/examples/22b176a184517cf1b5801f5eb4f17f97.asciidoc new file mode 100644 index 000000000..b641acec5 --- /dev/null +++ b/docs/examples/22b176a184517cf1b5801f5eb4f17f97.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// data-streams/downsampling-dsl.asciidoc:349 + +[source, python] +---- +resp = client.indices.rollover( + alias="datastream", +) +print(resp) +---- diff --git a/docs/examples/22dde5fe7ac5d85d52115641a68b3c55.asciidoc b/docs/examples/22dde5fe7ac5d85d52115641a68b3c55.asciidoc index d09d80766..6479363e5 100644 --- a/docs/examples/22dde5fe7ac5d85d52115641a68b3c55.asciidoc +++ b/docs/examples/22dde5fe7ac5d85d52115641a68b3c55.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:196 +// indices/analyze.asciidoc:202 [source, python] ---- diff --git a/docs/examples/2310d84ebf113f2a3ed14cc53172ae4a.asciidoc b/docs/examples/2310d84ebf113f2a3ed14cc53172ae4a.asciidoc index 79f87f9cc..0e4c70c10 100644 --- a/docs/examples/2310d84ebf113f2a3ed14cc53172ae4a.asciidoc +++ b/docs/examples/2310d84ebf113f2a3ed14cc53172ae4a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/text-expansion-query.asciidoc:93 +// query-dsl/text-expansion-query.asciidoc:100 [source, python] ---- diff --git a/docs/examples/23b062c157235246d7c347b9047b2435.asciidoc b/docs/examples/23b062c157235246d7c347b9047b2435.asciidoc index 1277fbb7a..94a71a76e 100644 --- a/docs/examples/23b062c157235246d7c347b9047b2435.asciidoc +++ b/docs/examples/23b062c157235246d7c347b9047b2435.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:113 +// rest-api/security/create-role-mappings.asciidoc:119 [source, python] ---- diff --git a/docs/examples/242a26ced0e5706e48dcda19a4003094.asciidoc b/docs/examples/242a26ced0e5706e48dcda19a4003094.asciidoc index e6459126a..cfe98f488 100644 --- a/docs/examples/242a26ced0e5706e48dcda19a4003094.asciidoc +++ b/docs/examples/242a26ced0e5706e48dcda19a4003094.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:964 +// docs/reindex.asciidoc:970 [source, python] ---- diff --git a/docs/examples/246763219ec06172f7aa57bba28d344a.asciidoc b/docs/examples/246763219ec06172f7aa57bba28d344a.asciidoc new file mode 100644 index 000000000..5a340dc07 --- /dev/null +++ b/docs/examples/246763219ec06172f7aa57bba28d344a.asciidoc @@ -0,0 +1,109 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/rank-vectors.asciidoc:159 + +[source, python] +---- +resp = client.indices.create( + index="my-rank-vectors-bit", + mappings={ + "properties": { + "my_vector": { + "type": "rank_vectors", + "element_type": "bit" + } + } + }, +) +print(resp) + +resp1 = client.bulk( + index="my-rank-vectors-bit", + refresh=True, + operations=[ + { + "index": { + "_id": "1" + } + }, + { + "my_vector": [ + 127, + -127, + 0, + 1, + 42 + ] + }, + { + "index": { + "_id": "2" + } + }, + { + "my_vector": "8100012a7f" + } + ], +) +print(resp1) + +resp2 = client.search( + index="my-rank-vectors-bit", + query={ + "script_score": { + "query": { + "match_all": {} + }, + "script": { + "source": "maxSimDotProduct(params.query_vector, 'my_vector')", + "params": { + "query_vector": [ + [ + 0.35, + 0.77, + 0.95, + 0.15, + 0.11, + 0.08, + 0.58, + 0.06, + 0.44, + 0.52, + 0.21, + 0.62, + 0.65, + 0.16, + 0.64, + 0.39, + 0.93, + 0.06, + 0.93, + 0.31, + 0.92, + 0, + 0.66, + 0.86, + 0.92, + 0.03, + 0.81, + 0.31, + 0.2, + 0.92, + 0.95, + 0.64, + 0.19, + 0.26, + 0.77, + 0.64, + 0.78, + 0.32, + 0.97, + 0.84 + ] + ] + } + } + } + }, +) +print(resp2) +---- diff --git a/docs/examples/249bf48252c8cea47ef872541c8a884c.asciidoc b/docs/examples/249bf48252c8cea47ef872541c8a884c.asciidoc index af3cafb7b..7327a497f 100644 --- a/docs/examples/249bf48252c8cea47ef872541c8a884c.asciidoc +++ b/docs/examples/249bf48252c8cea47ef872541c8a884c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/grant-api-keys.asciidoc:127 +// rest-api/security/grant-api-keys.asciidoc:133 [source, python] ---- diff --git a/docs/examples/24ad3c234f69f55a3fbe2d488e70178a.asciidoc b/docs/examples/24ad3c234f69f55a3fbe2d488e70178a.asciidoc index db644f6b7..cb65f4f6d 100644 --- a/docs/examples/24ad3c234f69f55a3fbe2d488e70178a.asciidoc +++ b/docs/examples/24ad3c234f69f55a3fbe2d488e70178a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:354 +// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:360 [source, python] ---- diff --git a/docs/examples/24aee6033bf77a68ced74e3fd9d34283.asciidoc b/docs/examples/24aee6033bf77a68ced74e3fd9d34283.asciidoc index 7c1bba413..c7c3ce5ab 100644 --- a/docs/examples/24aee6033bf77a68ced74e3fd9d34283.asciidoc +++ b/docs/examples/24aee6033bf77a68ced74e3fd9d34283.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-index-template-v1.asciidoc:79 +// indices/get-index-template-v1.asciidoc:85 [source, python] ---- diff --git a/docs/examples/24d806d1803158dacd4dda73c4204d3e.asciidoc b/docs/examples/24d806d1803158dacd4dda73c4204d3e.asciidoc index bdff603a7..727fcb365 100644 --- a/docs/examples/24d806d1803158dacd4dda73c4204d3e.asciidoc +++ b/docs/examples/24d806d1803158dacd4dda73c4204d3e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-rules/apis/get-query-rule.asciidoc:105 +// query-rules/apis/get-query-rule.asciidoc:111 [source, python] ---- diff --git a/docs/examples/2577acb462b95bd4394523cf2f8a661f.asciidoc b/docs/examples/2577acb462b95bd4394523cf2f8a661f.asciidoc deleted file mode 100644 index d8e5f8698..000000000 --- a/docs/examples/2577acb462b95bd4394523cf2f8a661f.asciidoc +++ /dev/null @@ -1,33 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// esql/processing-commands/lookup.asciidoc:30 - -[source, python] ----- -resp = client.esql.query( - format="txt", - query="\n FROM library\n | SORT page_count DESC\n | KEEP name, author\n | LOOKUP era ON author\n | LIMIT 5\n ", - tables={ - "era": { - "author": { - "keyword": [ - "Frank Herbert", - "Peter F. Hamilton", - "Vernor Vinge", - "Alastair Reynolds", - "James S.A. Corey" - ] - }, - "era": { - "keyword": [ - "The New Wave", - "Diamond", - "Diamond", - "Diamond", - "Hadron" - ] - } - } - }, -) -print(resp) ----- diff --git a/docs/examples/25a0dad6547d432f5a3d394528f1c138.asciidoc b/docs/examples/25a0dad6547d432f5a3d394528f1c138.asciidoc index 7b429b7bd..c81a6c009 100644 --- a/docs/examples/25a0dad6547d432f5a3d394528f1c138.asciidoc +++ b/docs/examples/25a0dad6547d432f5a3d394528f1c138.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:395 +// docs/get.asciidoc:401 [source, python] ---- diff --git a/docs/examples/25c0e66a433a0cd596e0641b752ff6d7.asciidoc b/docs/examples/25c0e66a433a0cd596e0641b752ff6d7.asciidoc index 8f0653e9e..c814a4488 100644 --- a/docs/examples/25c0e66a433a0cd596e0641b752ff6d7.asciidoc +++ b/docs/examples/25c0e66a433a0cd596e0641b752ff6d7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/shards.asciidoc:405 +// cat/shards.asciidoc:414 [source, python] ---- diff --git a/docs/examples/25cb9e1da00dfd971065ce182467434d.asciidoc b/docs/examples/25cb9e1da00dfd971065ce182467434d.asciidoc index 4a396c3df..b6541bf87 100644 --- a/docs/examples/25cb9e1da00dfd971065ce182467434d.asciidoc +++ b/docs/examples/25cb9e1da00dfd971065ce182467434d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/voting-exclusions.asciidoc:112 +// cluster/voting-exclusions.asciidoc:122 [source, python] ---- diff --git a/docs/examples/261480571394632db40e88fbb6c59c2f.asciidoc b/docs/examples/261480571394632db40e88fbb6c59c2f.asciidoc index 73966f9df..061c558a8 100644 --- a/docs/examples/261480571394632db40e88fbb6c59c2f.asciidoc +++ b/docs/examples/261480571394632db40e88fbb6c59c2f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/delete-role-mappings.asciidoc:46 +// rest-api/security/delete-role-mappings.asciidoc:52 [source, python] ---- diff --git a/docs/examples/2623eb122cc0299b42fc9eca6e7f5e56.asciidoc b/docs/examples/2623eb122cc0299b42fc9eca6e7f5e56.asciidoc index cfd59dc5d..9f4e353e0 100644 --- a/docs/examples/2623eb122cc0299b42fc9eca6e7f5e56.asciidoc +++ b/docs/examples/2623eb122cc0299b42fc9eca6e7f5e56.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-builtin-privileges.asciidoc:58 +// rest-api/security/get-builtin-privileges.asciidoc:64 [source, python] ---- diff --git a/docs/examples/2646710ece0c4c843aebeacd370d0396.asciidoc b/docs/examples/2646710ece0c4c843aebeacd370d0396.asciidoc index 41168da02..0deba1383 100644 --- a/docs/examples/2646710ece0c4c843aebeacd370d0396.asciidoc +++ b/docs/examples/2646710ece0c4c843aebeacd370d0396.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:137 +// mapping/types/dense-vector.asciidoc:141 [source, python] ---- diff --git a/docs/examples/26d3ab748a855eb383e992eb1ff79662.asciidoc b/docs/examples/26d3ab748a855eb383e992eb1ff79662.asciidoc index 9dba23b31..a46a7e75f 100644 --- a/docs/examples/26d3ab748a855eb383e992eb1ff79662.asciidoc +++ b/docs/examples/26d3ab748a855eb383e992eb1ff79662.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// eql/delete-async-eql-search-api.asciidoc:14 +// eql/delete-async-eql-search-api.asciidoc:20 [source, python] ---- diff --git a/docs/examples/270549e6b062228312c4e7a54a2c2209.asciidoc b/docs/examples/270549e6b062228312c4e7a54a2c2209.asciidoc index 3fdc374f1..f2fbab21c 100644 --- a/docs/examples/270549e6b062228312c4e7a54a2c2209.asciidoc +++ b/docs/examples/270549e6b062228312c4e7a54a2c2209.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/task-queue-backlog.asciidoc:34 +// troubleshooting/common-issues/task-queue-backlog.asciidoc:55 [source, python] ---- diff --git a/docs/examples/2720e613d520ce352b62e990c2d283f7.asciidoc b/docs/examples/2720e613d520ce352b62e990c2d283f7.asciidoc index 36e3e207f..e1d7d8b4c 100644 --- a/docs/examples/2720e613d520ce352b62e990c2d283f7.asciidoc +++ b/docs/examples/2720e613d520ce352b62e990c2d283f7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/remove-policy-from-index.asciidoc:87 +// ilm/apis/remove-policy-from-index.asciidoc:93 [source, python] ---- diff --git a/docs/examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc b/docs/examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc new file mode 100644 index 000000000..f7955285c --- /dev/null +++ b/docs/examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:604 + +[source, python] +---- +resp = client.indices.add_block( + index=".ml-anomalies-custom-example", + block="write", +) +print(resp) +---- diff --git a/docs/examples/27384266370152add76471dd0332a2f1.asciidoc b/docs/examples/27384266370152add76471dd0332a2f1.asciidoc index 534dfb41d..a99bf0468 100644 --- a/docs/examples/27384266370152add76471dd0332a2f1.asciidoc +++ b/docs/examples/27384266370152add76471dd0332a2f1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/update-transform.asciidoc:257 +// transform/apis/update-transform.asciidoc:263 [source, python] ---- diff --git a/docs/examples/275ec358d5d1e4b9ff06cb4ae7e47650.asciidoc b/docs/examples/275ec358d5d1e4b9ff06cb4ae7e47650.asciidoc index b19ba72f6..1bebbcc24 100644 --- a/docs/examples/275ec358d5d1e4b9ff06cb4ae7e47650.asciidoc +++ b/docs/examples/275ec358d5d1e4b9ff06cb4ae7e47650.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-index-template.asciidoc:78 +// indices/get-index-template.asciidoc:84 [source, python] ---- diff --git a/docs/examples/2864d04bf99860ed5dbe1458f1ab5f78.asciidoc b/docs/examples/2864d04bf99860ed5dbe1458f1ab5f78.asciidoc index c9fcedba5..0f6d7a087 100644 --- a/docs/examples/2864d04bf99860ed5dbe1458f1ab5f78.asciidoc +++ b/docs/examples/2864d04bf99860ed5dbe1458f1ab5f78.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/put-autoscaling-policy.asciidoc:16 +// autoscaling/apis/put-autoscaling-policy.asciidoc:22 [source, python] ---- diff --git a/docs/examples/2884eacac3ad05ff794f5296ec7427e7.asciidoc b/docs/examples/2884eacac3ad05ff794f5296ec7427e7.asciidoc index 923e21c79..687e5f0fa 100644 --- a/docs/examples/2884eacac3ad05ff794f5296ec7427e7.asciidoc +++ b/docs/examples/2884eacac3ad05ff794f5296ec7427e7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/knn-query.asciidoc:57 +// query-dsl/knn-query.asciidoc:58 [source, python] ---- diff --git a/docs/examples/2891aa10ee9d474780adf94d5607f2db.asciidoc b/docs/examples/2891aa10ee9d474780adf94d5607f2db.asciidoc index fe88b0dff..fc9780c02 100644 --- a/docs/examples/2891aa10ee9d474780adf94d5607f2db.asciidoc +++ b/docs/examples/2891aa10ee9d474780adf94d5607f2db.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:175 +// search/search-your-data/sort-search-results.asciidoc:177 [source, python] ---- diff --git a/docs/examples/2932e6f71e247cf52e11d2f38f114ddf.asciidoc b/docs/examples/2932e6f71e247cf52e11d2f38f114ddf.asciidoc index 871706d7e..da25fd166 100644 --- a/docs/examples/2932e6f71e247cf52e11d2f38f114ddf.asciidoc +++ b/docs/examples/2932e6f71e247cf52e11d2f38f114ddf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:294 +// docs/reindex.asciidoc:300 [source, python] ---- diff --git a/docs/examples/295b3aaeb223612afdd991744dc9c873.asciidoc b/docs/examples/295b3aaeb223612afdd991744dc9c873.asciidoc index f54eccc6e..f069fd0f1 100644 --- a/docs/examples/295b3aaeb223612afdd991744dc9c873.asciidoc +++ b/docs/examples/295b3aaeb223612afdd991744dc9c873.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:484 +// scripting/using.asciidoc:489 [source, python] ---- diff --git a/docs/examples/dfcdadcf91529d3a399e05684195028e.asciidoc b/docs/examples/2968ffb8135f77ba3a9b876dd4918119.asciidoc similarity index 85% rename from docs/examples/dfcdadcf91529d3a399e05684195028e.asciidoc rename to docs/examples/2968ffb8135f77ba3a9b876dd4918119.asciidoc index 635e058fb..67a616b10 100644 --- a/docs/examples/dfcdadcf91529d3a399e05684195028e.asciidoc +++ b/docs/examples/2968ffb8135f77ba3a9b876dd4918119.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "azure-ai-studio-embeddings", - "pipeline": "azure_ai_studio_embeddings" + "pipeline": "azure_ai_studio_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/29824032d7d64512d17458fdd687b1f6.asciidoc b/docs/examples/29824032d7d64512d17458fdd687b1f6.asciidoc index 7500f918a..99994b7c2 100644 --- a/docs/examples/29824032d7d64512d17458fdd687b1f6.asciidoc +++ b/docs/examples/29824032d7d64512d17458fdd687b1f6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:138 +// cluster/tasks.asciidoc:144 [source, python] ---- diff --git a/docs/examples/299900fb08da80fe455cf3f1bb7d62ee.asciidoc b/docs/examples/299900fb08da80fe455cf3f1bb7d62ee.asciidoc index 77842e352..f1e964b2e 100644 --- a/docs/examples/299900fb08da80fe455cf3f1bb7d62ee.asciidoc +++ b/docs/examples/299900fb08da80fe455cf3f1bb7d62ee.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-field-mapping.asciidoc:96 +// indices/get-field-mapping.asciidoc:102 [source, python] ---- diff --git a/docs/examples/29aeabacb1fdf5b083d5f091b6d1bd44.asciidoc b/docs/examples/29aeabacb1fdf5b083d5f091b6d1bd44.asciidoc new file mode 100644 index 000000000..8fd8db4c8 --- /dev/null +++ b/docs/examples/29aeabacb1fdf5b083d5f091b6d1bd44.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/data-stream-reindex.asciidoc:105 + +[source, python] +---- +resp = client.indices.migrate_reindex( + reindex={ + "source": { + "index": "my-data-stream" + }, + "mode": "upgrade" + }, +) +print(resp) +---- diff --git a/docs/examples/29d9df958de292cec50daaf31844b573.asciidoc b/docs/examples/29d9df958de292cec50daaf31844b573.asciidoc index 91441a858..444057fcb 100644 --- a/docs/examples/29d9df958de292cec50daaf31844b573.asciidoc +++ b/docs/examples/29d9df958de292cec50daaf31844b573.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-field-mapping.asciidoc:226 +// indices/get-field-mapping.asciidoc:232 [source, python] ---- diff --git a/docs/examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc b/docs/examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc index e831ba094..d3fe44432 100644 --- a/docs/examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc +++ b/docs/examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc @@ -1,13 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/oidc-logout-api.asciidoc:47 +// rest-api/security/oidc-logout-api.asciidoc:53 [source, python] ---- resp = client.security.oidc_logout( - body={ - "token": "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", - "refresh_token": "vLBPvmAB6KvwvJZr27cS" - }, + token="dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", + refresh_token="vLBPvmAB6KvwvJZr27cS", ) print(resp) ---- diff --git a/docs/examples/2a21674c40f9b182a8944769d20b2357.asciidoc b/docs/examples/2a21674c40f9b182a8944769d20b2357.asciidoc new file mode 100644 index 000000000..a9b622970 --- /dev/null +++ b/docs/examples/2a21674c40f9b182a8944769d20b2357.asciidoc @@ -0,0 +1,34 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/rank-vectors.asciidoc:137 + +[source, python] +---- +resp = client.search( + index="my-rank-vectors-float", + query={ + "script_score": { + "query": { + "match_all": {} + }, + "script": { + "source": "maxSimDotProduct(params.query_vector, 'my_vector')", + "params": { + "query_vector": [ + [ + 0.5, + 10, + 6 + ], + [ + -0.5, + 10, + 10 + ] + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/2a5f7e7d6b92c66e52616845146d2820.asciidoc b/docs/examples/2a5f7e7d6b92c66e52616845146d2820.asciidoc index 757d2d7a4..b944107e3 100644 --- a/docs/examples/2a5f7e7d6b92c66e52616845146d2820.asciidoc +++ b/docs/examples/2a5f7e7d6b92c66e52616845146d2820.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/painless-examples.asciidoc:513 +// transform/painless-examples.asciidoc:522 [source, python] ---- diff --git a/docs/examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc b/docs/examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc new file mode 100644 index 000000000..f349cd415 --- /dev/null +++ b/docs/examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc @@ -0,0 +1,35 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/processors/attachment.asciidoc:162 + +[source, python] +---- +resp = client.ingest.put_pipeline( + id="attachment", + description="Extract attachment information including original binary", + processors=[ + { + "attachment": { + "field": "data", + "remove_binary": False + } + } + ], +) +print(resp) + +resp1 = client.index( + index="my-index-000001", + id="my_id", + pipeline="attachment", + document={ + "data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=" + }, +) +print(resp1) + +resp2 = client.get( + index="my-index-000001", + id="my_id", +) +print(resp2) +---- diff --git a/docs/examples/2a71e2d7f7179dd76183d30789046808.asciidoc b/docs/examples/2a71e2d7f7179dd76183d30789046808.asciidoc index 46ca2436d..3e5c29b2d 100644 --- a/docs/examples/2a71e2d7f7179dd76183d30789046808.asciidoc +++ b/docs/examples/2a71e2d7f7179dd76183d30789046808.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/multivalued-fields.asciidoc:177 +// esql/multivalued-fields.asciidoc:224 [source, python] ---- diff --git a/docs/examples/2aa548b692fc2fe7b6f0d90eb8b2ae29.asciidoc b/docs/examples/2aa548b692fc2fe7b6f0d90eb8b2ae29.asciidoc index aea75cee0..a9a2a489c 100644 --- a/docs/examples/2aa548b692fc2fe7b6f0d90eb8b2ae29.asciidoc +++ b/docs/examples/2aa548b692fc2fe7b6f0d90eb8b2ae29.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/delete-watch.asciidoc:60 +// rest-api/watcher/delete-watch.asciidoc:66 [source, python] ---- diff --git a/docs/examples/2acf75803494fef29f9ca70671aa6be1.asciidoc b/docs/examples/2acf75803494fef29f9ca70671aa6be1.asciidoc index fbba69008..fd659fcfc 100644 --- a/docs/examples/2acf75803494fef29f9ca70671aa6be1.asciidoc +++ b/docs/examples/2acf75803494fef29f9ca70671aa6be1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-delete-roles.asciidoc:95 +// rest-api/security/bulk-delete-roles.asciidoc:100 [source, python] ---- diff --git a/docs/examples/2afd49985950cbcccf727fa858d00067.asciidoc b/docs/examples/2afd49985950cbcccf727fa858d00067.asciidoc new file mode 100644 index 000000000..19ceadeaa --- /dev/null +++ b/docs/examples/2afd49985950cbcccf727fa858d00067.asciidoc @@ -0,0 +1,24 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/semantic-text.asciidoc:159 + +[source, python] +---- +resp = client.indices.create( + index="test-index", + query={ + "match": { + "my_field": "Which country is Paris in?" + } + }, + highlight={ + "fields": { + "my_field": { + "type": "semantic", + "number_of_fragments": 2, + "order": "score" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc b/docs/examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc index 65c237a2b..2a307f890 100644 --- a/docs/examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc +++ b/docs/examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc @@ -1,12 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-rest.asciidoc:381 +// esql/esql-rest.asciidoc:384 [source, python] ---- resp = client.esql.async_query_get( id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=", wait_for_completion_timeout="30s", - body=None, ) print(resp) ---- diff --git a/docs/examples/2b1c560f00d9bcf5caaf56c03f6b5962.asciidoc b/docs/examples/2b1c560f00d9bcf5caaf56c03f6b5962.asciidoc index 5027a5dcb..d7c29ec7b 100644 --- a/docs/examples/2b1c560f00d9bcf5caaf56c03f6b5962.asciidoc +++ b/docs/examples/2b1c560f00d9bcf5caaf56c03f6b5962.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connector-sync-jobs-api.asciidoc:78 +// connector/apis/list-connector-sync-jobs-api.asciidoc:85 [source, python] ---- diff --git a/docs/examples/2b5c69778eb3daba9fbd7242bcc2daf9.asciidoc b/docs/examples/2b5c69778eb3daba9fbd7242bcc2daf9.asciidoc index d8dd88c98..9ada8f2a3 100644 --- a/docs/examples/2b5c69778eb3daba9fbd7242bcc2daf9.asciidoc +++ b/docs/examples/2b5c69778eb3daba9fbd7242bcc2daf9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/query-api-key.asciidoc:724 +// rest-api/security/query-api-key.asciidoc:729 [source, python] ---- diff --git a/docs/examples/2b7687e3d7c06824950e00618c297864.asciidoc b/docs/examples/2b7687e3d7c06824950e00618c297864.asciidoc index c9652cf82..6c9103348 100644 --- a/docs/examples/2b7687e3d7c06824950e00618c297864.asciidoc +++ b/docs/examples/2b7687e3d7c06824950e00618c297864.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/resolve-cluster.asciidoc:141 +// indices/resolve-cluster.asciidoc:205 [source, python] ---- diff --git a/docs/examples/2bacdcb278705d944f367cfb984cf4d2.asciidoc b/docs/examples/2bacdcb278705d944f367cfb984cf4d2.asciidoc index 3d9506a77..e5f183126 100644 --- a/docs/examples/2bacdcb278705d944f367cfb984cf4d2.asciidoc +++ b/docs/examples/2bacdcb278705d944f367cfb984cf4d2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:30 +// search/search-your-data/sort-search-results.asciidoc:32 [source, python] ---- diff --git a/docs/examples/2bb41b0b4876ce98cd0cd8fb6d337f18.asciidoc b/docs/examples/2bb41b0b4876ce98cd0cd8fb6d337f18.asciidoc deleted file mode 100644 index 64dfcb7b5..000000000 --- a/docs/examples/2bb41b0b4876ce98cd0cd8fb6d337f18.asciidoc +++ /dev/null @@ -1,16 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// migration/transient-settings-migration-guide.asciidoc:64 - -[source, python] ----- -resp = client.cluster.put_settings( - persistent={ - "cluster.indices.close.enable": False, - "indices.recovery.max_bytes_per_sec": "50mb" - }, - transient={ - "*": None - }, -) -print(resp) ----- diff --git a/docs/examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc b/docs/examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc new file mode 100644 index 000000000..fa2d8bedb --- /dev/null +++ b/docs/examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc @@ -0,0 +1,77 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/passthrough.asciidoc:11 + +[source, python] +---- +resp = client.indices.create( + index="my-index-000001", + mappings={ + "properties": { + "attributes": { + "type": "passthrough", + "priority": 10, + "properties": { + "id": { + "type": "keyword" + } + } + } + } + }, +) +print(resp) + +resp1 = client.index( + index="my-index-000001", + id="1", + document={ + "attributes": { + "id": "foo", + "zone": 10 + } + }, +) +print(resp1) + +resp2 = client.search( + index="my-index-000001", + query={ + "bool": { + "must": [ + { + "match": { + "id": "foo" + } + }, + { + "match": { + "zone": 10 + } + } + ] + } + }, +) +print(resp2) + +resp3 = client.search( + index="my-index-000001", + query={ + "bool": { + "must": [ + { + "match": { + "attributes.id": "foo" + } + }, + { + "match": { + "attributes.zone": 10 + } + } + ] + } + }, +) +print(resp3) +---- diff --git a/docs/examples/2c0dbdcf400cde5d36f7c9e6c1101011.asciidoc b/docs/examples/2c0dbdcf400cde5d36f7c9e6c1101011.asciidoc index f2ff73eba..412da48fc 100644 --- a/docs/examples/2c0dbdcf400cde5d36f7c9e6c1101011.asciidoc +++ b/docs/examples/2c0dbdcf400cde5d36f7c9e6c1101011.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/health.asciidoc:101 +// cat/health.asciidoc:107 [source, python] ---- diff --git a/docs/examples/2c1e16e9ac24cfea979af2a69900d3c2.asciidoc b/docs/examples/2c1e16e9ac24cfea979af2a69900d3c2.asciidoc index 81f979d28..4b9bf1e58 100644 --- a/docs/examples/2c1e16e9ac24cfea979af2a69900d3c2.asciidoc +++ b/docs/examples/2c1e16e9ac24cfea979af2a69900d3c2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/put-synonym-rule.asciidoc:107 +// synonyms/apis/put-synonym-rule.asciidoc:113 [source, python] ---- diff --git a/docs/examples/2c3dff44904d3d73ff47f1afe89c7f86.asciidoc b/docs/examples/2c3dff44904d3d73ff47f1afe89c7f86.asciidoc index 83f9a5add..6770b543c 100644 --- a/docs/examples/2c3dff44904d3d73ff47f1afe89c7f86.asciidoc +++ b/docs/examples/2c3dff44904d3d73ff47f1afe89c7f86.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:369 +// docs/update-by-query.asciidoc:375 [source, python] ---- diff --git a/docs/examples/2c44657adf550b8ade5cf5334106d38b.asciidoc b/docs/examples/2c44657adf550b8ade5cf5334106d38b.asciidoc index 6b4e8588e..baf7c4d24 100644 --- a/docs/examples/2c44657adf550b8ade5cf5334106d38b.asciidoc +++ b/docs/examples/2c44657adf550b8ade5cf5334106d38b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1406 +// mapping/runtime.asciidoc:1404 [source, python] ---- diff --git a/docs/examples/2c602b4ee8f22cda2cdf19bad31da0af.asciidoc b/docs/examples/2c602b4ee8f22cda2cdf19bad31da0af.asciidoc index 1aedc5929..b799fcc28 100644 --- a/docs/examples/2c602b4ee8f22cda2cdf19bad31da0af.asciidoc +++ b/docs/examples/2c602b4ee8f22cda2cdf19bad31da0af.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster.asciidoc:53 +// cluster.asciidoc:59 [source, python] ---- diff --git a/docs/examples/2c86840a46242a38cf82024a9321be46.asciidoc b/docs/examples/2c86840a46242a38cf82024a9321be46.asciidoc new file mode 100644 index 000000000..b377f60c6 --- /dev/null +++ b/docs/examples/2c86840a46242a38cf82024a9321be46.asciidoc @@ -0,0 +1,28 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/getting-started.asciidoc:362 + +[source, python] +---- +resp = client.indices.create( + index="my-explicit-mappings-books", + mappings={ + "dynamic": False, + "properties": { + "name": { + "type": "text" + }, + "author": { + "type": "text" + }, + "release_date": { + "type": "date", + "format": "yyyy-MM-dd" + }, + "page_count": { + "type": "integer" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/2d0244c020075595acb625aa5ba8f455.asciidoc b/docs/examples/2d0244c020075595acb625aa5ba8f455.asciidoc new file mode 100644 index 000000000..483a812fc --- /dev/null +++ b/docs/examples/2d0244c020075595acb625aa5ba8f455.asciidoc @@ -0,0 +1,38 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/fields/synthetic-source.asciidoc:253 + +[source, python] +---- +resp = client.index( + index="idx_keep", + id="1", + document={ + "path": { + "to": [ + { + "foo": [ + 3, + 2, + 1 + ] + }, + { + "foo": [ + 30, + 20, + 10 + ] + } + ], + "bar": "baz" + }, + "ids": [ + 200, + 100, + 300, + 100 + ] + }, +) +print(resp) +---- diff --git a/docs/examples/2d150ff3b6b991b58fea6aa5cc669aa3.asciidoc b/docs/examples/2d150ff3b6b991b58fea6aa5cc669aa3.asciidoc index 88454fbda..2c16c93b6 100644 --- a/docs/examples/2d150ff3b6b991b58fea6aa5cc669aa3.asciidoc +++ b/docs/examples/2d150ff3b6b991b58fea6aa5cc669aa3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/match-phrase-query.asciidoc:30 +// query-dsl/match-phrase-query.asciidoc:66 [source, python] ---- diff --git a/docs/examples/2d60e3bdfee7afbddee149f40450b8b5.asciidoc b/docs/examples/2d60e3bdfee7afbddee149f40450b8b5.asciidoc index 4c868c678..cdd7b1711 100644 --- a/docs/examples/2d60e3bdfee7afbddee149f40450b8b5.asciidoc +++ b/docs/examples/2d60e3bdfee7afbddee149f40450b8b5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/validate.asciidoc:143 +// search/validate.asciidoc:149 [source, python] ---- diff --git a/docs/examples/2d8fcb03de417a71e7888bbdd948a692.asciidoc b/docs/examples/2d8fcb03de417a71e7888bbdd948a692.asciidoc index bc202ff06..7d6b79a11 100644 --- a/docs/examples/2d8fcb03de417a71e7888bbdd948a692.asciidoc +++ b/docs/examples/2d8fcb03de417a71e7888bbdd948a692.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/transforms.asciidoc:191 +// cat/transforms.asciidoc:197 [source, python] ---- diff --git a/docs/examples/2de6885bacb8769b8f22dce253c96b0c.asciidoc b/docs/examples/2de6885bacb8769b8f22dce253c96b0c.asciidoc index 4b1cfdc52..db56adc49 100644 --- a/docs/examples/2de6885bacb8769b8f22dce253c96b0c.asciidoc +++ b/docs/examples/2de6885bacb8769b8f22dce253c96b0c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/intervals-query.asciidoc:343 +// query-dsl/intervals-query.asciidoc:424 [source, python] ---- diff --git a/docs/examples/2e09666d3ad5ad9afc22763ee6e97a2b.asciidoc b/docs/examples/2e09666d3ad5ad9afc22763ee6e97a2b.asciidoc index 26fb74ccc..f99fbc33a 100644 --- a/docs/examples/2e09666d3ad5ad9afc22763ee6e97a2b.asciidoc +++ b/docs/examples/2e09666d3ad5ad9afc22763ee6e97a2b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-put.asciidoc:155 +// slm/apis/slm-put.asciidoc:160 [source, python] ---- diff --git a/docs/examples/2e36fe22051a47e052e349854d9948b9.asciidoc b/docs/examples/2e36fe22051a47e052e349854d9948b9.asciidoc index 84d55190c..271a14e94 100644 --- a/docs/examples/2e36fe22051a47e052e349854d9948b9.asciidoc +++ b/docs/examples/2e36fe22051a47e052e349854d9948b9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/explain.asciidoc:192 +// search/explain.asciidoc:198 [source, python] ---- diff --git a/docs/examples/2e7844477b41fcfa9efefee4ec0e7101.asciidoc b/docs/examples/2e7844477b41fcfa9efefee4ec0e7101.asciidoc new file mode 100644 index 000000000..04f8c55ea --- /dev/null +++ b/docs/examples/2e7844477b41fcfa9efefee4ec0e7101.asciidoc @@ -0,0 +1,45 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/search-using-query-rules.asciidoc:241 + +[source, python] +---- +resp = client.search( + index="my-index-000001", + retriever={ + "rule": { + "match_criteria": { + "query_string": "puggles", + "user_country": "us" + }, + "ruleset_ids": [ + "my-ruleset" + ], + "retriever": { + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "query_string": { + "query": "pugs" + } + } + } + }, + { + "standard": { + "query": { + "query_string": { + "query": "puggles" + } + } + } + } + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/2e796e5ca59768d4426abbf9a049db3e.asciidoc b/docs/examples/2e796e5ca59768d4426abbf9a049db3e.asciidoc index 11dd4351b..bdcc4a2a4 100644 --- a/docs/examples/2e796e5ca59768d4426abbf9a049db3e.asciidoc +++ b/docs/examples/2e796e5ca59768d4426abbf9a049db3e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/split-index.asciidoc:169 +// indices/split-index.asciidoc:175 [source, python] ---- diff --git a/docs/examples/2e7f4b9be999422a12abb680572b13c8.asciidoc b/docs/examples/2e7f4b9be999422a12abb680572b13c8.asciidoc index 14b98a120..594fdbfb6 100644 --- a/docs/examples/2e7f4b9be999422a12abb680572b13c8.asciidoc +++ b/docs/examples/2e7f4b9be999422a12abb680572b13c8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/get-lifecycle.asciidoc:76 +// ilm/apis/get-lifecycle.asciidoc:82 [source, python] ---- diff --git a/docs/examples/2ee002e60bd7a38d466e5f0eb0c38946.asciidoc b/docs/examples/2ee002e60bd7a38d466e5f0eb0c38946.asciidoc index 0da4d008c..6fd68fa15 100644 --- a/docs/examples/2ee002e60bd7a38d466e5f0eb0c38946.asciidoc +++ b/docs/examples/2ee002e60bd7a38d466e5f0eb0c38946.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:373 +// alias.asciidoc:375 [source, python] ---- diff --git a/docs/examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc b/docs/examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc deleted file mode 100644 index 5f4e810a8..000000000 --- a/docs/examples/2f07b81fd47ec3b074242a760f0c4e9e.asciidoc +++ /dev/null @@ -1,13 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// index-modules/slowlog.asciidoc:149 - -[source, python] ----- -resp = client.indices.put_settings( - index="my-index-000001", - settings={ - "index.indexing.slowlog.include.user": True - }, -) -print(resp) ----- diff --git a/docs/examples/2f0b2181c434a879a23b4643bdd92575.asciidoc b/docs/examples/2f0b2181c434a879a23b4643bdd92575.asciidoc index 67cf5f704..31b77bbc0 100644 --- a/docs/examples/2f0b2181c434a879a23b4643bdd92575.asciidoc +++ b/docs/examples/2f0b2181c434a879a23b4643bdd92575.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-settings.asciidoc:76 +// indices/get-settings.asciidoc:82 [source, python] ---- diff --git a/docs/examples/2f2580ea420e1836d922fe48fa8ada97.asciidoc b/docs/examples/2f2580ea420e1836d922fe48fa8ada97.asciidoc index 403ea20b7..e64a402cb 100644 --- a/docs/examples/2f2580ea420e1836d922fe48fa8ada97.asciidoc +++ b/docs/examples/2f2580ea420e1836d922fe48fa8ada97.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/delete-auto-follow-pattern.asciidoc:33 +// ccr/apis/auto-follow/delete-auto-follow-pattern.asciidoc:39 [source, python] ---- diff --git a/docs/examples/2f2fd35905feef0b561c05d70c7064c1.asciidoc b/docs/examples/2f2fd35905feef0b561c05d70c7064c1.asciidoc index 98ad01d8c..d7bf20ff3 100644 --- a/docs/examples/2f2fd35905feef0b561c05d70c7064c1.asciidoc +++ b/docs/examples/2f2fd35905feef0b561c05d70c7064c1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// migration/migrate_8_0/migrate_to_java_time.asciidoc:239 +// mapping/dynamic/templates.asciidoc:570 [source, python] ---- diff --git a/docs/examples/2f67db5e4d6c958258c3d70fb2d0b1c8.asciidoc b/docs/examples/2f67db5e4d6c958258c3d70fb2d0b1c8.asciidoc deleted file mode 100644 index 00612b5df..000000000 --- a/docs/examples/2f67db5e4d6c958258c3d70fb2d0b1c8.asciidoc +++ /dev/null @@ -1,13 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// migration/migrate_8_0/index-setting-changes.asciidoc:48 - -[source, python] ----- -resp = client.indices.put_settings( - index="my-index-000001", - settings={ - "index.merge.policy.max_merge_at_once_explicit": None - }, -) -print(resp) ----- diff --git a/docs/examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc b/docs/examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc new file mode 100644 index 000000000..a5cb08edb --- /dev/null +++ b/docs/examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/semantic-text.asciidoc:242 + +[source, python] +---- +resp = client.indices.create( + index="test-index", + mappings={ + "properties": { + "source_field": { + "type": "text", + "fields": { + "infer_field": { + "type": "semantic_text", + "inference_id": ".elser-2-elasticsearch" + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/2f98924c3d593ea2b60edb9cef5bee22.asciidoc b/docs/examples/2f98924c3d593ea2b60edb9cef5bee22.asciidoc index 6b434ce62..e811461d4 100644 --- a/docs/examples/2f98924c3d593ea2b60edb9cef5bee22.asciidoc +++ b/docs/examples/2f98924c3d593ea2b60edb9cef5bee22.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:483 +// how-to/size-your-shards.asciidoc:484 [source, python] ---- diff --git a/docs/examples/2f9ee29fe49f7d206a41212aa5945296.asciidoc b/docs/examples/2f9ee29fe49f7d206a41212aa5945296.asciidoc new file mode 100644 index 000000000..ec5c59702 --- /dev/null +++ b/docs/examples/2f9ee29fe49f7d206a41212aa5945296.asciidoc @@ -0,0 +1,22 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/create-index-from-source.asciidoc:117 + +[source, python] +---- +resp = client.indices.create_from( + source="my-index", + dest="my-new-index", + create_from={ + "settings_override": { + "index": { + "blocks.write": None, + "blocks.read": None, + "blocks.read_only": None, + "blocks.read_only_allow_delete": None, + "blocks.metadata": None + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/2fa7ded8515b32f26c54394ea598f573.asciidoc b/docs/examples/2fa7ded8515b32f26c54394ea598f573.asciidoc index 4dcbb9d05..bc1835a56 100644 --- a/docs/examples/2fa7ded8515b32f26c54394ea598f573.asciidoc +++ b/docs/examples/2fa7ded8515b32f26c54394ea598f573.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/index-templates.asciidoc:120 +// indices/index-templates.asciidoc:123 [source, python] ---- diff --git a/docs/examples/2fc80a2ad1ca8b2dcb13ed1895b8e861.asciidoc b/docs/examples/2fc80a2ad1ca8b2dcb13ed1895b8e861.asciidoc index 822d66bd1..f72ef744d 100644 --- a/docs/examples/2fc80a2ad1ca8b2dcb13ed1895b8e861.asciidoc +++ b/docs/examples/2fc80a2ad1ca8b2dcb13ed1895b8e861.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/update-settings.asciidoc:123 +// cluster/update-settings.asciidoc:128 [source, python] ---- diff --git a/docs/examples/2fe28d9a91b3081a9ec4601af8fb7b1c.asciidoc b/docs/examples/2fe28d9a91b3081a9ec4601af8fb7b1c.asciidoc index 08dfe7896..0c2613078 100644 --- a/docs/examples/2fe28d9a91b3081a9ec4601af8fb7b1c.asciidoc +++ b/docs/examples/2fe28d9a91b3081a9ec4601af8fb7b1c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:710 +// docs/update-by-query.asciidoc:716 [source, python] ---- diff --git a/docs/examples/2fea3e324939cc7e9c396964aeee7111.asciidoc b/docs/examples/2fea3e324939cc7e9c396964aeee7111.asciidoc index 339421498..aee1dc023 100644 --- a/docs/examples/2fea3e324939cc7e9c396964aeee7111.asciidoc +++ b/docs/examples/2fea3e324939cc7e9c396964aeee7111.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/match-query.asciidoc:252 +// query-dsl/match-query.asciidoc:256 [source, python] ---- diff --git a/docs/examples/2fee452baff92b409cbfc8d71eb5fc0e.asciidoc b/docs/examples/2fee452baff92b409cbfc8d71eb5fc0e.asciidoc index cb576f087..92af294a0 100644 --- a/docs/examples/2fee452baff92b409cbfc8d71eb5fc0e.asciidoc +++ b/docs/examples/2fee452baff92b409cbfc8d71eb5fc0e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/nodes.asciidoc:352 +// cat/nodes.asciidoc:361 [source, python] ---- diff --git a/docs/examples/300576666769b78fa6fa26b232837f81.asciidoc b/docs/examples/300576666769b78fa6fa26b232837f81.asciidoc index e0c8d0f52..45f240604 100644 --- a/docs/examples/300576666769b78fa6fa26b232837f81.asciidoc +++ b/docs/examples/300576666769b78fa6fa26b232837f81.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/get-autoscaling-capacity.asciidoc:16 +// autoscaling/apis/get-autoscaling-capacity.asciidoc:22 [source, python] ---- diff --git a/docs/examples/30abc76a39e551f4b52c65002bb6405d.asciidoc b/docs/examples/30abc76a39e551f4b52c65002bb6405d.asciidoc index b126f55e5..71a436af7 100644 --- a/docs/examples/30abc76a39e551f4b52c65002bb6405d.asciidoc +++ b/docs/examples/30abc76a39e551f4b52c65002bb6405d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:279 +// rest-api/security/get-api-keys.asciidoc:285 [source, python] ---- diff --git a/docs/examples/30d051f534aeb884176eedb2c11dac85.asciidoc b/docs/examples/30d051f534aeb884176eedb2c11dac85.asciidoc new file mode 100644 index 000000000..7d95ecb4e --- /dev/null +++ b/docs/examples/30d051f534aeb884176eedb2c11dac85.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-elasticsearch.asciidoc:176 + +[source, python] +---- +resp = client.inference.put( + task_type="rerank", + inference_id="my-elastic-rerank", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "model_id": ".rerank-v1", + "num_threads": 1, + "adaptive_allocations": { + "enabled": True, + "min_number_of_allocations": 1, + "max_number_of_allocations": 4 + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/30f3e3b9df46afd12e68bc71f18483b4.asciidoc b/docs/examples/30f3e3b9df46afd12e68bc71f18483b4.asciidoc index 7b431ccc1..594027bb3 100644 --- a/docs/examples/30f3e3b9df46afd12e68bc71f18483b4.asciidoc +++ b/docs/examples/30f3e3b9df46afd12e68bc71f18483b4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:125 +// indices/put-mapping.asciidoc:131 [source, python] ---- diff --git a/docs/examples/5f8d90515995a5eee189d722abe3b111.asciidoc b/docs/examples/310bdfb0d0d75bac7bff036a3fe51d4d.asciidoc similarity index 91% rename from docs/examples/5f8d90515995a5eee189d722abe3b111.asciidoc rename to docs/examples/310bdfb0d0d75bac7bff036a3fe51d4d.asciidoc index 42081a588..502c80666 100644 --- a/docs/examples/5f8d90515995a5eee189d722abe3b111.asciidoc +++ b/docs/examples/310bdfb0d0d75bac7bff036a3fe51d4d.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="azure_ai_studio_embeddings", + id="azure_ai_studio_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc b/docs/examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc new file mode 100644 index 000000000..367c6cad1 --- /dev/null +++ b/docs/examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc @@ -0,0 +1,30 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/search-multiple-indices.asciidoc:51 + +[source, python] +---- +resp = client.search( + index="my-index-*", + query={ + "bool": { + "must": [ + { + "match": { + "user.id": "kimchy" + } + } + ], + "must_not": [ + { + "terms": { + "_index": [ + "my-index-01" + ] + } + } + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/31ab4ec26176857280af630bf84a2823.asciidoc b/docs/examples/31ab4ec26176857280af630bf84a2823.asciidoc index 46e965fdf..fbbf52f58 100644 --- a/docs/examples/31ab4ec26176857280af630bf84a2823.asciidoc +++ b/docs/examples/31ab4ec26176857280af630bf84a2823.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/saml-sp-metadata.asciidoc:42 +// rest-api/security/saml-sp-metadata.asciidoc:48 [source, python] ---- diff --git a/docs/examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc b/docs/examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc deleted file mode 100644 index d76914bba..000000000 --- a/docs/examples/31bc93e429ad0de11dd2dd231e8f2c5e.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// indices/apis/unfreeze.asciidoc:51 - -[source, python] ----- -resp = client.indices.unfreeze( - index="my-index-000001", -) -print(resp) ----- diff --git a/docs/examples/31f4400716500149cccbc19aa06bff66.asciidoc b/docs/examples/31f4400716500149cccbc19aa06bff66.asciidoc index 0caf5ace5..65b6cb5b3 100644 --- a/docs/examples/31f4400716500149cccbc19aa06bff66.asciidoc +++ b/docs/examples/31f4400716500149cccbc19aa06bff66.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/dangling-index-delete.asciidoc:13 +// indices/dangling-index-delete.asciidoc:19 [source, python] ---- diff --git a/docs/examples/320645d771e952af2a67bb7445c3688d.asciidoc b/docs/examples/320645d771e952af2a67bb7445c3688d.asciidoc index f29deb5b7..4afe0c1b7 100644 --- a/docs/examples/320645d771e952af2a67bb7445c3688d.asciidoc +++ b/docs/examples/320645d771e952af2a67bb7445c3688d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1647 +// analysis/analyzers/lang-analyzer.asciidoc:1648 [source, python] ---- diff --git a/docs/examples/32123981430e5a8b34fe14314fc48429.asciidoc b/docs/examples/32123981430e5a8b34fe14314fc48429.asciidoc index 0b6646b9d..311b84ef4 100644 --- a/docs/examples/32123981430e5a8b34fe14314fc48429.asciidoc +++ b/docs/examples/32123981430e5a8b34fe14314fc48429.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/search-multiple-indices.asciidoc:11 +// search/search-your-data/search-multiple-indices.asciidoc:17 [source, python] ---- diff --git a/docs/examples/3218f8ccd59c8c90349816e0428e8fb8.asciidoc b/docs/examples/3218f8ccd59c8c90349816e0428e8fb8.asciidoc index cdc58299a..f44248852 100644 --- a/docs/examples/3218f8ccd59c8c90349816e0428e8fb8.asciidoc +++ b/docs/examples/3218f8ccd59c8c90349816e0428e8fb8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:92 +// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:99 [source, python] ---- diff --git a/docs/examples/327466380bcd55361973b4a96c6dccb2.asciidoc b/docs/examples/327466380bcd55361973b4a96c6dccb2.asciidoc index 307952a06..4d6c43729 100644 --- a/docs/examples/327466380bcd55361973b4a96c6dccb2.asciidoc +++ b/docs/examples/327466380bcd55361973b4a96c6dccb2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1697 +// analysis/analyzers/lang-analyzer.asciidoc:1698 [source, python] ---- diff --git a/docs/examples/32b7963c5cabbe9cc7d15da62f5edda9.asciidoc b/docs/examples/32b7963c5cabbe9cc7d15da62f5edda9.asciidoc index bb4f229f4..8ab95653f 100644 --- a/docs/examples/32b7963c5cabbe9cc7d15da62f5edda9.asciidoc +++ b/docs/examples/32b7963c5cabbe9cc7d15da62f5edda9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-user-profile-data.asciidoc:118 +// rest-api/security/update-user-profile-data.asciidoc:124 [source, python] ---- diff --git a/docs/examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc b/docs/examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc new file mode 100644 index 000000000..52477014c --- /dev/null +++ b/docs/examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// ilm/actions/ilm-searchable-snapshot.asciidoc:130 + +[source, python] +---- +resp = client.ilm.put_lifecycle( + name="my_policy", + policy={ + "phases": { + "hot": { + "actions": { + "rollover": { + "max_primary_shard_size": "50gb" + }, + "searchable_snapshot": { + "snapshot_repository": "backing_repo", + "replicate_for": "14d" + } + } + }, + "delete": { + "min_age": "28d", + "actions": { + "delete": {} + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/23af230e824f48b9cd56a4cf973d788c.asciidoc b/docs/examples/3312c82f81816bf76629db9582991812.asciidoc similarity index 79% rename from docs/examples/23af230e824f48b9cd56a4cf973d788c.asciidoc rename to docs/examples/3312c82f81816bf76629db9582991812.asciidoc index 167bf7db0..15244e685 100644 --- a/docs/examples/23af230e824f48b9cd56a4cf973d788c.asciidoc +++ b/docs/examples/3312c82f81816bf76629db9582991812.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// index-modules/slowlog.asciidoc:31 +// index-modules/slowlog.asciidoc:135 [source, python] ---- @@ -13,7 +13,8 @@ resp = client.indices.put_settings( "index.search.slowlog.threshold.fetch.warn": "1s", "index.search.slowlog.threshold.fetch.info": "800ms", "index.search.slowlog.threshold.fetch.debug": "500ms", - "index.search.slowlog.threshold.fetch.trace": "200ms" + "index.search.slowlog.threshold.fetch.trace": "200ms", + "index.search.slowlog.include.user": True }, ) print(resp) diff --git a/docs/examples/3337c817ebd438254505a31e91c91724.asciidoc b/docs/examples/3337c817ebd438254505a31e91c91724.asciidoc index 5c223af15..c6182f37d 100644 --- a/docs/examples/3337c817ebd438254505a31e91c91724.asciidoc +++ b/docs/examples/3337c817ebd438254505a31e91c91724.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-data-stream.asciidoc:71 +// indices/get-data-stream.asciidoc:77 [source, python] ---- diff --git a/docs/examples/3341d3bbb53052447a37c92a04c14b70.asciidoc b/docs/examples/3341d3bbb53052447a37c92a04c14b70.asciidoc index b9d4f716e..fa4c91226 100644 --- a/docs/examples/3341d3bbb53052447a37c92a04c14b70.asciidoc +++ b/docs/examples/3341d3bbb53052447a37c92a04c14b70.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:351 +// scripting/using.asciidoc:356 [source, python] ---- diff --git a/docs/examples/d3a558ef226e9dccc1c7c61e1167547f.asciidoc b/docs/examples/334811cfceb6858aeec5b3461717dd63.asciidoc similarity index 85% rename from docs/examples/d3a558ef226e9dccc1c7c61e1167547f.asciidoc rename to docs/examples/334811cfceb6858aeec5b3461717dd63.asciidoc index 0ed88bba1..cf1347fab 100644 --- a/docs/examples/d3a558ef226e9dccc1c7c61e1167547f.asciidoc +++ b/docs/examples/334811cfceb6858aeec5b3461717dd63.asciidoc @@ -1,11 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/geoip.asciidoc:186 +// ingest/processors/geoip.asciidoc:188 [source, python] ---- resp = client.ingest.put_pipeline( id="geoip", - description="Add geoip info", + description="Add ip geolocation info", processors=[ { "geoip": { diff --git a/docs/examples/33610800d9de3c3e6d6b3c611ace7330.asciidoc b/docs/examples/33610800d9de3c3e6d6b3c611ace7330.asciidoc index 06f9cf273..fa7a72bbe 100644 --- a/docs/examples/33610800d9de3c3e6d6b3c611ace7330.asciidoc +++ b/docs/examples/33610800d9de3c3e6d6b3c611ace7330.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:128 +// cluster/tasks.asciidoc:134 [source, python] ---- diff --git a/docs/examples/3386fe07e90844dbcdbbe7c07f09e04a.asciidoc b/docs/examples/3386fe07e90844dbcdbbe7c07f09e04a.asciidoc index d1902818c..a698a9b98 100644 --- a/docs/examples/3386fe07e90844dbcdbbe7c07f09e04a.asciidoc +++ b/docs/examples/3386fe07e90844dbcdbbe7c07f09e04a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/delete-synonyms-set.asciidoc:61 +// synonyms/apis/delete-synonyms-set.asciidoc:66 [source, python] ---- diff --git a/docs/examples/339c4e5af9f9069ad9912aa574488b59.asciidoc b/docs/examples/339c4e5af9f9069ad9912aa574488b59.asciidoc new file mode 100644 index 000000000..f0f281db4 --- /dev/null +++ b/docs/examples/339c4e5af9f9069ad9912aa574488b59.asciidoc @@ -0,0 +1,70 @@ +// This file is autogenerated, DO NOT EDIT +// vectors/vector-functions.asciidoc:346 + +[source, python] +---- +resp = client.indices.create( + index="my-index-bit-vectors", + mappings={ + "properties": { + "my_dense_vector": { + "type": "dense_vector", + "index": False, + "element_type": "bit", + "dims": 40 + } + } + }, +) +print(resp) + +resp1 = client.index( + index="my-index-bit-vectors", + id="1", + document={ + "my_dense_vector": [ + 8, + 5, + -15, + 1, + -7 + ] + }, +) +print(resp1) + +resp2 = client.index( + index="my-index-bit-vectors", + id="2", + document={ + "my_dense_vector": [ + -1, + 115, + -3, + 4, + -128 + ] + }, +) +print(resp2) + +resp3 = client.index( + index="my-index-bit-vectors", + id="3", + document={ + "my_dense_vector": [ + 2, + 18, + -5, + 0, + -124 + ] + }, +) +print(resp3) + +resp4 = client.indices.refresh( + index="my-index-bit-vectors", +) +print(resp4) +---- diff --git a/docs/examples/33d480fc6812ada75756cf5337bc9092.asciidoc b/docs/examples/33d480fc6812ada75756cf5337bc9092.asciidoc index b2a058e49..221597579 100644 --- a/docs/examples/33d480fc6812ada75756cf5337bc9092.asciidoc +++ b/docs/examples/33d480fc6812ada75756cf5337bc9092.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connector-sync-jobs-api.asciidoc:57 +// connector/apis/list-connector-sync-jobs-api.asciidoc:64 [source, python] ---- diff --git a/docs/examples/342ddf9121aeddd82fea2464665e25da.asciidoc b/docs/examples/342ddf9121aeddd82fea2464665e25da.asciidoc index 13694ba05..bbd82aa9d 100644 --- a/docs/examples/342ddf9121aeddd82fea2464665e25da.asciidoc +++ b/docs/examples/342ddf9121aeddd82fea2464665e25da.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/create-connector-api.asciidoc:20 +// connector/apis/create-connector-api.asciidoc:27 [source, python] ---- diff --git a/docs/examples/346f28d82acb5427c304aa574fea0008.asciidoc b/docs/examples/346f28d82acb5427c304aa574fea0008.asciidoc index a0683551d..efd1f5771 100644 --- a/docs/examples/346f28d82acb5427c304aa574fea0008.asciidoc +++ b/docs/examples/346f28d82acb5427c304aa574fea0008.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1846 +// analysis/analyzers/lang-analyzer.asciidoc:1847 [source, python] ---- diff --git a/docs/examples/3477a89d869b1f7f72d50c2ca86c4679.asciidoc b/docs/examples/3477a89d869b1f7f72d50c2ca86c4679.asciidoc index b92aa95bf..8ecac553a 100644 --- a/docs/examples/3477a89d869b1f7f72d50c2ca86c4679.asciidoc +++ b/docs/examples/3477a89d869b1f7f72d50c2ca86c4679.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/activate-watch.asciidoc:82 +// rest-api/watcher/activate-watch.asciidoc:88 [source, python] ---- diff --git a/docs/examples/34be27141e3a476c138546190101c8bc.asciidoc b/docs/examples/34be27141e3a476c138546190101c8bc.asciidoc index 3cee3576c..f5c1d92f1 100644 --- a/docs/examples/34be27141e3a476c138546190101c8bc.asciidoc +++ b/docs/examples/34be27141e3a476c138546190101c8bc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-vector-tile-api.asciidoc:33 +// search/search-vector-tile-api.asciidoc:38 [source, python] ---- diff --git a/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc b/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc index f983391dd..2aca9fdab 100644 --- a/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc +++ b/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// health/health.asciidoc:480 +// health/health.asciidoc:486 [source, python] ---- diff --git a/docs/examples/3545261682af72f4bee57f2bac0a9590.asciidoc b/docs/examples/3545261682af72f4bee57f2bac0a9590.asciidoc index 7085907ee..f1682e1f6 100644 --- a/docs/examples/3545261682af72f4bee57f2bac0a9590.asciidoc +++ b/docs/examples/3545261682af72f4bee57f2bac0a9590.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shard-stores.asciidoc:150 +// indices/shard-stores.asciidoc:156 [source, python] ---- diff --git a/docs/examples/355d0ee2fcb6c1fc403c6267f710e25a.asciidoc b/docs/examples/355d0ee2fcb6c1fc403c6267f710e25a.asciidoc index 95c58cd5e..b6122821f 100644 --- a/docs/examples/355d0ee2fcb6c1fc403c6267f710e25a.asciidoc +++ b/docs/examples/355d0ee2fcb6c1fc403c6267f710e25a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:716 +// docs/reindex.asciidoc:722 [source, python] ---- diff --git a/docs/examples/35a272df8c919a12d7c3106a18245748.asciidoc b/docs/examples/35a272df8c919a12d7c3106a18245748.asciidoc index db4d626eb..93c86a953 100644 --- a/docs/examples/35a272df8c919a12d7c3106a18245748.asciidoc +++ b/docs/examples/35a272df8c919a12d7c3106a18245748.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/infer-trained-model.asciidoc:849 +// ml/trained-models/apis/infer-trained-model.asciidoc:956 [source, python] ---- diff --git a/docs/examples/35be136ba9df7474a5521631e2a385b1.asciidoc b/docs/examples/35be136ba9df7474a5521631e2a385b1.asciidoc index 890b4dc77..5990b49a5 100644 --- a/docs/examples/35be136ba9df7474a5521631e2a385b1.asciidoc +++ b/docs/examples/35be136ba9df7474a5521631e2a385b1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/lifecycle/apis/explain-lifecycle.asciidoc:50 +// data-streams/lifecycle/apis/explain-lifecycle.asciidoc:56 [source, python] ---- diff --git a/docs/examples/35f892b475a1770f18328158be7039fd.asciidoc b/docs/examples/35f892b475a1770f18328158be7039fd.asciidoc index bd69bcdd1..2ae10c083 100644 --- a/docs/examples/35f892b475a1770f18328158be7039fd.asciidoc +++ b/docs/examples/35f892b475a1770f18328158be7039fd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:72 +// mapping/types/dense-vector.asciidoc:71 [source, python] ---- diff --git a/docs/examples/3608e4fcd17dd8d5f88ec9a3db2f5d89.asciidoc b/docs/examples/3608e4fcd17dd8d5f88ec9a3db2f5d89.asciidoc index 5c0875fce..c71cd49c0 100644 --- a/docs/examples/3608e4fcd17dd8d5f88ec9a3db2f5d89.asciidoc +++ b/docs/examples/3608e4fcd17dd8d5f88ec9a3db2f5d89.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/put-synonyms-set.asciidoc:83 +// synonyms/apis/put-synonyms-set.asciidoc:89 [source, python] ---- diff --git a/docs/examples/804cdf477ec829740e3d045140400c3b.asciidoc b/docs/examples/3649194a97d265a3bc758f8b38f7561e.asciidoc similarity index 69% rename from docs/examples/804cdf477ec829740e3d045140400c3b.asciidoc rename to docs/examples/3649194a97d265a3bc758f8b38f7561e.asciidoc index 61607f892..e2071f790 100644 --- a/docs/examples/804cdf477ec829740e3d045140400c3b.asciidoc +++ b/docs/examples/3649194a97d265a3bc758f8b38f7561e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-semantic-text.asciidoc:68 +// search/search-your-data/semantic-text-hybrid-search:21 [source, python] ---- @@ -8,8 +8,7 @@ resp = client.indices.create( mappings={ "properties": { "semantic_text": { - "type": "semantic_text", - "inference_id": "my-elser-endpoint" + "type": "semantic_text" }, "content": { "type": "text", diff --git a/docs/examples/365256ebdfa47b449780771d9beba8d9.asciidoc b/docs/examples/365256ebdfa47b449780771d9beba8d9.asciidoc index 0cd8f33d6..09fc5efcd 100644 --- a/docs/examples/365256ebdfa47b449780771d9beba8d9.asciidoc +++ b/docs/examples/365256ebdfa47b449780771d9beba8d9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/check-in-connector-sync-job-api.asciidoc:49 +// connector/apis/check-in-connector-sync-job-api.asciidoc:56 [source, python] ---- diff --git a/docs/examples/36792c81c053e0555407d1e83e7e054f.asciidoc b/docs/examples/36792c81c053e0555407d1e83e7e054f.asciidoc new file mode 100644 index 000000000..4941727c4 --- /dev/null +++ b/docs/examples/36792c81c053e0555407d1e83e7e054f.asciidoc @@ -0,0 +1,82 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:452 + +[source, python] +---- +resp = client.search( + index="movies", + size=10, + retriever={ + "rescorer": { + "rescore": { + "window_size": 50, + "query": { + "rescore_query": { + "script_score": { + "query": { + "match_all": {} + }, + "script": { + "source": "cosineSimilarity(params.queryVector, 'product-vector_final_stage') + 1.0", + "params": { + "queryVector": [ + -0.5, + 90, + -10, + 14.8, + -156 + ] + } + } + } + } + } + }, + "retriever": { + "rrf": { + "rank_window_size": 100, + "retrievers": [ + { + "standard": { + "query": { + "sparse_vector": { + "field": "plot_embedding", + "inference_id": "my-elser-model", + "query": "films that explore psychological depths" + } + } + } + }, + { + "standard": { + "query": { + "multi_match": { + "query": "crime", + "fields": [ + "plot", + "title" + ] + } + } + } + }, + { + "knn": { + "field": "vector", + "query_vector": [ + 10, + 22, + 77 + ], + "k": 10, + "num_candidates": 10 + } + } + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/65e892a362d940e4a74965f21c15ca09.asciidoc b/docs/examples/36ac0ef9ea63efc431580f7ade8ad53c.asciidoc similarity index 86% rename from docs/examples/65e892a362d940e4a74965f21c15ca09.asciidoc rename to docs/examples/36ac0ef9ea63efc431580f7ade8ad53c.asciidoc index 02927c0a2..5ccef54b7 100644 --- a/docs/examples/65e892a362d940e4a74965f21c15ca09.asciidoc +++ b/docs/examples/36ac0ef9ea63efc431580f7ade8ad53c.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "openai-embeddings", - "pipeline": "openai_embeddings" + "pipeline": "openai_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc b/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc index 22d10734a..d0107a261 100644 --- a/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc +++ b/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// quickstart/getting-started.asciidoc:244 +// quickstart/getting-started.asciidoc:484 [source, python] ---- diff --git a/docs/examples/36d229f734adcdab00be266a7ce038b1.asciidoc b/docs/examples/36d229f734adcdab00be266a7ce038b1.asciidoc index f4c484a27..b52adb699 100644 --- a/docs/examples/36d229f734adcdab00be266a7ce038b1.asciidoc +++ b/docs/examples/36d229f734adcdab00be266a7ce038b1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:375 +// mapping/types/dense-vector.asciidoc:404 [source, python] ---- diff --git a/docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc b/docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc index a2f05d6e8..5af3045ba 100644 --- a/docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc +++ b/docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/indices/request_cache.asciidoc:139 +// shard-request-cache.asciidoc:125 [source, python] ---- diff --git a/docs/examples/370b297ed3433577adf53e64f572d89d.asciidoc b/docs/examples/370b297ed3433577adf53e64f572d89d.asciidoc index c294fea7b..5ab7ae26d 100644 --- a/docs/examples/370b297ed3433577adf53e64f572d89d.asciidoc +++ b/docs/examples/370b297ed3433577adf53e64f572d89d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/delete-connector-sync-job-api.asciidoc:45 +// connector/apis/delete-connector-sync-job-api.asciidoc:52 [source, python] ---- diff --git a/docs/examples/371962cf63e65c10026177c6a1bad0b6.asciidoc b/docs/examples/371962cf63e65c10026177c6a1bad0b6.asciidoc index b46d30acf..6fbf2785e 100644 --- a/docs/examples/371962cf63e65c10026177c6a1bad0b6.asciidoc +++ b/docs/examples/371962cf63e65c10026177c6a1bad0b6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-start.asciidoc:41 +// tab-widgets/troubleshooting/data/start-slm.asciidoc:63 [source, python] ---- diff --git a/docs/examples/3722dad876023e0757138dd5a6d3240e.asciidoc b/docs/examples/3722dad876023e0757138dd5a6d3240e.asciidoc new file mode 100644 index 000000000..4346ba355 --- /dev/null +++ b/docs/examples/3722dad876023e0757138dd5a6d3240e.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/create-index-from-source.asciidoc:63 + +[source, python] +---- +resp = client.indices.create( + index="my-index", + settings={ + "index": { + "number_of_shards": 3, + "blocks.write": True + } + }, + mappings={ + "properties": { + "field1": { + "type": "text" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/3759ca688c4bd3c838780a9aad63258b.asciidoc b/docs/examples/3759ca688c4bd3c838780a9aad63258b.asciidoc index 4d7be2d86..3cf758d97 100644 --- a/docs/examples/3759ca688c4bd3c838780a9aad63258b.asciidoc +++ b/docs/examples/3759ca688c4bd3c838780a9aad63258b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-index-template.asciidoc:35 +// indices/get-index-template.asciidoc:41 [source, python] ---- diff --git a/docs/examples/37983daac3d9c8582583a507b3adb7f2.asciidoc b/docs/examples/37983daac3d9c8582583a507b3adb7f2.asciidoc index 2086a8afc..d1b1b1359 100644 --- a/docs/examples/37983daac3d9c8582583a507b3adb7f2.asciidoc +++ b/docs/examples/37983daac3d9c8582583a507b3adb7f2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// shutdown/apis/shutdown-delete.asciidoc:51 +// shutdown/apis/shutdown-delete.asciidoc:57 [source, python] ---- diff --git a/docs/examples/37c73410bf13429279cbc61a413957d8.asciidoc b/docs/examples/37c73410bf13429279cbc61a413957d8.asciidoc index 56fc5156b..b75a76507 100644 --- a/docs/examples/37c73410bf13429279cbc61a413957d8.asciidoc +++ b/docs/examples/37c73410bf13429279cbc61a413957d8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:557 +// how-to/size-your-shards.asciidoc:558 [source, python] ---- diff --git a/docs/examples/3819d0a5c2eed635c88e9e7bf2e81584.asciidoc b/docs/examples/3819d0a5c2eed635c88e9e7bf2e81584.asciidoc index b5ef17a87..b8fab2deb 100644 --- a/docs/examples/3819d0a5c2eed635c88e9e7bf2e81584.asciidoc +++ b/docs/examples/3819d0a5c2eed635c88e9e7bf2e81584.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/revert-snapshot.asciidoc:78 +// ml/anomaly-detection/apis/revert-snapshot.asciidoc:84 [source, python] ---- diff --git a/docs/examples/386eb7dcd3149db82605bf22c5d851bf.asciidoc b/docs/examples/386eb7dcd3149db82605bf22c5d851bf.asciidoc index ad82daded..76ae0c4fc 100644 --- a/docs/examples/386eb7dcd3149db82605bf22c5d851bf.asciidoc +++ b/docs/examples/386eb7dcd3149db82605bf22c5d851bf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/query-api-key.asciidoc:368 +// rest-api/security/query-api-key.asciidoc:373 [source, python] ---- diff --git a/docs/examples/388d3eda4f792d3fce044777739217e6.asciidoc b/docs/examples/388d3eda4f792d3fce044777739217e6.asciidoc index 14dd866c0..1e79fb553 100644 --- a/docs/examples/388d3eda4f792d3fce044777739217e6.asciidoc +++ b/docs/examples/388d3eda4f792d3fce044777739217e6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:436 +// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:442 [source, python] ---- diff --git a/docs/examples/38ba93890494bfa7beece58dffa44f98.asciidoc b/docs/examples/38ba93890494bfa7beece58dffa44f98.asciidoc deleted file mode 100644 index b82fab19a..000000000 --- a/docs/examples/38ba93890494bfa7beece58dffa44f98.asciidoc +++ /dev/null @@ -1,23 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// mapping/types/semantic-text.asciidoc:177 - -[source, python] ----- -resp = client.bulk( - index="test-index", - operations=[ - { - "update": { - "_id": "1" - } - }, - { - "doc": { - "infer_field": "updated inference field", - "source_field": "updated source field" - } - } - ], -) -print(resp) ----- diff --git a/docs/examples/38eed000de433b540116928681c520d3.asciidoc b/docs/examples/38eed000de433b540116928681c520d3.asciidoc index dc8c501d5..01aa0804e 100644 --- a/docs/examples/38eed000de433b540116928681c520d3.asciidoc +++ b/docs/examples/38eed000de433b540116928681c520d3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/preview-datafeed.asciidoc:110 +// ml/anomaly-detection/apis/preview-datafeed.asciidoc:116 [source, python] ---- diff --git a/docs/examples/38f7739f750f1411bccf511a0abaaea3.asciidoc b/docs/examples/38f7739f750f1411bccf511a0abaaea3.asciidoc index 148e2b226..047f0f243 100644 --- a/docs/examples/38f7739f750f1411bccf511a0abaaea3.asciidoc +++ b/docs/examples/38f7739f750f1411bccf511a0abaaea3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/field-caps.asciidoc:13 +// search/field-caps.asciidoc:18 [source, python] ---- diff --git a/docs/examples/3924ee252581ebb96ac0e60046125ae8.asciidoc b/docs/examples/3924ee252581ebb96ac0e60046125ae8.asciidoc index c4035e5f0..f516951de 100644 --- a/docs/examples/3924ee252581ebb96ac0e60046125ae8.asciidoc +++ b/docs/examples/3924ee252581ebb96ac0e60046125ae8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-users.asciidoc:63 +// rest-api/security/get-users.asciidoc:68 [source, python] ---- diff --git a/docs/examples/3951d7fcd7f849fa278daf342872125a.asciidoc b/docs/examples/3951d7fcd7f849fa278daf342872125a.asciidoc index 86b07b0f5..d36bff51e 100644 --- a/docs/examples/3951d7fcd7f849fa278daf342872125a.asciidoc +++ b/docs/examples/3951d7fcd7f849fa278daf342872125a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:372 +// indices/analyze.asciidoc:378 [source, python] ---- diff --git a/docs/examples/39760996f94ad34aaceaa16a5cc97993.asciidoc b/docs/examples/39760996f94ad34aaceaa16a5cc97993.asciidoc index a7560e618..7fb510cfb 100644 --- a/docs/examples/39760996f94ad34aaceaa16a5cc97993.asciidoc +++ b/docs/examples/39760996f94ad34aaceaa16a5cc97993.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// shutdown/apis/shutdown-get.asciidoc:61 +// shutdown/apis/shutdown-get.asciidoc:67 [source, python] ---- diff --git a/docs/examples/397ab5f9ea0b69ae85038bb0b9915180.asciidoc b/docs/examples/397ab5f9ea0b69ae85038bb0b9915180.asciidoc index 404236df4..a8a6d1c8b 100644 --- a/docs/examples/397ab5f9ea0b69ae85038bb0b9915180.asciidoc +++ b/docs/examples/397ab5f9ea0b69ae85038bb0b9915180.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/downsampling-ilm.asciidoc:512 +// data-streams/downsampling-dsl.asciidoc:523 [source, python] ---- diff --git a/docs/examples/398389933901b572a06a752bc780af7c.asciidoc b/docs/examples/398389933901b572a06a752bc780af7c.asciidoc index 8855fa937..9f4033e64 100644 --- a/docs/examples/398389933901b572a06a752bc780af7c.asciidoc +++ b/docs/examples/398389933901b572a06a752bc780af7c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-anthropic.asciidoc:111 +// inference/service-anthropic.asciidoc:137 [source, python] ---- diff --git a/docs/examples/39ce44333d28ed2b833722d3e3cb06f3.asciidoc b/docs/examples/39ce44333d28ed2b833722d3e3cb06f3.asciidoc index 6886f0a54..4aa468359 100644 --- a/docs/examples/39ce44333d28ed2b833722d3e3cb06f3.asciidoc +++ b/docs/examples/39ce44333d28ed2b833722d3e3cb06f3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/bool-query.asciidoc:184 +// query-dsl/bool-query.asciidoc:187 [source, python] ---- diff --git a/docs/examples/39d6f575c9458d9c941364dfd0493fa0.asciidoc b/docs/examples/39d6f575c9458d9c941364dfd0493fa0.asciidoc index fc9b88784..deee416bf 100644 --- a/docs/examples/39d6f575c9458d9c941364dfd0493fa0.asciidoc +++ b/docs/examples/39d6f575c9458d9c941364dfd0493fa0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-calendar-event.asciidoc:112 +// ml/anomaly-detection/apis/get-calendar-event.asciidoc:118 [source, python] ---- diff --git a/docs/examples/3a12feb0de224bfaaf518d95b9f516ff.asciidoc b/docs/examples/3a12feb0de224bfaaf518d95b9f516ff.asciidoc index aea9c1758..887795465 100644 --- a/docs/examples/3a12feb0de224bfaaf518d95b9f516ff.asciidoc +++ b/docs/examples/3a12feb0de224bfaaf518d95b9f516ff.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/put-watch.asciidoc:120 +// rest-api/watcher/put-watch.asciidoc:126 [source, python] ---- diff --git a/docs/examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc b/docs/examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc new file mode 100644 index 000000000..6ebfa63af --- /dev/null +++ b/docs/examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:620 + +[source, python] +---- +resp = client.search( + index=".ml-anomalies-custom-example", + size=0, + aggs={ + "job_ids": { + "terms": { + "field": "job_id", + "size": 100 + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/3a2953fd81d65118a776c87a81530e15.asciidoc b/docs/examples/3a2953fd81d65118a776c87a81530e15.asciidoc index 1264164ad..874f6e65e 100644 --- a/docs/examples/3a2953fd81d65118a776c87a81530e15.asciidoc +++ b/docs/examples/3a2953fd81d65118a776c87a81530e15.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:593 +// search/search-your-data/highlighting.asciidoc:605 [source, python] ---- diff --git a/docs/examples/3a2f37f8f32b1aa6bcfb252b9e00f904.asciidoc b/docs/examples/3a2f37f8f32b1aa6bcfb252b9e00f904.asciidoc index 8b4e3c4e5..ff19e59b7 100644 --- a/docs/examples/3a2f37f8f32b1aa6bcfb252b9e00f904.asciidoc +++ b/docs/examples/3a2f37f8f32b1aa6bcfb252b9e00f904.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// index-modules.asciidoc:95 +// index-modules.asciidoc:97 [source, python] ---- diff --git a/docs/examples/3a489743e49902df38e3368cae00717a.asciidoc b/docs/examples/3a489743e49902df38e3368cae00717a.asciidoc new file mode 100644 index 000000000..bb1aeb077 --- /dev/null +++ b/docs/examples/3a489743e49902df38e3368cae00717a.asciidoc @@ -0,0 +1,8 @@ +// This file is autogenerated, DO NOT EDIT +// troubleshooting/common-issues/high-cpu-usage.asciidoc:47 + +[source, python] +---- +resp = client.nodes.hot_threads() +print(resp) +---- diff --git a/docs/examples/60d689aae3f8de1e6830329dfd69a6a6.asciidoc b/docs/examples/3a4953663a5a3809b692c27446e16b7f.asciidoc similarity index 85% rename from docs/examples/60d689aae3f8de1e6830329dfd69a6a6.asciidoc rename to docs/examples/3a4953663a5a3809b692c27446e16b7f.asciidoc index 17aa35fd1..5d9373bf9 100644 --- a/docs/examples/60d689aae3f8de1e6830329dfd69a6a6.asciidoc +++ b/docs/examples/3a4953663a5a3809b692c27446e16b7f.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "amazon-bedrock-embeddings", - "pipeline": "amazon_bedrock_embeddings" + "pipeline": "amazon_bedrock_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/3a5f2e2313614ea9693545edee22ac43.asciidoc b/docs/examples/3a5f2e2313614ea9693545edee22ac43.asciidoc index 51594a734..58caf00b1 100644 --- a/docs/examples/3a5f2e2313614ea9693545edee22ac43.asciidoc +++ b/docs/examples/3a5f2e2313614ea9693545edee22ac43.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/delete-service-token.asciidoc:47 +// rest-api/security/delete-service-token.asciidoc:53 [source, python] ---- diff --git a/docs/examples/3a6238835c7d9f51e6d91f92885fadeb.asciidoc b/docs/examples/3a6238835c7d9f51e6d91f92885fadeb.asciidoc index d35ef64ac..a5c22e4e2 100644 --- a/docs/examples/3a6238835c7d9f51e6d91f92885fadeb.asciidoc +++ b/docs/examples/3a6238835c7d9f51e6d91f92885fadeb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:11 +// search/search-your-data/sort-search-results.asciidoc:13 [source, python] ---- diff --git a/docs/examples/d1a285aa244ec461d68f13e7078a33c0.asciidoc b/docs/examples/3ab8f65fcb55a0e3664c55749ec41efd.asciidoc similarity index 93% rename from docs/examples/d1a285aa244ec461d68f13e7078a33c0.asciidoc rename to docs/examples/3ab8f65fcb55a0e3664c55749ec41efd.asciidoc index ee97186fe..292815dbd 100644 --- a/docs/examples/d1a285aa244ec461d68f13e7078a33c0.asciidoc +++ b/docs/examples/3ab8f65fcb55a0e3664c55749ec41efd.asciidoc @@ -32,7 +32,8 @@ resp = client.indices.create( "decimal_digit", "arabic_normalization", "persian_normalization", - "persian_stop" + "persian_stop", + "persian_stem" ] } } diff --git a/docs/examples/3ac8b5234e9d53859245cf8ab0094ca5.asciidoc b/docs/examples/3ac8b5234e9d53859245cf8ab0094ca5.asciidoc index e510a9c1b..06db20d8f 100644 --- a/docs/examples/3ac8b5234e9d53859245cf8ab0094ca5.asciidoc +++ b/docs/examples/3ac8b5234e9d53859245cf8ab0094ca5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-job.asciidoc:68 +// ml/anomaly-detection/apis/delete-job.asciidoc:74 [source, python] ---- diff --git a/docs/examples/3afc6dacf90b42900ab571aad8a61d75.asciidoc b/docs/examples/3afc6dacf90b42900ab571aad8a61d75.asciidoc index 9168398c6..db5b89d75 100644 --- a/docs/examples/3afc6dacf90b42900ab571aad8a61d75.asciidoc +++ b/docs/examples/3afc6dacf90b42900ab571aad8a61d75.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1598 +// analysis/analyzers/lang-analyzer.asciidoc:1599 [source, python] ---- diff --git a/docs/examples/3b04cc894e6a47d57983484010feac0c.asciidoc b/docs/examples/3b04cc894e6a47d57983484010feac0c.asciidoc index 7cc78c0b8..f652beadc 100644 --- a/docs/examples/3b04cc894e6a47d57983484010feac0c.asciidoc +++ b/docs/examples/3b04cc894e6a47d57983484010feac0c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:863 +// docs/reindex.asciidoc:869 [source, python] ---- diff --git a/docs/examples/3b18e9de638ff0b1c7a1f1f6bf1c24f3.asciidoc b/docs/examples/3b18e9de638ff0b1c7a1f1f6bf1c24f3.asciidoc index 4e2dc399f..b25a5f0c5 100644 --- a/docs/examples/3b18e9de638ff0b1c7a1f1f6bf1c24f3.asciidoc +++ b/docs/examples/3b18e9de638ff0b1c7a1f1f6bf1c24f3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-app-privileges.asciidoc:88 +// rest-api/security/get-app-privileges.asciidoc:94 [source, python] ---- diff --git a/docs/examples/3b1ff884f3bab390ae357e622c0544a9.asciidoc b/docs/examples/3b1ff884f3bab390ae357e622c0544a9.asciidoc index 401012b2d..41861b264 100644 --- a/docs/examples/3b1ff884f3bab390ae357e622c0544a9.asciidoc +++ b/docs/examples/3b1ff884f3bab390ae357e622c0544a9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rrf.asciidoc:180 +// search/rrf.asciidoc:186 [source, python] ---- diff --git a/docs/examples/3b40db1c5c6b36f087d7a09a4ce285c6.asciidoc b/docs/examples/3b40db1c5c6b36f087d7a09a4ce285c6.asciidoc index 1bdcf73a4..c337b8791 100644 --- a/docs/examples/3b40db1c5c6b36f087d7a09a4ce285c6.asciidoc +++ b/docs/examples/3b40db1c5c6b36f087d7a09a4ce285c6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-index-template.asciidoc:87 +// indices/get-index-template.asciidoc:93 [source, python] ---- diff --git a/docs/examples/3b606631284877f9bca15051630995ad.asciidoc b/docs/examples/3b606631284877f9bca15051630995ad.asciidoc index ccbcc0ec2..b9145064c 100644 --- a/docs/examples/3b606631284877f9bca15051630995ad.asciidoc +++ b/docs/examples/3b606631284877f9bca15051630995ad.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:436 +// scripting/using.asciidoc:441 [source, python] ---- diff --git a/docs/examples/3b64821fe9db73eb03860c60d775d7ff.asciidoc b/docs/examples/3b64821fe9db73eb03860c60d775d7ff.asciidoc index e8fb70a41..674654235 100644 --- a/docs/examples/3b64821fe9db73eb03860c60d775d7ff.asciidoc +++ b/docs/examples/3b64821fe9db73eb03860c60d775d7ff.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-cross-cluster-api-key.asciidoc:191 +// rest-api/security/update-cross-cluster-api-key.asciidoc:197 [source, python] ---- diff --git a/docs/examples/3b6718257421b5419bf4cd6a7303c57e.asciidoc b/docs/examples/3b6718257421b5419bf4cd6a7303c57e.asciidoc deleted file mode 100644 index 0bea327f3..000000000 --- a/docs/examples/3b6718257421b5419bf4cd6a7303c57e.asciidoc +++ /dev/null @@ -1,11 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// ingest/apis/get-geoip-database.asciidoc:55 - -[source, python] ----- -resp = client.perform_request( - "GET", - "/_ingest/geoip/database/my-database-id", -) -print(resp) ----- diff --git a/docs/examples/3b9c54604535d97e8368d47148aecc6f.asciidoc b/docs/examples/3b9c54604535d97e8368d47148aecc6f.asciidoc index 8f8853fb3..90feec12e 100644 --- a/docs/examples/3b9c54604535d97e8368d47148aecc6f.asciidoc +++ b/docs/examples/3b9c54604535d97e8368d47148aecc6f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/update-snapshot.asciidoc:49 +// ml/anomaly-detection/apis/update-snapshot.asciidoc:55 [source, python] ---- diff --git a/docs/examples/3bb491db29deba25e1cc82bcaa1aa1a1.asciidoc b/docs/examples/3bb491db29deba25e1cc82bcaa1aa1a1.asciidoc index 8520d79fc..356d37aac 100644 --- a/docs/examples/3bb491db29deba25e1cc82bcaa1aa1a1.asciidoc +++ b/docs/examples/3bb491db29deba25e1cc82bcaa1aa1a1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:775 +// docs/reindex.asciidoc:781 [source, python] ---- diff --git a/docs/examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc b/docs/examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc new file mode 100644 index 000000000..b58b0609d --- /dev/null +++ b/docs/examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc @@ -0,0 +1,65 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:321 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "linear": { + "retrievers": [ + { + "retriever": { + "standard": { + "query": { + "function_score": { + "query": { + "term": { + "topic": "ai" + } + }, + "functions": [ + { + "script_score": { + "script": { + "source": "doc['timestamp'].value.millis" + } + } + } + ], + "boost_mode": "replace" + } + }, + "sort": { + "timestamp": { + "order": "asc" + } + } + } + }, + "weight": 2, + "normalizer": "minmax" + }, + { + "retriever": { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + }, + "weight": 1.5 + } + ], + "rank_window_size": 10 + } + }, + source=False, +) +print(resp) +---- diff --git a/docs/examples/3bc872dbcdad8ff02cbaea39e7f38352.asciidoc b/docs/examples/3bc872dbcdad8ff02cbaea39e7f38352.asciidoc index e1218aca3..5016d46ad 100644 --- a/docs/examples/3bc872dbcdad8ff02cbaea39e7f38352.asciidoc +++ b/docs/examples/3bc872dbcdad8ff02cbaea39e7f38352.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:202 +// search/search-your-data/sort-search-results.asciidoc:204 [source, python] ---- diff --git a/docs/examples/3bfa2362add163802fc2210cc2f37ba2.asciidoc b/docs/examples/3bfa2362add163802fc2210cc2f37ba2.asciidoc index d5d96fb70..0ac911e10 100644 --- a/docs/examples/3bfa2362add163802fc2210cc2f37ba2.asciidoc +++ b/docs/examples/3bfa2362add163802fc2210cc2f37ba2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/clone-snapshot-api.asciidoc:10 +// snapshot-restore/apis/clone-snapshot-api.asciidoc:16 [source, python] ---- diff --git a/docs/examples/3c0d0c38e1c819a35a68cdba5ae8ccc4.asciidoc b/docs/examples/3c0d0c38e1c819a35a68cdba5ae8ccc4.asciidoc index d020f99d7..7f0c81b94 100644 --- a/docs/examples/3c0d0c38e1c819a35a68cdba5ae8ccc4.asciidoc +++ b/docs/examples/3c0d0c38e1c819a35a68cdba5ae8ccc4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/inference-api/infer-api-task.asciidoc:254 +// tab-widgets/inference-api/infer-api-task.asciidoc:262 [source, python] ---- diff --git a/docs/examples/3c345feb7c52fd54bcb5d5505fd8bc3b.asciidoc b/docs/examples/3c345feb7c52fd54bcb5d5505fd8bc3b.asciidoc index e7a52923d..9abe7bfa5 100644 --- a/docs/examples/3c345feb7c52fd54bcb5d5505fd8bc3b.asciidoc +++ b/docs/examples/3c345feb7c52fd54bcb5d5505fd8bc3b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/infer-trained-model.asciidoc:1008 +// ml/trained-models/apis/infer-trained-model.asciidoc:1115 [source, python] ---- diff --git a/docs/examples/3c6abb9885cb1a997fcdd16f7fa4f673.asciidoc b/docs/examples/3c6abb9885cb1a997fcdd16f7fa4f673.asciidoc index e56708bad..cdd703ba8 100644 --- a/docs/examples/3c6abb9885cb1a997fcdd16f7fa4f673.asciidoc +++ b/docs/examples/3c6abb9885cb1a997fcdd16f7fa4f673.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shrink-index.asciidoc:11 +// indices/shrink-index.asciidoc:17 [source, python] ---- diff --git a/docs/examples/3c7621a81fa982b79f040a6d2611530e.asciidoc b/docs/examples/3c7621a81fa982b79f040a6d2611530e.asciidoc index 8b35b2a9b..71e813344 100644 --- a/docs/examples/3c7621a81fa982b79f040a6d2611530e.asciidoc +++ b/docs/examples/3c7621a81fa982b79f040a6d2611530e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/simulate-template.asciidoc:151 +// indices/simulate-template.asciidoc:157 [source, python] ---- diff --git a/docs/examples/3cd93a48906069709b76420c66930c01.asciidoc b/docs/examples/3cd93a48906069709b76420c66930c01.asciidoc index fffdc26dd..6c3859dd8 100644 --- a/docs/examples/3cd93a48906069709b76420c66930c01.asciidoc +++ b/docs/examples/3cd93a48906069709b76420c66930c01.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/tokenfilters/stemmer-tokenfilter.asciidoc:265 +// analysis/tokenfilters/stemmer-tokenfilter.asciidoc:264 [source, python] ---- diff --git a/docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc b/docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc index 2ae1accfc..f1781b5f4 100644 --- a/docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc +++ b/docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/root.asciidoc:11 +// rest-api/root.asciidoc:17 [source, python] ---- diff --git a/docs/examples/3d316bddd8503a6cc10566630a4155d3.asciidoc b/docs/examples/3d316bddd8503a6cc10566630a4155d3.asciidoc index 8f6c809f3..dce950a5f 100644 --- a/docs/examples/3d316bddd8503a6cc10566630a4155d3.asciidoc +++ b/docs/examples/3d316bddd8503a6cc10566630a4155d3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/get-settings.asciidoc:16 +// rest-api/watcher/get-settings.asciidoc:22 [source, python] ---- diff --git a/docs/examples/3d6a56dd3d93ece0e3da3fb66b4696d3.asciidoc b/docs/examples/3d6a56dd3d93ece0e3da3fb66b4696d3.asciidoc index 04eade572..ab8d1a44f 100644 --- a/docs/examples/3d6a56dd3d93ece0e3da3fb66b4696d3.asciidoc +++ b/docs/examples/3d6a56dd3d93ece0e3da3fb66b4696d3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-usage.asciidoc:66 +// cluster/nodes-usage.asciidoc:71 [source, python] ---- diff --git a/docs/examples/3da35090e093c2d83c3b7d0d83bcb4ae.asciidoc b/docs/examples/3da35090e093c2d83c3b7d0d83bcb4ae.asciidoc index e76879c83..bf8d48f17 100644 --- a/docs/examples/3da35090e093c2d83c3b7d0d83bcb4ae.asciidoc +++ b/docs/examples/3da35090e093c2d83c3b7d0d83bcb4ae.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// setup/important-settings/path-settings.asciidoc:71 +// path-settings-overview.asciidoc:51 [source, python] ---- diff --git a/docs/examples/3db2b5a6424aa92ecab7a8640c38685a.asciidoc b/docs/examples/3db2b5a6424aa92ecab7a8640c38685a.asciidoc index 51ec05d35..0f80fcace 100644 --- a/docs/examples/3db2b5a6424aa92ecab7a8640c38685a.asciidoc +++ b/docs/examples/3db2b5a6424aa92ecab7a8640c38685a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/delete.asciidoc:180 +// docs/delete.asciidoc:186 [source, python] ---- diff --git a/docs/examples/3e121b43773cbb6dffa9b483c86a1f8d.asciidoc b/docs/examples/3e121b43773cbb6dffa9b483c86a1f8d.asciidoc index 12737c951..2c5368e9f 100644 --- a/docs/examples/3e121b43773cbb6dffa9b483c86a1f8d.asciidoc +++ b/docs/examples/3e121b43773cbb6dffa9b483c86a1f8d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-update-api-keys.asciidoc:81 +// rest-api/security/bulk-update-api-keys.asciidoc:87 [source, python] ---- diff --git a/docs/examples/3e278e6c193b4c17dbdc70670e15d78c.asciidoc b/docs/examples/3e278e6c193b4c17dbdc70670e15d78c.asciidoc index 5d41900e4..f0d41dfdc 100644 --- a/docs/examples/3e278e6c193b4c17dbdc70670e15d78c.asciidoc +++ b/docs/examples/3e278e6c193b4c17dbdc70670e15d78c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:642 +// search/search-your-data/highlighting.asciidoc:654 [source, python] ---- diff --git a/docs/examples/3e33c1a4298ea6a0dec65a3ebf9ba973.asciidoc b/docs/examples/3e33c1a4298ea6a0dec65a3ebf9ba973.asciidoc index 657a6b6c1..01636840a 100644 --- a/docs/examples/3e33c1a4298ea6a0dec65a3ebf9ba973.asciidoc +++ b/docs/examples/3e33c1a4298ea6a0dec65a3ebf9ba973.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:333 +// docs/termvectors.asciidoc:339 [source, python] ---- diff --git a/docs/examples/3e8ed6ae016eb823cb00d9035b8ac459.asciidoc b/docs/examples/3e8ed6ae016eb823cb00d9035b8ac459.asciidoc index 50e9dce77..7d8074935 100644 --- a/docs/examples/3e8ed6ae016eb823cb00d9035b8ac459.asciidoc +++ b/docs/examples/3e8ed6ae016eb823cb00d9035b8ac459.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search.asciidoc:10 +// search/search.asciidoc:16 [source, python] ---- diff --git a/docs/examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc b/docs/examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc new file mode 100644 index 000000000..3a9ce3e68 --- /dev/null +++ b/docs/examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc @@ -0,0 +1,16 @@ +// This file is autogenerated, DO NOT EDIT +// alias.asciidoc:420 + +[source, python] +---- +resp = client.indices.update_aliases( + actions=[ + { + "remove_index": { + "index": "my-index-2099.05.06-000001" + } + } + ], +) +print(resp) +---- diff --git a/docs/examples/3ed79871d956bfb2d6d2721d7272520c.asciidoc b/docs/examples/3ed79871d956bfb2d6d2721d7272520c.asciidoc index c7be516e2..1f0745d69 100644 --- a/docs/examples/3ed79871d956bfb2d6d2721d7272520c.asciidoc +++ b/docs/examples/3ed79871d956bfb2d6d2721d7272520c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/stats.asciidoc:112 +// rest-api/watcher/stats.asciidoc:118 [source, python] ---- diff --git a/docs/examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc b/docs/examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc index 680282f79..fe24eccf5 100644 --- a/docs/examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc +++ b/docs/examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc @@ -1,13 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-async-query-api.asciidoc:17 +// esql/esql-async-query-api.asciidoc:23 [source, python] ---- resp = client.esql.async_query( - body={ - "query": "\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", - "wait_for_completion_timeout": "2s" - }, + query="\n FROM library\n | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n | STATS MAX(page_count) BY year\n | SORT year\n | LIMIT 5\n ", + wait_for_completion_timeout="2s", ) print(resp) ---- diff --git a/docs/examples/3f2e5132e35b9e8b3203a4a0541cf0d4.asciidoc b/docs/examples/3f2e5132e35b9e8b3203a4a0541cf0d4.asciidoc index 6c2756e0b..dc4fd9f52 100644 --- a/docs/examples/3f2e5132e35b9e8b3203a4a0541cf0d4.asciidoc +++ b/docs/examples/3f2e5132e35b9e8b3203a4a0541cf0d4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/actions/ilm-searchable-snapshot.asciidoc:93 +// ilm/actions/ilm-searchable-snapshot.asciidoc:103 [source, python] ---- diff --git a/docs/examples/3f30310cc6d0adae6b0f61705624a695.asciidoc b/docs/examples/3f30310cc6d0adae6b0f61705624a695.asciidoc index b8624b2ff..63c092f08 100644 --- a/docs/examples/3f30310cc6d0adae6b0f61705624a695.asciidoc +++ b/docs/examples/3f30310cc6d0adae6b0f61705624a695.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/create-snapshot-api.asciidoc:160 +// snapshot-restore/apis/create-snapshot-api.asciidoc:166 [source, python] ---- diff --git a/docs/examples/3f8dc309b63fa0437898107b0d964217.asciidoc b/docs/examples/3f8dc309b63fa0437898107b0d964217.asciidoc index d97f352cd..333e71a68 100644 --- a/docs/examples/3f8dc309b63fa0437898107b0d964217.asciidoc +++ b/docs/examples/3f8dc309b63fa0437898107b0d964217.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/anomaly-detectors.asciidoc:281 +// cat/anomaly-detectors.asciidoc:287 [source, python] ---- diff --git a/docs/examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc b/docs/examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc new file mode 100644 index 000000000..7f8d2cc65 --- /dev/null +++ b/docs/examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:360 + +[source, python] +---- +resp = client.search( + index="kibana_sample_data_ecommerce", + size=0, + aggs={ + "order_stats": { + "stats": { + "field": "taxful_total_price" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/3fe4264ace04405989141c43aadfff81.asciidoc b/docs/examples/3fe4264ace04405989141c43aadfff81.asciidoc index dc3644d3d..84122ddd4 100644 --- a/docs/examples/3fe4264ace04405989141c43aadfff81.asciidoc +++ b/docs/examples/3fe4264ace04405989141c43aadfff81.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-roles.asciidoc:154 +// rest-api/security/create-roles.asciidoc:173 [source, python] ---- diff --git a/docs/examples/3fe5e6c0d5ea4586aa04f989ae54b72e.asciidoc b/docs/examples/3fe5e6c0d5ea4586aa04f989ae54b72e.asciidoc index e8e5b0d59..66637dbe9 100644 --- a/docs/examples/3fe5e6c0d5ea4586aa04f989ae54b72e.asciidoc +++ b/docs/examples/3fe5e6c0d5ea4586aa04f989ae54b72e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/verify-repo-api.asciidoc:25 +// snapshot-restore/apis/verify-repo-api.asciidoc:31 [source, python] ---- diff --git a/docs/examples/400e89eb46ead8e9c9e40f123fd5e590.asciidoc b/docs/examples/400e89eb46ead8e9c9e40f123fd5e590.asciidoc index 8e863d72b..d4266e99d 100644 --- a/docs/examples/400e89eb46ead8e9c9e40f123fd5e590.asciidoc +++ b/docs/examples/400e89eb46ead8e9c9e40f123fd5e590.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:428 +// docs/reindex.asciidoc:434 [source, python] ---- diff --git a/docs/examples/4029af36cb3f8202549017f7378803b4.asciidoc b/docs/examples/4029af36cb3f8202549017f7378803b4.asciidoc index 215136b33..558cc0bd3 100644 --- a/docs/examples/4029af36cb3f8202549017f7378803b4.asciidoc +++ b/docs/examples/4029af36cb3f8202549017f7378803b4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/get-settings.asciidoc:10 +// cluster/get-settings.asciidoc:16 [source, python] ---- diff --git a/docs/examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc b/docs/examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc index 500d3e1c5..ef7fcf7e1 100644 --- a/docs/examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc +++ b/docs/examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc @@ -1,11 +1,10 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-async-query-get-api.asciidoc:11 +// esql/esql-async-query-get-api.asciidoc:17 [source, python] ---- resp = client.esql.async_query_get( id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=", - body=None, ) print(resp) ---- diff --git a/docs/examples/405ac843a9156d3cab374e199cac87fb.asciidoc b/docs/examples/405ac843a9156d3cab374e199cac87fb.asciidoc index fa979e0df..efc7cddb3 100644 --- a/docs/examples/405ac843a9156d3cab374e199cac87fb.asciidoc +++ b/docs/examples/405ac843a9156d3cab374e199cac87fb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/create-connector-sync-job-api.asciidoc:15 +// connector/apis/create-connector-sync-job-api.asciidoc:21 [source, python] ---- diff --git a/docs/examples/405db6f3a01eceacfaa8b0ed3e4b3ac2.asciidoc b/docs/examples/405db6f3a01eceacfaa8b0ed3e4b3ac2.asciidoc index 33c666fed..d9a5a7e2b 100644 --- a/docs/examples/405db6f3a01eceacfaa8b0ed3e4b3ac2.asciidoc +++ b/docs/examples/405db6f3a01eceacfaa8b0ed3e4b3ac2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-overall-buckets.asciidoc:175 +// ml/anomaly-detection/apis/get-overall-buckets.asciidoc:181 [source, python] ---- diff --git a/docs/examples/4061fd5ba7221ca85805ed14d59a6bc5.asciidoc b/docs/examples/4061fd5ba7221ca85805ed14d59a6bc5.asciidoc index 62d2fd139..0b040a384 100644 --- a/docs/examples/4061fd5ba7221ca85805ed14d59a6bc5.asciidoc +++ b/docs/examples/4061fd5ba7221ca85805ed14d59a6bc5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:266 +// scripting/using.asciidoc:271 [source, python] ---- diff --git a/docs/examples/408060f0c52300588a6dee774f4fd6a5.asciidoc b/docs/examples/408060f0c52300588a6dee774f4fd6a5.asciidoc index 71728aef6..28a8deeb5 100644 --- a/docs/examples/408060f0c52300588a6dee774f4fd6a5.asciidoc +++ b/docs/examples/408060f0c52300588a6dee774f4fd6a5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/downsampling-ilm.asciidoc:260 +// data-streams/downsampling-dsl.asciidoc:218 [source, python] ---- diff --git a/docs/examples/40bd86e400d27e68b8f0ae580c29d32d.asciidoc b/docs/examples/40bd86e400d27e68b8f0ae580c29d32d.asciidoc index 2cb413860..f150be621 100644 --- a/docs/examples/40bd86e400d27e68b8f0ae580c29d32d.asciidoc +++ b/docs/examples/40bd86e400d27e68b8f0ae580c29d32d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:278 +// how-to/size-your-shards.asciidoc:279 [source, python] ---- diff --git a/docs/examples/40c3e7bb1fdc125a1ab21bd7d7326694.asciidoc b/docs/examples/40c3e7bb1fdc125a1ab21bd7d7326694.asciidoc index 7aeed7da6..9a580ba46 100644 --- a/docs/examples/40c3e7bb1fdc125a1ab21bd7d7326694.asciidoc +++ b/docs/examples/40c3e7bb1fdc125a1ab21bd7d7326694.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/multivalued-fields.asciidoc:133 +// esql/multivalued-fields.asciidoc:145 [source, python] ---- diff --git a/docs/examples/40f287bf733420bbab134b74c7d0ea5d.asciidoc b/docs/examples/40f287bf733420bbab134b74c7d0ea5d.asciidoc new file mode 100644 index 000000000..003c7f9ea --- /dev/null +++ b/docs/examples/40f287bf733420bbab134b74c7d0ea5d.asciidoc @@ -0,0 +1,24 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/ingest-vectors.asciidoc:68 + +[source, python] +---- +resp = client.index( + index="amazon-reviews", + id="1", + document={ + "review_text": "This product is lifechanging! I'm telling all my friends about it.", + "review_vector": [ + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8 + ] + }, +) +print(resp) +---- diff --git a/docs/examples/40f97f70e8e743c6a6296c81b920aeb0.asciidoc b/docs/examples/40f97f70e8e743c6a6296c81b920aeb0.asciidoc index 8f4e0432d..06969d9fd 100644 --- a/docs/examples/40f97f70e8e743c6a6296c81b920aeb0.asciidoc +++ b/docs/examples/40f97f70e8e743c6a6296c81b920aeb0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:313 +// how-to/size-your-shards.asciidoc:314 [source, python] ---- diff --git a/docs/examples/4113c57384aa37c58d11579e20c00760.asciidoc b/docs/examples/4113c57384aa37c58d11579e20c00760.asciidoc index b76e6d369..6da608277 100644 --- a/docs/examples/4113c57384aa37c58d11579e20c00760.asciidoc +++ b/docs/examples/4113c57384aa37c58d11579e20c00760.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:59 +// docs/get.asciidoc:65 [source, python] ---- diff --git a/docs/examples/41175d304e660da2931764f9a4418fd3.asciidoc b/docs/examples/41175d304e660da2931764f9a4418fd3.asciidoc index d58c99075..c5847cd73 100644 --- a/docs/examples/41175d304e660da2931764f9a4418fd3.asciidoc +++ b/docs/examples/41175d304e660da2931764f9a4418fd3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-pipeline-api.asciidoc:87 +// connector/apis/update-connector-pipeline-api.asciidoc:94 [source, python] ---- diff --git a/docs/examples/41195ef13af0465cdee1ae18f6c00fde.asciidoc b/docs/examples/41195ef13af0465cdee1ae18f6c00fde.asciidoc index 3febeb06c..3b320bb1e 100644 --- a/docs/examples/41195ef13af0465cdee1ae18f6c00fde.asciidoc +++ b/docs/examples/41195ef13af0465cdee1ae18f6c00fde.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-stop.asciidoc:47 +// slm/apis/slm-stop.asciidoc:52 [source, python] ---- diff --git a/docs/examples/412f8238ab5182678f1d8f6383031b11.asciidoc b/docs/examples/412f8238ab5182678f1d8f6383031b11.asciidoc index c57e81fa5..8450dd9a2 100644 --- a/docs/examples/412f8238ab5182678f1d8f6383031b11.asciidoc +++ b/docs/examples/412f8238ab5182678f1d8f6383031b11.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-alias.asciidoc:10 +// indices/get-alias.asciidoc:16 [source, python] ---- diff --git a/docs/examples/413fdcc7c437775a16bb55b81c2bbe2b.asciidoc b/docs/examples/413fdcc7c437775a16bb55b81c2bbe2b.asciidoc index fa73e0203..a626e7e41 100644 --- a/docs/examples/413fdcc7c437775a16bb55b81c2bbe2b.asciidoc +++ b/docs/examples/413fdcc7c437775a16bb55b81c2bbe2b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1618 +// mapping/runtime.asciidoc:1616 [source, python] ---- diff --git a/docs/examples/416a3ba11232d3c078c1c31340cf356f.asciidoc b/docs/examples/416a3ba11232d3c078c1c31340cf356f.asciidoc index e8318037b..94459206c 100644 --- a/docs/examples/416a3ba11232d3c078c1c31340cf356f.asciidoc +++ b/docs/examples/416a3ba11232d3c078c1c31340cf356f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:475 +// search/search-your-data/highlighting.asciidoc:487 [source, python] ---- diff --git a/docs/examples/41d24383d29b2808a65258a0a3256e96.asciidoc b/docs/examples/41d24383d29b2808a65258a0a3256e96.asciidoc new file mode 100644 index 000000000..ea815d5f7 --- /dev/null +++ b/docs/examples/41d24383d29b2808a65258a0a3256e96.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-jinaai.asciidoc:188 + +[source, python] +---- +resp = client.indices.create( + index="jinaai-index", + mappings={ + "properties": { + "content": { + "type": "semantic_text", + "inference_id": "jinaai-embeddings" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/41dbd79f624b998d01c10921e9a35c4b.asciidoc b/docs/examples/41dbd79f624b998d01c10921e9a35c4b.asciidoc index 6f7efef11..7a5985b03 100644 --- a/docs/examples/41dbd79f624b998d01c10921e9a35c4b.asciidoc +++ b/docs/examples/41dbd79f624b998d01c10921e9a35c4b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:290 +// docs/update.asciidoc:296 [source, python] ---- diff --git a/docs/examples/41fd33a293a575bd71a1fac7bcc8b47c.asciidoc b/docs/examples/41fd33a293a575bd71a1fac7bcc8b47c.asciidoc index 234b4b474..b9c9770e5 100644 --- a/docs/examples/41fd33a293a575bd71a1fac7bcc8b47c.asciidoc +++ b/docs/examples/41fd33a293a575bd71a1fac7bcc8b47c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search-application/apis/put-search-application.asciidoc:148 +// search-application/apis/put-search-application.asciidoc:153 [source, python] ---- diff --git a/docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc b/docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc index 92314f5f5..f929c54b2 100644 --- a/docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc +++ b/docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/cluster/misc.asciidoc:133 +// modules/cluster/misc.asciidoc:136 [source, python] ---- diff --git a/docs/examples/421e68e2b9789f0e8c08760d9e685d1c.asciidoc b/docs/examples/421e68e2b9789f0e8c08760d9e685d1c.asciidoc index 7184d8b40..2c831b393 100644 --- a/docs/examples/421e68e2b9789f0e8c08760d9e685d1c.asciidoc +++ b/docs/examples/421e68e2b9789f0e8c08760d9e685d1c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/update-job.asciidoc:258 +// ml/anomaly-detection/apis/update-job.asciidoc:264 [source, python] ---- diff --git a/docs/examples/424fbf082cd4affb84439abfc916b597.asciidoc b/docs/examples/424fbf082cd4affb84439abfc916b597.asciidoc index c09038abb..96b24b354 100644 --- a/docs/examples/424fbf082cd4affb84439abfc916b597.asciidoc +++ b/docs/examples/424fbf082cd4affb84439abfc916b597.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/downsample-data-stream.asciidoc:59 +// indices/downsample-data-stream.asciidoc:65 [source, python] ---- diff --git a/docs/examples/425eaaf9c7e3b1e77a3474fbab4183b4.asciidoc b/docs/examples/425eaaf9c7e3b1e77a3474fbab4183b4.asciidoc index 3f7f7db24..7b8038083 100644 --- a/docs/examples/425eaaf9c7e3b1e77a3474fbab4183b4.asciidoc +++ b/docs/examples/425eaaf9c7e3b1e77a3474fbab4183b4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/task-queue-backlog.asciidoc:22 +// troubleshooting/common-issues/task-queue-backlog.asciidoc:36 [source, python] ---- diff --git a/docs/examples/4301cb9d970ec65778f91ce1f438e0d5.asciidoc b/docs/examples/4301cb9d970ec65778f91ce1f438e0d5.asciidoc index 87313bc14..6c3d6250f 100644 --- a/docs/examples/4301cb9d970ec65778f91ce1f438e0d5.asciidoc +++ b/docs/examples/4301cb9d970ec65778f91ce1f438e0d5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:289 +// alias.asciidoc:291 [source, python] ---- diff --git a/docs/examples/430705509f8367aef92be413f702520b.asciidoc b/docs/examples/430705509f8367aef92be413f702520b.asciidoc index 2bf5117b8..41b09e782 100644 --- a/docs/examples/430705509f8367aef92be413f702520b.asciidoc +++ b/docs/examples/430705509f8367aef92be413f702520b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-status-api.asciidoc:75 +// connector/apis/update-connector-status-api.asciidoc:82 [source, python] ---- diff --git a/docs/examples/4310869b97d4224acaa6d66b1e196048.asciidoc b/docs/examples/4310869b97d4224acaa6d66b1e196048.asciidoc index cab2434e0..6b7f6bef2 100644 --- a/docs/examples/4310869b97d4224acaa6d66b1e196048.asciidoc +++ b/docs/examples/4310869b97d4224acaa6d66b1e196048.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-elser.asciidoc:172 +// search/search-your-data/semantic-search-elser.asciidoc:184 [source, python] ---- diff --git a/docs/examples/433cf45a23decdf3a096016ffaaf26ba.asciidoc b/docs/examples/433cf45a23decdf3a096016ffaaf26ba.asciidoc index 5302d44a4..8bd263b9c 100644 --- a/docs/examples/433cf45a23decdf3a096016ffaaf26ba.asciidoc +++ b/docs/examples/433cf45a23decdf3a096016ffaaf26ba.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:394 +// alias.asciidoc:396 [source, python] ---- diff --git a/docs/examples/436d50b85fc8f0977d02059eec00719b.asciidoc b/docs/examples/436d50b85fc8f0977d02059eec00719b.asciidoc deleted file mode 100644 index 041633ca9..000000000 --- a/docs/examples/436d50b85fc8f0977d02059eec00719b.asciidoc +++ /dev/null @@ -1,21 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:309 - -[source, python] ----- -resp = client.update( - index="test", - id="1", - script={ - "source": "ctx._source.counter += params.count", - "lang": "painless", - "params": { - "count": 4 - } - }, - upsert={ - "counter": 1 - }, -) -print(resp) ----- diff --git a/docs/examples/43d9e314431336a6f084cea76dfd6489.asciidoc b/docs/examples/43d9e314431336a6f084cea76dfd6489.asciidoc new file mode 100644 index 000000000..c1ec6eb7d --- /dev/null +++ b/docs/examples/43d9e314431336a6f084cea76dfd6489.asciidoc @@ -0,0 +1,22 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:254 + +[source, python] +---- +resp = client.search( + index="restaurants", + retriever={ + "knn": { + "field": "vector", + "query_vector": [ + 10, + 22, + 77 + ], + "k": 10, + "num_candidates": 10 + } + }, +) +print(resp) +---- diff --git a/docs/examples/43e86fbaeed068dcc981214338559b5a.asciidoc b/docs/examples/43e86fbaeed068dcc981214338559b5a.asciidoc index 254f835ae..2363196a9 100644 --- a/docs/examples/43e86fbaeed068dcc981214338559b5a.asciidoc +++ b/docs/examples/43e86fbaeed068dcc981214338559b5a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/resolve-cluster.asciidoc:58 +// indices/resolve-cluster.asciidoc:92 [source, python] ---- diff --git a/docs/examples/43fe75fa9f3fca846598fdad58fd98cb.asciidoc b/docs/examples/43fe75fa9f3fca846598fdad58fd98cb.asciidoc index a5f3ab8d5..134df95bc 100644 --- a/docs/examples/43fe75fa9f3fca846598fdad58fd98cb.asciidoc +++ b/docs/examples/43fe75fa9f3fca846598fdad58fd98cb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/usage.asciidoc:38 +// rest-api/usage.asciidoc:44 [source, python] ---- diff --git a/docs/examples/44198781d164a15be633d4469485a544.asciidoc b/docs/examples/44198781d164a15be633d4469485a544.asciidoc new file mode 100644 index 000000000..b51ba5ba8 --- /dev/null +++ b/docs/examples/44198781d164a15be633d4469485a544.asciidoc @@ -0,0 +1,29 @@ +// This file is autogenerated, DO NOT EDIT +// vectors/vector-functions.asciidoc:383 + +[source, python] +---- +resp = client.search( + index="my-index-bit-vectors", + query={ + "script_score": { + "query": { + "match_all": {} + }, + "script": { + "source": "dotProduct(params.query_vector, 'my_dense_vector')", + "params": { + "query_vector": [ + 8, + 5, + -15, + 1, + -7 + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/44231f7cdd5c3a21025861cdef31e355.asciidoc b/docs/examples/44231f7cdd5c3a21025861cdef31e355.asciidoc index d4067263d..3b58c3f01 100644 --- a/docs/examples/44231f7cdd5c3a21025861cdef31e355.asciidoc +++ b/docs/examples/44231f7cdd5c3a21025861cdef31e355.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:201 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:206 [source, python] ---- diff --git a/docs/examples/44385b61342e20ea05f254015b2b04d7.asciidoc b/docs/examples/44385b61342e20ea05f254015b2b04d7.asciidoc index 54d047589..809e5607b 100644 --- a/docs/examples/44385b61342e20ea05f254015b2b04d7.asciidoc +++ b/docs/examples/44385b61342e20ea05f254015b2b04d7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-delete-roles.asciidoc:49 +// rest-api/security/bulk-delete-roles.asciidoc:54 [source, python] ---- diff --git a/docs/examples/443dd902f64b3217505c9595839c3b2d.asciidoc b/docs/examples/443dd902f64b3217505c9595839c3b2d.asciidoc index 44612024a..b32cc324f 100644 --- a/docs/examples/443dd902f64b3217505c9595839c3b2d.asciidoc +++ b/docs/examples/443dd902f64b3217505c9595839c3b2d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/search-multiple-indices.asciidoc:104 +// search/search-your-data/search-multiple-indices.asciidoc:138 [source, python] ---- diff --git a/docs/examples/443e8da9968f1c65f46a2a65a1e1e078.asciidoc b/docs/examples/443e8da9968f1c65f46a2a65a1e1e078.asciidoc index d6f42c8fb..0f02f4bb2 100644 --- a/docs/examples/443e8da9968f1c65f46a2a65a1e1e078.asciidoc +++ b/docs/examples/443e8da9968f1c65f46a2a65a1e1e078.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/set-up-tsds.asciidoc:146 +// data-streams/set-up-tsds.asciidoc:147 [source, python] ---- diff --git a/docs/examples/445f8a6ef75fb43da52990b3a9063c78.asciidoc b/docs/examples/445f8a6ef75fb43da52990b3a9063c78.asciidoc index b91e1f5cf..6473b0542 100644 --- a/docs/examples/445f8a6ef75fb43da52990b3a9063c78.asciidoc +++ b/docs/examples/445f8a6ef75fb43da52990b3a9063c78.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1658 +// mapping/runtime.asciidoc:1656 [source, python] ---- diff --git a/docs/examples/4479e8c63a04fa22207a6a8803eadcad.asciidoc b/docs/examples/4479e8c63a04fa22207a6a8803eadcad.asciidoc index b5d3ca633..3abec964f 100644 --- a/docs/examples/4479e8c63a04fa22207a6a8803eadcad.asciidoc +++ b/docs/examples/4479e8c63a04fa22207a6a8803eadcad.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/cluster/allocation_awareness.asciidoc:67 +// modules/cluster/allocation_awareness.asciidoc:62 [source, python] ---- diff --git a/docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc b/docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc index 8d22ea53a..66d57f24a 100644 --- a/docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc +++ b/docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/indices/request_cache.asciidoc:59 +// shard-request-cache.asciidoc:61 [source, python] ---- diff --git a/docs/examples/44b8a236d7cfb31c43c6d066ae16d8cd.asciidoc b/docs/examples/44b8a236d7cfb31c43c6d066ae16d8cd.asciidoc index db0e61236..a3bd120f1 100644 --- a/docs/examples/44b8a236d7cfb31c43c6d066ae16d8cd.asciidoc +++ b/docs/examples/44b8a236d7cfb31c43c6d066ae16d8cd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/profile.asciidoc:35 +// search/profile.asciidoc:40 [source, python] ---- diff --git a/docs/examples/44bca3f17d403517af3616754dc795bb.asciidoc b/docs/examples/44bca3f17d403517af3616754dc795bb.asciidoc index 948217540..f7231526e 100644 --- a/docs/examples/44bca3f17d403517af3616754dc795bb.asciidoc +++ b/docs/examples/44bca3f17d403517af3616754dc795bb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/script-score-query.asciidoc:345 +// query-dsl/script-score-query.asciidoc:352 [source, python] ---- diff --git a/docs/examples/44da736ce0e1587c1e7c45eee606ead7.asciidoc b/docs/examples/44da736ce0e1587c1e7c45eee606ead7.asciidoc index f41b42c8d..44157ab00 100644 --- a/docs/examples/44da736ce0e1587c1e7c45eee606ead7.asciidoc +++ b/docs/examples/44da736ce0e1587c1e7c45eee606ead7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:403 +// docs/update-by-query.asciidoc:409 [source, python] ---- diff --git a/docs/examples/44db41b8465af951e366da97ade63bc1.asciidoc b/docs/examples/44db41b8465af951e366da97ade63bc1.asciidoc index 08d8e6708..19a3b1d21 100644 --- a/docs/examples/44db41b8465af951e366da97ade63bc1.asciidoc +++ b/docs/examples/44db41b8465af951e366da97ade63bc1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/apis/reload-analyzers.asciidoc:154 +// indices/apis/reload-analyzers.asciidoc:160 [source, python] ---- diff --git a/docs/examples/44dfac5bc3131014e2c6bb1ebc76b33d.asciidoc b/docs/examples/44dfac5bc3131014e2c6bb1ebc76b33d.asciidoc index f65120117..eb7296c56 100644 --- a/docs/examples/44dfac5bc3131014e2c6bb1ebc76b33d.asciidoc +++ b/docs/examples/44dfac5bc3131014e2c6bb1ebc76b33d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:144 +// search/search-your-data/sort-search-results.asciidoc:146 [source, python] ---- diff --git a/docs/examples/458b2228aed7464d915a5d73cb6b98f6.asciidoc b/docs/examples/458b2228aed7464d915a5d73cb6b98f6.asciidoc index d8d3104df..654e8e078 100644 --- a/docs/examples/458b2228aed7464d915a5d73cb6b98f6.asciidoc +++ b/docs/examples/458b2228aed7464d915a5d73cb6b98f6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/snapshots.asciidoc:129 +// cat/snapshots.asciidoc:135 [source, python] ---- diff --git a/docs/examples/45954b8aaedfed57012be8b6538b0a24.asciidoc b/docs/examples/45954b8aaedfed57012be8b6538b0a24.asciidoc new file mode 100644 index 000000000..cdff938a9 --- /dev/null +++ b/docs/examples/45954b8aaedfed57012be8b6538b0a24.asciidoc @@ -0,0 +1,45 @@ +// This file is autogenerated, DO NOT EDIT +// inference/chat-completion-inference.asciidoc:356 + +[source, python] +---- +resp = client.inference.stream_inference( + task_type="chat_completion", + inference_id="openai-completion", + messages=[ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What's the price of a scarf?" + } + ] + } + ], + tools=[ + { + "type": "function", + "function": { + "name": "get_current_price", + "description": "Get the current price of a item", + "parameters": { + "type": "object", + "properties": { + "item": { + "id": "123" + } + } + } + } + } + ], + tool_choice={ + "type": "function", + "function": { + "name": "get_current_price" + } + }, +) +print(resp) +---- diff --git a/docs/examples/46064e81620162a23e75002a7eeb8b10.asciidoc b/docs/examples/46064e81620162a23e75002a7eeb8b10.asciidoc index 3c332a0b2..b99e20fcf 100644 --- a/docs/examples/46064e81620162a23e75002a7eeb8b10.asciidoc +++ b/docs/examples/46064e81620162a23e75002a7eeb8b10.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/move-to-step.asciidoc:188 +// ilm/apis/move-to-step.asciidoc:194 [source, python] ---- diff --git a/docs/examples/46658f00edc4865dfe472a392374cd0f.asciidoc b/docs/examples/46658f00edc4865dfe472a392374cd0f.asciidoc index 83abbcf70..185af87c5 100644 --- a/docs/examples/46658f00edc4865dfe472a392374cd0f.asciidoc +++ b/docs/examples/46658f00edc4865dfe472a392374cd0f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template-v1.asciidoc:252 +// indices/put-index-template-v1.asciidoc:258 [source, python] ---- diff --git a/docs/examples/468f7ec42cdd8287cdea3ec1cea4a514.asciidoc b/docs/examples/468f7ec42cdd8287cdea3ec1cea4a514.asciidoc index 20d03bb33..25ae2ca45 100644 --- a/docs/examples/468f7ec42cdd8287cdea3ec1cea4a514.asciidoc +++ b/docs/examples/468f7ec42cdd8287cdea3ec1cea4a514.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:333 +// scripting/using.asciidoc:338 [source, python] ---- diff --git a/docs/examples/46b1c1f6e0c86528be84c373eeb8d425.asciidoc b/docs/examples/46b1c1f6e0c86528be84c373eeb8d425.asciidoc index a187319f3..27eda1700 100644 --- a/docs/examples/46b1c1f6e0c86528be84c373eeb8d425.asciidoc +++ b/docs/examples/46b1c1f6e0c86528be84c373eeb8d425.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// licensing/update-license.asciidoc:139 +// licensing/update-license.asciidoc:145 [source, python] ---- diff --git a/docs/examples/46b771a9932c3fa6057a7b2679c72ef0.asciidoc b/docs/examples/46b771a9932c3fa6057a7b2679c72ef0.asciidoc new file mode 100644 index 000000000..f9bceeaba --- /dev/null +++ b/docs/examples/46b771a9932c3fa6057a7b2679c72ef0.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/data-stream-reindex.asciidoc:143 + +[source, python] +---- +resp = client.indices.get_migrate_reindex_status( + index="my-data-stream", +) +print(resp) +---- diff --git a/docs/examples/480e531db799c4c909afd8e2a73a8d0b.asciidoc b/docs/examples/480e531db799c4c909afd8e2a73a8d0b.asciidoc index 21c1254ff..f2f7b1dd4 100644 --- a/docs/examples/480e531db799c4c909afd8e2a73a8d0b.asciidoc +++ b/docs/examples/480e531db799c4c909afd8e2a73a8d0b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/forcemerge.asciidoc:193 +// indices/forcemerge.asciidoc:199 [source, python] ---- diff --git a/docs/examples/483d669ec0768bc4e275a568c6164704.asciidoc b/docs/examples/483d669ec0768bc4e275a568c6164704.asciidoc index e568ac3f6..ac531f427 100644 --- a/docs/examples/483d669ec0768bc4e275a568c6164704.asciidoc +++ b/docs/examples/483d669ec0768bc4e275a568c6164704.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/post-pause-follow.asciidoc:29 +// ccr/apis/follow/post-pause-follow.asciidoc:35 [source, python] ---- diff --git a/docs/examples/488f6df1df71972392b670ce557f7ff3.asciidoc b/docs/examples/488f6df1df71972392b670ce557f7ff3.asciidoc index f44dfa132..6d60ffbe5 100644 --- a/docs/examples/488f6df1df71972392b670ce557f7ff3.asciidoc +++ b/docs/examples/488f6df1df71972392b670ce557f7ff3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template-v1.asciidoc:234 +// indices/put-index-template-v1.asciidoc:240 [source, python] ---- diff --git a/docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc b/docs/examples/48e142e6c69014e0509d4c9251749d77.asciidoc similarity index 72% rename from docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc rename to docs/examples/48e142e6c69014e0509d4c9251749d77.asciidoc index f56b0349b..1f8ce6f36 100644 --- a/docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc +++ b/docs/examples/48e142e6c69014e0509d4c9251749d77.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-openai.asciidoc:121 +// inference/service-openai.asciidoc:161 [source, python] ---- @@ -10,7 +10,8 @@ resp = client.inference.put( "service": "openai", "service_settings": { "api_key": "", - "model_id": "text-embedding-ada-002" + "model_id": "text-embedding-3-small", + "dimensions": 128 } }, ) diff --git a/docs/examples/4982c547be1ad9455ae836990aea92c5.asciidoc b/docs/examples/4982c547be1ad9455ae836990aea92c5.asciidoc index b7a6d50b1..6cb70a9ca 100644 --- a/docs/examples/4982c547be1ad9455ae836990aea92c5.asciidoc +++ b/docs/examples/4982c547be1ad9455ae836990aea92c5.asciidoc @@ -1,11 +1,16 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/start-trained-model-deployment.asciidoc:222 +// ml/trained-models/apis/start-trained-model-deployment.asciidoc:228 [source, python] ---- resp = client.ml.start_trained_model_deployment( model_id="my_model", deployment_id="my_model_for_search", + adaptive_allocations={ + "enabled": True, + "min_number_of_allocations": 3, + "max_number_of_allocations": 10 + }, ) print(resp) ---- diff --git a/docs/examples/49a19615ebe2c013b8321152163478ab.asciidoc b/docs/examples/49a19615ebe2c013b8321152163478ab.asciidoc new file mode 100644 index 000000000..db5e78aa5 --- /dev/null +++ b/docs/examples/49a19615ebe2c013b8321152163478ab.asciidoc @@ -0,0 +1,42 @@ +// This file is autogenerated, DO NOT EDIT +// scripting/fields.asciidoc:92 + +[source, python] +---- +resp = client.index( + index="my-index-000001", + id="1", + refresh=True, + document={ + "text": "quick brown fox" + }, +) +print(resp) + +resp1 = client.index( + index="my-index-000001", + id="2", + refresh=True, + document={ + "text": "quick fox" + }, +) +print(resp1) + +resp2 = client.search( + index="my-index-000001", + query={ + "script_score": { + "query": { + "match": { + "text": "quick brown fox" + } + }, + "script": { + "source": "_termStats.termFreq().getAverage()" + } + } + }, +) +print(resp2) +---- diff --git a/docs/examples/49b31e23f8b9667b6a7b2734d55fb6ed.asciidoc b/docs/examples/49b31e23f8b9667b6a7b2734d55fb6ed.asciidoc deleted file mode 100644 index a3fcb5fab..000000000 --- a/docs/examples/49b31e23f8b9667b6a7b2734d55fb6ed.asciidoc +++ /dev/null @@ -1,24 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// search/knn-search.asciidoc:36 - -[source, python] ----- -resp = client.knn_search( - index="my-index", - knn={ - "field": "image_vector", - "query_vector": [ - 0.3, - 0.1, - 1.2 - ], - "k": 10, - "num_candidates": 100 - }, - source=[ - "name", - "file_type" - ], -) -print(resp) ----- diff --git a/docs/examples/49c052a748c943180db78fee8e144239.asciidoc b/docs/examples/49c052a748c943180db78fee8e144239.asciidoc index 35f82f055..d40b88497 100644 --- a/docs/examples/49c052a748c943180db78fee8e144239.asciidoc +++ b/docs/examples/49c052a748c943180db78fee8e144239.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-api-key-cache.asciidoc:50 +// rest-api/security/clear-api-key-cache.asciidoc:56 [source, python] ---- diff --git a/docs/examples/49d87c2eb7314ed34221c5fb4f21dfcc.asciidoc b/docs/examples/49d87c2eb7314ed34221c5fb4f21dfcc.asciidoc index 50a554339..26e15bc31 100644 --- a/docs/examples/49d87c2eb7314ed34221c5fb4f21dfcc.asciidoc +++ b/docs/examples/49d87c2eb7314ed34221c5fb4f21dfcc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:257 +// indices/analyze.asciidoc:263 [source, python] ---- diff --git a/docs/examples/49e8773a34fcbf825de38426cff5509c.asciidoc b/docs/examples/49e8773a34fcbf825de38426cff5509c.asciidoc index 1723f1af4..4e7fd6c8f 100644 --- a/docs/examples/49e8773a34fcbf825de38426cff5509c.asciidoc +++ b/docs/examples/49e8773a34fcbf825de38426cff5509c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/profile.asciidoc:1270 +// search/profile.asciidoc:1275 [source, python] ---- diff --git a/docs/examples/49f4d2a461536d150e16b1e0a3148678.asciidoc b/docs/examples/49f4d2a461536d150e16b1e0a3148678.asciidoc index c32439da7..4163a05da 100644 --- a/docs/examples/49f4d2a461536d150e16b1e0a3148678.asciidoc +++ b/docs/examples/49f4d2a461536d150e16b1e0a3148678.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/clearcache.asciidoc:110 +// indices/clearcache.asciidoc:116 [source, python] ---- diff --git a/docs/examples/4a1951844bd39f26961bfc965f3432b1.asciidoc b/docs/examples/4a1951844bd39f26961bfc965f3432b1.asciidoc index ed58cd4a6..487751e38 100644 --- a/docs/examples/4a1951844bd39f26961bfc965f3432b1.asciidoc +++ b/docs/examples/4a1951844bd39f26961bfc965f3432b1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/multi-get.asciidoc:138 +// docs/multi-get.asciidoc:144 [source, python] ---- diff --git a/docs/examples/4a4b8a406681584a91c0e614c1fa4344.asciidoc b/docs/examples/4a4b8a406681584a91c0e614c1fa4344.asciidoc index 2b0e13e14..7327152dc 100644 --- a/docs/examples/4a4b8a406681584a91c0e614c1fa4344.asciidoc +++ b/docs/examples/4a4b8a406681584a91c0e614c1fa4344.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-api-keys.asciidoc:128 +// rest-api/security/create-api-keys.asciidoc:134 [source, python] ---- diff --git a/docs/examples/4ae494d1e62231e832fc0436b04e2014.asciidoc b/docs/examples/4ae494d1e62231e832fc0436b04e2014.asciidoc index 2aed5eb79..66d40366f 100644 --- a/docs/examples/4ae494d1e62231e832fc0436b04e2014.asciidoc +++ b/docs/examples/4ae494d1e62231e832fc0436b04e2014.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/validate.asciidoc:116 +// search/validate.asciidoc:122 [source, python] ---- diff --git a/docs/examples/4b1044259a6d777d87529eae25675005.asciidoc b/docs/examples/4b1044259a6d777d87529eae25675005.asciidoc index 3d9ff4dca..4422e2335 100644 --- a/docs/examples/4b1044259a6d777d87529eae25675005.asciidoc +++ b/docs/examples/4b1044259a6d777d87529eae25675005.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:444 +// docs/update-by-query.asciidoc:450 [source, python] ---- diff --git a/docs/examples/4b5110a21676cc0e26e050a4b4552235.asciidoc b/docs/examples/4b5110a21676cc0e26e050a4b4552235.asciidoc index b631d63a0..7881b4323 100644 --- a/docs/examples/4b5110a21676cc0e26e050a4b4552235.asciidoc +++ b/docs/examples/4b5110a21676cc0e26e050a4b4552235.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/get-synonyms-set.asciidoc:75 +// synonyms/apis/get-synonyms-set.asciidoc:81 [source, python] ---- diff --git a/docs/examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc b/docs/examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc new file mode 100644 index 000000000..b7583a76d --- /dev/null +++ b/docs/examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// inference/stream-inference.asciidoc:92 + +[source, python] +---- +resp = client.inference.stream_inference( + task_type="completion", + inference_id="openai-completion", + input="What is Elastic?", +) +print(resp) +---- diff --git a/docs/examples/4bc4db44b8c74610b73f21a421099a13.asciidoc b/docs/examples/4bc4db44b8c74610b73f21a421099a13.asciidoc index 488080f02..1773348bd 100644 --- a/docs/examples/4bc4db44b8c74610b73f21a421099a13.asciidoc +++ b/docs/examples/4bc4db44b8c74610b73f21a421099a13.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-tokens.asciidoc:188 +// rest-api/security/invalidate-tokens.asciidoc:194 [source, python] ---- diff --git a/docs/examples/4be07b34db282044c88d5021c7ea08ee.asciidoc b/docs/examples/4be07b34db282044c88d5021c7ea08ee.asciidoc index 5c8c2d90c..5b9e08deb 100644 --- a/docs/examples/4be07b34db282044c88d5021c7ea08ee.asciidoc +++ b/docs/examples/4be07b34db282044c88d5021c7ea08ee.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:18 +// mapping/types/dense-vector.asciidoc:17 [source, python] ---- diff --git a/docs/examples/4bef98a2dac575a50ee0783c2269f1db.asciidoc b/docs/examples/4bef98a2dac575a50ee0783c2269f1db.asciidoc index 2058b87cf..80814dcf0 100644 --- a/docs/examples/4bef98a2dac575a50ee0783c2269f1db.asciidoc +++ b/docs/examples/4bef98a2dac575a50ee0783c2269f1db.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:469 +// mapping/types/dense-vector.asciidoc:498 [source, python] ---- diff --git a/docs/examples/4bfcb2861f1d572bd0d66acd66deab0b.asciidoc b/docs/examples/4bfcb2861f1d572bd0d66acd66deab0b.asciidoc index b83d3fc8a..a476373ec 100644 --- a/docs/examples/4bfcb2861f1d572bd0d66acd66deab0b.asciidoc +++ b/docs/examples/4bfcb2861f1d572bd0d66acd66deab0b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/update-datafeed.asciidoc:160 +// ml/anomaly-detection/apis/update-datafeed.asciidoc:166 [source, python] ---- diff --git a/docs/examples/4c174e228b6b74497b73ef2be80de7ad.asciidoc b/docs/examples/4c174e228b6b74497b73ef2be80de7ad.asciidoc index aec9f0336..3dd959ac0 100644 --- a/docs/examples/4c174e228b6b74497b73ef2be80de7ad.asciidoc +++ b/docs/examples/4c174e228b6b74497b73ef2be80de7ad.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/get-trained-models.asciidoc:1460 +// ml/trained-models/apis/get-trained-models.asciidoc:1467 [source, python] ---- diff --git a/docs/examples/4c3db8987d7b2d3d3df78ff1e71e7ede.asciidoc b/docs/examples/4c3db8987d7b2d3d3df78ff1e71e7ede.asciidoc index a8ec61ba0..4fb637fd2 100644 --- a/docs/examples/4c3db8987d7b2d3d3df78ff1e71e7ede.asciidoc +++ b/docs/examples/4c3db8987d7b2d3d3df78ff1e71e7ede.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/match-query.asciidoc:18 +// query-dsl/match-query.asciidoc:22 [source, python] ---- diff --git a/docs/examples/4c5f0d7af287618062bb627b44ccb23e.asciidoc b/docs/examples/4c5f0d7af287618062bb627b44ccb23e.asciidoc index 4d151a625..b54dcffd9 100644 --- a/docs/examples/4c5f0d7af287618062bb627b44ccb23e.asciidoc +++ b/docs/examples/4c5f0d7af287618062bb627b44ccb23e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:192 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:197 [source, python] ---- diff --git a/docs/examples/4c712bd5637892a11f16b8975a0a98ed.asciidoc b/docs/examples/4c712bd5637892a11f16b8975a0a98ed.asciidoc index 33328d0f1..d67e3f986 100644 --- a/docs/examples/4c712bd5637892a11f16b8975a0a98ed.asciidoc +++ b/docs/examples/4c712bd5637892a11f16b8975a0a98ed.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/dataframeanalytics.asciidoc:131 +// cat/dataframeanalytics.asciidoc:137 [source, python] ---- diff --git a/docs/examples/4c9350ed09b28f00e297ebe73c3b95a2.asciidoc b/docs/examples/4c9350ed09b28f00e297ebe73c3b95a2.asciidoc index f8f432fcb..85dd4b15b 100644 --- a/docs/examples/4c9350ed09b28f00e297ebe73c3b95a2.asciidoc +++ b/docs/examples/4c9350ed09b28f00e297ebe73c3b95a2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-elasticsearch.asciidoc:144 +// inference/service-elasticsearch.asciidoc:236 [source, python] ---- diff --git a/docs/examples/4c95d54b32df4dc49e9762b6c1ae2c05.asciidoc b/docs/examples/4c95d54b32df4dc49e9762b6c1ae2c05.asciidoc index 20d5098b5..da1513b91 100644 --- a/docs/examples/4c95d54b32df4dc49e9762b6c1ae2c05.asciidoc +++ b/docs/examples/4c95d54b32df4dc49e9762b6c1ae2c05.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/text.asciidoc:356 +// mapping/types/text.asciidoc:368 [source, python] ---- diff --git a/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc b/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc index 11b34e97f..b0a3784fb 100644 --- a/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc +++ b/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/allocation-explain.asciidoc:443 +// cluster/allocation-explain.asciidoc:457 [source, python] ---- diff --git a/docs/examples/4cb44556b8c699f43489b17b42ddd475.asciidoc b/docs/examples/4cb44556b8c699f43489b17b42ddd475.asciidoc index 7e66cc7c7..533486e82 100644 --- a/docs/examples/4cb44556b8c699f43489b17b42ddd475.asciidoc +++ b/docs/examples/4cb44556b8c699f43489b17b42ddd475.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/multi-get.asciidoc:216 +// docs/multi-get.asciidoc:222 [source, python] ---- diff --git a/docs/examples/4cdbd53f08df4bf66e2a47c0f1fcb3f8.asciidoc b/docs/examples/4cdbd53f08df4bf66e2a47c0f1fcb3f8.asciidoc index fb2f2e2c8..5f643884b 100644 --- a/docs/examples/4cdbd53f08df4bf66e2a47c0f1fcb3f8.asciidoc +++ b/docs/examples/4cdbd53f08df4bf66e2a47c0f1fcb3f8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/clearcache.asciidoc:130 +// indices/clearcache.asciidoc:136 [source, python] ---- diff --git a/docs/examples/4cdcc3fde5cea165a3a7567962b9bd61.asciidoc b/docs/examples/4cdcc3fde5cea165a3a7567962b9bd61.asciidoc index a74c2c8cb..fcc5123ad 100644 --- a/docs/examples/4cdcc3fde5cea165a3a7567962b9bd61.asciidoc +++ b/docs/examples/4cdcc3fde5cea165a3a7567962b9bd61.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/put-synonyms-set.asciidoc:125 +// synonyms/apis/put-synonyms-set.asciidoc:131 [source, python] ---- diff --git a/docs/examples/4d21725453955582ff12b4a1104aa7b6.asciidoc b/docs/examples/4d21725453955582ff12b4a1104aa7b6.asciidoc index 4f877c366..dafdda283 100644 --- a/docs/examples/4d21725453955582ff12b4a1104aa7b6.asciidoc +++ b/docs/examples/4d21725453955582ff12b4a1104aa7b6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/update-filter.asciidoc:44 +// ml/anomaly-detection/apis/update-filter.asciidoc:50 [source, python] ---- diff --git a/docs/examples/4d2e6eb7fea407deeb7a859c267fda62.asciidoc b/docs/examples/4d2e6eb7fea407deeb7a859c267fda62.asciidoc index cc1d2081a..7defd89a7 100644 --- a/docs/examples/4d2e6eb7fea407deeb7a859c267fda62.asciidoc +++ b/docs/examples/4d2e6eb7fea407deeb7a859c267fda62.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/put-job.asciidoc:254 +// rollup/apis/put-job.asciidoc:260 [source, python] ---- diff --git a/docs/examples/4d7c0b52d3c0a084157428624c543c90.asciidoc b/docs/examples/4d7c0b52d3c0a084157428624c543c90.asciidoc index f949a6474..df65fde44 100644 --- a/docs/examples/4d7c0b52d3c0a084157428624c543c90.asciidoc +++ b/docs/examples/4d7c0b52d3c0a084157428624c543c90.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/common/apis/get-ml-info.asciidoc:38 +// ml/common/apis/get-ml-info.asciidoc:44 [source, python] ---- diff --git a/docs/examples/4da0cb8693e9ceceee2ba3b558014bbf.asciidoc b/docs/examples/4da0cb8693e9ceceee2ba3b558014bbf.asciidoc new file mode 100644 index 000000000..1e3760d1b --- /dev/null +++ b/docs/examples/4da0cb8693e9ceceee2ba3b558014bbf.asciidoc @@ -0,0 +1,38 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-sharepoint-online.asciidoc:1088 + +[source, python] +---- +resp = client.update_by_query( + index="INDEX_NAME", + conflicts="proceed", + query={ + "bool": { + "filter": [ + { + "match": { + "object_type": "drive_item" + } + }, + { + "exists": { + "field": "file" + } + }, + { + "range": { + "lastModifiedDateTime": { + "lte": "now-180d" + } + } + } + ] + } + }, + script={ + "source": "ctx._source.body = ''", + "lang": "painless" + }, +) +print(resp) +---- diff --git a/docs/examples/4dab4c5168047ba596af1beb0e55b845.asciidoc b/docs/examples/4dab4c5168047ba596af1beb0e55b845.asciidoc deleted file mode 100644 index 275db14c9..000000000 --- a/docs/examples/4dab4c5168047ba596af1beb0e55b845.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// migration/transient-settings-migration-guide.asciidoc:82 - -[source, python] ----- -resp = client.cluster.get_settings( - flat_settings=True, -) -print(resp) ----- diff --git a/docs/examples/a53ff77d83222c0e76453e630d64787e.asciidoc b/docs/examples/4dc151eebefd484a28aed1a175743364.asciidoc similarity index 92% rename from docs/examples/a53ff77d83222c0e76453e630d64787e.asciidoc rename to docs/examples/4dc151eebefd484a28aed1a175743364.asciidoc index 52aeed34e..37d5cc81d 100644 --- a/docs/examples/a53ff77d83222c0e76453e630d64787e.asciidoc +++ b/docs/examples/4dc151eebefd484a28aed1a175743364.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="openai_embeddings", + id="openai_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/bdb671866e2f0195f8dfbdb7f20bf591.asciidoc b/docs/examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc similarity index 52% rename from docs/examples/bdb671866e2f0195f8dfbdb7f20bf591.asciidoc rename to docs/examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc index f398c9d7c..11ed7d7dd 100644 --- a/docs/examples/bdb671866e2f0195f8dfbdb7f20bf591.asciidoc +++ b/docs/examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc @@ -1,16 +1,15 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-semantic-text.asciidoc:34 +// inference/elastic-infer-service.asciidoc:100 [source, python] ---- resp = client.inference.put( task_type="sparse_embedding", - inference_id="my-elser-endpoint", + inference_id="elser-model-eis", inference_config={ - "service": "elser", + "service": "elastic", "service_settings": { - "num_allocations": 1, - "num_threads": 1 + "model_name": "elser" } }, ) diff --git a/docs/examples/4e931cfac74e46e221cf4a9ab88a182d.asciidoc b/docs/examples/4e931cfac74e46e221cf4a9ab88a182d.asciidoc index 6970d0a99..ae1dda74c 100644 --- a/docs/examples/4e931cfac74e46e221cf4a9ab88a182d.asciidoc +++ b/docs/examples/4e931cfac74e46e221cf4a9ab88a182d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/field-caps.asciidoc:246 +// search/field-caps.asciidoc:251 [source, python] ---- diff --git a/docs/examples/4ed946065faa92f9950f04e402676a97.asciidoc b/docs/examples/4ed946065faa92f9950f04e402676a97.asciidoc index 47af87b3b..72f00c320 100644 --- a/docs/examples/4ed946065faa92f9950f04e402676a97.asciidoc +++ b/docs/examples/4ed946065faa92f9950f04e402676a97.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/info.asciidoc:200 +// rest-api/info.asciidoc:206 [source, python] ---- diff --git a/docs/examples/4edfb5934d14ad7655bd7e19a112b5c0.asciidoc b/docs/examples/4edfb5934d14ad7655bd7e19a112b5c0.asciidoc new file mode 100644 index 000000000..562471a1c --- /dev/null +++ b/docs/examples/4edfb5934d14ad7655bd7e19a112b5c0.asciidoc @@ -0,0 +1,58 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:522 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "bool": { + "must": [ + { + "term": { + "tags": "vegetarian" + } + }, + { + "range": { + "rating": { + "gte": 4.5 + } + } + } + ], + "should": [ + { + "term": { + "category": "Main Course" + } + }, + { + "multi_match": { + "query": "curry spicy", + "fields": [ + "title^2", + "description" + ] + } + }, + { + "range": { + "date": { + "gte": "now-1M/d" + } + } + } + ], + "must_not": [ + { + "term": { + "category.keyword": "Dessert" + } + } + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/4ee31fd4ea6d18f32ec28b7fa433441d.asciidoc b/docs/examples/4ee31fd4ea6d18f32ec28b7fa433441d.asciidoc index 3a608567f..5211b63ec 100644 --- a/docs/examples/4ee31fd4ea6d18f32ec28b7fa433441d.asciidoc +++ b/docs/examples/4ee31fd4ea6d18f32ec28b7fa433441d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/put-app-privileges.asciidoc:88 +// rest-api/security/put-app-privileges.asciidoc:94 [source, python] ---- diff --git a/docs/examples/c9373ff5ed6b026173428fbb92ca2d9f.asciidoc b/docs/examples/4eeded40f30949e359714a5bb6c88612.asciidoc similarity index 87% rename from docs/examples/c9373ff5ed6b026173428fbb92ca2d9f.asciidoc rename to docs/examples/4eeded40f30949e359714a5bb6c88612.asciidoc index 8f1d14d52..b5bb3b50f 100644 --- a/docs/examples/c9373ff5ed6b026173428fbb92ca2d9f.asciidoc +++ b/docs/examples/4eeded40f30949e359714a5bb6c88612.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "elser-embeddings", - "pipeline": "elser_embeddings" + "pipeline": "elser_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/4f08d9e21d9f199acc77abfb83287878.asciidoc b/docs/examples/4f08d9e21d9f199acc77abfb83287878.asciidoc index 97db55509..c13a9cfa3 100644 --- a/docs/examples/4f08d9e21d9f199acc77abfb83287878.asciidoc +++ b/docs/examples/4f08d9e21d9f199acc77abfb83287878.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search-application/apis/search-application-search.asciidoc:125 +// search-application/apis/search-application-search.asciidoc:130 [source, python] ---- diff --git a/docs/examples/4f140d8922efdf3420e41b1cb669a289.asciidoc b/docs/examples/4f140d8922efdf3420e41b1cb669a289.asciidoc index 1f5787c1c..9febe3c0c 100644 --- a/docs/examples/4f140d8922efdf3420e41b1cb669a289.asciidoc +++ b/docs/examples/4f140d8922efdf3420e41b1cb669a289.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/delete-component-template.asciidoc:25 +// indices/delete-component-template.asciidoc:31 [source, python] ---- diff --git a/docs/examples/4f621ab694f62ddb89e0684a9e76c4d1.asciidoc b/docs/examples/4f621ab694f62ddb89e0684a9e76c4d1.asciidoc index 8e43ea56c..271540047 100644 --- a/docs/examples/4f621ab694f62ddb89e0684a9e76c4d1.asciidoc +++ b/docs/examples/4f621ab694f62ddb89e0684a9e76c4d1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:574 +// search/search-your-data/highlighting.asciidoc:586 [source, python] ---- diff --git a/docs/examples/4f666d710758578e2582850dac3ad144.asciidoc b/docs/examples/4f666d710758578e2582850dac3ad144.asciidoc index 60e20c858..0474f05fc 100644 --- a/docs/examples/4f666d710758578e2582850dac3ad144.asciidoc +++ b/docs/examples/4f666d710758578e2582850dac3ad144.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-user-profile-data.asciidoc:135 +// rest-api/security/update-user-profile-data.asciidoc:141 [source, python] ---- diff --git a/docs/examples/4f6694ef147a73b1163bde3c13779d26.asciidoc b/docs/examples/4f6694ef147a73b1163bde3c13779d26.asciidoc new file mode 100644 index 000000000..249c1bddd --- /dev/null +++ b/docs/examples/4f6694ef147a73b1163bde3c13779d26.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// troubleshooting/common-issues/rejected-requests.asciidoc:68 + +[source, python] +---- +resp = client.nodes.stats( + human=True, + filter_path="nodes.*.indexing_pressure", +) +print(resp) +---- diff --git a/docs/examples/4f8a4ad49e2bca6784c88ede18a1a709.asciidoc b/docs/examples/4f8a4ad49e2bca6784c88ede18a1a709.asciidoc index c7576d78e..3cabc3382 100644 --- a/docs/examples/4f8a4ad49e2bca6784c88ede18a1a709.asciidoc +++ b/docs/examples/4f8a4ad49e2bca6784c88ede18a1a709.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// licensing/delete-license.asciidoc:37 +// licensing/delete-license.asciidoc:43 [source, python] ---- diff --git a/docs/examples/4fa9ee04188cbf0b38cfc28f6a56527d.asciidoc b/docs/examples/4fa9ee04188cbf0b38cfc28f6a56527d.asciidoc index ac9f9eb67..aab1b8537 100644 --- a/docs/examples/4fa9ee04188cbf0b38cfc28f6a56527d.asciidoc +++ b/docs/examples/4fa9ee04188cbf0b38cfc28f6a56527d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-datafeed.asciidoc:74 +// ml/anomaly-detection/apis/get-datafeed.asciidoc:80 [source, python] ---- diff --git a/docs/examples/4fb0629146ca78b85e823edd405497bb.asciidoc b/docs/examples/4fb0629146ca78b85e823edd405497bb.asciidoc index ce649ee73..2c8596f9b 100644 --- a/docs/examples/4fb0629146ca78b85e823edd405497bb.asciidoc +++ b/docs/examples/4fb0629146ca78b85e823edd405497bb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/put-dfanalytics.asciidoc:908 +// ml/df-analytics/apis/put-dfanalytics.asciidoc:914 [source, python] ---- diff --git a/docs/examples/4fcca1687d7b2cf08de526539fea5a76.asciidoc b/docs/examples/4fcca1687d7b2cf08de526539fea5a76.asciidoc index 49ed59db1..1abf2a2a7 100644 --- a/docs/examples/4fcca1687d7b2cf08de526539fea5a76.asciidoc +++ b/docs/examples/4fcca1687d7b2cf08de526539fea5a76.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/text-expansion-query.asciidoc:112 +// query-dsl/text-expansion-query.asciidoc:119 [source, python] ---- diff --git a/docs/examples/4ff2dcec03fe097075cf1d174a019a1f.asciidoc b/docs/examples/4ff2dcec03fe097075cf1d174a019a1f.asciidoc index ed884ed78..9e3334ae1 100644 --- a/docs/examples/4ff2dcec03fe097075cf1d174a019a1f.asciidoc +++ b/docs/examples/4ff2dcec03fe097075cf1d174a019a1f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:709 +// search/search-your-data/highlighting.asciidoc:721 [source, python] ---- diff --git a/docs/examples/5093bfd281dbe41bd0dba8ff979e6e47.asciidoc b/docs/examples/5093bfd281dbe41bd0dba8ff979e6e47.asciidoc index 1dfd1c859..a25580013 100644 --- a/docs/examples/5093bfd281dbe41bd0dba8ff979e6e47.asciidoc +++ b/docs/examples/5093bfd281dbe41bd0dba8ff979e6e47.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/apis/get-stored-script-api.asciidoc:24 +// scripting/apis/get-stored-script-api.asciidoc:30 [source, python] ---- diff --git a/docs/examples/50a9623c153cabe64101efb633e10e6c.asciidoc b/docs/examples/50a9623c153cabe64101efb633e10e6c.asciidoc index b84d11c31..08678e3bd 100644 --- a/docs/examples/50a9623c153cabe64101efb633e10e6c.asciidoc +++ b/docs/examples/50a9623c153cabe64101efb633e10e6c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/delete-autoscaling-policy.asciidoc:31 +// autoscaling/apis/delete-autoscaling-policy.asciidoc:37 [source, python] ---- diff --git a/docs/examples/50b5c0332949d2154c72b629b5fa6222.asciidoc b/docs/examples/50b5c0332949d2154c72b629b5fa6222.asciidoc index 0922defcd..b096a417a 100644 --- a/docs/examples/50b5c0332949d2154c72b629b5fa6222.asciidoc +++ b/docs/examples/50b5c0332949d2154c72b629b5fa6222.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:339 +// indices/put-mapping.asciidoc:345 [source, python] ---- diff --git a/docs/examples/50d9c0508ddb0fc5ba5a893eec219dd8.asciidoc b/docs/examples/50d9c0508ddb0fc5ba5a893eec219dd8.asciidoc index 13c958321..a078c4d75 100644 --- a/docs/examples/50d9c0508ddb0fc5ba5a893eec219dd8.asciidoc +++ b/docs/examples/50d9c0508ddb0fc5ba5a893eec219dd8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/fields/synthetic-source.asciidoc:125 +// mapping/fields/synthetic-source.asciidoc:129 [source, python] ---- diff --git a/docs/examples/50dc35d3d8705bd62aed20a15209476c.asciidoc b/docs/examples/50dc35d3d8705bd62aed20a15209476c.asciidoc index a51c7d773..8919d476a 100644 --- a/docs/examples/50dc35d3d8705bd62aed20a15209476c.asciidoc +++ b/docs/examples/50dc35d3d8705bd62aed20a15209476c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:358 +// rest-api/security/create-role-mappings.asciidoc:364 [source, python] ---- diff --git a/docs/examples/50ddf374cfa8128538ea092ee98b723d.asciidoc b/docs/examples/50ddf374cfa8128538ea092ee98b723d.asciidoc deleted file mode 100644 index e5951558a..000000000 --- a/docs/examples/50ddf374cfa8128538ea092ee98b723d.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/task-queue-backlog.asciidoc:45 - -[source, python] ----- -resp = client.tasks.list( - filter_path="nodes.*.tasks", -) -print(resp) ----- diff --git a/docs/examples/511e5bb8ab881171b7e8629095e30b85.asciidoc b/docs/examples/511e5bb8ab881171b7e8629095e30b85.asciidoc index f99c9de99..0b4ccfb09 100644 --- a/docs/examples/511e5bb8ab881171b7e8629095e30b85.asciidoc +++ b/docs/examples/511e5bb8ab881171b7e8629095e30b85.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/downsampling-ilm.asciidoc:417 +// data-streams/downsampling-dsl.asciidoc:400 [source, python] ---- diff --git a/docs/examples/5174c3c731fc1703e5b43ae2bae7a80e.asciidoc b/docs/examples/5174c3c731fc1703e5b43ae2bae7a80e.asciidoc index 4488c4343..cef5594ec 100644 --- a/docs/examples/5174c3c731fc1703e5b43ae2bae7a80e.asciidoc +++ b/docs/examples/5174c3c731fc1703e5b43ae2bae7a80e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// sql/apis/clear-sql-cursor-api.asciidoc:23 +// sql/apis/clear-sql-cursor-api.asciidoc:29 [source, python] ---- diff --git a/docs/examples/5195a88194f7a139c635a84398d76205.asciidoc b/docs/examples/5195a88194f7a139c635a84398d76205.asciidoc index 812b30e06..93151dd86 100644 --- a/docs/examples/5195a88194f7a139c635a84398d76205.asciidoc +++ b/docs/examples/5195a88194f7a139c635a84398d76205.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/restore-snapshot-api.asciidoc:54 +// snapshot-restore/apis/restore-snapshot-api.asciidoc:60 [source, python] ---- diff --git a/docs/examples/519e46350316a33162740e5d7968aa2c.asciidoc b/docs/examples/519e46350316a33162740e5d7968aa2c.asciidoc new file mode 100644 index 000000000..a0daa1e65 --- /dev/null +++ b/docs/examples/519e46350316a33162740e5d7968aa2c.asciidoc @@ -0,0 +1,27 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/knn-search.asciidoc:1103 + +[source, python] +---- +resp = client.search( + index="image-index", + knn={ + "field": "image-vector", + "query_vector": [ + -5, + 9, + -12 + ], + "k": 10, + "num_candidates": 100, + "rescore_vector": { + "oversample": 2 + } + }, + fields=[ + "title", + "file-type" + ], +) +print(resp) +---- diff --git a/docs/examples/51b44224feee6e2e5974824334474c77.asciidoc b/docs/examples/51b44224feee6e2e5974824334474c77.asciidoc index 134b309bb..93e483a64 100644 --- a/docs/examples/51b44224feee6e2e5974824334474c77.asciidoc +++ b/docs/examples/51b44224feee6e2e5974824334474c77.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/repository-s3.asciidoc:342 +// snapshot-restore/repository-s3.asciidoc:371 [source, python] ---- diff --git a/docs/examples/51f1a0930362594b231a5bcc17673768.asciidoc b/docs/examples/51f1a0930362594b231a5bcc17673768.asciidoc index 0950c1dee..4c986a6ed 100644 --- a/docs/examples/51f1a0930362594b231a5bcc17673768.asciidoc +++ b/docs/examples/51f1a0930362594b231a5bcc17673768.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/modify-data-streams-api.asciidoc:11 +// data-streams/modify-data-streams-api.asciidoc:17 [source, python] ---- diff --git a/docs/examples/5275842787967b6db876025f4a1c6942.asciidoc b/docs/examples/5275842787967b6db876025f4a1c6942.asciidoc index 679b69a09..dd4e9ae6e 100644 --- a/docs/examples/5275842787967b6db876025f4a1c6942.asciidoc +++ b/docs/examples/5275842787967b6db876025f4a1c6942.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/suggesters.asciidoc:122 +// search/suggesters.asciidoc:128 [source, python] ---- diff --git a/docs/examples/529671ffaf7cc75fe83a81d729788be4.asciidoc b/docs/examples/529671ffaf7cc75fe83a81d729788be4.asciidoc new file mode 100644 index 000000000..69a3e2868 --- /dev/null +++ b/docs/examples/529671ffaf7cc75fe83a81d729788be4.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-known-issues.asciidoc:124 + +[source, python] +---- +resp = client.update( + index=".elastic-connectors", + id="connector_id", + doc={ + "configuration": { + "field_a": { + "type": "str", + "value": "" + }, + "field_b": { + "type": "bool", + "value": False + }, + "field_c": { + "type": "int", + "value": 1 + }, + "field_d": { + "type": "list", + "value": "a,b" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/52a2d119addb15366a935115518335fd.asciidoc b/docs/examples/52a2d119addb15366a935115518335fd.asciidoc index 2ee9ea4c7..221acc952 100644 --- a/docs/examples/52a2d119addb15366a935115518335fd.asciidoc +++ b/docs/examples/52a2d119addb15366a935115518335fd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shrink-index.asciidoc:46 +// indices/shrink-index.asciidoc:52 [source, python] ---- diff --git a/docs/examples/52b71aa4ae6563abae78cd20ff06d1e9.asciidoc b/docs/examples/52b71aa4ae6563abae78cd20ff06d1e9.asciidoc index 8121426ba..eda2a03b6 100644 --- a/docs/examples/52b71aa4ae6563abae78cd20ff06d1e9.asciidoc +++ b/docs/examples/52b71aa4ae6563abae78cd20ff06d1e9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/hotspotting.asciidoc:142 +// troubleshooting/common-issues/hotspotting.asciidoc:148 [source, python] ---- diff --git a/docs/examples/52c2b4c180388f5ae044588ba70b70f0.asciidoc b/docs/examples/52c2b4c180388f5ae044588ba70b70f0.asciidoc index 0a7997675..1a2dbaaae 100644 --- a/docs/examples/52c2b4c180388f5ae044588ba70b70f0.asciidoc +++ b/docs/examples/52c2b4c180388f5ae044588ba70b70f0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/knn-query.asciidoc:172 +// query-dsl/knn-query.asciidoc:178 [source, python] ---- diff --git a/docs/examples/52f4c5eb08d39f98e2e2f5527ece9731.asciidoc b/docs/examples/52f4c5eb08d39f98e2e2f5527ece9731.asciidoc index 4e861160e..89fa235ad 100644 --- a/docs/examples/52f4c5eb08d39f98e2e2f5527ece9731.asciidoc +++ b/docs/examples/52f4c5eb08d39f98e2e2f5527ece9731.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-alibabacloud-ai-search.asciidoc:154 +// inference/service-alibabacloud-ai-search.asciidoc:210 [source, python] ---- diff --git a/docs/examples/5305bc07c1bf90bab3e8db1de3e31b26.asciidoc b/docs/examples/5305bc07c1bf90bab3e8db1de3e31b26.asciidoc index 4458a453d..b8649ab3c 100644 --- a/docs/examples/5305bc07c1bf90bab3e8db1de3e31b26.asciidoc +++ b/docs/examples/5305bc07c1bf90bab3e8db1de3e31b26.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// shutdown/apis/shutdown-put.asciidoc:96 +// shutdown/apis/shutdown-put.asciidoc:102 [source, python] ---- diff --git a/docs/examples/532ddf9afdcd0b1c9c0bb331e74d8df3.asciidoc b/docs/examples/532ddf9afdcd0b1c9c0bb331e74d8df3.asciidoc index d42b38962..238c865bc 100644 --- a/docs/examples/532ddf9afdcd0b1c9c0bb331e74d8df3.asciidoc +++ b/docs/examples/532ddf9afdcd0b1c9c0bb331e74d8df3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:156 +// search/search-your-data/sort-search-results.asciidoc:158 [source, python] ---- diff --git a/docs/examples/532f371934b61fb4992d37bedcc085de.asciidoc b/docs/examples/532f371934b61fb4992d37bedcc085de.asciidoc index dab4d1e81..d558dc5d6 100644 --- a/docs/examples/532f371934b61fb4992d37bedcc085de.asciidoc +++ b/docs/examples/532f371934b61fb4992d37bedcc085de.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// shutdown/apis/shutdown-get.asciidoc:49 +// shutdown/apis/shutdown-get.asciidoc:55 [source, python] ---- diff --git a/docs/examples/533087d787b48878a0bf3fa8d0851b64.asciidoc b/docs/examples/533087d787b48878a0bf3fa8d0851b64.asciidoc deleted file mode 100644 index ee9fdaefd..000000000 --- a/docs/examples/533087d787b48878a0bf3fa8d0851b64.asciidoc +++ /dev/null @@ -1,11 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// ingest/apis/delete-geoip-database.asciidoc:52 - -[source, python] ----- -resp = client.perform_request( - "DELETE", - "/_ingest/geoip/database/example-database-id", -) -print(resp) ----- diff --git a/docs/examples/537bce129338d9227bccb6a0283dab45.asciidoc b/docs/examples/537bce129338d9227bccb6a0283dab45.asciidoc new file mode 100644 index 000000000..2bae93faa --- /dev/null +++ b/docs/examples/537bce129338d9227bccb6a0283dab45.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/data-stream-reindex.asciidoc:232 + +[source, python] +---- +resp = client.cluster.put_settings( + persistent={ + "migrate.data_stream_reindex_max_request_per_second": 10000 + }, +) +print(resp) +---- diff --git a/docs/examples/53c6256295111524d5ff2885bdcb99a9.asciidoc b/docs/examples/53c6256295111524d5ff2885bdcb99a9.asciidoc index f59be3554..0777d6f7c 100644 --- a/docs/examples/53c6256295111524d5ff2885bdcb99a9.asciidoc +++ b/docs/examples/53c6256295111524d5ff2885bdcb99a9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/get-transform-stats.asciidoc:322 +// transform/apis/get-transform-stats.asciidoc:328 [source, python] ---- diff --git a/docs/examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc b/docs/examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc new file mode 100644 index 000000000..40f6deb33 --- /dev/null +++ b/docs/examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/processors/inference.asciidoc:784 + +[source, python] +---- +resp = client.ingest.simulate( + id="query_helper_pipeline", + docs=[ + { + "_source": { + "content": "artificial intelligence in medicine articles published in the last 12 months" + } + } + ], +) +print(resp) +---- diff --git a/docs/examples/5457c94f0039c6b95c7f9f305d0c6b58.asciidoc b/docs/examples/5457c94f0039c6b95c7f9f305d0c6b58.asciidoc index 95e608a13..f538d29ea 100644 --- a/docs/examples/5457c94f0039c6b95c7f9f305d0c6b58.asciidoc +++ b/docs/examples/5457c94f0039c6b95c7f9f305d0c6b58.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-stats.asciidoc:2528 +// cluster/nodes-stats.asciidoc:2538 [source, python] ---- diff --git a/docs/examples/3a7a6ab88a49b484fafb10c8eb09b562.asciidoc b/docs/examples/548a9b6f447bb820380c1c23e57c18c3.asciidoc similarity index 92% rename from docs/examples/3a7a6ab88a49b484fafb10c8eb09b562.asciidoc rename to docs/examples/548a9b6f447bb820380c1c23e57c18c3.asciidoc index 3ee86992c..46022c5f3 100644 --- a/docs/examples/3a7a6ab88a49b484fafb10c8eb09b562.asciidoc +++ b/docs/examples/548a9b6f447bb820380c1c23e57c18c3.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="cohere_embeddings", + id="cohere_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/54a47b5d07e7bfbea75c77f35eaae18d.asciidoc b/docs/examples/54a47b5d07e7bfbea75c77f35eaae18d.asciidoc new file mode 100644 index 000000000..474cc58ef --- /dev/null +++ b/docs/examples/54a47b5d07e7bfbea75c77f35eaae18d.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-known-issues.asciidoc:77 + +[source, python] +---- +resp = client.indices.put_mapping( + index=".elastic-connectors-sync-jobs-v1", + properties={ + "job_type": { + "type": "keyword" + } + }, +) +print(resp) +---- diff --git a/docs/examples/55085e6a2891040b6ac696561d0787c8.asciidoc b/docs/examples/55085e6a2891040b6ac696561d0787c8.asciidoc new file mode 100644 index 000000000..7e29fa416 --- /dev/null +++ b/docs/examples/55085e6a2891040b6ac696561d0787c8.asciidoc @@ -0,0 +1,32 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/passthrough.asciidoc:93 + +[source, python] +---- +resp = client.indices.create( + index="my-index-000002", + mappings={ + "properties": { + "attributes": { + "type": "passthrough", + "priority": 10, + "properties": { + "id": { + "type": "keyword" + } + } + }, + "resource.attributes": { + "type": "passthrough", + "priority": 20, + "properties": { + "id": { + "type": "keyword" + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/55096381f811388fafd8e244dd2402c8.asciidoc b/docs/examples/55096381f811388fafd8e244dd2402c8.asciidoc index e460dfbb5..9c38bd334 100644 --- a/docs/examples/55096381f811388fafd8e244dd2402c8.asciidoc +++ b/docs/examples/55096381f811388fafd8e244dd2402c8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:445 +// indices/rollover-index.asciidoc:451 [source, python] ---- diff --git a/docs/examples/b468d0124dc485385a34504d5b7af82a.asciidoc b/docs/examples/551467688d8c701315d0a371850a4056.asciidoc similarity index 85% rename from docs/examples/b468d0124dc485385a34504d5b7af82a.asciidoc rename to docs/examples/551467688d8c701315d0a371850a4056.asciidoc index a613d0c3d..6cd149a4a 100644 --- a/docs/examples/b468d0124dc485385a34504d5b7af82a.asciidoc +++ b/docs/examples/551467688d8c701315d0a371850a4056.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "hugging-face-embeddings", - "pipeline": "hugging_face_embeddings" + "pipeline": "hugging_face_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/97f260817b60f3deb7f7034d7dee7e12.asciidoc b/docs/examples/551799fef2f86e393db83a967e4a30d1.asciidoc similarity index 75% rename from docs/examples/97f260817b60f3deb7f7034d7dee7e12.asciidoc rename to docs/examples/551799fef2f86e393db83a967e4a30d1.asciidoc index 09cf33165..e2b93fb61 100644 --- a/docs/examples/97f260817b60f3deb7f7034d7dee7e12.asciidoc +++ b/docs/examples/551799fef2f86e393db83a967e4a30d1.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/aggregate-metric-double.asciidoc:267 +// mapping/types/aggregate-metric-double.asciidoc:264 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "agg_metric": { "type": "aggregate_metric_double", diff --git a/docs/examples/558b3f9b987771e9f9f35e51a0d7e062.asciidoc b/docs/examples/558b3f9b987771e9f9f35e51a0d7e062.asciidoc index 053704c71..a5d7653a2 100644 --- a/docs/examples/558b3f9b987771e9f9f35e51a0d7e062.asciidoc +++ b/docs/examples/558b3f9b987771e9f9f35e51a0d7e062.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/profile.asciidoc:1155 +// search/profile.asciidoc:1160 [source, python] ---- diff --git a/docs/examples/55e8ddf643726dec51531ada0bec7143.asciidoc b/docs/examples/55e8ddf643726dec51531ada0bec7143.asciidoc index e1f3f9765..0ef93680e 100644 --- a/docs/examples/55e8ddf643726dec51531ada0bec7143.asciidoc +++ b/docs/examples/55e8ddf643726dec51531ada0bec7143.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-stats.asciidoc:26 +// slm/apis/slm-stats.asciidoc:32 [source, python] ---- diff --git a/docs/examples/55f4a15b84b724b9fbf2efd29a4da120.asciidoc b/docs/examples/55f4a15b84b724b9fbf2efd29a4da120.asciidoc index e47fdd6ae..5ab51f4c9 100644 --- a/docs/examples/55f4a15b84b724b9fbf2efd29a4da120.asciidoc +++ b/docs/examples/55f4a15b84b724b9fbf2efd29a4da120.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/authenticate.asciidoc:35 +// rest-api/security/authenticate.asciidoc:41 [source, python] ---- diff --git a/docs/examples/5619103306878d58a058bce87c5bd82b.asciidoc b/docs/examples/5619103306878d58a058bce87c5bd82b.asciidoc index d73c08bc4..fac3847b5 100644 --- a/docs/examples/5619103306878d58a058bce87c5bd82b.asciidoc +++ b/docs/examples/5619103306878d58a058bce87c5bd82b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/recovery.asciidoc:336 +// indices/recovery.asciidoc:342 [source, python] ---- diff --git a/docs/examples/563dfbf421422c837ee6929ae2ede876.asciidoc b/docs/examples/563dfbf421422c837ee6929ae2ede876.asciidoc index a15e07d5c..fe461e602 100644 --- a/docs/examples/563dfbf421422c837ee6929ae2ede876.asciidoc +++ b/docs/examples/563dfbf421422c837ee6929ae2ede876.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/migrate-to-data-stream.asciidoc:53 +// indices/migrate-to-data-stream.asciidoc:59 [source, python] ---- diff --git a/docs/examples/1b60ad542abb511cbd926ac8c55b609c.asciidoc b/docs/examples/565386eee0951865a684e41fab53b40c.asciidoc similarity index 84% rename from docs/examples/1b60ad542abb511cbd926ac8c55b609c.asciidoc rename to docs/examples/565386eee0951865a684e41fab53b40c.asciidoc index 4e3a57eb3..4ee080da8 100644 --- a/docs/examples/1b60ad542abb511cbd926ac8c55b609c.asciidoc +++ b/docs/examples/565386eee0951865a684e41fab53b40c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-elser.asciidoc:141 +// inference/service-elser.asciidoc:128 [source, python] ---- @@ -13,7 +13,8 @@ resp = client.inference.put( "enabled": True, "min_number_of_allocations": 3, "max_number_of_allocations": 10 - } + }, + "num_threads": 1 } }, ) diff --git a/docs/examples/56563f91d9f0b74e9e4aae9cb221845b.asciidoc b/docs/examples/56563f91d9f0b74e9e4aae9cb221845b.asciidoc index 67cb1a01c..519d06ace 100644 --- a/docs/examples/56563f91d9f0b74e9e4aae9cb221845b.asciidoc +++ b/docs/examples/56563f91d9f0b74e9e4aae9cb221845b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-cross-cluster-api-key.asciidoc:106 +// rest-api/security/create-cross-cluster-api-key.asciidoc:111 [source, python] ---- diff --git a/docs/examples/568979150ce18739f8d3ea859355aaa3.asciidoc b/docs/examples/568979150ce18739f8d3ea859355aaa3.asciidoc index 9accb5678..534e62d6e 100644 --- a/docs/examples/568979150ce18739f8d3ea859355aaa3.asciidoc +++ b/docs/examples/568979150ce18739f8d3ea859355aaa3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-users.asciidoc:87 +// rest-api/security/get-users.asciidoc:92 [source, python] ---- diff --git a/docs/examples/56a1aa4f7fa62f2289e20607e3039bf3.asciidoc b/docs/examples/56a1aa4f7fa62f2289e20607e3039bf3.asciidoc index c43a52a11..3d50d720a 100644 --- a/docs/examples/56a1aa4f7fa62f2289e20607e3039bf3.asciidoc +++ b/docs/examples/56a1aa4f7fa62f2289e20607e3039bf3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:13 +// indices/put-mapping.asciidoc:19 [source, python] ---- diff --git a/docs/examples/56b6b50b174a935d368301ebd717231d.asciidoc b/docs/examples/56b6b50b174a935d368301ebd717231d.asciidoc index d4873c9da..b7f802b9d 100644 --- a/docs/examples/56b6b50b174a935d368301ebd717231d.asciidoc +++ b/docs/examples/56b6b50b174a935d368301ebd717231d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/stats.asciidoc:119 +// rest-api/watcher/stats.asciidoc:125 [source, python] ---- diff --git a/docs/examples/5db5349162a4fbe74bffb646926a2495.asciidoc b/docs/examples/56da252798b8e7b006738428aa1a7f4c.asciidoc similarity index 67% rename from docs/examples/5db5349162a4fbe74bffb646926a2495.asciidoc rename to docs/examples/56da252798b8e7b006738428aa1a7f4c.asciidoc index 43631c2cb..f53776159 100644 --- a/docs/examples/5db5349162a4fbe74bffb646926a2495.asciidoc +++ b/docs/examples/56da252798b8e7b006738428aa1a7f4c.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/range.asciidoc:357 +// mapping/types/range.asciidoc:373 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "my_range": { "type": "long_range" diff --git a/docs/examples/56db76c987106a870357854d3068ad98.asciidoc b/docs/examples/56db76c987106a870357854d3068ad98.asciidoc index ede6b5e5c..fc05e3283 100644 --- a/docs/examples/56db76c987106a870357854d3068ad98.asciidoc +++ b/docs/examples/56db76c987106a870357854d3068ad98.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-rules/apis/list-query-rulesets.asciidoc:158 +// query-rules/apis/list-query-rulesets.asciidoc:164 [source, python] ---- diff --git a/docs/examples/578808065fee8691355b8f25c35782cd.asciidoc b/docs/examples/578808065fee8691355b8f25c35782cd.asciidoc index 8bd882564..4ec94c9f5 100644 --- a/docs/examples/578808065fee8691355b8f25c35782cd.asciidoc +++ b/docs/examples/578808065fee8691355b8f25c35782cd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/profile.asciidoc:1018 +// search/profile.asciidoc:1023 [source, python] ---- diff --git a/docs/examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc b/docs/examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc index a18b9a0a8..d9f9291ff 100644 --- a/docs/examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc +++ b/docs/examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc @@ -1,14 +1,12 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/oidc-prepare-authentication-api.asciidoc:100 +// rest-api/security/oidc-prepare-authentication-api.asciidoc:106 [source, python] ---- resp = client.security.oidc_prepare_authentication( - body={ - "realm": "oidc1", - "state": "lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO", - "nonce": "zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5" - }, + realm="oidc1", + state="lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO", + nonce="zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5", ) print(resp) ---- diff --git a/docs/examples/57e0bbab98f17d5b564d1ea146a55fe4.asciidoc b/docs/examples/57e0bbab98f17d5b564d1ea146a55fe4.asciidoc index 79a2d5fcf..19c524c34 100644 --- a/docs/examples/57e0bbab98f17d5b564d1ea146a55fe4.asciidoc +++ b/docs/examples/57e0bbab98f17d5b564d1ea146a55fe4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template.asciidoc:218 +// indices/put-index-template.asciidoc:227 [source, python] ---- diff --git a/docs/examples/582c4b05401dbc190b19411282d85310.asciidoc b/docs/examples/582c4b05401dbc190b19411282d85310.asciidoc index ed9d3ea23..299d52aec 100644 --- a/docs/examples/582c4b05401dbc190b19411282d85310.asciidoc +++ b/docs/examples/582c4b05401dbc190b19411282d85310.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:375 +// scripting/using.asciidoc:380 [source, python] ---- diff --git a/docs/examples/5836b09198feb1269ed12839b416123d.asciidoc b/docs/examples/5836b09198feb1269ed12839b416123d.asciidoc new file mode 100644 index 000000000..5f11e91e2 --- /dev/null +++ b/docs/examples/5836b09198feb1269ed12839b416123d.asciidoc @@ -0,0 +1,16 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-jinaai.asciidoc:218 + +[source, python] +---- +resp = client.search( + index="jinaai-index", + query={ + "semantic": { + "field": "content", + "query": "who inspired taking care of the sea?" + } + }, +) +print(resp) +---- diff --git a/docs/examples/5837d5f50665ac0a26181d3aaeb3f204.asciidoc b/docs/examples/5837d5f50665ac0a26181d3aaeb3f204.asciidoc index 71163305a..c5c20efb5 100644 --- a/docs/examples/5837d5f50665ac0a26181d3aaeb3f204.asciidoc +++ b/docs/examples/5837d5f50665ac0a26181d3aaeb3f204.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/start-trained-model-deployment.asciidoc:208 +// ml/trained-models/apis/start-trained-model-deployment.asciidoc:214 [source, python] ---- diff --git a/docs/examples/584f502cf840134f2db5f39e2483ced1.asciidoc b/docs/examples/584f502cf840134f2db5f39e2483ced1.asciidoc index 925fc1eb0..cb0cd262e 100644 --- a/docs/examples/584f502cf840134f2db5f39e2483ced1.asciidoc +++ b/docs/examples/584f502cf840134f2db5f39e2483ced1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1453 +// analysis/analyzers/lang-analyzer.asciidoc:1454 [source, python] ---- diff --git a/docs/examples/585a34ad79aee16678b37da785933ac8.asciidoc b/docs/examples/585a34ad79aee16678b37da785933ac8.asciidoc index 4ae188bd7..069d5ef6e 100644 --- a/docs/examples/585a34ad79aee16678b37da785933ac8.asciidoc +++ b/docs/examples/585a34ad79aee16678b37da785933ac8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/stop.asciidoc:79 +// ilm/apis/stop.asciidoc:85 [source, python] ---- diff --git a/docs/examples/58ca855be30049f8f0879e532db51ee2.asciidoc b/docs/examples/58ca855be30049f8f0879e532db51ee2.asciidoc index d043f45f6..b6c5fea9f 100644 --- a/docs/examples/58ca855be30049f8f0879e532db51ee2.asciidoc +++ b/docs/examples/58ca855be30049f8f0879e532db51ee2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/put-transform.asciidoc:314 +// transform/apis/put-transform.asciidoc:320 [source, python] ---- diff --git a/docs/examples/58dd26afc919722e21358c91e112b27a.asciidoc b/docs/examples/58dd26afc919722e21358c91e112b27a.asciidoc new file mode 100644 index 000000000..a96a8752d --- /dev/null +++ b/docs/examples/58dd26afc919722e21358c91e112b27a.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:459 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "range": { + "date": { + "gte": "2023-05-01", + "lte": "2023-05-31" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc b/docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc index 95b46f3fe..cea199fa0 100644 --- a/docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc +++ b/docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/cluster/misc.asciidoc:179 +// modules/cluster/misc.asciidoc:182 [source, python] ---- diff --git a/docs/examples/591c7fb7451069829a14bba593136f1f.asciidoc b/docs/examples/591c7fb7451069829a14bba593136f1f.asciidoc index 85d4c0f71..bdebba748 100644 --- a/docs/examples/591c7fb7451069829a14bba593136f1f.asciidoc +++ b/docs/examples/591c7fb7451069829a14bba593136f1f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/forecast.asciidoc:82 +// ml/anomaly-detection/apis/forecast.asciidoc:88 [source, python] ---- diff --git a/docs/examples/5969c446688c8b326acc80276573e9d2.asciidoc b/docs/examples/5969c446688c8b326acc80276573e9d2.asciidoc index fd1bb3e8e..b166e37cb 100644 --- a/docs/examples/5969c446688c8b326acc80276573e9d2.asciidoc +++ b/docs/examples/5969c446688c8b326acc80276573e9d2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:312 +// search/search-your-data/highlighting.asciidoc:324 [source, python] ---- diff --git a/docs/examples/5987afb2c17c73fe3d860937565ef115.asciidoc b/docs/examples/5987afb2c17c73fe3d860937565ef115.asciidoc index d777e9bd5..b2c20b385 100644 --- a/docs/examples/5987afb2c17c73fe3d860937565ef115.asciidoc +++ b/docs/examples/5987afb2c17c73fe3d860937565ef115.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/point-in-time-api.asciidoc:40 +// search/point-in-time-api.asciidoc:46 [source, python] ---- diff --git a/docs/examples/599f693cc7d30b1153f5eeecec8eb23a.asciidoc b/docs/examples/599f693cc7d30b1153f5eeecec8eb23a.asciidoc index 8b43c7453..df07501d6 100644 --- a/docs/examples/599f693cc7d30b1153f5eeecec8eb23a.asciidoc +++ b/docs/examples/599f693cc7d30b1153f5eeecec8eb23a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/delete-index-template-v1.asciidoc:29 +// indices/delete-index-template-v1.asciidoc:35 [source, python] ---- diff --git a/docs/examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc b/docs/examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc new file mode 100644 index 000000000..216f6cbbd --- /dev/null +++ b/docs/examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:415 + +[source, python] +---- +resp = client.indices.get_settings( + index=".reindexed-v9-ml-anomalies-custom-example", +) +print(resp) +---- diff --git a/docs/examples/59b8b9555f4aa30bc4613f819e9fc8f0.asciidoc b/docs/examples/59b8b9555f4aa30bc4613f819e9fc8f0.asciidoc index 06bef0b08..e5617647b 100644 --- a/docs/examples/59b8b9555f4aa30bc4613f819e9fc8f0.asciidoc +++ b/docs/examples/59b8b9555f4aa30bc4613f819e9fc8f0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/close.asciidoc:72 +// indices/close.asciidoc:78 [source, python] ---- diff --git a/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc b/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc index f825daf85..691256d73 100644 --- a/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc +++ b/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-openai.asciidoc:137 +// inference/service-openai.asciidoc:177 [source, python] ---- diff --git a/docs/examples/59f0ad2a6f97200e98e8eb079cdd8334.asciidoc b/docs/examples/59f0ad2a6f97200e98e8eb079cdd8334.asciidoc index 44e6fc0af..48a62341f 100644 --- a/docs/examples/59f0ad2a6f97200e98e8eb079cdd8334.asciidoc +++ b/docs/examples/59f0ad2a6f97200e98e8eb079cdd8334.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/multi-get.asciidoc:156 +// docs/multi-get.asciidoc:162 [source, python] ---- diff --git a/docs/examples/5ad365ed9e1a3c26093a0f09666c133a.asciidoc b/docs/examples/5ad365ed9e1a3c26093a0f09666c133a.asciidoc index 921bfe844..eb54a1bb6 100644 --- a/docs/examples/5ad365ed9e1a3c26093a0f09666c133a.asciidoc +++ b/docs/examples/5ad365ed9e1a3c26093a0f09666c133a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:246 +// rest-api/security/create-role-mappings.asciidoc:252 [source, python] ---- diff --git a/docs/examples/5afbd9caed88c32f8a2968c07054f096.asciidoc b/docs/examples/5afbd9caed88c32f8a2968c07054f096.asciidoc index 912ae0d8c..0f4d555f8 100644 --- a/docs/examples/5afbd9caed88c32f8a2968c07054f096.asciidoc +++ b/docs/examples/5afbd9caed88c32f8a2968c07054f096.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/logstash/delete-pipeline.asciidoc:67 +// rest-api/logstash/delete-pipeline.asciidoc:73 [source, python] ---- diff --git a/docs/examples/5b0cc9e186a8f765a11141809b8b17b7.asciidoc b/docs/examples/5b0cc9e186a8f765a11141809b8b17b7.asciidoc index 6766b1c62..d3044eb49 100644 --- a/docs/examples/5b0cc9e186a8f765a11141809b8b17b7.asciidoc +++ b/docs/examples/5b0cc9e186a8f765a11141809b8b17b7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search-application/apis/list-search-applications.asciidoc:101 +// search-application/apis/list-search-applications.asciidoc:106 [source, python] ---- diff --git a/docs/examples/5b191f2dbfa46c774cc9b9b9e8d1d831.asciidoc b/docs/examples/5b191f2dbfa46c774cc9b9b9e8d1d831.asciidoc index 5a0713e09..5c8dd5b84 100644 --- a/docs/examples/5b191f2dbfa46c774cc9b9b9e8d1d831.asciidoc +++ b/docs/examples/5b191f2dbfa46c774cc9b9b9e8d1d831.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-user-privileges.asciidoc:34 +// rest-api/security/get-user-privileges.asciidoc:40 [source, python] ---- diff --git a/docs/examples/5b281956e35a26e734c482b42b356c0d.asciidoc b/docs/examples/5b281956e35a26e734c482b42b356c0d.asciidoc index 4b77d9f45..02c2cfbd7 100644 --- a/docs/examples/5b281956e35a26e734c482b42b356c0d.asciidoc +++ b/docs/examples/5b281956e35a26e734c482b42b356c0d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/alias-exists.asciidoc:10 +// indices/alias-exists.asciidoc:16 [source, python] ---- diff --git a/docs/examples/5b2a13366bd4e1ab4b25d04d360570dc.asciidoc b/docs/examples/5b2a13366bd4e1ab4b25d04d360570dc.asciidoc index 01a6a6ea8..57c176743 100644 --- a/docs/examples/5b2a13366bd4e1ab4b25d04d360570dc.asciidoc +++ b/docs/examples/5b2a13366bd4e1ab4b25d04d360570dc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-component-template.asciidoc:252 +// indices/put-component-template.asciidoc:262 [source, python] ---- diff --git a/docs/examples/5b7d6f1db88ca6f42c48fa3dbb4341e8.asciidoc b/docs/examples/5b7d6f1db88ca6f42c48fa3dbb4341e8.asciidoc index b58e6bc27..9990e5c7b 100644 --- a/docs/examples/5b7d6f1db88ca6f42c48fa3dbb4341e8.asciidoc +++ b/docs/examples/5b7d6f1db88ca6f42c48fa3dbb4341e8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-mapping.asciidoc:79 +// indices/get-mapping.asciidoc:85 [source, python] ---- diff --git a/docs/examples/5bba213a7f543190139d1a69ab2ed076.asciidoc b/docs/examples/5bba213a7f543190139d1a69ab2ed076.asciidoc new file mode 100644 index 000000000..c9c33f40d --- /dev/null +++ b/docs/examples/5bba213a7f543190139d1a69ab2ed076.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// esql/esql-across-clusters.asciidoc:302 + +[source, python] +---- +resp = client.esql.async_query( + format="json", + query="\n FROM cluster_one:my-index*,cluster_two:logs*\n | STATS COUNT(http.response.status_code) BY user.id\n | LIMIT 2\n ", + include_ccs_metadata=True, +) +print(resp) +---- diff --git a/docs/examples/5bbccf103107e505c17ae59863753efd.asciidoc b/docs/examples/5bbccf103107e505c17ae59863753efd.asciidoc index 056d688e7..2b1bde38c 100644 --- a/docs/examples/5bbccf103107e505c17ae59863753efd.asciidoc +++ b/docs/examples/5bbccf103107e505c17ae59863753efd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-influencer.asciidoc:152 +// ml/anomaly-detection/apis/get-influencer.asciidoc:158 [source, python] ---- diff --git a/docs/examples/5c7ece1f30267adabdb832424871900a.asciidoc b/docs/examples/5c7ece1f30267adabdb832424871900a.asciidoc index 4e8858788..46a493cee 100644 --- a/docs/examples/5c7ece1f30267adabdb832424871900a.asciidoc +++ b/docs/examples/5c7ece1f30267adabdb832424871900a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/troubleshooting-unbalanced-cluster.asciidoc:20 +// troubleshooting/troubleshooting-unbalanced-cluster.asciidoc:24 [source, python] ---- diff --git a/docs/examples/5ccfd9f4698dcd7cdfbc6bad60081aab.asciidoc b/docs/examples/5ccfd9f4698dcd7cdfbc6bad60081aab.asciidoc index 6ec562e73..c953d972f 100644 --- a/docs/examples/5ccfd9f4698dcd7cdfbc6bad60081aab.asciidoc +++ b/docs/examples/5ccfd9f4698dcd7cdfbc6bad60081aab.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/get-dfanalytics.asciidoc:212 +// ml/df-analytics/apis/get-dfanalytics.asciidoc:218 [source, python] ---- diff --git a/docs/examples/5ceb734e3affe00e2cdc29af748d95bf.asciidoc b/docs/examples/5ceb734e3affe00e2cdc29af748d95bf.asciidoc new file mode 100644 index 000000000..8e8095f7b --- /dev/null +++ b/docs/examples/5ceb734e3affe00e2cdc29af748d95bf.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// inference/inference-apis.asciidoc:114 + +[source, python] +---- +resp = client.inference.put( + task_type="sparse_embedding", + inference_id="small_chunk_size", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "num_allocations": 1, + "num_threads": 1 + }, + "chunking_settings": { + "strategy": "sentence", + "max_chunk_size": 100, + "sentence_overlap": 0 + } + }, +) +print(resp) +---- diff --git a/docs/examples/5cf12cc4f98d98dc79bead7e6556679c.asciidoc b/docs/examples/5cf12cc4f98d98dc79bead7e6556679c.asciidoc new file mode 100644 index 000000000..b920f8437 --- /dev/null +++ b/docs/examples/5cf12cc4f98d98dc79bead7e6556679c.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/fields/synthetic-source.asciidoc:10 + +[source, python] +---- +resp = client.indices.create( + index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/5d03bb385904d20c5323885706738459.asciidoc b/docs/examples/5d03bb385904d20c5323885706738459.asciidoc index b5272d856..baeaa644a 100644 --- a/docs/examples/5d03bb385904d20c5323885706738459.asciidoc +++ b/docs/examples/5d03bb385904d20c5323885706738459.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/aliases.asciidoc:10 +// indices/aliases.asciidoc:16 [source, python] ---- diff --git a/docs/examples/1d827ae674970692643ea81991e5396e.asciidoc b/docs/examples/5daf8ede198be9b118da5bee9896cb00.asciidoc similarity index 75% rename from docs/examples/1d827ae674970692643ea81991e5396e.asciidoc rename to docs/examples/5daf8ede198be9b118da5bee9896cb00.asciidoc index faaa8e48a..ddad0eab9 100644 --- a/docs/examples/1d827ae674970692643ea81991e5396e.asciidoc +++ b/docs/examples/5daf8ede198be9b118da5bee9896cb00.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/flattened.asciidoc:334 +// mapping/types/flattened.asciidoc:333 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "flattened": { "type": "flattened" diff --git a/docs/examples/5deeed427f35cbaee4b8ddc45002a9d7.asciidoc b/docs/examples/5deeed427f35cbaee4b8ddc45002a9d7.asciidoc index a5c9ef373..1edbb7e20 100644 --- a/docs/examples/5deeed427f35cbaee4b8ddc45002a9d7.asciidoc +++ b/docs/examples/5deeed427f35cbaee4b8ddc45002a9d7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-delete-roles.asciidoc:72 +// rest-api/security/bulk-delete-roles.asciidoc:77 [source, python] ---- diff --git a/docs/examples/5dfb23f6e36ef484f1d3271bae76a8d1.asciidoc b/docs/examples/5dfb23f6e36ef484f1d3271bae76a8d1.asciidoc index a7d0b7013..c99773099 100644 --- a/docs/examples/5dfb23f6e36ef484f1d3271bae76a8d1.asciidoc +++ b/docs/examples/5dfb23f6e36ef484f1d3271bae76a8d1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/recovery.asciidoc:234 +// indices/recovery.asciidoc:240 [source, python] ---- diff --git a/docs/examples/4b113c7f475cfe484a150ddbb8e6c5c7.asciidoc b/docs/examples/5e021307d331a4483a5aa2198168451b.asciidoc similarity index 61% rename from docs/examples/4b113c7f475cfe484a150ddbb8e6c5c7.asciidoc rename to docs/examples/5e021307d331a4483a5aa2198168451b.asciidoc index c50d2f691..cd316527b 100644 --- a/docs/examples/4b113c7f475cfe484a150ddbb8e6c5c7.asciidoc +++ b/docs/examples/5e021307d331a4483a5aa2198168451b.asciidoc @@ -1,10 +1,10 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-roles.asciidoc:170 +// rest-api/security/create-roles.asciidoc:189 [source, python] ---- resp = client.security.put_role( - name="role_with_remote_indices", + name="only_remote_access_role", remote_indices=[ { "clusters": [ @@ -20,6 +20,16 @@ resp = client.security.put_role( ] } ], + remote_cluster=[ + { + "clusters": [ + "my_remote" + ], + "privileges": [ + "monitor_stats" + ] + } + ], ) print(resp) ---- diff --git a/docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc b/docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc index d1f47e0f5..207872edc 100644 --- a/docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc +++ b/docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/indices/request_cache.asciidoc:86 +// shard-request-cache.asciidoc:88 [source, python] ---- diff --git a/docs/examples/5e124875d97c27362ae858160ae1c6d5.asciidoc b/docs/examples/5e124875d97c27362ae858160ae1c6d5.asciidoc index d83f724ea..9381112b4 100644 --- a/docs/examples/5e124875d97c27362ae858160ae1c6d5.asciidoc +++ b/docs/examples/5e124875d97c27362ae858160ae1c6d5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:44 +// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:50 [source, python] ---- diff --git a/docs/examples/5e415c490a46358643ee2aab554b4876.asciidoc b/docs/examples/5e415c490a46358643ee2aab554b4876.asciidoc index b86c34e4d..e19029d48 100644 --- a/docs/examples/5e415c490a46358643ee2aab554b4876.asciidoc +++ b/docs/examples/5e415c490a46358643ee2aab554b4876.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:57 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:63 [source, python] ---- diff --git a/docs/examples/5ea9da129ca70a5fe534f27a82d80b29.asciidoc b/docs/examples/5ea9da129ca70a5fe534f27a82d80b29.asciidoc index a84be9f9e..eab3c0c2e 100644 --- a/docs/examples/5ea9da129ca70a5fe534f27a82d80b29.asciidoc +++ b/docs/examples/5ea9da129ca70a5fe534f27a82d80b29.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:669 +// search/search-your-data/highlighting.asciidoc:681 [source, python] ---- diff --git a/docs/examples/5f16358ebb5d14b86f57612d5f92d923.asciidoc b/docs/examples/5f16358ebb5d14b86f57612d5f92d923.asciidoc new file mode 100644 index 000000000..565804a37 --- /dev/null +++ b/docs/examples/5f16358ebb5d14b86f57612d5f92d923.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/semantic-text.asciidoc:26 + +[source, python] +---- +resp = client.indices.create( + index="my-index-000001", + mappings={ + "properties": { + "inference_field": { + "type": "semantic_text" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/5f1ed9cfdc149763b444acfbe10b0e16.asciidoc b/docs/examples/5f1ed9cfdc149763b444acfbe10b0e16.asciidoc index 4b346a298..118ad732e 100644 --- a/docs/examples/5f1ed9cfdc149763b444acfbe10b0e16.asciidoc +++ b/docs/examples/5f1ed9cfdc149763b444acfbe10b0e16.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:265 +// indices/put-mapping.asciidoc:271 [source, python] ---- diff --git a/docs/examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc b/docs/examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc index 7ce071786..895efc693 100644 --- a/docs/examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc +++ b/docs/examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:233 +// search/search-your-data/sort-search-results.asciidoc:235 [source, python] ---- diff --git a/docs/examples/5f8acd1e367b048b5542dbc6079bcc88.asciidoc b/docs/examples/5f8acd1e367b048b5542dbc6079bcc88.asciidoc index 5b8040c61..3d8c97850 100644 --- a/docs/examples/5f8acd1e367b048b5542dbc6079bcc88.asciidoc +++ b/docs/examples/5f8acd1e367b048b5542dbc6079bcc88.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/tokenfilters/hyphenation-decompounder-tokenfilter.asciidoc:132 +// analysis/tokenfilters/hyphenation-decompounder-tokenfilter.asciidoc:144 [source, python] ---- diff --git a/docs/examples/5faa121e00a0582160b2adb2b72fed67.asciidoc b/docs/examples/5faa121e00a0582160b2adb2b72fed67.asciidoc index 6342a01eb..47a0bb0a1 100644 --- a/docs/examples/5faa121e00a0582160b2adb2b72fed67.asciidoc +++ b/docs/examples/5faa121e00a0582160b2adb2b72fed67.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-settings.asciidoc:92 +// indices/get-settings.asciidoc:98 [source, python] ---- diff --git a/docs/examples/5fca6671bc8eaddc44ac488d1c3c6909.asciidoc b/docs/examples/5fca6671bc8eaddc44ac488d1c3c6909.asciidoc index f3234a306..5007151bf 100644 --- a/docs/examples/5fca6671bc8eaddc44ac488d1c3c6909.asciidoc +++ b/docs/examples/5fca6671bc8eaddc44ac488d1c3c6909.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-calendar.asciidoc:89 +// ml/anomaly-detection/apis/get-calendar.asciidoc:95 [source, python] ---- diff --git a/docs/examples/5fde0d78e9b2cc0519f8a63848ed344e.asciidoc b/docs/examples/5fde0d78e9b2cc0519f8a63848ed344e.asciidoc index 74cfdcf7b..df3038e41 100644 --- a/docs/examples/5fde0d78e9b2cc0519f8a63848ed344e.asciidoc +++ b/docs/examples/5fde0d78e9b2cc0519f8a63848ed344e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-rules/apis/get-query-ruleset.asciidoc:102 +// query-rules/apis/get-query-ruleset.asciidoc:108 [source, python] ---- diff --git a/docs/examples/601ad3b0ceccb3fcd282e5ec36748954.asciidoc b/docs/examples/601ad3b0ceccb3fcd282e5ec36748954.asciidoc index 41fbc65df..be80f02ef 100644 --- a/docs/examples/601ad3b0ceccb3fcd282e5ec36748954.asciidoc +++ b/docs/examples/601ad3b0ceccb3fcd282e5ec36748954.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-service-credentials.asciidoc:59 +// rest-api/security/get-service-credentials.asciidoc:64 [source, python] ---- diff --git a/docs/examples/602e04051c092cf77de2f75a563661b8.asciidoc b/docs/examples/602e04051c092cf77de2f75a563661b8.asciidoc index 4d7617acd..8e7d57b80 100644 --- a/docs/examples/602e04051c092cf77de2f75a563661b8.asciidoc +++ b/docs/examples/602e04051c092cf77de2f75a563661b8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat.asciidoc:57 +// cat.asciidoc:63 [source, python] ---- diff --git a/docs/examples/604da59fe41160efa10a846a9dacc07a.asciidoc b/docs/examples/604da59fe41160efa10a846a9dacc07a.asciidoc index b25e552f6..771bd1742 100644 --- a/docs/examples/604da59fe41160efa10a846a9dacc07a.asciidoc +++ b/docs/examples/604da59fe41160efa10a846a9dacc07a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// eql/get-async-eql-status-api.asciidoc:18 +// eql/get-async-eql-status-api.asciidoc:25 [source, python] ---- diff --git a/docs/examples/6061aadb3b870791278212d1e8f52b39.asciidoc b/docs/examples/6061aadb3b870791278212d1e8f52b39.asciidoc index 7a90e38ee..077977e52 100644 --- a/docs/examples/6061aadb3b870791278212d1e8f52b39.asciidoc +++ b/docs/examples/6061aadb3b870791278212d1e8f52b39.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/common/apis/get-ml-memory.asciidoc:228 +// ml/common/apis/get-ml-memory.asciidoc:234 [source, python] ---- diff --git a/docs/examples/6097ae69c64454a92a89ef01b994e9f9.asciidoc b/docs/examples/6097ae69c64454a92a89ef01b994e9f9.asciidoc index 4cad7c0a3..b22dce60a 100644 --- a/docs/examples/6097ae69c64454a92a89ef01b994e9f9.asciidoc +++ b/docs/examples/6097ae69c64454a92a89ef01b994e9f9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/put-synonym-rule.asciidoc:145 +// synonyms/apis/put-synonym-rule.asciidoc:151 [source, python] ---- diff --git a/docs/examples/60d3f9a99cc91b43aaa7524a9a74dba0.asciidoc b/docs/examples/60d3f9a99cc91b43aaa7524a9a74dba0.asciidoc new file mode 100644 index 000000000..6fe2dc982 --- /dev/null +++ b/docs/examples/60d3f9a99cc91b43aaa7524a9a74dba0.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// troubleshooting/common-issues/rejected-requests.asciidoc:50 + +[source, python] +---- +resp = client.nodes.stats( + metric="breaker", +) +print(resp) +---- diff --git a/docs/examples/60f889fbed5df3185444f7015b48ed76.asciidoc b/docs/examples/60f889fbed5df3185444f7015b48ed76.asciidoc index f0991a95c..c742c3978 100644 --- a/docs/examples/60f889fbed5df3185444f7015b48ed76.asciidoc +++ b/docs/examples/60f889fbed5df3185444f7015b48ed76.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-index.asciidoc:10 +// indices/create-index.asciidoc:16 [source, python] ---- diff --git a/docs/examples/612c2e975f833de9815651135735eae5.asciidoc b/docs/examples/612c2e975f833de9815651135735eae5.asciidoc index b3e378bbb..4a1a4e169 100644 --- a/docs/examples/612c2e975f833de9815651135735eae5.asciidoc +++ b/docs/examples/612c2e975f833de9815651135735eae5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:247 +// cluster/tasks.asciidoc:253 [source, python] ---- diff --git a/docs/examples/615dc36f0978c676624fb7d1144b4899.asciidoc b/docs/examples/615dc36f0978c676624fb7d1144b4899.asciidoc new file mode 100644 index 000000000..878cf4851 --- /dev/null +++ b/docs/examples/615dc36f0978c676624fb7d1144b4899.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// data-streams/lifecycle/apis/get-lifecycle-stats.asciidoc:69 + +[source, python] +---- +resp = client.indices.get_data_lifecycle_stats( + human=True, + pretty=True, +) +print(resp) +---- diff --git a/docs/examples/618c9d42284c067891fb57034a4fd834.asciidoc b/docs/examples/618c9d42284c067891fb57034a4fd834.asciidoc index cb2e2f133..3bab5a6e7 100644 --- a/docs/examples/618c9d42284c067891fb57034a4fd834.asciidoc +++ b/docs/examples/618c9d42284c067891fb57034a4fd834.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/start-job.asciidoc:50 +// rollup/apis/start-job.asciidoc:56 [source, python] ---- diff --git a/docs/examples/61d6b9503459914c436930c3ae87d454.asciidoc b/docs/examples/61d6b9503459914c436930c3ae87d454.asciidoc index 12f47766f..4782a49cf 100644 --- a/docs/examples/61d6b9503459914c436930c3ae87d454.asciidoc +++ b/docs/examples/61d6b9503459914c436930c3ae87d454.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-rules/apis/list-query-rulesets.asciidoc:165 +// query-rules/apis/list-query-rulesets.asciidoc:171 [source, python] ---- diff --git a/docs/examples/6244204213f60edf2f23295f9059f2c9.asciidoc b/docs/examples/6244204213f60edf2f23295f9059f2c9.asciidoc index eacb1ead7..ac7a3d39c 100644 --- a/docs/examples/6244204213f60edf2f23295f9059f2c9.asciidoc +++ b/docs/examples/6244204213f60edf2f23295f9059f2c9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/stats.asciidoc:163 +// rest-api/watcher/stats.asciidoc:169 [source, python] ---- diff --git a/docs/examples/62ccee6ad356428c2d625742f961ceb7.asciidoc b/docs/examples/62ccee6ad356428c2d625742f961ceb7.asciidoc index d94a8ced9..156da376e 100644 --- a/docs/examples/62ccee6ad356428c2d625742f961ceb7.asciidoc +++ b/docs/examples/62ccee6ad356428c2d625742f961ceb7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-api-key.asciidoc:200 +// rest-api/security/update-api-key.asciidoc:206 [source, python] ---- diff --git a/docs/examples/62d3c8fccb11471bdc12555c1a7777f2.asciidoc b/docs/examples/62d3c8fccb11471bdc12555c1a7777f2.asciidoc index 2c535f041..3e5631809 100644 --- a/docs/examples/62d3c8fccb11471bdc12555c1a7777f2.asciidoc +++ b/docs/examples/62d3c8fccb11471bdc12555c1a7777f2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/fields/synthetic-source.asciidoc:89 +// mapping/fields/synthetic-source.asciidoc:93 [source, python] ---- diff --git a/docs/examples/62eafc5b3ab75cc67314d5a8567d6077.asciidoc b/docs/examples/62eafc5b3ab75cc67314d5a8567d6077.asciidoc index 1af60a98f..880a8fc68 100644 --- a/docs/examples/62eafc5b3ab75cc67314d5a8567d6077.asciidoc +++ b/docs/examples/62eafc5b3ab75cc67314d5a8567d6077.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:225 +// rest-api/security/get-api-keys.asciidoc:231 [source, python] ---- diff --git a/docs/examples/6329fb2840a4373ff6d342f2653247cb.asciidoc b/docs/examples/6329fb2840a4373ff6d342f2653247cb.asciidoc new file mode 100644 index 000000000..d5b3150a1 --- /dev/null +++ b/docs/examples/6329fb2840a4373ff6d342f2653247cb.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/getting-started.asciidoc:299 + +[source, python] +---- +resp = client.indices.get_mapping( + index="books", +) +print(resp) +---- diff --git a/docs/examples/636ee2066450605247ec1f68d04b8ee4.asciidoc b/docs/examples/636ee2066450605247ec1f68d04b8ee4.asciidoc index f80d11e67..bf1dc4f69 100644 --- a/docs/examples/636ee2066450605247ec1f68d04b8ee4.asciidoc +++ b/docs/examples/636ee2066450605247ec1f68d04b8ee4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1467 +// mapping/runtime.asciidoc:1465 [source, python] ---- diff --git a/docs/examples/63893e7e9479a9b60db71dcddcc79aaf.asciidoc b/docs/examples/63893e7e9479a9b60db71dcddcc79aaf.asciidoc index 1ee6a288d..753107965 100644 --- a/docs/examples/63893e7e9479a9b60db71dcddcc79aaf.asciidoc +++ b/docs/examples/63893e7e9479a9b60db71dcddcc79aaf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-calendar.asciidoc:38 +// ml/anomaly-detection/apis/delete-calendar.asciidoc:44 [source, python] ---- diff --git a/docs/examples/63a53fcb0717ae9033a679cbfc932851.asciidoc b/docs/examples/63a53fcb0717ae9033a679cbfc932851.asciidoc new file mode 100644 index 000000000..746b8a42d --- /dev/null +++ b/docs/examples/63a53fcb0717ae9033a679cbfc932851.asciidoc @@ -0,0 +1,20 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-alibabacloud-ai-search.asciidoc:174 + +[source, python] +---- +resp = client.inference.put( + task_type="completion", + inference_id="alibabacloud_ai_search_completion", + inference_config={ + "service": "alibabacloud-ai-search", + "service_settings": { + "host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com", + "api_key": "{{API_KEY}}", + "service_id": "ops-qwen-turbo", + "workspace": "default" + } + }, +) +print(resp) +---- diff --git a/docs/examples/63bf3480627a89b4b4ede4150e1d6bc0.asciidoc b/docs/examples/63bf3480627a89b4b4ede4150e1d6bc0.asciidoc index 5560f6733..91a1b7c2e 100644 --- a/docs/examples/63bf3480627a89b4b4ede4150e1d6bc0.asciidoc +++ b/docs/examples/63bf3480627a89b4b4ede4150e1d6bc0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-create-roles.asciidoc:106 +// rest-api/security/bulk-create-roles.asciidoc:125 [source, python] ---- diff --git a/docs/examples/63cc960215ae83b359c12df3c0993bfa.asciidoc b/docs/examples/63cc960215ae83b359c12df3c0993bfa.asciidoc index 5529b0b89..bbf69419f 100644 --- a/docs/examples/63cc960215ae83b359c12df3c0993bfa.asciidoc +++ b/docs/examples/63cc960215ae83b359c12df3c0993bfa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-index.asciidoc:130 +// indices/create-index.asciidoc:136 [source, python] ---- diff --git a/docs/examples/63e20883732ec30b5400046be2efb0f1.asciidoc b/docs/examples/63e20883732ec30b5400046be2efb0f1.asciidoc index e6e5a0dd6..d2846a3b6 100644 --- a/docs/examples/63e20883732ec30b5400046be2efb0f1.asciidoc +++ b/docs/examples/63e20883732ec30b5400046be2efb0f1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/flush.asciidoc:121 +// indices/flush.asciidoc:127 [source, python] ---- diff --git a/docs/examples/63ecdab34940af053acc409164914c32.asciidoc b/docs/examples/63ecdab34940af053acc409164914c32.asciidoc index c44c3147f..0c5d51106 100644 --- a/docs/examples/63ecdab34940af053acc409164914c32.asciidoc +++ b/docs/examples/63ecdab34940af053acc409164914c32.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/sparse-vector.asciidoc:46 +// mapping/types/sparse-vector.asciidoc:63 [source, python] ---- diff --git a/docs/examples/640621cea39cdeeb76fbc95bff31a18d.asciidoc b/docs/examples/640621cea39cdeeb76fbc95bff31a18d.asciidoc index 7d20c7a29..1837f3899 100644 --- a/docs/examples/640621cea39cdeeb76fbc95bff31a18d.asciidoc +++ b/docs/examples/640621cea39cdeeb76fbc95bff31a18d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-last-sync-api.asciidoc:115 +// connector/apis/update-connector-last-sync-api.asciidoc:122 [source, python] ---- diff --git a/docs/examples/640dbeecb736bd25f6f2b392b76a7531.asciidoc b/docs/examples/640dbeecb736bd25f6f2b392b76a7531.asciidoc new file mode 100644 index 000000000..08ac55001 --- /dev/null +++ b/docs/examples/640dbeecb736bd25f6f2b392b76a7531.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// cluster/stats.asciidoc:1914 + +[source, python] +---- +resp = client.cluster.stats( + include_remotes=True, +) +print(resp) +---- diff --git a/docs/examples/6414b9276ba1c63898c3ff5cbe03c54e.asciidoc b/docs/examples/6414b9276ba1c63898c3ff5cbe03c54e.asciidoc index 5227631bd..561422a4b 100644 --- a/docs/examples/6414b9276ba1c63898c3ff5cbe03c54e.asciidoc +++ b/docs/examples/6414b9276ba1c63898c3ff5cbe03c54e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/segments.asciidoc:128 +// indices/segments.asciidoc:134 [source, python] ---- diff --git a/docs/examples/642161d70dacf7d153767d37d3726838.asciidoc b/docs/examples/642161d70dacf7d153767d37d3726838.asciidoc index 3fb9f5242..a6acd8d13 100644 --- a/docs/examples/642161d70dacf7d153767d37d3726838.asciidoc +++ b/docs/examples/642161d70dacf7d153767d37d3726838.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-index-caps.asciidoc:163 +// rollup/apis/rollup-index-caps.asciidoc:171 [source, python] ---- diff --git a/docs/examples/643e19c3b6ac1134554dd890e2249c2b.asciidoc b/docs/examples/643e19c3b6ac1134554dd890e2249c2b.asciidoc index 8a0fb1610..c77ffb136 100644 --- a/docs/examples/643e19c3b6ac1134554dd890e2249c2b.asciidoc +++ b/docs/examples/643e19c3b6ac1134554dd890e2249c2b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/logs.asciidoc:26 +// data-streams/logs.asciidoc:20 [source, python] ---- diff --git a/docs/examples/64622409407316d2d47094e692d9b516.asciidoc b/docs/examples/64622409407316d2d47094e692d9b516.asciidoc index b5cabc544..606ac367b 100644 --- a/docs/examples/64622409407316d2d47094e692d9b516.asciidoc +++ b/docs/examples/64622409407316d2d47094e692d9b516.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:395 +// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:401 [source, python] ---- diff --git a/docs/examples/646d71869f1a18c5bede7759559bfc47.asciidoc b/docs/examples/646d71869f1a18c5bede7759559bfc47.asciidoc index 4b28aad02..036a676f3 100644 --- a/docs/examples/646d71869f1a18c5bede7759559bfc47.asciidoc +++ b/docs/examples/646d71869f1a18c5bede7759559bfc47.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-field-mapping.asciidoc:236 +// indices/get-field-mapping.asciidoc:242 [source, python] ---- diff --git a/docs/examples/64a79861225553799b26e118d7851dcc.asciidoc b/docs/examples/64a79861225553799b26e118d7851dcc.asciidoc index 13d42948d..1d24bea18 100644 --- a/docs/examples/64a79861225553799b26e118d7851dcc.asciidoc +++ b/docs/examples/64a79861225553799b26e118d7851dcc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/error-handling.asciidoc:57 +// ilm/error-handling.asciidoc:61 [source, python] ---- diff --git a/docs/examples/64c572abc23394a77b6cca0b5368ee1d.asciidoc b/docs/examples/64c572abc23394a77b6cca0b5368ee1d.asciidoc index 87b81e8e4..adbb544fe 100644 --- a/docs/examples/64c572abc23394a77b6cca0b5368ee1d.asciidoc +++ b/docs/examples/64c572abc23394a77b6cca0b5368ee1d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// features/apis/get-features-api.asciidoc:12 +// features/apis/get-features-api.asciidoc:18 [source, python] ---- diff --git a/docs/examples/64d24f4b2a57dba48092dafe3eb68ad1.asciidoc b/docs/examples/64d24f4b2a57dba48092dafe3eb68ad1.asciidoc index 381ddf143..d916c5e3d 100644 --- a/docs/examples/64d24f4b2a57dba48092dafe3eb68ad1.asciidoc +++ b/docs/examples/64d24f4b2a57dba48092dafe3eb68ad1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/multi-get.asciidoc:239 +// docs/multi-get.asciidoc:245 [source, python] ---- diff --git a/docs/examples/650a0fb27c66a790c4687267423af1da.asciidoc b/docs/examples/650a0fb27c66a790c4687267423af1da.asciidoc index 8bf376bd6..9a7d80337 100644 --- a/docs/examples/650a0fb27c66a790c4687267423af1da.asciidoc +++ b/docs/examples/650a0fb27c66a790c4687267423af1da.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:102 +// alias.asciidoc:104 [source, python] ---- diff --git a/docs/examples/654882f545eca8d7047695f867c63072.asciidoc b/docs/examples/654882f545eca8d7047695f867c63072.asciidoc index ed2907890..f2cf570e4 100644 --- a/docs/examples/654882f545eca8d7047695f867c63072.asciidoc +++ b/docs/examples/654882f545eca8d7047695f867c63072.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/stop-transform.asciidoc:81 +// transform/apis/stop-transform.asciidoc:87 [source, python] ---- diff --git a/docs/examples/65b6185356f16f2f0d84bc5aee2ed0fc.asciidoc b/docs/examples/65b6185356f16f2f0d84bc5aee2ed0fc.asciidoc index 6c0013855..48abc6096 100644 --- a/docs/examples/65b6185356f16f2f0d84bc5aee2ed0fc.asciidoc +++ b/docs/examples/65b6185356f16f2f0d84bc5aee2ed0fc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/sparse-vector-query.asciidoc:25 +// query-dsl/sparse-vector-query.asciidoc:26 [source, python] ---- diff --git a/docs/examples/6606d46685d10377b996b5f20f1229b5.asciidoc b/docs/examples/6606d46685d10377b996b5f20f1229b5.asciidoc index 9e0132018..1ab17d6c4 100644 --- a/docs/examples/6606d46685d10377b996b5f20f1229b5.asciidoc +++ b/docs/examples/6606d46685d10377b996b5f20f1229b5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-index-name-api.asciidoc:75 +// connector/apis/update-connector-index-name-api.asciidoc:82 [source, python] ---- diff --git a/docs/examples/6636701d31b0c9eb8316f1f8e99cc918.asciidoc b/docs/examples/6636701d31b0c9eb8316f1f8e99cc918.asciidoc index afbe3f43f..fffecee75 100644 --- a/docs/examples/6636701d31b0c9eb8316f1f8e99cc918.asciidoc +++ b/docs/examples/6636701d31b0c9eb8316f1f8e99cc918.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// aggregations/metrics/scripted-metric-aggregation.asciidoc:17 +// aggregations/metrics/scripted-metric-aggregation.asciidoc:19 [source, python] ---- diff --git a/docs/examples/66539dc6011dd2e0282cf81db1f3df27.asciidoc b/docs/examples/66539dc6011dd2e0282cf81db1f3df27.asciidoc index 8e89820c4..77fde631d 100644 --- a/docs/examples/66539dc6011dd2e0282cf81db1f3df27.asciidoc +++ b/docs/examples/66539dc6011dd2e0282cf81db1f3df27.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat.asciidoc:85 +// cat.asciidoc:91 [source, python] ---- diff --git a/docs/examples/666c420fe61fa122386da3c356a64943.asciidoc b/docs/examples/666c420fe61fa122386da3c356a64943.asciidoc index 4ccb7c58f..484d647be 100644 --- a/docs/examples/666c420fe61fa122386da3c356a64943.asciidoc +++ b/docs/examples/666c420fe61fa122386da3c356a64943.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:600 +// search/search-your-data/sort-search-results.asciidoc:602 [source, python] ---- diff --git a/docs/examples/6689aa213884196b47a6f482d4993749.asciidoc b/docs/examples/6689aa213884196b47a6f482d4993749.asciidoc index c850d3ee8..c522b28a5 100644 --- a/docs/examples/6689aa213884196b47a6f482d4993749.asciidoc +++ b/docs/examples/6689aa213884196b47a6f482d4993749.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/put-pipeline.asciidoc:11 +// ingest/apis/put-pipeline.asciidoc:17 [source, python] ---- diff --git a/docs/examples/66915e95b723ee2f6e5164a94b8f98c1.asciidoc b/docs/examples/66915e95b723ee2f6e5164a94b8f98c1.asciidoc new file mode 100644 index 000000000..61d7fc158 --- /dev/null +++ b/docs/examples/66915e95b723ee2f6e5164a94b8f98c1.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/create-index-from-source.asciidoc:85 + +[source, python] +---- +resp = client.indices.create_from( + source="my-index", + dest="my-new-index", + create_from=None, +) +print(resp) +---- diff --git a/docs/examples/67154a4837cf996a9a9c3e61d6e9d1b3.asciidoc b/docs/examples/67154a4837cf996a9a9c3e61d6e9d1b3.asciidoc deleted file mode 100644 index 647b80bda..000000000 --- a/docs/examples/67154a4837cf996a9a9c3e61d6e9d1b3.asciidoc +++ /dev/null @@ -1,15 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// migration/migrate_8_0/migrate_to_java_time.asciidoc:289 - -[source, python] ----- -resp = client.reindex( - source={ - "index": "my-index-000001" - }, - dest={ - "index": "my-index-000002" - }, -) -print(resp) ----- diff --git a/docs/examples/674bb755111c6fbaa4c5ac759395c122.asciidoc b/docs/examples/674bb755111c6fbaa4c5ac759395c122.asciidoc index a61c8c89c..dc4f21124 100644 --- a/docs/examples/674bb755111c6fbaa4c5ac759395c122.asciidoc +++ b/docs/examples/674bb755111c6fbaa4c5ac759395c122.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:128 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:132 [source, python] ---- diff --git a/docs/examples/67aac8882fa476db8a5878b67ea08eb3.asciidoc b/docs/examples/67aac8882fa476db8a5878b67ea08eb3.asciidoc index 4ca7f4d84..d8dfbd7a0 100644 --- a/docs/examples/67aac8882fa476db8a5878b67ea08eb3.asciidoc +++ b/docs/examples/67aac8882fa476db8a5878b67ea08eb3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/repo-analysis-api.asciidoc:26 +// snapshot-restore/apis/repo-analysis-api.asciidoc:32 [source, python] ---- diff --git a/docs/examples/67b71a95b6fe6c83faae51ea038a1bf1.asciidoc b/docs/examples/67b71a95b6fe6c83faae51ea038a1bf1.asciidoc new file mode 100644 index 000000000..f0c9152d8 --- /dev/null +++ b/docs/examples/67b71a95b6fe6c83faae51ea038a1bf1.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// esql/esql-rest.asciidoc:407 + +[source, python] +---- +resp = client.esql.async_query_delete( + id="FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=", +) +print(resp) +---- diff --git a/docs/examples/67bab07fda27ef77e3bc948211051a33.asciidoc b/docs/examples/67bab07fda27ef77e3bc948211051a33.asciidoc index d7b22ab98..b0dbc1131 100644 --- a/docs/examples/67bab07fda27ef77e3bc948211051a33.asciidoc +++ b/docs/examples/67bab07fda27ef77e3bc948211051a33.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/hotspotting.asciidoc:154 +// troubleshooting/common-issues/hotspotting.asciidoc:160 [source, python] ---- diff --git a/docs/examples/67ffa135c50c43d6788636c88078c7d1.asciidoc b/docs/examples/67ffa135c50c43d6788636c88078c7d1.asciidoc index 263c02e41..ce2a93601 100644 --- a/docs/examples/67ffa135c50c43d6788636c88078c7d1.asciidoc +++ b/docs/examples/67ffa135c50c43d6788636c88078c7d1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/simulate-pipeline.asciidoc:150 +// ingest/apis/simulate-pipeline.asciidoc:156 [source, python] ---- diff --git a/docs/examples/68738b4fd0dda177022be45be95b4c84.asciidoc b/docs/examples/68738b4fd0dda177022be45be95b4c84.asciidoc index 632e5ba7d..56a80efcd 100644 --- a/docs/examples/68738b4fd0dda177022be45be95b4c84.asciidoc +++ b/docs/examples/68738b4fd0dda177022be45be95b4c84.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:202 +// docs/reindex.asciidoc:208 [source, python] ---- diff --git a/docs/examples/68b64313bf89ec3f2c645da61999dbb4.asciidoc b/docs/examples/68b64313bf89ec3f2c645da61999dbb4.asciidoc index bd40f4871..3134ba195 100644 --- a/docs/examples/68b64313bf89ec3f2c645da61999dbb4.asciidoc +++ b/docs/examples/68b64313bf89ec3f2c645da61999dbb4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-info.asciidoc:221 +// cluster/nodes-info.asciidoc:226 [source, python] ---- diff --git a/docs/examples/2fd458d37aab509fe2d970c0b6e2a10f.asciidoc b/docs/examples/68d7f7d4d268ee98caead5aef19933d6.asciidoc similarity index 98% rename from docs/examples/2fd458d37aab509fe2d970c0b6e2a10f.asciidoc rename to docs/examples/68d7f7d4d268ee98caead5aef19933d6.asciidoc index 54adac201..d486506c0 100644 --- a/docs/examples/2fd458d37aab509fe2d970c0b6e2a10f.asciidoc +++ b/docs/examples/68d7f7d4d268ee98caead5aef19933d6.asciidoc @@ -48,7 +48,7 @@ print(resp) resp1 = client.indices.put_index_template( name="2", index_patterns=[ - "k8s*" + "k9s*" ], composed_of=[ "destination_template" diff --git a/docs/examples/692606cc6d6462becc321d92961a3bac.asciidoc b/docs/examples/692606cc6d6462becc321d92961a3bac.asciidoc index 176019bf1..d237ae7f7 100644 --- a/docs/examples/692606cc6d6462becc321d92961a3bac.asciidoc +++ b/docs/examples/692606cc6d6462becc321d92961a3bac.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// text-structure/apis/test-grok-pattern.asciidoc:54 +// text-structure/apis/test-grok-pattern.asciidoc:60 [source, python] ---- diff --git a/docs/examples/69541f0bb81ab3797926bb2a00607cda.asciidoc b/docs/examples/69541f0bb81ab3797926bb2a00607cda.asciidoc new file mode 100644 index 000000000..bd34b9be6 --- /dev/null +++ b/docs/examples/69541f0bb81ab3797926bb2a00607cda.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:748 + +[source, python] +---- +resp = client.inference.put( + task_type="rerank", + inference_id="my-msmarco-minilm-model", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "num_allocations": 1, + "num_threads": 1, + "model_id": "cross-encoder__ms-marco-minilm-l-6-v2" + } + }, +) +print(resp) +---- diff --git a/docs/examples/698e0a2b67ba7842caa801d9ef46ebe3.asciidoc b/docs/examples/698e0a2b67ba7842caa801d9ef46ebe3.asciidoc index b164965d1..e6bfa74d3 100644 --- a/docs/examples/698e0a2b67ba7842caa801d9ef46ebe3.asciidoc +++ b/docs/examples/698e0a2b67ba7842caa801d9ef46ebe3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:499 +// search/search-your-data/highlighting.asciidoc:511 [source, python] ---- diff --git a/docs/examples/69a08e7bdcc616f3bdcb8ae842d9e30e.asciidoc b/docs/examples/69a08e7bdcc616f3bdcb8ae842d9e30e.asciidoc index 87d427403..0b36e7def 100644 --- a/docs/examples/69a08e7bdcc616f3bdcb8ae842d9e30e.asciidoc +++ b/docs/examples/69a08e7bdcc616f3bdcb8ae842d9e30e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:354 +// docs/get.asciidoc:360 [source, python] ---- diff --git a/docs/examples/69ab708fe65a75f870223d2289c3d171.asciidoc b/docs/examples/69ab708fe65a75f870223d2289c3d171.asciidoc index 342a15224..9bacae628 100644 --- a/docs/examples/69ab708fe65a75f870223d2289c3d171.asciidoc +++ b/docs/examples/69ab708fe65a75f870223d2289c3d171.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/redact.asciidoc:106 +// ingest/processors/redact.asciidoc:107 [source, python] ---- diff --git a/docs/examples/69c07cfdf8054c301cd6186c5d71aa02.asciidoc b/docs/examples/69c07cfdf8054c301cd6186c5d71aa02.asciidoc index b4add7199..24327ea21 100644 --- a/docs/examples/69c07cfdf8054c301cd6186c5d71aa02.asciidoc +++ b/docs/examples/69c07cfdf8054c301cd6186c5d71aa02.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:344 +// docs/update-by-query.asciidoc:350 [source, python] ---- diff --git a/docs/examples/69d5710bdec73041c66f21d5f96637e8.asciidoc b/docs/examples/69d5710bdec73041c66f21d5f96637e8.asciidoc index ca1d05204..cfe77f4c1 100644 --- a/docs/examples/69d5710bdec73041c66f21d5f96637e8.asciidoc +++ b/docs/examples/69d5710bdec73041c66f21d5f96637e8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:214 +// search/search-your-data/sort-search-results.asciidoc:216 [source, python] ---- diff --git a/docs/examples/69f8b0f2a9ba47e11f363d788cee9d6d.asciidoc b/docs/examples/69f8b0f2a9ba47e11f363d788cee9d6d.asciidoc index 0325c8d27..18bd0f1ce 100644 --- a/docs/examples/69f8b0f2a9ba47e11f363d788cee9d6d.asciidoc +++ b/docs/examples/69f8b0f2a9ba47e11f363d788cee9d6d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// migration/apis/deprecation.asciidoc:140 +// migration/apis/deprecation.asciidoc:146 [source, python] ---- diff --git a/docs/examples/6a350a17701e8c8158407191f2718b66.asciidoc b/docs/examples/6a350a17701e8c8158407191f2718b66.asciidoc index a721d4b83..a3290564b 100644 --- a/docs/examples/6a350a17701e8c8158407191f2718b66.asciidoc +++ b/docs/examples/6a350a17701e8c8158407191f2718b66.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/post-unfollow.asciidoc:74 +// ccr/apis/follow/post-unfollow.asciidoc:80 [source, python] ---- diff --git a/docs/examples/6a3a86ff58e5f20950d429cf2832c229.asciidoc b/docs/examples/6a3a86ff58e5f20950d429cf2832c229.asciidoc index a6761640a..624c974fa 100644 --- a/docs/examples/6a3a86ff58e5f20950d429cf2832c229.asciidoc +++ b/docs/examples/6a3a86ff58e5f20950d429cf2832c229.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/get-pipeline.asciidoc:76 +// ingest/apis/get-pipeline.asciidoc:82 [source, python] ---- diff --git a/docs/examples/6aca241c0361d26f134712821e2d09a9.asciidoc b/docs/examples/6aca241c0361d26f134712821e2d09a9.asciidoc index 72da86fba..c0a72833c 100644 --- a/docs/examples/6aca241c0361d26f134712821e2d09a9.asciidoc +++ b/docs/examples/6aca241c0361d26f134712821e2d09a9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/clean-up-repo-api.asciidoc:79 +// snapshot-restore/apis/clean-up-repo-api.asciidoc:85 [source, python] ---- diff --git a/docs/examples/6b0288acb739c4667d41339e5100c327.asciidoc b/docs/examples/6b0288acb739c4667d41339e5100c327.asciidoc index 26a2af93b..421376449 100644 --- a/docs/examples/6b0288acb739c4667d41339e5100c327.asciidoc +++ b/docs/examples/6b0288acb739c4667d41339e5100c327.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/match-query.asciidoc:230 +// query-dsl/match-query.asciidoc:234 [source, python] ---- diff --git a/docs/examples/6b1336ff477f91d4a0db0b06db546ff0.asciidoc b/docs/examples/6b1336ff477f91d4a0db0b06db546ff0.asciidoc index 1dccfee87..162a22abf 100644 --- a/docs/examples/6b1336ff477f91d4a0db0b06db546ff0.asciidoc +++ b/docs/examples/6b1336ff477f91d4a0db0b06db546ff0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/stop.asciidoc:45 +// rest-api/watcher/stop.asciidoc:51 [source, python] ---- diff --git a/docs/examples/6b3dcde0656d3a96dbcfed1ec814e10a.asciidoc b/docs/examples/6b3dcde0656d3a96dbcfed1ec814e10a.asciidoc index 650690a2c..81ce7ccd1 100644 --- a/docs/examples/6b3dcde0656d3a96dbcfed1ec814e10a.asciidoc +++ b/docs/examples/6b3dcde0656d3a96dbcfed1ec814e10a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// shutdown/apis/shutdown-delete.asciidoc:65 +// shutdown/apis/shutdown-delete.asciidoc:71 [source, python] ---- diff --git a/docs/examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc b/docs/examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc new file mode 100644 index 000000000..bc427ddf0 --- /dev/null +++ b/docs/examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// index-modules/slowlog.asciidoc:219 + +[source, python] +---- +resp = client.indices.put_settings( + index="*", + settings={ + "index.search.slowlog.include.user": True, + "index.search.slowlog.threshold.fetch.warn": "30s", + "index.search.slowlog.threshold.query.warn": "30s" + }, +) +print(resp) +---- diff --git a/docs/examples/a69c7c3412af73758f629e76263063b5.asciidoc b/docs/examples/6b6e275efe3d2aafe0fc3443f2c96868.asciidoc similarity index 84% rename from docs/examples/a69c7c3412af73758f629e76263063b5.asciidoc rename to docs/examples/6b6e275efe3d2aafe0fc3443f2c96868.asciidoc index 8ffb9afbe..c10420e51 100644 --- a/docs/examples/a69c7c3412af73758f629e76263063b5.asciidoc +++ b/docs/examples/6b6e275efe3d2aafe0fc3443f2c96868.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "google-vertex-ai-embeddings", - "pipeline": "google_vertex_ai_embeddings" + "pipeline": "google_vertex_ai_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/6b6f5e0ab4ef523fc9a3a4a655848f64.asciidoc b/docs/examples/6b6f5e0ab4ef523fc9a3a4a655848f64.asciidoc index 9c8ff6008..10f198dce 100644 --- a/docs/examples/6b6f5e0ab4ef523fc9a3a4a655848f64.asciidoc +++ b/docs/examples/6b6f5e0ab4ef523fc9a3a4a655848f64.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/sparse-vector-query.asciidoc:43 +// query-dsl/sparse-vector-query.asciidoc:44 [source, python] ---- diff --git a/docs/examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc b/docs/examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc index 941c5899b..db8d1d9dc 100644 --- a/docs/examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc +++ b/docs/examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc @@ -12,7 +12,7 @@ resp = client.search_application.put( "template": { "script": { "lang": "mustache", - "source": "\n {\n \"query\": {\n \"bool\": {\n \"must\": [\n {{#query}}\n \n {{/query}}\n ],\n \"filter\": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n \"_source\": {\n \"includes\": [\"title\", \"plot\"]\n },\n \"aggs\": {{#toJson}}_es_aggs{{/toJson}},\n \"from\": {{from}},\n \"size\": {{size}},\n \"sort\": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ", + "source": "\n {\n \"query\": {\n \"bool\": {\n \"must\": [\n {{#query}}\n {{/query}}\n ],\n \"filter\": {{#toJson}}_es_filters{{/toJson}}\n }\n },\n \"_source\": {\n \"includes\": [\"title\", \"plot\"]\n },\n \"aggs\": {{#toJson}}_es_aggs{{/toJson}},\n \"from\": {{from}},\n \"size\": {{size}},\n \"sort\": {{#toJson}}_es_sort_fields{{/toJson}}\n }\n ", "params": { "query": "", "_es_filters": {}, diff --git a/docs/examples/6b8c5c8145c287c4fc535fa57ccf95a7.asciidoc b/docs/examples/6b8c5c8145c287c4fc535fa57ccf95a7.asciidoc index 0b217472d..39589af02 100644 --- a/docs/examples/6b8c5c8145c287c4fc535fa57ccf95a7.asciidoc +++ b/docs/examples/6b8c5c8145c287c4fc535fa57ccf95a7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connector-sync-jobs-api.asciidoc:64 +// connector/apis/list-connector-sync-jobs-api.asciidoc:71 [source, python] ---- diff --git a/docs/examples/6ba332596f5eb29660c90ab2d480e7dc.asciidoc b/docs/examples/6ba332596f5eb29660c90ab2d480e7dc.asciidoc index a24ccbc71..fbd0709e9 100644 --- a/docs/examples/6ba332596f5eb29660c90ab2d480e7dc.asciidoc +++ b/docs/examples/6ba332596f5eb29660c90ab2d480e7dc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template-v1.asciidoc:183 +// indices/put-index-template-v1.asciidoc:189 [source, python] ---- diff --git a/docs/examples/6baf72c04d48cb04c2f8be609ff3b3b5.asciidoc b/docs/examples/6baf72c04d48cb04c2f8be609ff3b3b5.asciidoc new file mode 100644 index 000000000..cd4a70809 --- /dev/null +++ b/docs/examples/6baf72c04d48cb04c2f8be609ff3b3b5.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/semantic-text.asciidoc:132 + +[source, python] +---- +resp = client.search( + index="test-index", + query={ + "match": { + "my_semantic_field": "Which country is Paris in?" + } + }, + highlight={ + "fields": { + "my_semantic_field": { + "number_of_fragments": 2, + "order": "score" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/6c70b022a8a74b887fe46e514feb38c0.asciidoc b/docs/examples/6c70b022a8a74b887fe46e514feb38c0.asciidoc index 4b7511daa..4ad22e7db 100644 --- a/docs/examples/6c70b022a8a74b887fe46e514feb38c0.asciidoc +++ b/docs/examples/6c70b022a8a74b887fe46e514feb38c0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/recovery.asciidoc:12 +// indices/recovery.asciidoc:18 [source, python] ---- diff --git a/docs/examples/6c72460570307f23478100db04a84c8e.asciidoc b/docs/examples/6c72460570307f23478100db04a84c8e.asciidoc index 883ddf576..be86726e6 100644 --- a/docs/examples/6c72460570307f23478100db04a84c8e.asciidoc +++ b/docs/examples/6c72460570307f23478100db04a84c8e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-component-template.asciidoc:86 +// indices/get-component-template.asciidoc:92 [source, python] ---- diff --git a/docs/examples/6c8bf6d4d68b7756f953be4c07655337.asciidoc b/docs/examples/6c8bf6d4d68b7756f953be4c07655337.asciidoc index 4b01b060e..522f1b320 100644 --- a/docs/examples/6c8bf6d4d68b7756f953be4c07655337.asciidoc +++ b/docs/examples/6c8bf6d4d68b7756f953be4c07655337.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-reload-secure-settings.asciidoc:63 +// cluster/nodes-reload-secure-settings.asciidoc:69 [source, python] ---- diff --git a/docs/examples/6c927313867647e0ef3cd3a37cb410cc.asciidoc b/docs/examples/6c927313867647e0ef3cd3a37cb410cc.asciidoc index 0c0e8d4e0..b34f7c02f 100644 --- a/docs/examples/6c927313867647e0ef3cd3a37cb410cc.asciidoc +++ b/docs/examples/6c927313867647e0ef3cd3a37cb410cc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-api-keys.asciidoc:179 +// rest-api/security/invalidate-api-keys.asciidoc:185 [source, python] ---- diff --git a/docs/examples/10535507a9735fcf06600444b9067d4c.asciidoc b/docs/examples/6cb1dae368c945ecf7c9ec332a5743a2.asciidoc similarity index 74% rename from docs/examples/10535507a9735fcf06600444b9067d4c.asciidoc rename to docs/examples/6cb1dae368c945ecf7c9ec332a5743a2.asciidoc index 475eb922f..553747119 100644 --- a/docs/examples/10535507a9735fcf06600444b9067d4c.asciidoc +++ b/docs/examples/6cb1dae368c945ecf7c9ec332a5743a2.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/text.asciidoc:184 +// mapping/types/text.asciidoc:180 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "text": { "type": "text", diff --git a/docs/examples/6ce6cac9df216c52371c2e77e6e07ba1.asciidoc b/docs/examples/6ce6cac9df216c52371c2e77e6e07ba1.asciidoc index 7f5bcdd06..4458d2c85 100644 --- a/docs/examples/6ce6cac9df216c52371c2e77e6e07ba1.asciidoc +++ b/docs/examples/6ce6cac9df216c52371c2e77e6e07ba1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-rules/apis/put-query-ruleset.asciidoc:117 +// query-rules/apis/put-query-ruleset.asciidoc:123 [source, python] ---- diff --git a/docs/examples/6ce8334def48552ba7d44025580d9105.asciidoc b/docs/examples/6ce8334def48552ba7d44025580d9105.asciidoc index 68fce2f90..3aca2af6a 100644 --- a/docs/examples/6ce8334def48552ba7d44025580d9105.asciidoc +++ b/docs/examples/6ce8334def48552ba7d44025580d9105.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:240 +// alias.asciidoc:242 [source, python] ---- diff --git a/docs/examples/6db118771354792646229e7a3c30c7e9.asciidoc b/docs/examples/6db118771354792646229e7a3c30c7e9.asciidoc index ad36969c7..26dd39276 100644 --- a/docs/examples/6db118771354792646229e7a3c30c7e9.asciidoc +++ b/docs/examples/6db118771354792646229e7a3c30c7e9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:993 +// mapping/runtime.asciidoc:991 [source, python] ---- diff --git a/docs/examples/6dcd3916679f6aa64f79524c75991ebd.asciidoc b/docs/examples/6dcd3916679f6aa64f79524c75991ebd.asciidoc index 10fcf33a0..3b72c1464 100644 --- a/docs/examples/6dcd3916679f6aa64f79524c75991ebd.asciidoc +++ b/docs/examples/6dcd3916679f6aa64f79524c75991ebd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-rest.asciidoc:245 +// esql/esql-rest.asciidoc:248 [source, python] ---- diff --git a/docs/examples/6dd2a107bc64fd6f058fb17c21640649.asciidoc b/docs/examples/6dd2a107bc64fd6f058fb17c21640649.asciidoc index 4cf7cbec2..1ec99e3ef 100644 --- a/docs/examples/6dd2a107bc64fd6f058fb17c21640649.asciidoc +++ b/docs/examples/6dd2a107bc64fd6f058fb17c21640649.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-tokens.asciidoc:210 +// rest-api/security/invalidate-tokens.asciidoc:216 [source, python] ---- diff --git a/docs/examples/6dd4c02fe3d6b800648a04d3e2d29fc1.asciidoc b/docs/examples/6dd4c02fe3d6b800648a04d3e2d29fc1.asciidoc index 7682dc8ef..17a4a4a4c 100644 --- a/docs/examples/6dd4c02fe3d6b800648a04d3e2d29fc1.asciidoc +++ b/docs/examples/6dd4c02fe3d6b800648a04d3e2d29fc1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/delete-snapshot-api.asciidoc:72 +// snapshot-restore/apis/delete-snapshot-api.asciidoc:78 [source, python] ---- diff --git a/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc b/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc index b7861383a..1742c8750 100644 --- a/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc +++ b/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-azure-ai-studio.asciidoc:159 +// inference/service-azure-ai-studio.asciidoc:185 [source, python] ---- diff --git a/docs/examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc b/docs/examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc new file mode 100644 index 000000000..265795311 --- /dev/null +++ b/docs/examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc @@ -0,0 +1,16 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:453 + +[source, python] +---- +resp = client.reindex( + wait_for_completion=False, + source={ + "index": ".ml-anomalies-custom-example" + }, + dest={ + "index": ".reindexed-v9-ml-anomalies-custom-example" + }, +) +print(resp) +---- diff --git a/docs/examples/6e6b78e6b689a5d6aa637271b6d084e2.asciidoc b/docs/examples/6e6b78e6b689a5d6aa637271b6d084e2.asciidoc new file mode 100644 index 000000000..14522e393 --- /dev/null +++ b/docs/examples/6e6b78e6b689a5d6aa637271b6d084e2.asciidoc @@ -0,0 +1,52 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:363 + +[source, python] +---- +resp = client.search( + index="movies", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "sparse_vector": { + "field": "plot_embedding", + "inference_id": "my-elser-model", + "query": "films that explore psychological depths" + } + } + } + }, + { + "standard": { + "query": { + "multi_match": { + "query": "crime", + "fields": [ + "plot", + "title" + ] + } + } + } + }, + { + "knn": { + "field": "vector", + "query_vector": [ + 10, + 22, + 77 + ], + "k": 10, + "num_candidates": 10 + } + } + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/6ea062455229151e311869a81ee40252.asciidoc b/docs/examples/6ea062455229151e311869a81ee40252.asciidoc index 95f3a9047..7b0addc75 100644 --- a/docs/examples/6ea062455229151e311869a81ee40252.asciidoc +++ b/docs/examples/6ea062455229151e311869a81ee40252.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/search-multiple-indices.asciidoc:49 +// search/search-your-data/search-multiple-indices.asciidoc:83 [source, python] ---- diff --git a/docs/examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc b/docs/examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc index 0ffe6b433..cef497432 100644 --- a/docs/examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc +++ b/docs/examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc @@ -1,15 +1,13 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-update-api-keys.asciidoc:296 +// rest-api/security/bulk-update-api-keys.asciidoc:302 [source, python] ---- resp = client.security.bulk_update_api_keys( - body={ - "ids": [ - "VuaCfGcBCdbkQm-e5aOx", - "H3_AhoIBA9hmeQJdg7ij" - ] - }, + ids=[ + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij" + ], ) print(resp) ---- diff --git a/docs/examples/6f48ab7cbb8a4a46d0e9272c07166eaf.asciidoc b/docs/examples/6f48ab7cbb8a4a46d0e9272c07166eaf.asciidoc index 9942c771f..ae2cff12d 100644 --- a/docs/examples/6f48ab7cbb8a4a46d0e9272c07166eaf.asciidoc +++ b/docs/examples/6f48ab7cbb8a4a46d0e9272c07166eaf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// sql/apis/sql-translate-api.asciidoc:12 +// sql/apis/sql-translate-api.asciidoc:18 [source, python] ---- diff --git a/docs/examples/6f4cbebfd6d2cee54aa3e7a86a755ef8.asciidoc b/docs/examples/6f4cbebfd6d2cee54aa3e7a86a755ef8.asciidoc index b3acd844e..76430e37d 100644 --- a/docs/examples/6f4cbebfd6d2cee54aa3e7a86a755ef8.asciidoc +++ b/docs/examples/6f4cbebfd6d2cee54aa3e7a86a755ef8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/knn-query.asciidoc:204 +// query-dsl/knn-query.asciidoc:210 [source, python] ---- diff --git a/docs/examples/6f855bc92b4cc6e6a63f95bce1cb4441.asciidoc b/docs/examples/6f855bc92b4cc6e6a63f95bce1cb4441.asciidoc index 139cdcd7b..7efd19751 100644 --- a/docs/examples/6f855bc92b4cc6e6a63f95bce1cb4441.asciidoc +++ b/docs/examples/6f855bc92b4cc6e6a63f95bce1cb4441.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/logstash/get-pipeline.asciidoc:69 +// rest-api/logstash/get-pipeline.asciidoc:75 [source, python] ---- diff --git a/docs/examples/6f8bdca97e43aac75e32de655aa4314a.asciidoc b/docs/examples/6f8bdca97e43aac75e32de655aa4314a.asciidoc new file mode 100644 index 000000000..31751614e --- /dev/null +++ b/docs/examples/6f8bdca97e43aac75e32de655aa4314a.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:450 + +[source, python] +---- +resp = client.connector.delete( + connector_id="my-connector-id&delete_sync_jobs=true", +) +print(resp) +---- diff --git a/docs/examples/f9ee5d55a73f4c1fe7d507609047aefd.asciidoc b/docs/examples/6fa02c2ad485bbe91f44b321158250f3.asciidoc similarity index 69% rename from docs/examples/f9ee5d55a73f4c1fe7d507609047aefd.asciidoc rename to docs/examples/6fa02c2ad485bbe91f44b321158250f3.asciidoc index d74dee4b3..f5ab1b8f5 100644 --- a/docs/examples/f9ee5d55a73f4c1fe7d507609047aefd.asciidoc +++ b/docs/examples/6fa02c2ad485bbe91f44b321158250f3.asciidoc @@ -16,6 +16,15 @@ resp = client.search( ] } }, + highlight={ + "fields": { + "my_field": { + "matched_fields": [ + "my_field._index_prefix" + ] + } + } + }, ) print(resp) ---- diff --git a/docs/examples/6fa570ae7039171e2ab722344ec1063f.asciidoc b/docs/examples/6fa570ae7039171e2ab722344ec1063f.asciidoc index 787c451f0..e71e7bd27 100644 --- a/docs/examples/6fa570ae7039171e2ab722344ec1063f.asciidoc +++ b/docs/examples/6fa570ae7039171e2ab722344ec1063f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-field-mapping.asciidoc:14 +// indices/get-field-mapping.asciidoc:20 [source, python] ---- diff --git a/docs/examples/6fc778e9a888b16b937c5c2a7a1ec140.asciidoc b/docs/examples/6fc778e9a888b16b937c5c2a7a1ec140.asciidoc index 3502d3a1a..509f9ce44 100644 --- a/docs/examples/6fc778e9a888b16b937c5c2a7a1ec140.asciidoc +++ b/docs/examples/6fc778e9a888b16b937c5c2a7a1ec140.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// searchable-snapshots/apis/clear-cache.asciidoc:69 +// searchable-snapshots/apis/clear-cache.asciidoc:75 [source, python] ---- diff --git a/docs/examples/6fe6c095c6995e0f2214f5f3bc85d74e.asciidoc b/docs/examples/6fe6c095c6995e0f2214f5f3bc85d74e.asciidoc index cba318af2..ea72bc7db 100644 --- a/docs/examples/6fe6c095c6995e0f2214f5f3bc85d74e.asciidoc +++ b/docs/examples/6fe6c095c6995e0f2214f5f3bc85d74e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/lifecycle/apis/delete-lifecycle.asciidoc:77 +// data-streams/lifecycle/apis/delete-lifecycle.asciidoc:83 [source, python] ---- diff --git a/docs/examples/701f1fffc65e9e51c96aa60261e2eae3.asciidoc b/docs/examples/701f1fffc65e9e51c96aa60261e2eae3.asciidoc index 46263db30..5505f8c93 100644 --- a/docs/examples/701f1fffc65e9e51c96aa60261e2eae3.asciidoc +++ b/docs/examples/701f1fffc65e9e51c96aa60261e2eae3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-cross-cluster-api-key.asciidoc:120 +// rest-api/security/update-cross-cluster-api-key.asciidoc:126 [source, python] ---- diff --git a/docs/examples/708e7ec681be41791f232817a07cda82.asciidoc b/docs/examples/708e7ec681be41791f232817a07cda82.asciidoc index 522239825..6fe563481 100644 --- a/docs/examples/708e7ec681be41791f232817a07cda82.asciidoc +++ b/docs/examples/708e7ec681be41791f232817a07cda82.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-api.asciidoc:532 +// snapshot-restore/apis/get-snapshot-api.asciidoc:538 [source, python] ---- diff --git a/docs/examples/70c736ecb3746dbe839af0e468712805.asciidoc b/docs/examples/70c736ecb3746dbe839af0e468712805.asciidoc index 88e06c678..f30a7d193 100644 --- a/docs/examples/70c736ecb3746dbe839af0e468712805.asciidoc +++ b/docs/examples/70c736ecb3746dbe839af0e468712805.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/delete-transform.asciidoc:53 +// transform/apis/delete-transform.asciidoc:59 [source, python] ---- diff --git a/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc b/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc index 6382cbc78..83f65cf1b 100644 --- a/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc +++ b/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/update-trained-model-deployment.asciidoc:74 +// ml/trained-models/apis/update-trained-model-deployment.asciidoc:80 [source, python] ---- diff --git a/docs/examples/7106e6317e6368b9863cf64df9c6f0c9.asciidoc b/docs/examples/7106e6317e6368b9863cf64df9c6f0c9.asciidoc index 6e7c9ce55..f24bc51be 100644 --- a/docs/examples/7106e6317e6368b9863cf64df9c6f0c9.asciidoc +++ b/docs/examples/7106e6317e6368b9863cf64df9c6f0c9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/put-transform.asciidoc:378 +// transform/apis/put-transform.asciidoc:384 [source, python] ---- diff --git a/docs/examples/7163346755400594d1dd7e445aa19ff0.asciidoc b/docs/examples/7163346755400594d1dd7e445aa19ff0.asciidoc new file mode 100644 index 000000000..914d14320 --- /dev/null +++ b/docs/examples/7163346755400594d1dd7e445aa19ff0.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:426 + +[source, python] +---- +resp = client.search( + index="music", +) +print(resp) +---- diff --git a/docs/examples/8bf51fd50195b46bacbf872f460ebec2.asciidoc b/docs/examples/71998bb300ac2a58419b0772cdc1c586.asciidoc similarity index 70% rename from docs/examples/8bf51fd50195b46bacbf872f460ebec2.asciidoc rename to docs/examples/71998bb300ac2a58419b0772cdc1c586.asciidoc index 550e81a85..0b9cdbc9f 100644 --- a/docs/examples/8bf51fd50195b46bacbf872f460ebec2.asciidoc +++ b/docs/examples/71998bb300ac2a58419b0772cdc1c586.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/version.asciidoc:86 +// mapping/types/version.asciidoc:85 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "versions": { "type": "version" diff --git a/docs/examples/71c629c44bf3c542a0daacbfc253c4b0.asciidoc b/docs/examples/71c629c44bf3c542a0daacbfc253c4b0.asciidoc index 4644d9566..aafa33337 100644 --- a/docs/examples/71c629c44bf3c542a0daacbfc253c4b0.asciidoc +++ b/docs/examples/71c629c44bf3c542a0daacbfc253c4b0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/stats.asciidoc:1812 +// cluster/stats.asciidoc:1907 [source, python] ---- diff --git a/docs/examples/71fa652ddea811eb3c8bf8c5db21e549.asciidoc b/docs/examples/71fa652ddea811eb3c8bf8c5db21e549.asciidoc index 94f43f795..c0932dc5d 100644 --- a/docs/examples/71fa652ddea811eb3c8bf8c5db21e549.asciidoc +++ b/docs/examples/71fa652ddea811eb3c8bf8c5db21e549.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:224 +// indices/analyze.asciidoc:230 [source, python] ---- diff --git a/docs/examples/72ae3851160fcf02b8e2cdfd4e57d238.asciidoc b/docs/examples/72ae3851160fcf02b8e2cdfd4e57d238.asciidoc index 570c50a35..55eef3143 100644 --- a/docs/examples/72ae3851160fcf02b8e2cdfd4e57d238.asciidoc +++ b/docs/examples/72ae3851160fcf02b8e2cdfd4e57d238.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/start.asciidoc:75 +// tab-widgets/troubleshooting/data/start-ilm.asciidoc:66 [source, python] ---- diff --git a/docs/examples/72bae0252b74ff6fd9f0702ff008d84a.asciidoc b/docs/examples/72bae0252b74ff6fd9f0702ff008d84a.asciidoc index 733bae91a..676bf2d62 100644 --- a/docs/examples/72bae0252b74ff6fd9f0702ff008d84a.asciidoc +++ b/docs/examples/72bae0252b74ff6fd9f0702ff008d84a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-api.asciidoc:664 +// snapshot-restore/apis/get-snapshot-api.asciidoc:670 [source, python] ---- diff --git a/docs/examples/72beebe779a258c225dee7b023e60c52.asciidoc b/docs/examples/72beebe779a258c225dee7b023e60c52.asciidoc index 4b0eeca27..1863afd2c 100644 --- a/docs/examples/72beebe779a258c225dee7b023e60c52.asciidoc +++ b/docs/examples/72beebe779a258c225dee7b023e60c52.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/point-in-time-api.asciidoc:146 +// search/point-in-time-api.asciidoc:152 [source, python] ---- diff --git a/docs/examples/730045fae3743c39b612813a42c330c3.asciidoc b/docs/examples/730045fae3743c39b612813a42c330c3.asciidoc new file mode 100644 index 000000000..646e4225f --- /dev/null +++ b/docs/examples/730045fae3743c39b612813a42c330c3.asciidoc @@ -0,0 +1,26 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/params/index-prefixes.asciidoc:64 + +[source, python] +---- +resp = client.search( + index="my-index-000001", + query={ + "prefix": { + "full_name": { + "value": "ki" + } + } + }, + highlight={ + "fields": { + "full_name": { + "matched_fields": [ + "full_name._index_prefix" + ] + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/73646c12ad33a813ab2280f1dc83500e.asciidoc b/docs/examples/73646c12ad33a813ab2280f1dc83500e.asciidoc index 3ca8489e1..61020a145 100644 --- a/docs/examples/73646c12ad33a813ab2280f1dc83500e.asciidoc +++ b/docs/examples/73646c12ad33a813ab2280f1dc83500e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/put-follow.asciidoc:24 +// ccr/apis/follow/put-follow.asciidoc:30 [source, python] ---- diff --git a/docs/examples/73b07b24ab2c4cd304a57f9cbda8b863.asciidoc b/docs/examples/73b07b24ab2c4cd304a57f9cbda8b863.asciidoc index 6fe97c17f..c0a9ee6d8 100644 --- a/docs/examples/73b07b24ab2c4cd304a57f9cbda8b863.asciidoc +++ b/docs/examples/73b07b24ab2c4cd304a57f9cbda8b863.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// behavioral-analytics/apis/list-analytics-collection.asciidoc:60 +// behavioral-analytics/apis/list-analytics-collection.asciidoc:66 [source, python] ---- diff --git a/docs/examples/73d1a6c5ef90b7e35d43a0bfdc1e158d.asciidoc b/docs/examples/73d1a6c5ef90b7e35d43a0bfdc1e158d.asciidoc index adff218d6..db79aaa94 100644 --- a/docs/examples/73d1a6c5ef90b7e35d43a0bfdc1e158d.asciidoc +++ b/docs/examples/73d1a6c5ef90b7e35d43a0bfdc1e158d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-index-caps.asciidoc:88 +// rollup/apis/rollup-index-caps.asciidoc:95 [source, python] ---- diff --git a/docs/examples/73ebc89cb32adb389ae16bb088d7c7e6.asciidoc b/docs/examples/73ebc89cb32adb389ae16bb088d7c7e6.asciidoc index 54424173c..524e6230b 100644 --- a/docs/examples/73ebc89cb32adb389ae16bb088d7c7e6.asciidoc +++ b/docs/examples/73ebc89cb32adb389ae16bb088d7c7e6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:84 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:242 [source, python] ---- diff --git a/docs/examples/73fa0d6d03cd98ea538fff9e89d99eed.asciidoc b/docs/examples/73fa0d6d03cd98ea538fff9e89d99eed.asciidoc index 7a44e748a..1a87f8842 100644 --- a/docs/examples/73fa0d6d03cd98ea538fff9e89d99eed.asciidoc +++ b/docs/examples/73fa0d6d03cd98ea538fff9e89d99eed.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-service-accounts.asciidoc:57 +// rest-api/security/get-service-accounts.asciidoc:63 [source, python] ---- diff --git a/docs/examples/741180473ba526219578ad0422f4fe81.asciidoc b/docs/examples/741180473ba526219578ad0422f4fe81.asciidoc index bb11e7c3e..462e68e4d 100644 --- a/docs/examples/741180473ba526219578ad0422f4fe81.asciidoc +++ b/docs/examples/741180473ba526219578ad0422f4fe81.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-features-api.asciidoc:90 +// connector/apis/update-connector-features-api.asciidoc:97 [source, python] ---- diff --git a/docs/examples/7429b16221fe741fd31b0584786dd0b0.asciidoc b/docs/examples/7429b16221fe741fd31b0584786dd0b0.asciidoc index a124435ab..9e552ae3c 100644 --- a/docs/examples/7429b16221fe741fd31b0584786dd0b0.asciidoc +++ b/docs/examples/7429b16221fe741fd31b0584786dd0b0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/post-inference.asciidoc:248 +// inference/post-inference.asciidoc:249 [source, python] ---- diff --git a/docs/examples/744aeb2af40f519e430e21e004e3c3b7.asciidoc b/docs/examples/744aeb2af40f519e430e21e004e3c3b7.asciidoc index 8cf092fe3..952a42b78 100644 --- a/docs/examples/744aeb2af40f519e430e21e004e3c3b7.asciidoc +++ b/docs/examples/744aeb2af40f519e430e21e004e3c3b7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/multivalued-fields.asciidoc:91 +// esql/multivalued-fields.asciidoc:99 [source, python] ---- diff --git a/docs/examples/a4ec42130f3c75fc9d1d5f7cb6222cd5.asciidoc b/docs/examples/745864ef2427188241a4702b94ea57be.asciidoc similarity index 94% rename from docs/examples/a4ec42130f3c75fc9d1d5f7cb6222cd5.asciidoc rename to docs/examples/745864ef2427188241a4702b94ea57be.asciidoc index 8f5158ccc..f2b580fb5 100644 --- a/docs/examples/a4ec42130f3c75fc9d1d5f7cb6222cd5.asciidoc +++ b/docs/examples/745864ef2427188241a4702b94ea57be.asciidoc @@ -11,7 +11,7 @@ resp = client.search( "filter": { "range": { "price": { - "to": "500" + "lte": "500" } } } diff --git a/docs/examples/746e0a1cb5984f2672963b363505c7b3.asciidoc b/docs/examples/746e0a1cb5984f2672963b363505c7b3.asciidoc index 265bb0fb3..5c56c2f3f 100644 --- a/docs/examples/746e0a1cb5984f2672963b363505c7b3.asciidoc +++ b/docs/examples/746e0a1cb5984f2672963b363505c7b3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/date.asciidoc:189 +// mapping/types/date.asciidoc:188 [source, python] ---- diff --git a/docs/examples/7471e97aaaf21c3a200abdd89f15c3cc.asciidoc b/docs/examples/7471e97aaaf21c3a200abdd89f15c3cc.asciidoc index 63f567ecd..8db72beed 100644 --- a/docs/examples/7471e97aaaf21c3a200abdd89f15c3cc.asciidoc +++ b/docs/examples/7471e97aaaf21c3a200abdd89f15c3cc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/intervals-query.asciidoc:312 +// query-dsl/intervals-query.asciidoc:393 [source, python] ---- diff --git a/docs/examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc b/docs/examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc new file mode 100644 index 000000000..4fce43b61 --- /dev/null +++ b/docs/examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc @@ -0,0 +1,33 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:1343 + +[source, python] +---- +resp = client.search( + index="kibana_sample_data_ecommerce", + size=0, + aggs={ + "daily_sales": { + "date_histogram": { + "field": "order_date", + "calendar_interval": "day" + }, + "aggs": { + "daily_revenue": { + "sum": { + "field": "taxful_total_price" + } + }, + "smoothed_revenue": { + "moving_fn": { + "buckets_path": "daily_revenue", + "window": 3, + "script": "MovingFunctions.unweightedAvg(values)" + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/74a80c28737a0648db0dfe7f049d12f2.asciidoc b/docs/examples/74a80c28737a0648db0dfe7f049d12f2.asciidoc index c94c2b279..604fd2449 100644 --- a/docs/examples/74a80c28737a0648db0dfe7f049d12f2.asciidoc +++ b/docs/examples/74a80c28737a0648db0dfe7f049d12f2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:272 +// docs/get.asciidoc:278 [source, python] ---- diff --git a/docs/examples/74b229a6e020113e5749099451979c89.asciidoc b/docs/examples/74b229a6e020113e5749099451979c89.asciidoc deleted file mode 100644 index d4560e688..000000000 --- a/docs/examples/74b229a6e020113e5749099451979c89.asciidoc +++ /dev/null @@ -1,26 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// query-dsl/semantic-query.asciidoc:172 - -[source, python] ----- -resp = client.search( - index="test-index", - query={ - "nested": { - "path": "inference_field.inference.chunks", - "query": { - "knn": { - "field": "inference_field.inference.chunks.embeddings", - "query_vector_builder": { - "text_embedding": { - "model_id": "my_inference_id", - "model_text": "mountain lake" - } - } - } - } - } - }, -) -print(resp) ----- diff --git a/docs/examples/74da377bccad43da2b0e276c086d26ba.asciidoc b/docs/examples/74da377bccad43da2b0e276c086d26ba.asciidoc index 731c683e3..7607134c9 100644 --- a/docs/examples/74da377bccad43da2b0e276c086d26ba.asciidoc +++ b/docs/examples/74da377bccad43da2b0e276c086d26ba.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/cluster-info.asciidoc:382 +// cluster/cluster-info.asciidoc:388 [source, python] ---- diff --git a/docs/examples/35b686d9d9e915d0dea7a4251781767d.asciidoc b/docs/examples/750ac969f9a05567f5cdf4f93d6244b6.asciidoc similarity index 93% rename from docs/examples/35b686d9d9e915d0dea7a4251781767d.asciidoc rename to docs/examples/750ac969f9a05567f5cdf4f93d6244b6.asciidoc index 02508226f..7e47cc7c7 100644 --- a/docs/examples/35b686d9d9e915d0dea7a4251781767d.asciidoc +++ b/docs/examples/750ac969f9a05567f5cdf4f93d6244b6.asciidoc @@ -1,10 +1,9 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:248 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:281 [source, python] ---- resp = client.cluster.reroute( - metric="none", commands=[ { "allocate_empty_primary": { diff --git a/docs/examples/7594a9a85c8511701e281974cbc253e1.asciidoc b/docs/examples/7594a9a85c8511701e281974cbc253e1.asciidoc index 1425a25e1..3e348d90c 100644 --- a/docs/examples/7594a9a85c8511701e281974cbc253e1.asciidoc +++ b/docs/examples/7594a9a85c8511701e281974cbc253e1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/inference-api/infer-api-task.asciidoc:228 +// tab-widgets/inference-api/infer-api-task.asciidoc:236 [source, python] ---- diff --git a/docs/examples/75957a7d1b67e3d47899c5f18b32cb61.asciidoc b/docs/examples/75957a7d1b67e3d47899c5f18b32cb61.asciidoc index c6b6cad6c..4befbcd95 100644 --- a/docs/examples/75957a7d1b67e3d47899c5f18b32cb61.asciidoc +++ b/docs/examples/75957a7d1b67e3d47899c5f18b32cb61.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/close-job.asciidoc:99 +// ml/anomaly-detection/apis/close-job.asciidoc:105 [source, python] ---- diff --git a/docs/examples/75aba7b1d3a22dce62f26b8b1e6bee58.asciidoc b/docs/examples/75aba7b1d3a22dce62f26b8b1e6bee58.asciidoc index d603f109b..30dd30499 100644 --- a/docs/examples/75aba7b1d3a22dce62f26b8b1e6bee58.asciidoc +++ b/docs/examples/75aba7b1d3a22dce62f26b8b1e6bee58.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/validate.asciidoc:167 +// search/validate.asciidoc:173 [source, python] ---- diff --git a/docs/examples/75e360d03fb416f0a65ca37c662c2e9c.asciidoc b/docs/examples/75e360d03fb416f0a65ca37c662c2e9c.asciidoc index 4cccf15fc..2e00f18c9 100644 --- a/docs/examples/75e360d03fb416f0a65ca37c662c2e9c.asciidoc +++ b/docs/examples/75e360d03fb416f0a65ca37c662c2e9c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// aggregations/metrics/scripted-metric-aggregation.asciidoc:157 +// aggregations/metrics/scripted-metric-aggregation.asciidoc:159 [source, python] ---- diff --git a/docs/examples/75e6d66e94e61bd8a555beaaee255c36.asciidoc b/docs/examples/75e6d66e94e61bd8a555beaaee255c36.asciidoc index b8e011dc5..bfb1cadf1 100644 --- a/docs/examples/75e6d66e94e61bd8a555beaaee255c36.asciidoc +++ b/docs/examples/75e6d66e94e61bd8a555beaaee255c36.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-search.asciidoc:170 +// rollup/apis/rollup-search.asciidoc:178 [source, python] ---- diff --git a/docs/examples/76bc87c2592864152768687c2963d1d1.asciidoc b/docs/examples/76bc87c2592864152768687c2963d1d1.asciidoc index 204b2d14b..f0da20a0f 100644 --- a/docs/examples/76bc87c2592864152768687c2963d1d1.asciidoc +++ b/docs/examples/76bc87c2592864152768687c2963d1d1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-api-key.asciidoc:148 +// rest-api/security/update-api-key.asciidoc:154 [source, python] ---- diff --git a/docs/examples/76c167d8ab305cb43b594f140c902dfe.asciidoc b/docs/examples/76c167d8ab305cb43b594f140c902dfe.asciidoc index 9a6d854d8..ffc545fa3 100644 --- a/docs/examples/76c167d8ab305cb43b594f140c902dfe.asciidoc +++ b/docs/examples/76c167d8ab305cb43b594f140c902dfe.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shrink-index.asciidoc:162 +// indices/shrink-index.asciidoc:168 [source, python] ---- diff --git a/docs/examples/76c73b54f3f1e5cb1c0fcccd7c3fd18e.asciidoc b/docs/examples/76c73b54f3f1e5cb1c0fcccd7c3fd18e.asciidoc new file mode 100644 index 000000000..de9e27866 --- /dev/null +++ b/docs/examples/76c73b54f3f1e5cb1c0fcccd7c3fd18e.asciidoc @@ -0,0 +1,87 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/ingest-vectors.asciidoc:86 + +[source, python] +---- +resp = client.bulk( + operations=[ + { + "index": { + "_index": "amazon-reviews", + "_id": "2" + } + }, + { + "review_text": "This product is amazing! I love it.", + "review_vector": [ + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8 + ] + }, + { + "index": { + "_index": "amazon-reviews", + "_id": "3" + } + }, + { + "review_text": "This product is terrible. I hate it.", + "review_vector": [ + 0.8, + 0.7, + 0.6, + 0.5, + 0.4, + 0.3, + 0.2, + 0.1 + ] + }, + { + "index": { + "_index": "amazon-reviews", + "_id": "4" + } + }, + { + "review_text": "This product is great. I can do anything with it.", + "review_vector": [ + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8 + ] + }, + { + "index": { + "_index": "amazon-reviews", + "_id": "5" + } + }, + { + "review_text": "This product has ruined my life and the lives of my family and friends.", + "review_vector": [ + 0.8, + 0.7, + 0.6, + 0.5, + 0.4, + 0.3, + 0.2, + 0.1 + ] + } + ], +) +print(resp) +---- diff --git a/docs/examples/76dbdd0b2bd48c3c6b1a8d81e23bafd6.asciidoc b/docs/examples/76dbdd0b2bd48c3c6b1a8d81e23bafd6.asciidoc index 88bbfb22e..954224106 100644 --- a/docs/examples/76dbdd0b2bd48c3c6b1a8d81e23bafd6.asciidoc +++ b/docs/examples/76dbdd0b2bd48c3c6b1a8d81e23bafd6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:143 +// indices/analyze.asciidoc:149 [source, python] ---- diff --git a/docs/examples/76e02434835630cb830724beb92df354.asciidoc b/docs/examples/76e02434835630cb830724beb92df354.asciidoc new file mode 100644 index 000000000..cc7602fe4 --- /dev/null +++ b/docs/examples/76e02434835630cb830724beb92df354.asciidoc @@ -0,0 +1,47 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:1433 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "rrf": { + "retrievers": [ + { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + }, + { + "text_similarity_reranker": { + "retriever": { + "standard": { + "query": { + "term": { + "topic": "ai" + } + } + } + }, + "field": "text", + "inference_id": "my-rerank-model", + "inference_text": "Can I use generative AI to identify user intent and improve search relevance?" + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + }, + source=False, +) +print(resp) +---- diff --git a/docs/examples/77082b1ffaae9ac52dfc133fa597baa7.asciidoc b/docs/examples/77082b1ffaae9ac52dfc133fa597baa7.asciidoc new file mode 100644 index 000000000..c2b612309 --- /dev/null +++ b/docs/examples/77082b1ffaae9ac52dfc133fa597baa7.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:241 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "match": { + "description": { + "query": "fluffy pancakes", + "operator": "and" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/7709a48020a6cefbbe547fb944541cdb.asciidoc b/docs/examples/7709a48020a6cefbbe547fb944541cdb.asciidoc index 10db24405..00ea6fa58 100644 --- a/docs/examples/7709a48020a6cefbbe547fb944541cdb.asciidoc +++ b/docs/examples/7709a48020a6cefbbe547fb944541cdb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:392 +// mapping/types/dense-vector.asciidoc:421 [source, python] ---- diff --git a/docs/examples/77447e2966708e92f5e219d43ac3f00d.asciidoc b/docs/examples/77447e2966708e92f5e219d43ac3f00d.asciidoc index 10b268ae4..075cb366a 100644 --- a/docs/examples/77447e2966708e92f5e219d43ac3f00d.asciidoc +++ b/docs/examples/77447e2966708e92f5e219d43ac3f00d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:226 +// cluster/tasks.asciidoc:232 [source, python] ---- diff --git a/docs/examples/774bfde8793dc4927f7cad2dd91c5b5f.asciidoc b/docs/examples/774bfde8793dc4927f7cad2dd91c5b5f.asciidoc index 40889a7d3..980ce422b 100644 --- a/docs/examples/774bfde8793dc4927f7cad2dd91c5b5f.asciidoc +++ b/docs/examples/774bfde8793dc4927f7cad2dd91c5b5f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/multi-search-template-api.asciidoc:38 +// search/multi-search-template-api.asciidoc:44 [source, python] ---- diff --git a/docs/examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc b/docs/examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc index 12661f21d..f68073684 100644 --- a/docs/examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc +++ b/docs/examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc @@ -1,35 +1,33 @@ // This file is autogenerated, DO NOT EDIT -// text-structure/apis/find-message-structure.asciidoc:87 +// text-structure/apis/find-message-structure.asciidoc:93 [source, python] ---- resp = client.text_structure.find_message_structure( - body={ - "messages": [ - "[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128", - "[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]", - "[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]", - "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]", - "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]", - "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]", - "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]", - "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]", - "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]", - "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]", - "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]", - "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]", - "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]", - "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]", - "[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]", - "[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled", - "[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled", - "[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled", - "[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]", - "[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]", - "[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized", - "[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ..." - ] - }, + messages=[ + "[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128", + "[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]", + "[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]", + "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]", + "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]", + "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]", + "[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]", + "[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled", + "[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled", + "[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled", + "[2024-03-05T10:52:47,755][INFO ][o.e.i.r.RecoverySettings ] [laptop] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]", + "[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]", + "[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized", + "[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ..." + ], ) print(resp) ---- diff --git a/docs/examples/7752b677825523bfb0c38ad9325a6d47.asciidoc b/docs/examples/7752b677825523bfb0c38ad9325a6d47.asciidoc index 3d71c943a..1fb038498 100644 --- a/docs/examples/7752b677825523bfb0c38ad9325a6d47.asciidoc +++ b/docs/examples/7752b677825523bfb0c38ad9325a6d47.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/delete-connector-api.asciidoc:69 +// connector/apis/delete-connector-api.asciidoc:79 [source, python] ---- diff --git a/docs/examples/776b553df0e507c96dbdbaedecaca0cc.asciidoc b/docs/examples/776b553df0e507c96dbdbaedecaca0cc.asciidoc index 3794702c4..e6f55debc 100644 --- a/docs/examples/776b553df0e507c96dbdbaedecaca0cc.asciidoc +++ b/docs/examples/776b553df0e507c96dbdbaedecaca0cc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/infer-trained-model.asciidoc:880 +// ml/trained-models/apis/infer-trained-model.asciidoc:987 [source, python] ---- diff --git a/docs/examples/7781b13b0ffff6026d10c4e3ab4a3a51.asciidoc b/docs/examples/7781b13b0ffff6026d10c4e3ab4a3a51.asciidoc index ed9f75c24..fdb30e0d9 100644 --- a/docs/examples/7781b13b0ffff6026d10c4e3ab4a3a51.asciidoc +++ b/docs/examples/7781b13b0ffff6026d10c4e3ab4a3a51.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// behavioral-analytics/apis/put-analytics-collection.asciidoc:49 +// behavioral-analytics/apis/put-analytics-collection.asciidoc:55 [source, python] ---- diff --git a/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc b/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc index 5590d6b84..62e3132f7 100644 --- a/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc +++ b/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-azure-openai.asciidoc:121 +// inference/service-azure-openai.asciidoc:147 [source, python] ---- diff --git a/docs/examples/77c099c97ea6911e2dd6e996da7dcca0.asciidoc b/docs/examples/77c099c97ea6911e2dd6e996da7dcca0.asciidoc index 5536af5cf..c68675eb1 100644 --- a/docs/examples/77c099c97ea6911e2dd6e996da7dcca0.asciidoc +++ b/docs/examples/77c099c97ea6911e2dd6e996da7dcca0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-hot-threads.asciidoc:72 +// cluster/nodes-hot-threads.asciidoc:78 [source, python] ---- diff --git a/docs/examples/77c50f982906718ecc59aa708aed728f.asciidoc b/docs/examples/77c50f982906718ecc59aa708aed728f.asciidoc index 498e9f892..e36b4be9a 100644 --- a/docs/examples/77c50f982906718ecc59aa708aed728f.asciidoc +++ b/docs/examples/77c50f982906718ecc59aa708aed728f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:294 +// scripting/using.asciidoc:299 [source, python] ---- diff --git a/docs/examples/77ca1a3193f75651e0bf9e8fe5227a04.asciidoc b/docs/examples/77ca1a3193f75651e0bf9e8fe5227a04.asciidoc index 3800f0b25..53ab5fcec 100644 --- a/docs/examples/77ca1a3193f75651e0bf9e8fe5227a04.asciidoc +++ b/docs/examples/77ca1a3193f75651e0bf9e8fe5227a04.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-job-model-snapshot-upgrade-stats.asciidoc:121 +// ml/anomaly-detection/apis/get-job-model-snapshot-upgrade-stats.asciidoc:127 [source, python] ---- diff --git a/docs/examples/9d47f02a063444da9f098858a1830d28.asciidoc b/docs/examples/77cebba946fe648873a1e7375c13df41.asciidoc similarity index 60% rename from docs/examples/9d47f02a063444da9f098858a1830d28.asciidoc rename to docs/examples/77cebba946fe648873a1e7375c13df41.asciidoc index 0cef3692d..85c688fad 100644 --- a/docs/examples/9d47f02a063444da9f098858a1830d28.asciidoc +++ b/docs/examples/77cebba946fe648873a1e7375c13df41.asciidoc @@ -1,11 +1,12 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:210 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:215 [source, python] ---- resp = client.cluster.put_settings( persistent={ - "cluster.routing.allocation.disk.watermark.low": "30gb" + "cluster.routing.allocation.disk.watermark.low": "90%", + "cluster.routing.allocation.disk.watermark.high": "95%" }, ) print(resp) diff --git a/docs/examples/77d0780c5faea4c9ec51a322a6811b3b.asciidoc b/docs/examples/77d0780c5faea4c9ec51a322a6811b3b.asciidoc index 80d2beda2..35a1df0e3 100644 --- a/docs/examples/77d0780c5faea4c9ec51a322a6811b3b.asciidoc +++ b/docs/examples/77d0780c5faea4c9ec51a322a6811b3b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1311 +// mapping/runtime.asciidoc:1309 [source, python] ---- diff --git a/docs/examples/77e3dcd87d2b2c8e6ec842462b02df1f.asciidoc b/docs/examples/77e3dcd87d2b2c8e6ec842462b02df1f.asciidoc index 80b434a2f..3459e379e 100644 --- a/docs/examples/77e3dcd87d2b2c8e6ec842462b02df1f.asciidoc +++ b/docs/examples/77e3dcd87d2b2c8e6ec842462b02df1f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/clone-index.asciidoc:10 +// indices/clone-index.asciidoc:16 [source, python] ---- diff --git a/docs/examples/78043831fd32004a82930c8ac8a1d809.asciidoc b/docs/examples/78043831fd32004a82930c8ac8a1d809.asciidoc new file mode 100644 index 000000000..5a0d6d76f --- /dev/null +++ b/docs/examples/78043831fd32004a82930c8ac8a1d809.asciidoc @@ -0,0 +1,48 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:1378 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "text_similarity_reranker": { + "retriever": { + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "query_string": { + "query": "(information retrieval) OR (artificial intelligence)", + "default_field": "text" + } + } + } + }, + { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + }, + "field": "text", + "inference_id": "my-rerank-model", + "inference_text": "What are the state of the art applications of AI in information retrieval?" + } + }, + source=False, +) +print(resp) +---- diff --git a/docs/examples/78176cd6f570e1534bb40b19e6e900b6.asciidoc b/docs/examples/78176cd6f570e1534bb40b19e6e900b6.asciidoc index 62ff4fba8..2fd9fd572 100644 --- a/docs/examples/78176cd6f570e1534bb40b19e6e900b6.asciidoc +++ b/docs/examples/78176cd6f570e1534bb40b19e6e900b6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/alias.asciidoc:87 +// cat/alias.asciidoc:93 [source, python] ---- diff --git a/docs/examples/84490ee2c6c07dbd2101ce2e3751e1aa.asciidoc b/docs/examples/7888c509774a2abfe82ca370c43d8789.asciidoc similarity index 86% rename from docs/examples/84490ee2c6c07dbd2101ce2e3751e1aa.asciidoc rename to docs/examples/7888c509774a2abfe82ca370c43d8789.asciidoc index d25d4f72b..9856bdaa3 100644 --- a/docs/examples/84490ee2c6c07dbd2101ce2e3751e1aa.asciidoc +++ b/docs/examples/7888c509774a2abfe82ca370c43d8789.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "cohere-embeddings", - "pipeline": "cohere_embeddings" + "pipeline": "cohere_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/78c4035e4fbf6851140660f6ed2a1fa5.asciidoc b/docs/examples/78c4035e4fbf6851140660f6ed2a1fa5.asciidoc index b980e41a9..130322ecc 100644 --- a/docs/examples/78c4035e4fbf6851140660f6ed2a1fa5.asciidoc +++ b/docs/examples/78c4035e4fbf6851140660f6ed2a1fa5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/stats.asciidoc:115 +// indices/stats.asciidoc:121 [source, python] ---- diff --git a/docs/examples/78c96113ae4ed0054e581b17542528a7.asciidoc b/docs/examples/78c96113ae4ed0054e581b17542528a7.asciidoc index d7e332f84..65574f3f8 100644 --- a/docs/examples/78c96113ae4ed0054e581b17542528a7.asciidoc +++ b/docs/examples/78c96113ae4ed0054e581b17542528a7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:403 +// docs/reindex.asciidoc:409 [source, python] ---- diff --git a/docs/examples/78e20b4cff470ed7357de1fd74bcfeb7.asciidoc b/docs/examples/78e20b4cff470ed7357de1fd74bcfeb7.asciidoc index b14f14162..ff8f36636 100644 --- a/docs/examples/78e20b4cff470ed7357de1fd74bcfeb7.asciidoc +++ b/docs/examples/78e20b4cff470ed7357de1fd74bcfeb7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:135 +// alias.asciidoc:137 [source, python] ---- diff --git a/docs/examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc b/docs/examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc new file mode 100644 index 000000000..1ab1bd218 --- /dev/null +++ b/docs/examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc @@ -0,0 +1,35 @@ +// This file is autogenerated, DO NOT EDIT +// query-dsl/intervals-query.asciidoc:539 + +[source, python] +---- +resp = client.search( + query={ + "intervals": { + "my_text": { + "all_of": { + "ordered": False, + "max_gaps": 1, + "intervals": [ + { + "match": { + "query": "my favorite food", + "max_gaps": 0, + "ordered": True + } + }, + { + "match": { + "query": "cold porridge", + "max_gaps": 4, + "ordered": True + } + } + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/79d206a528be704050a437adce2496dd.asciidoc b/docs/examples/79d206a528be704050a437adce2496dd.asciidoc new file mode 100644 index 000000000..0a1f7c9ca --- /dev/null +++ b/docs/examples/79d206a528be704050a437adce2496dd.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:629 + +[source, python] +---- +resp = client.inference.put( + task_type="rerank", + inference_id="my-elastic-rerank", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "model_id": ".rerank-v1", + "num_threads": 1, + "adaptive_allocations": { + "enabled": True, + "min_number_of_allocations": 1, + "max_number_of_allocations": 10 + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/79f33e05b203eb46eef7958fbc95ef77.asciidoc b/docs/examples/79f33e05b203eb46eef7958fbc95ef77.asciidoc index 01da4fc57..8ddda044a 100644 --- a/docs/examples/79f33e05b203eb46eef7958fbc95ef77.asciidoc +++ b/docs/examples/79f33e05b203eb46eef7958fbc95ef77.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:87 +// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:93 [source, python] ---- diff --git a/docs/examples/79ff4e7fa5c004226d05d7e2bfb5dc1e.asciidoc b/docs/examples/79ff4e7fa5c004226d05d7e2bfb5dc1e.asciidoc new file mode 100644 index 000000000..ac63f53fb --- /dev/null +++ b/docs/examples/79ff4e7fa5c004226d05d7e2bfb5dc1e.asciidoc @@ -0,0 +1,51 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/passthrough.asciidoc:134 + +[source, python] +---- +resp = client.indices.put_index_template( + name="my-metrics", + index_patterns=[ + "metrics-mymetrics-*" + ], + priority=200, + data_stream={}, + template={ + "settings": { + "index.mode": "time_series" + }, + "mappings": { + "properties": { + "attributes": { + "type": "passthrough", + "priority": 10, + "time_series_dimension": True, + "properties": { + "host.name": { + "type": "keyword" + } + } + }, + "cpu": { + "type": "integer", + "time_series_metric": "counter" + } + } + } + }, +) +print(resp) + +resp1 = client.index( + index="metrics-mymetrics-test", + document={ + "@timestamp": "2020-01-01T00:00:00.000Z", + "attributes": { + "host.name": "foo", + "zone": "bar" + }, + "cpu": 10 + }, +) +print(resp1) +---- diff --git a/docs/examples/7a0c633a67244e9703344d036e584d95.asciidoc b/docs/examples/7a0c633a67244e9703344d036e584d95.asciidoc index db177d476..d7325bc54 100644 --- a/docs/examples/7a0c633a67244e9703344d036e584d95.asciidoc +++ b/docs/examples/7a0c633a67244e9703344d036e584d95.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/enable-user-profile.asciidoc:54 +// rest-api/security/enable-user-profile.asciidoc:60 [source, python] ---- diff --git a/docs/examples/7a0eb2222fe282d3aab66e12feff2a3b.asciidoc b/docs/examples/7a0eb2222fe282d3aab66e12feff2a3b.asciidoc index 77928735e..a829a70e7 100644 --- a/docs/examples/7a0eb2222fe282d3aab66e12feff2a3b.asciidoc +++ b/docs/examples/7a0eb2222fe282d3aab66e12feff2a3b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:834 +// mapping/runtime.asciidoc:832 [source, python] ---- diff --git a/docs/examples/7a23a385a63c87cab58fd494870450fd.asciidoc b/docs/examples/7a23a385a63c87cab58fd494870450fd.asciidoc index c38503fb5..4116be624 100644 --- a/docs/examples/7a23a385a63c87cab58fd494870450fd.asciidoc +++ b/docs/examples/7a23a385a63c87cab58fd494870450fd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:175 +// rest-api/security/create-role-mappings.asciidoc:181 [source, python] ---- diff --git a/docs/examples/7a27336a61284d079f3cc3994cf927d1.asciidoc b/docs/examples/7a27336a61284d079f3cc3994cf927d1.asciidoc new file mode 100644 index 000000000..5115db85e --- /dev/null +++ b/docs/examples/7a27336a61284d079f3cc3994cf927d1.asciidoc @@ -0,0 +1,58 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/dls-overview.asciidoc:283 + +[source, python] +---- +resp = client.security.create_api_key( + name="my-api-key", + role_descriptors={ + "role-source1": { + "indices": [ + { + "names": [ + "source1" + ], + "privileges": [ + "read" + ], + "query": { + "template": { + "params": { + "access_control": [ + "example.user@example.com", + "source1-user-group" + ] + } + }, + "source": "..." + } + } + ] + }, + "role-source2": { + "indices": [ + { + "names": [ + "source2" + ], + "privileges": [ + "read" + ], + "query": { + "template": { + "params": { + "access_control": [ + "example.user@example.com", + "source2-user-group" + ] + } + }, + "source": "..." + } + } + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/7a2fdfd7b0553d63440af7598f9ad867.asciidoc b/docs/examples/7a2fdfd7b0553d63440af7598f9ad867.asciidoc new file mode 100644 index 000000000..b6a6cc46d --- /dev/null +++ b/docs/examples/7a2fdfd7b0553d63440af7598f9ad867.asciidoc @@ -0,0 +1,19 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/semantic-text.asciidoc:63 + +[source, python] +---- +resp = client.indices.create( + index="my-index-000003", + mappings={ + "properties": { + "inference_field": { + "type": "semantic_text", + "inference_id": "my-elser-endpoint-for-ingest", + "search_inference_id": "my-elser-endpoint-for-search" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/7a32f44a1511ecb0d3f0b0ff2aca5c44.asciidoc b/docs/examples/7a32f44a1511ecb0d3f0b0ff2aca5c44.asciidoc deleted file mode 100644 index 984cd88e4..000000000 --- a/docs/examples/7a32f44a1511ecb0d3f0b0ff2aca5c44.asciidoc +++ /dev/null @@ -1,23 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// migration/migrate_8_0/migrate_to_java_time.asciidoc:305 - -[source, python] ----- -resp = client.indices.update_aliases( - actions=[ - { - "remove": { - "index": "my-index-000001", - "alias": "my-index" - } - }, - { - "add": { - "index": "my-index-000002", - "alias": "my-index" - } - } - ], -) -print(resp) ----- diff --git a/docs/examples/7a3a7fbd81e5050b42e8c1eca26c7c1d.asciidoc b/docs/examples/7a3a7fbd81e5050b42e8c1eca26c7c1d.asciidoc index a1990bd3f..60b088761 100644 --- a/docs/examples/7a3a7fbd81e5050b42e8c1eca26c7c1d.asciidoc +++ b/docs/examples/7a3a7fbd81e5050b42e8c1eca26c7c1d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/async-search.asciidoc:334 +// search/async-search.asciidoc:340 [source, python] ---- diff --git a/docs/examples/7a8de5606f283f4ef171b015eef6befa.asciidoc b/docs/examples/7a8de5606f283f4ef171b015eef6befa.asciidoc index 3c62552a4..f35c65c58 100644 --- a/docs/examples/7a8de5606f283f4ef171b015eef6befa.asciidoc +++ b/docs/examples/7a8de5606f283f4ef171b015eef6befa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/stats.asciidoc:143 +// indices/stats.asciidoc:149 [source, python] ---- diff --git a/docs/examples/7ae434b3667c589a8e70fe560f4ee3f9.asciidoc b/docs/examples/7ae434b3667c589a8e70fe560f4ee3f9.asciidoc index 782dd3688..a094945d5 100644 --- a/docs/examples/7ae434b3667c589a8e70fe560f4ee3f9.asciidoc +++ b/docs/examples/7ae434b3667c589a8e70fe560f4ee3f9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:12 +// docs/update-by-query.asciidoc:18 [source, python] ---- diff --git a/docs/examples/7af1f62b0cf496cbf593d83d30b472cc.asciidoc b/docs/examples/7af1f62b0cf496cbf593d83d30b472cc.asciidoc new file mode 100644 index 000000000..b98d052b9 --- /dev/null +++ b/docs/examples/7af1f62b0cf496cbf593d83d30b472cc.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:226 + +[source, python] +---- +resp = client.security.create_api_key( + name="music-connector", + role_descriptors={ + "music-connector-role": { + "cluster": [ + "monitor", + "manage_connector" + ], + "indices": [ + { + "names": [ + "music", + ".search-acl-filter-music", + ".elastic-connectors*" + ], + "privileges": [ + "all" + ], + "allow_restricted_indices": False + } + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/7b5c231526846f2f7b98d78f3656ae6a.asciidoc b/docs/examples/7b5c231526846f2f7b98d78f3656ae6a.asciidoc index 66cd93a86..2127f437f 100644 --- a/docs/examples/7b5c231526846f2f7b98d78f3656ae6a.asciidoc +++ b/docs/examples/7b5c231526846f2f7b98d78f3656ae6a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:362 +// docs/update.asciidoc:364 [source, python] ---- diff --git a/docs/examples/7b864d61767ab283cfd5f9b9ba784b1f.asciidoc b/docs/examples/7b864d61767ab283cfd5f9b9ba784b1f.asciidoc index 510099f4a..fbda20ffb 100644 --- a/docs/examples/7b864d61767ab283cfd5f9b9ba784b1f.asciidoc +++ b/docs/examples/7b864d61767ab283cfd5f9b9ba784b1f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:201 +// rest-api/security/get-api-keys.asciidoc:207 [source, python] ---- diff --git a/docs/examples/7ba29f0be2297b54a640b0a17d7ef5ca.asciidoc b/docs/examples/7ba29f0be2297b54a640b0a17d7ef5ca.asciidoc new file mode 100644 index 000000000..aff1144dd --- /dev/null +++ b/docs/examples/7ba29f0be2297b54a640b0a17d7ef5ca.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/apis/delete-ip-location-database.asciidoc:16 + +[source, python] +---- +resp = client.ingest.delete_ip_location_database( + id="my-database-id", +) +print(resp) +---- diff --git a/docs/examples/8593715fcc70315a0816b435551258e0.asciidoc b/docs/examples/7bdc283b96c7a965fae23013647b8578.asciidoc similarity index 79% rename from docs/examples/8593715fcc70315a0816b435551258e0.asciidoc rename to docs/examples/7bdc283b96c7a965fae23013647b8578.asciidoc index d3df5ebad..2bc21bbf0 100644 --- a/docs/examples/8593715fcc70315a0816b435551258e0.asciidoc +++ b/docs/examples/7bdc283b96c7a965fae23013647b8578.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/semantic-text.asciidoc:155 +// mapping/types/semantic-text.asciidoc:220 [source, python] ---- @@ -7,13 +7,13 @@ resp = client.indices.create( index="test-index", mappings={ "properties": { - "infer_field": { - "type": "semantic_text", - "inference_id": "my-elser-endpoint" - }, "source_field": { "type": "text", "copy_to": "infer_field" + }, + "infer_field": { + "type": "semantic_text", + "inference_id": ".elser-2-elasticsearch" } } }, diff --git a/docs/examples/7c8f207e43115ea8f20d2298be5aaebc.asciidoc b/docs/examples/7c8f207e43115ea8f20d2298be5aaebc.asciidoc deleted file mode 100644 index 106984537..000000000 --- a/docs/examples/7c8f207e43115ea8f20d2298be5aaebc.asciidoc +++ /dev/null @@ -1,39 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// ingest/apis/simulate-ingest.asciidoc:56 - -[source, python] ----- -resp = client.simulate.ingest( - body={ - "docs": [ - { - "_index": "my-index", - "_id": "id", - "_source": { - "foo": "bar" - } - }, - { - "_index": "my-index", - "_id": "id", - "_source": { - "foo": "rab" - } - } - ], - "pipeline_substitutions": { - "my-pipeline": { - "processors": [ - { - "set": { - "field": "field3", - "value": "value3" - } - } - ] - } - } - }, -) -print(resp) ----- diff --git a/docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc b/docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc index 6685a274c..261211313 100644 --- a/docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc +++ b/docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// setup/advanced-configuration.asciidoc:124 +// setup/advanced-configuration.asciidoc:123 [source, python] ---- diff --git a/docs/examples/7cd3d8388c51a9f6ee3f730cdaddbb89.asciidoc b/docs/examples/7cd3d8388c51a9f6ee3f730cdaddbb89.asciidoc index 0bbe1f915..d872da8bc 100644 --- a/docs/examples/7cd3d8388c51a9f6ee3f730cdaddbb89.asciidoc +++ b/docs/examples/7cd3d8388c51a9f6ee3f730cdaddbb89.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/update-settings.asciidoc:91 +// indices/update-settings.asciidoc:97 [source, python] ---- diff --git a/docs/examples/f3574cfee3971d98417b8dc574a91be0.asciidoc b/docs/examples/7d3a74fe0ba3fe95d1c3275365ff9315.asciidoc similarity index 76% rename from docs/examples/f3574cfee3971d98417b8dc574a91be0.asciidoc rename to docs/examples/7d3a74fe0ba3fe95d1c3275365ff9315.asciidoc index 0d23bbd06..c812891e4 100644 --- a/docs/examples/f3574cfee3971d98417b8dc574a91be0.asciidoc +++ b/docs/examples/7d3a74fe0ba3fe95d1c3275365ff9315.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/flattened.asciidoc:367 +// mapping/types/flattened.asciidoc:374 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "flattened": { "type": "flattened" diff --git a/docs/examples/7d880157a95f64ad339225d4af71c2de.asciidoc b/docs/examples/7d880157a95f64ad339225d4af71c2de.asciidoc index da85d0ee3..ad48c8c12 100644 --- a/docs/examples/7d880157a95f64ad339225d4af71c2de.asciidoc +++ b/docs/examples/7d880157a95f64ad339225d4af71c2de.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/suggest-user-profile.asciidoc:99 +// rest-api/security/suggest-user-profile.asciidoc:105 [source, python] ---- diff --git a/docs/examples/7dabae9b37d2cbd724f2a069be9e753b.asciidoc b/docs/examples/7dabae9b37d2cbd724f2a069be9e753b.asciidoc index 0c8ed226f..46f020739 100644 --- a/docs/examples/7dabae9b37d2cbd724f2a069be9e753b.asciidoc +++ b/docs/examples/7dabae9b37d2cbd724f2a069be9e753b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/reset-job.asciidoc:73 +// ml/anomaly-detection/apis/reset-job.asciidoc:79 [source, python] ---- diff --git a/docs/examples/7daff6b7e668ab8a762b8ab5dff7a167.asciidoc b/docs/examples/7daff6b7e668ab8a762b8ab5dff7a167.asciidoc index 70e4049e8..75048641a 100644 --- a/docs/examples/7daff6b7e668ab8a762b8ab5dff7a167.asciidoc +++ b/docs/examples/7daff6b7e668ab8a762b8ab5dff7a167.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/sparse-vector-query.asciidoc:255 +// query-dsl/sparse-vector-query.asciidoc:260 [source, python] ---- diff --git a/docs/examples/7db09cab02d71f3a10d91071216d80fc.asciidoc b/docs/examples/7db09cab02d71f3a10d91071216d80fc.asciidoc new file mode 100644 index 000000000..cd720284a --- /dev/null +++ b/docs/examples/7db09cab02d71f3a10d91071216d80fc.asciidoc @@ -0,0 +1,27 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/ingest-vectors.asciidoc:108 + +[source, python] +---- +resp = client.search( + index="amazon-reviews", + retriever={ + "knn": { + "field": "review_vector", + "query_vector": [ + 0.1, + 0.2, + 0.3, + 0.4, + 0.5, + 0.6, + 0.7, + 0.8 + ], + "k": 2, + "num_candidates": 5 + } + }, +) +print(resp) +---- diff --git a/docs/examples/7db798942cf2d334456e30ef5fcb801b.asciidoc b/docs/examples/7db798942cf2d334456e30ef5fcb801b.asciidoc new file mode 100644 index 000000000..b91fa55a9 --- /dev/null +++ b/docs/examples/7db798942cf2d334456e30ef5fcb801b.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:161 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "match": { + "description": { + "query": "fluffy pancakes" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc b/docs/examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc new file mode 100644 index 000000000..4a8fcc25b --- /dev/null +++ b/docs/examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc @@ -0,0 +1,37 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:824 + +[source, python] +---- +resp = client.search( + index="kibana_sample_data_ecommerce", + size=0, + aggs={ + "daily_sales": { + "date_histogram": { + "field": "order_date", + "calendar_interval": "day", + "format": "yyyy-MM-dd" + }, + "aggs": { + "revenue": { + "sum": { + "field": "taxful_total_price" + } + }, + "unique_customers": { + "cardinality": { + "field": "customer_id" + } + }, + "avg_basket_size": { + "avg": { + "field": "total_quantity" + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/7de7e647c1c9cbe0a1df0d104fc0a947.asciidoc b/docs/examples/7de7e647c1c9cbe0a1df0d104fc0a947.asciidoc index 493a2bbd7..c5759f3ec 100644 --- a/docs/examples/7de7e647c1c9cbe0a1df0d104fc0a947.asciidoc +++ b/docs/examples/7de7e647c1c9cbe0a1df0d104fc0a947.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/repository-s3.asciidoc:20 +// snapshot-restore/repository-s3.asciidoc:23 [source, python] ---- diff --git a/docs/examples/7df191cc7f814e410a4ac7261065e6ef.asciidoc b/docs/examples/7df191cc7f814e410a4ac7261065e6ef.asciidoc index 6550ab9e4..9bc5dcb34 100644 --- a/docs/examples/7df191cc7f814e410a4ac7261065e6ef.asciidoc +++ b/docs/examples/7df191cc7f814e410a4ac7261065e6ef.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:468 +// docs/update-by-query.asciidoc:474 [source, python] ---- diff --git a/docs/examples/7e126e2751311db60cfcbb22c9c41caa.asciidoc b/docs/examples/7e126e2751311db60cfcbb22c9c41caa.asciidoc index 3a10e81ef..9a2fe5082 100644 --- a/docs/examples/7e126e2751311db60cfcbb22c9c41caa.asciidoc +++ b/docs/examples/7e126e2751311db60cfcbb22c9c41caa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/shards.asciidoc:386 +// cat/shards.asciidoc:395 [source, python] ---- diff --git a/docs/examples/7e484b8b41f9dbc2bcf1f340db197c1d.asciidoc b/docs/examples/7e484b8b41f9dbc2bcf1f340db197c1d.asciidoc index acbcbaafd..f75c537ad 100644 --- a/docs/examples/7e484b8b41f9dbc2bcf1f340db197c1d.asciidoc +++ b/docs/examples/7e484b8b41f9dbc2bcf1f340db197c1d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:25 +// docs/reindex.asciidoc:31 [source, python] ---- diff --git a/docs/examples/7e4cb3de3e3c75646b60f9f81ddc59cc.asciidoc b/docs/examples/7e4cb3de3e3c75646b60f9f81ddc59cc.asciidoc index f14130819..2d67112d4 100644 --- a/docs/examples/7e4cb3de3e3c75646b60f9f81ddc59cc.asciidoc +++ b/docs/examples/7e4cb3de3e3c75646b60f9f81ddc59cc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/clear-trained-model-deployment-cache.asciidoc:43 +// ml/trained-models/apis/clear-trained-model-deployment-cache.asciidoc:49 [source, python] ---- diff --git a/docs/examples/7e5faa551f2c95ffd627da352563d450.asciidoc b/docs/examples/7e5faa551f2c95ffd627da352563d450.asciidoc index 00324ab22..bb9c725f8 100644 --- a/docs/examples/7e5faa551f2c95ffd627da352563d450.asciidoc +++ b/docs/examples/7e5faa551f2c95ffd627da352563d450.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:269 +// rest-api/security/create-role-mappings.asciidoc:275 [source, python] ---- diff --git a/docs/examples/7e74d1a54e816e8f40cfdaa01b070788.asciidoc b/docs/examples/7e74d1a54e816e8f40cfdaa01b070788.asciidoc index fccbcf662..a2911efe7 100644 --- a/docs/examples/7e74d1a54e816e8f40cfdaa01b070788.asciidoc +++ b/docs/examples/7e74d1a54e816e8f40cfdaa01b070788.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rrf.asciidoc:244 +// search/rrf.asciidoc:250 [source, python] ---- diff --git a/docs/examples/7e77509ab646276ff78f58bb38bec8dd.asciidoc b/docs/examples/7e77509ab646276ff78f58bb38bec8dd.asciidoc index 9424c3552..03278ad8b 100644 --- a/docs/examples/7e77509ab646276ff78f58bb38bec8dd.asciidoc +++ b/docs/examples/7e77509ab646276ff78f58bb38bec8dd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-rules/apis/delete-query-ruleset.asciidoc:69 +// query-rules/apis/delete-query-ruleset.asciidoc:75 [source, python] ---- diff --git a/docs/examples/7ebeb6cf26be5b5ecdfd408bd0fc3215.asciidoc b/docs/examples/7ebeb6cf26be5b5ecdfd408bd0fc3215.asciidoc index 52fc6bcb5..cd921232c 100644 --- a/docs/examples/7ebeb6cf26be5b5ecdfd408bd0fc3215.asciidoc +++ b/docs/examples/7ebeb6cf26be5b5ecdfd408bd0fc3215.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/profile.asciidoc:1243 +// search/profile.asciidoc:1248 [source, python] ---- diff --git a/docs/examples/7ebfb30b3ece855c1b783d9210939469.asciidoc b/docs/examples/7ebfb30b3ece855c1b783d9210939469.asciidoc index 3b4263e19..c3f26825d 100644 --- a/docs/examples/7ebfb30b3ece855c1b783d9210939469.asciidoc +++ b/docs/examples/7ebfb30b3ece855c1b783d9210939469.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/flush-job.asciidoc:102 +// ml/anomaly-detection/apis/flush-job.asciidoc:108 [source, python] ---- diff --git a/docs/examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc b/docs/examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc new file mode 100644 index 000000000..a2b9f8e5c --- /dev/null +++ b/docs/examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc @@ -0,0 +1,34 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/processors/ip-location.asciidoc:188 + +[source, python] +---- +resp = client.ingest.put_pipeline( + id="ip_location", + description="Add ip geolocation info", + processors=[ + { + "ip_location": { + "field": "ip" + } + } + ], +) +print(resp) + +resp1 = client.index( + index="my-index-000001", + id="my_id", + pipeline="ip_location", + document={ + "ip": "80.231.5.0" + }, +) +print(resp1) + +resp2 = client.get( + index="my-index-000001", + id="my_id", +) +print(resp2) +---- diff --git a/docs/examples/7f2d511cb64743c006225e5933a14bb4.asciidoc b/docs/examples/7f2d511cb64743c006225e5933a14bb4.asciidoc index fd3323a81..60a3269ff 100644 --- a/docs/examples/7f2d511cb64743c006225e5933a14bb4.asciidoc +++ b/docs/examples/7f2d511cb64743c006225e5933a14bb4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-across-clusters.asciidoc:72 +// esql/esql-across-clusters.asciidoc:69 [source, python] ---- diff --git a/docs/examples/7f37031fb40b68a61255b7c71d7eed0b.asciidoc b/docs/examples/7f37031fb40b68a61255b7c71d7eed0b.asciidoc index 1bd88d1ea..451938e0c 100644 --- a/docs/examples/7f37031fb40b68a61255b7c71d7eed0b.asciidoc +++ b/docs/examples/7f37031fb40b68a61255b7c71d7eed0b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/execute-watch.asciidoc:299 +// rest-api/watcher/execute-watch.asciidoc:305 [source, python] ---- diff --git a/docs/examples/7f56755fb6c42f7e6203339a6d0cb6e6.asciidoc b/docs/examples/7f56755fb6c42f7e6203339a6d0cb6e6.asciidoc index 08132ba5d..18e25a546 100644 --- a/docs/examples/7f56755fb6c42f7e6203339a6d0cb6e6.asciidoc +++ b/docs/examples/7f56755fb6c42f7e6203339a6d0cb6e6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/match-query.asciidoc:279 +// query-dsl/match-query.asciidoc:283 [source, python] ---- diff --git a/docs/examples/7fb921376cbf66bf9f381bcdd62030ba.asciidoc b/docs/examples/7fb921376cbf66bf9f381bcdd62030ba.asciidoc index 9dd99bfbb..73cd9c68f 100644 --- a/docs/examples/7fb921376cbf66bf9f381bcdd62030ba.asciidoc +++ b/docs/examples/7fb921376cbf66bf9f381bcdd62030ba.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/apis/get-script-contexts-api.asciidoc:10 +// scripting/apis/get-script-contexts-api.asciidoc:16 [source, python] ---- diff --git a/docs/examples/7fd5883564d183603e60b37d286ac7e2.asciidoc b/docs/examples/7fd5883564d183603e60b37d286ac7e2.asciidoc index 924cb88d3..552dcecb9 100644 --- a/docs/examples/7fd5883564d183603e60b37d286ac7e2.asciidoc +++ b/docs/examples/7fd5883564d183603e60b37d286ac7e2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-expired-data.asciidoc:64 +// ml/anomaly-detection/apis/delete-expired-data.asciidoc:70 [source, python] ---- diff --git a/docs/examples/7fde3ff91c4a2e7080444af37d5cd287.asciidoc b/docs/examples/7fde3ff91c4a2e7080444af37d5cd287.asciidoc index 1e29997a4..649738ffe 100644 --- a/docs/examples/7fde3ff91c4a2e7080444af37d5cd287.asciidoc +++ b/docs/examples/7fde3ff91c4a2e7080444af37d5cd287.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-rest.asciidoc:286 +// esql/esql-rest.asciidoc:289 [source, python] ---- diff --git a/docs/examples/800861c15bb33ca01a46fb97dde7537a.asciidoc b/docs/examples/800861c15bb33ca01a46fb97dde7537a.asciidoc index 95fda5362..08a7b3942 100644 --- a/docs/examples/800861c15bb33ca01a46fb97dde7537a.asciidoc +++ b/docs/examples/800861c15bb33ca01a46fb97dde7537a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-filter.asciidoc:66 +// ml/anomaly-detection/apis/get-filter.asciidoc:72 [source, python] ---- diff --git a/docs/examples/f4d0ef2e0f76babee83d999fe35127f2.asciidoc b/docs/examples/80135e8c644e34cc70ce8a4e7915d1a2.asciidoc similarity index 89% rename from docs/examples/f4d0ef2e0f76babee83d999fe35127f2.asciidoc rename to docs/examples/80135e8c644e34cc70ce8a4e7915d1a2.asciidoc index 9a29988d0..888fe890e 100644 --- a/docs/examples/f4d0ef2e0f76babee83d999fe35127f2.asciidoc +++ b/docs/examples/80135e8c644e34cc70ce8a4e7915d1a2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/attachment.asciidoc:267 +// ingest/processors/attachment.asciidoc:315 [source, python] ---- @@ -12,7 +12,7 @@ resp = client.ingest.put_pipeline( "field": "data", "indexed_chars": 11, "indexed_chars_field": "max_size", - "remove_binary": False + "remove_binary": True } } ], diff --git a/docs/examples/8051766cadded0892290bc2cc06e145c.asciidoc b/docs/examples/8051766cadded0892290bc2cc06e145c.asciidoc index 289db73ae..dea7d94c0 100644 --- a/docs/examples/8051766cadded0892290bc2cc06e145c.asciidoc +++ b/docs/examples/8051766cadded0892290bc2cc06e145c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/ack-watch.asciidoc:245 +// rest-api/watcher/ack-watch.asciidoc:251 [source, python] ---- diff --git a/docs/examples/981b331db1404b39c1a612a135e4e76d.asciidoc b/docs/examples/8080cd9e24a8785728ce7c372ec4acf1.asciidoc similarity index 50% rename from docs/examples/981b331db1404b39c1a612a135e4e76d.asciidoc rename to docs/examples/8080cd9e24a8785728ce7c372ec4acf1.asciidoc index 6f3574e63..f6290d1e7 100644 --- a/docs/examples/981b331db1404b39c1a612a135e4e76d.asciidoc +++ b/docs/examples/8080cd9e24a8785728ce7c372ec4acf1.asciidoc @@ -1,17 +1,14 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/put-geoip-database.asciidoc:15 +// watcher/how-watcher-works.asciidoc:159 [source, python] ---- resp = client.perform_request( "PUT", - "/_ingest/geoip/database/my-database-id", + "/_watcher/settings", headers={"Content-Type": "application/json"}, body={ - "name": "GeoIP2-Domain", - "maxmind": { - "account_id": "1025402" - } + "index.routing.allocation.include.role": "watcher" }, ) print(resp) diff --git a/docs/examples/808f4db1e2361be77dd6816c1f818139.asciidoc b/docs/examples/808f4db1e2361be77dd6816c1f818139.asciidoc index da86a9850..675a184bc 100644 --- a/docs/examples/808f4db1e2361be77dd6816c1f818139.asciidoc +++ b/docs/examples/808f4db1e2361be77dd6816c1f818139.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shard-stores.asciidoc:13 +// indices/shard-stores.asciidoc:19 [source, python] ---- diff --git a/docs/examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc b/docs/examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc index 2f39bae89..6a24cfa16 100644 --- a/docs/examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc +++ b/docs/examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc @@ -1,39 +1,37 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-update-api-keys.asciidoc:176 +// rest-api/security/bulk-update-api-keys.asciidoc:182 [source, python] ---- resp = client.security.bulk_update_api_keys( - body={ - "ids": [ - "VuaCfGcBCdbkQm-e5aOx", - "H3_AhoIBA9hmeQJdg7ij" - ], - "role_descriptors": { - "role-a": { - "indices": [ - { - "names": [ - "*" - ], - "privileges": [ - "write" - ] - } - ] - } - }, - "metadata": { - "environment": { - "level": 2, - "trusted": True, - "tags": [ - "production" - ] - } - }, - "expiration": "30d" + ids=[ + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij" + ], + role_descriptors={ + "role-a": { + "indices": [ + { + "names": [ + "*" + ], + "privileges": [ + "write" + ] + } + ] + } }, + metadata={ + "environment": { + "level": 2, + "trusted": True, + "tags": [ + "production" + ] + } + }, + expiration="30d", ) print(resp) ---- diff --git a/docs/examples/80edd2124a822d9f9bf22ecc49d2c2e9.asciidoc b/docs/examples/80edd2124a822d9f9bf22ecc49d2c2e9.asciidoc index b9d0a1b4f..12c0a097e 100644 --- a/docs/examples/80edd2124a822d9f9bf22ecc49d2c2e9.asciidoc +++ b/docs/examples/80edd2124a822d9f9bf22ecc49d2c2e9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/get-synonym-rule.asciidoc:67 +// synonyms/apis/get-synonym-rule.asciidoc:72 [source, python] ---- diff --git a/docs/examples/8141b60ad245ece2ff5e8d0817400ee5.asciidoc b/docs/examples/8141b60ad245ece2ff5e8d0817400ee5.asciidoc index 1184d3f7f..b86225d86 100644 --- a/docs/examples/8141b60ad245ece2ff5e8d0817400ee5.asciidoc +++ b/docs/examples/8141b60ad245ece2ff5e8d0817400ee5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// eql/eql-search-api.asciidoc:631 +// eql/eql-search-api.asciidoc:684 [source, python] ---- diff --git a/docs/examples/8141cdaddbe7d794f09f9ee84e46194c.asciidoc b/docs/examples/8141cdaddbe7d794f09f9ee84e46194c.asciidoc index 3a3c00fb9..13fd6a661 100644 --- a/docs/examples/8141cdaddbe7d794f09f9ee84e46194c.asciidoc +++ b/docs/examples/8141cdaddbe7d794f09f9ee84e46194c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/count.asciidoc:67 +// cat/count.asciidoc:73 [source, python] ---- diff --git a/docs/examples/81612c2537386e031b7eb604f6756a71.asciidoc b/docs/examples/81612c2537386e031b7eb604f6756a71.asciidoc index 3f3cf6154..18f8a3bc8 100644 --- a/docs/examples/81612c2537386e031b7eb604f6756a71.asciidoc +++ b/docs/examples/81612c2537386e031b7eb604f6756a71.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/clone-index.asciidoc:117 +// indices/clone-index.asciidoc:123 [source, python] ---- diff --git a/docs/examples/81aad155ff23b1b396833b1182c9d46b.asciidoc b/docs/examples/81aad155ff23b1b396833b1182c9d46b.asciidoc index 99962351b..eb41e3131 100644 --- a/docs/examples/81aad155ff23b1b396833b1182c9d46b.asciidoc +++ b/docs/examples/81aad155ff23b1b396833b1182c9d46b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:31 +// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:35 [source, python] ---- diff --git a/docs/examples/821422f8a03dc98d024a15fc737fe9eb.asciidoc b/docs/examples/821422f8a03dc98d024a15fc737fe9eb.asciidoc index c6a34d582..c6c064054 100644 --- a/docs/examples/821422f8a03dc98d024a15fc737fe9eb.asciidoc +++ b/docs/examples/821422f8a03dc98d024a15fc737fe9eb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/delete-trained-models-aliases.asciidoc:51 +// ml/trained-models/apis/delete-trained-models-aliases.asciidoc:57 [source, python] ---- diff --git a/docs/examples/824fded1f9db28906ae7e85ae8de9bd0.asciidoc b/docs/examples/824fded1f9db28906ae7e85ae8de9bd0.asciidoc index 8492ee835..70cd4540b 100644 --- a/docs/examples/824fded1f9db28906ae7e85ae8de9bd0.asciidoc +++ b/docs/examples/824fded1f9db28906ae7e85ae8de9bd0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/post-resume-follow.asciidoc:84 +// ccr/apis/follow/post-resume-follow.asciidoc:90 [source, python] ---- diff --git a/docs/examples/827b7e9308ea288f18aea00a5accc38e.asciidoc b/docs/examples/827b7e9308ea288f18aea00a5accc38e.asciidoc index cc91ffc4d..fb48fb59b 100644 --- a/docs/examples/827b7e9308ea288f18aea00a5accc38e.asciidoc +++ b/docs/examples/827b7e9308ea288f18aea00a5accc38e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-component-template.asciidoc:40 +// indices/get-component-template.asciidoc:46 [source, python] ---- diff --git a/docs/examples/82844ef45e11c0eece100d3109db3182.asciidoc b/docs/examples/82844ef45e11c0eece100d3109db3182.asciidoc index 67b526d67..b601d54d0 100644 --- a/docs/examples/82844ef45e11c0eece100d3109db3182.asciidoc +++ b/docs/examples/82844ef45e11c0eece100d3109db3182.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-amazon-bedrock.asciidoc:154 +// inference/service-amazon-bedrock.asciidoc:180 [source, python] ---- diff --git a/docs/examples/828f0045747fde4888a947bb99e190e3.asciidoc b/docs/examples/828f0045747fde4888a947bb99e190e3.asciidoc new file mode 100644 index 000000000..b0c0af2a7 --- /dev/null +++ b/docs/examples/828f0045747fde4888a947bb99e190e3.asciidoc @@ -0,0 +1,29 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:837 + +[source, python] +---- +resp = client.search( + index="movies", + retriever={ + "rule": { + "match_criteria": { + "query_string": "harry potter" + }, + "ruleset_ids": [ + "my-ruleset" + ], + "retriever": { + "standard": { + "query": { + "query_string": { + "query": "harry potter" + } + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc b/docs/examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc new file mode 100644 index 000000000..8bbb6682c --- /dev/null +++ b/docs/examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc @@ -0,0 +1,32 @@ +// This file is autogenerated, DO NOT EDIT +// inference/chat-completion-inference.asciidoc:322 + +[source, python] +---- +resp = client.inference.stream_inference( + task_type="chat_completion", + inference_id="openai-completion", + messages=[ + { + "role": "assistant", + "content": "Let's find out what the weather is", + "tool_calls": [ + { + "id": "call_KcAjWtAww20AihPHphUh46Gd", + "type": "function", + "function": { + "name": "get_current_weather", + "arguments": "{\"location\":\"Boston, MA\"}" + } + } + ] + }, + { + "role": "tool", + "content": "The weather is cold", + "tool_call_id": "call_KcAjWtAww20AihPHphUh46Gd" + } + ], +) +print(resp) +---- diff --git a/docs/examples/82d6de3081de7b0664f44adf2942675a.asciidoc b/docs/examples/82d6de3081de7b0664f44adf2942675a.asciidoc index 74c43c0f7..b14f9ce36 100644 --- a/docs/examples/82d6de3081de7b0664f44adf2942675a.asciidoc +++ b/docs/examples/82d6de3081de7b0664f44adf2942675a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// behavioral-analytics/apis/list-analytics-collection.asciidoc:85 +// behavioral-analytics/apis/list-analytics-collection.asciidoc:91 [source, python] ---- diff --git a/docs/examples/8330b2ea6317769e52d0647ba434b354.asciidoc b/docs/examples/8330b2ea6317769e52d0647ba434b354.asciidoc index 6ee95743d..08a669440 100644 --- a/docs/examples/8330b2ea6317769e52d0647ba434b354.asciidoc +++ b/docs/examples/8330b2ea6317769e52d0647ba434b354.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/multi-get.asciidoc:262 +// docs/multi-get.asciidoc:268 [source, python] ---- diff --git a/docs/examples/8357aa6099089940589ae3e97e7bcffa.asciidoc b/docs/examples/8357aa6099089940589ae3e97e7bcffa.asciidoc index 0ae02fd4c..867b8527a 100644 --- a/docs/examples/8357aa6099089940589ae3e97e7bcffa.asciidoc +++ b/docs/examples/8357aa6099089940589ae3e97e7bcffa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/downsampling-ilm.asciidoc:381 +// data-streams/downsampling-dsl.asciidoc:362 [source, python] ---- diff --git a/docs/examples/838a4eabebba4c06100fb37dc30c7722.asciidoc b/docs/examples/838a4eabebba4c06100fb37dc30c7722.asciidoc index 07d36ca6b..4c2576b1a 100644 --- a/docs/examples/838a4eabebba4c06100fb37dc30c7722.asciidoc +++ b/docs/examples/838a4eabebba4c06100fb37dc30c7722.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-search.asciidoc:78 +// rollup/apis/rollup-search.asciidoc:84 [source, python] ---- diff --git a/docs/examples/839710129a165cf93c6e329abedf9089.asciidoc b/docs/examples/839710129a165cf93c6e329abedf9089.asciidoc index 393e65035..9bb354833 100644 --- a/docs/examples/839710129a165cf93c6e329abedf9089.asciidoc +++ b/docs/examples/839710129a165cf93c6e329abedf9089.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-cross-cluster-api-key.asciidoc:83 +// rest-api/security/update-cross-cluster-api-key.asciidoc:89 [source, python] ---- diff --git a/docs/examples/839a4b2930856790e34cc9dfeb983284.asciidoc b/docs/examples/839a4b2930856790e34cc9dfeb983284.asciidoc index bbb931afe..0e13d90e2 100644 --- a/docs/examples/839a4b2930856790e34cc9dfeb983284.asciidoc +++ b/docs/examples/839a4b2930856790e34cc9dfeb983284.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/downsampling.asciidoc:90 +// data-streams/downsampling.asciidoc:129 [source, python] ---- diff --git a/docs/examples/83b94f9e7b3a9abca8e165ea56927714.asciidoc b/docs/examples/83b94f9e7b3a9abca8e165ea56927714.asciidoc index 30cf5041e..b17d0c5b2 100644 --- a/docs/examples/83b94f9e7b3a9abca8e165ea56927714.asciidoc +++ b/docs/examples/83b94f9e7b3a9abca8e165ea56927714.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:380 +// indices/rollover-index.asciidoc:386 [source, python] ---- diff --git a/docs/examples/9aa2327ae315c39f2bce2bd22e0deb1b.asciidoc b/docs/examples/8417d8d35ec5fc5665dfb2f95d6d1101.asciidoc similarity index 92% rename from docs/examples/9aa2327ae315c39f2bce2bd22e0deb1b.asciidoc rename to docs/examples/8417d8d35ec5fc5665dfb2f95d6d1101.asciidoc index f342a73d5..b772d4988 100644 --- a/docs/examples/9aa2327ae315c39f2bce2bd22e0deb1b.asciidoc +++ b/docs/examples/8417d8d35ec5fc5665dfb2f95d6d1101.asciidoc @@ -17,7 +17,7 @@ resp = client.search( { "range": { "result.execution_time": { - "from": "now-10s" + "gte": "now-10s" } } } diff --git a/docs/examples/841d8b766902c8e3ae85c228a31383ac.asciidoc b/docs/examples/841d8b766902c8e3ae85c228a31383ac.asciidoc index 17e5ecf63..89b2d222d 100644 --- a/docs/examples/841d8b766902c8e3ae85c228a31383ac.asciidoc +++ b/docs/examples/841d8b766902c8e3ae85c228a31383ac.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// sql/apis/get-async-sql-search-status-api.asciidoc:12 +// sql/apis/get-async-sql-search-status-api.asciidoc:18 [source, python] ---- diff --git a/docs/examples/84237aa9da49ab4b4c4e2b21d2548df2.asciidoc b/docs/examples/84237aa9da49ab4b4c4e2b21d2548df2.asciidoc index 17a2d2fcc..a181069b1 100644 --- a/docs/examples/84237aa9da49ab4b4c4e2b21d2548df2.asciidoc +++ b/docs/examples/84237aa9da49ab4b4c4e2b21d2548df2.asciidoc @@ -1,11 +1,10 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/verify-repo-integrity-api.asciidoc:25 +// snapshot-restore/apis/verify-repo-integrity-api.asciidoc:31 [source, python] ---- -resp = client.snapshot.create( - repository="my_repository", - snapshot="_verify_integrity", +resp = client.snapshot.repository_verify_integrity( + name="my_repository", ) print(resp) ---- diff --git a/docs/examples/84243213614fe64930b1d430704afb29.asciidoc b/docs/examples/84243213614fe64930b1d430704afb29.asciidoc index 15574d907..ab64c7049 100644 --- a/docs/examples/84243213614fe64930b1d430704afb29.asciidoc +++ b/docs/examples/84243213614fe64930b1d430704afb29.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1016 +// mapping/runtime.asciidoc:1014 [source, python] ---- diff --git a/docs/examples/84465de841fe5c6099a0382f786f2cb8.asciidoc b/docs/examples/84465de841fe5c6099a0382f786f2cb8.asciidoc index e94fea979..733c7f6c0 100644 --- a/docs/examples/84465de841fe5c6099a0382f786f2cb8.asciidoc +++ b/docs/examples/84465de841fe5c6099a0382f786f2cb8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:74 +// alias.asciidoc:76 [source, python] ---- diff --git a/docs/examples/84c61160ca815e29e9973ba1380219dd.asciidoc b/docs/examples/84c61160ca815e29e9973ba1380219dd.asciidoc index 64f0af253..99b6078e2 100644 --- a/docs/examples/84c61160ca815e29e9973ba1380219dd.asciidoc +++ b/docs/examples/84c61160ca815e29e9973ba1380219dd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// searchable-snapshots/apis/shard-stats.asciidoc:73 +// searchable-snapshots/apis/shard-stats.asciidoc:79 [source, python] ---- diff --git a/docs/examples/84c69fb07050f0e89720007a6507a221.asciidoc b/docs/examples/84c69fb07050f0e89720007a6507a221.asciidoc index c46ae806d..0a74815fc 100644 --- a/docs/examples/84c69fb07050f0e89720007a6507a221.asciidoc +++ b/docs/examples/84c69fb07050f0e89720007a6507a221.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/high-cpu-usage.asciidoc:95 +// troubleshooting/common-issues/high-cpu-usage.asciidoc:118 [source, python] ---- diff --git a/docs/examples/84ef9fe951c6d3caa7438238a5b23319.asciidoc b/docs/examples/84ef9fe951c6d3caa7438238a5b23319.asciidoc new file mode 100644 index 000000000..0ece7ba7c --- /dev/null +++ b/docs/examples/84ef9fe951c6d3caa7438238a5b23319.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:487 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "term": { + "author.keyword": "Maria Rodriguez" + } + }, +) +print(resp) +---- diff --git a/docs/examples/853fc710cea79fb4e1a85fb6d149f9c5.asciidoc b/docs/examples/853fc710cea79fb4e1a85fb6d149f9c5.asciidoc new file mode 100644 index 000000000..12888ed06 --- /dev/null +++ b/docs/examples/853fc710cea79fb4e1a85fb6d149f9c5.asciidoc @@ -0,0 +1,44 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:876 + +[source, python] +---- +resp = client.search( + index="movies", + retriever={ + "rule": { + "match_criteria": { + "query_string": "harry potter" + }, + "ruleset_ids": [ + "my-ruleset" + ], + "retriever": { + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "query_string": { + "query": "sorcerer's stone" + } + } + } + }, + { + "standard": { + "query": { + "query_string": { + "query": "chamber of secrets" + } + } + } + } + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/8566f5ecf4ae14802ba63c8cc7c629f8.asciidoc b/docs/examples/8566f5ecf4ae14802ba63c8cc7c629f8.asciidoc index dfffb62b0..cf1c0fa6c 100644 --- a/docs/examples/8566f5ecf4ae14802ba63c8cc7c629f8.asciidoc +++ b/docs/examples/8566f5ecf4ae14802ba63c8cc7c629f8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/inference-api/infer-api-task.asciidoc:208 +// tab-widgets/inference-api/infer-api-task.asciidoc:216 [source, python] ---- diff --git a/docs/examples/8582e918a6275472d2eba2e95f1dbe77.asciidoc b/docs/examples/8582e918a6275472d2eba2e95f1dbe77.asciidoc index 1f744bb67..5f0baae9a 100644 --- a/docs/examples/8582e918a6275472d2eba2e95f1dbe77.asciidoc +++ b/docs/examples/8582e918a6275472d2eba2e95f1dbe77.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:61 +// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:65 [source, python] ---- diff --git a/docs/examples/85e2719d9fd6d2c2d47d28d39f2e3f7e.asciidoc b/docs/examples/85e2719d9fd6d2c2d47d28d39f2e3f7e.asciidoc index 385a7529e..3aab09fac 100644 --- a/docs/examples/85e2719d9fd6d2c2d47d28d39f2e3f7e.asciidoc +++ b/docs/examples/85e2719d9fd6d2c2d47d28d39f2e3f7e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// migration/apis/feature-migration.asciidoc:47 +// migration/apis/feature-migration.asciidoc:53 [source, python] ---- diff --git a/docs/examples/85f2839beeb71edb66988e5c82188be0.asciidoc b/docs/examples/85f2839beeb71edb66988e5c82188be0.asciidoc index 09bc916c5..c42c597e7 100644 --- a/docs/examples/85f2839beeb71edb66988e5c82188be0.asciidoc +++ b/docs/examples/85f2839beeb71edb66988e5c82188be0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// licensing/update-license.asciidoc:63 +// licensing/update-license.asciidoc:69 [source, python] ---- diff --git a/docs/examples/85f9fc6f98e8573efed9b034e853d5ae.asciidoc b/docs/examples/85f9fc6f98e8573efed9b034e853d5ae.asciidoc new file mode 100644 index 000000000..107825f54 --- /dev/null +++ b/docs/examples/85f9fc6f98e8573efed9b034e853d5ae.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-elasticsearch.asciidoc:289 + +[source, python] +---- +resp = client.inference.put( + task_type="sparse_embedding", + inference_id="use_existing_deployment", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "deployment_id": ".elser_model_2" + } + }, +) +print(resp) +---- diff --git a/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc b/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc index 57c7e9c05..d48245664 100644 --- a/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc +++ b/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-cohere.asciidoc:188 +// inference/service-cohere.asciidoc:214 [source, python] ---- diff --git a/docs/examples/861f5f61409dc87f3671293b87839ff7.asciidoc b/docs/examples/861f5f61409dc87f3671293b87839ff7.asciidoc index b5cbc6f3d..5993138ca 100644 --- a/docs/examples/861f5f61409dc87f3671293b87839ff7.asciidoc +++ b/docs/examples/861f5f61409dc87f3671293b87839ff7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/stats.asciidoc:1450 +// cluster/stats.asciidoc:1542 [source, python] ---- diff --git a/docs/examples/8621c05cc7cf3880bde751f6670a0c3a.asciidoc b/docs/examples/8621c05cc7cf3880bde751f6670a0c3a.asciidoc new file mode 100644 index 000000000..d4812b0ab --- /dev/null +++ b/docs/examples/8621c05cc7cf3880bde751f6670a0c3a.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:439 + +[source, python] +---- +resp = client.indices.put_settings( + index=".reindexed-v9-ml-anomalies-custom-example", + settings={ + "index": { + "number_of_replicas": 0 + } + }, +) +print(resp) +---- diff --git a/docs/examples/86280dcb49aa89083be4b2644daf1b7c.asciidoc b/docs/examples/86280dcb49aa89083be4b2644daf1b7c.asciidoc index 17ed48338..871123f58 100644 --- a/docs/examples/86280dcb49aa89083be4b2644daf1b7c.asciidoc +++ b/docs/examples/86280dcb49aa89083be4b2644daf1b7c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-job.asciidoc:234 +// ml/anomaly-detection/apis/get-job.asciidoc:240 [source, python] ---- diff --git a/docs/examples/8684589e31d96ab229e8c4feb4d704bb.asciidoc b/docs/examples/8684589e31d96ab229e8c4feb4d704bb.asciidoc index 56b0b8967..cac6bcbf9 100644 --- a/docs/examples/8684589e31d96ab229e8c4feb4d704bb.asciidoc +++ b/docs/examples/8684589e31d96ab229e8c4feb4d704bb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/enrich/get-enrich-policy.asciidoc:124 +// ingest/apis/enrich/get-enrich-policy.asciidoc:130 [source, python] ---- diff --git a/docs/examples/8699d35269a47ba867fa8cc766287413.asciidoc b/docs/examples/8699d35269a47ba867fa8cc766287413.asciidoc index 6606c3b1f..5ad7fc06e 100644 --- a/docs/examples/8699d35269a47ba867fa8cc766287413.asciidoc +++ b/docs/examples/8699d35269a47ba867fa8cc766287413.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// licensing/start-basic.asciidoc:42 +// licensing/start-basic.asciidoc:48 [source, python] ---- diff --git a/docs/examples/8739fad1fb2323950b673acf0c9f2ff5.asciidoc b/docs/examples/8739fad1fb2323950b673acf0c9f2ff5.asciidoc index 2a0845659..bc5186e11 100644 --- a/docs/examples/8739fad1fb2323950b673acf0c9f2ff5.asciidoc +++ b/docs/examples/8739fad1fb2323950b673acf0c9f2ff5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/open-close.asciidoc:120 +// indices/open-close.asciidoc:126 [source, python] ---- diff --git a/docs/examples/87416e6a1ca2da324dbed6deb05303eb.asciidoc b/docs/examples/87416e6a1ca2da324dbed6deb05303eb.asciidoc index 98b216fe6..3a6004b3e 100644 --- a/docs/examples/87416e6a1ca2da324dbed6deb05303eb.asciidoc +++ b/docs/examples/87416e6a1ca2da324dbed6deb05303eb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/count.asciidoc:105 +// search/count.asciidoc:112 [source, python] ---- diff --git a/docs/examples/87457bb3467484bec3e9df4e25942ba6.asciidoc b/docs/examples/87457bb3467484bec3e9df4e25942ba6.asciidoc index e2e6764d2..02f191745 100644 --- a/docs/examples/87457bb3467484bec3e9df4e25942ba6.asciidoc +++ b/docs/examples/87457bb3467484bec3e9df4e25942ba6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/multivalued-fields.asciidoc:225 +// esql/multivalued-fields.asciidoc:275 [source, python] ---- diff --git a/docs/examples/87469f8b7e9b965408479d276c3ce8aa.asciidoc b/docs/examples/87469f8b7e9b965408479d276c3ce8aa.asciidoc index fcd5ca517..7d6a699e2 100644 --- a/docs/examples/87469f8b7e9b965408479d276c3ce8aa.asciidoc +++ b/docs/examples/87469f8b7e9b965408479d276c3ce8aa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// behavioral-analytics/apis/list-analytics-collection.asciidoc:105 +// behavioral-analytics/apis/list-analytics-collection.asciidoc:111 [source, python] ---- diff --git a/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc b/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc index 1f2c7ceaa..58f99b552 100644 --- a/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc +++ b/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// health/health.asciidoc:473 +// health/health.asciidoc:479 [source, python] ---- diff --git a/docs/examples/87b0b496747ad6c1e4ab4b462128fa1c.asciidoc b/docs/examples/87b0b496747ad6c1e4ab4b462128fa1c.asciidoc index 15aa7398b..39ef07bad 100644 --- a/docs/examples/87b0b496747ad6c1e4ab4b462128fa1c.asciidoc +++ b/docs/examples/87b0b496747ad6c1e4ab4b462128fa1c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/nodeattrs.asciidoc:113 +// cat/nodeattrs.asciidoc:119 [source, python] ---- diff --git a/docs/examples/87c3e9963400a3e4b296ef8d1c86fae3.asciidoc b/docs/examples/87c3e9963400a3e4b296ef8d1c86fae3.asciidoc index 326753968..c582bf9a0 100644 --- a/docs/examples/87c3e9963400a3e4b296ef8d1c86fae3.asciidoc +++ b/docs/examples/87c3e9963400a3e4b296ef8d1c86fae3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-roles-cache.asciidoc:49 +// rest-api/security/clear-roles-cache.asciidoc:55 [source, python] ---- diff --git a/docs/examples/87c42ef733a50954e4d757fc0a08decc.asciidoc b/docs/examples/87c42ef733a50954e4d757fc0a08decc.asciidoc index 699f6f86e..a696167e8 100644 --- a/docs/examples/87c42ef733a50954e4d757fc0a08decc.asciidoc +++ b/docs/examples/87c42ef733a50954e4d757fc0a08decc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:255 +// rest-api/security/get-api-keys.asciidoc:261 [source, python] ---- diff --git a/docs/examples/88554b79dba8fd79991855a692b69ff9.asciidoc b/docs/examples/88554b79dba8fd79991855a692b69ff9.asciidoc index c96cce159..5b9b18135 100644 --- a/docs/examples/88554b79dba8fd79991855a692b69ff9.asciidoc +++ b/docs/examples/88554b79dba8fd79991855a692b69ff9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// graph/explore.asciidoc:309 +// graph/explore.asciidoc:315 [source, python] ---- diff --git a/docs/examples/88b19973b970adf9b73fca82017d4951.asciidoc b/docs/examples/88b19973b970adf9b73fca82017d4951.asciidoc index bb844e3be..9c389814b 100644 --- a/docs/examples/88b19973b970adf9b73fca82017d4951.asciidoc +++ b/docs/examples/88b19973b970adf9b73fca82017d4951.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/search-multiple-indices.asciidoc:30 +// search/search-your-data/search-multiple-indices.asciidoc:36 [source, python] ---- diff --git a/docs/examples/88cecae3f0363fc186d955dd8616b5d4.asciidoc b/docs/examples/88cecae3f0363fc186d955dd8616b5d4.asciidoc index 8910550de..293270942 100644 --- a/docs/examples/88cecae3f0363fc186d955dd8616b5d4.asciidoc +++ b/docs/examples/88cecae3f0363fc186d955dd8616b5d4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// eql/get-async-eql-status-api.asciidoc:83 +// eql/get-async-eql-status-api.asciidoc:90 [source, python] ---- diff --git a/docs/examples/88cf60d3310a56d8ae12704abc05b565.asciidoc b/docs/examples/88cf60d3310a56d8ae12704abc05b565.asciidoc index ce84bd692..e2a7fb005 100644 --- a/docs/examples/88cf60d3310a56d8ae12704abc05b565.asciidoc +++ b/docs/examples/88cf60d3310a56d8ae12704abc05b565.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// licensing/get-trial-status.asciidoc:40 +// licensing/get-trial-status.asciidoc:46 [source, python] ---- diff --git a/docs/examples/113ac8466084ee6ac4ed272e342dc468.asciidoc b/docs/examples/894fce12d8f0d01e4c4083885a0c0077.asciidoc similarity index 86% rename from docs/examples/113ac8466084ee6ac4ed272e342dc468.asciidoc rename to docs/examples/894fce12d8f0d01e4c4083885a0c0077.asciidoc index dde6989d5..2b80551c1 100644 --- a/docs/examples/113ac8466084ee6ac4ed272e342dc468.asciidoc +++ b/docs/examples/894fce12d8f0d01e4c4083885a0c0077.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "mistral-embeddings", - "pipeline": "mistral_embeddings" + "pipeline": "mistral_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/89b72dd7f747f6297c2b089e8bc807be.asciidoc b/docs/examples/89b72dd7f747f6297c2b089e8bc807be.asciidoc index 4b43638cc..e5818f9d3 100644 --- a/docs/examples/89b72dd7f747f6297c2b089e8bc807be.asciidoc +++ b/docs/examples/89b72dd7f747f6297c2b089e8bc807be.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/put-repo-api.asciidoc:10 +// snapshot-restore/apis/put-repo-api.asciidoc:16 [source, python] ---- diff --git a/docs/examples/89d2a3748dc14c6d5d4c6f94b9b03938.asciidoc b/docs/examples/89d2a3748dc14c6d5d4c6f94b9b03938.asciidoc index 53f24fc7b..fe773300a 100644 --- a/docs/examples/89d2a3748dc14c6d5d4c6f94b9b03938.asciidoc +++ b/docs/examples/89d2a3748dc14c6d5d4c6f94b9b03938.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/split-index.asciidoc:44 +// indices/split-index.asciidoc:50 [source, python] ---- diff --git a/docs/examples/89f547649895176c246bb8c41313ff21.asciidoc b/docs/examples/89f547649895176c246bb8c41313ff21.asciidoc new file mode 100644 index 000000000..58b50c14d --- /dev/null +++ b/docs/examples/89f547649895176c246bb8c41313ff21.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// esql/esql-syntax.asciidoc:202 + +[source, python] +---- +resp = client.esql.query( + query="\nFROM library\n| EVAL year = DATE_EXTRACT(\"year\", release_date)\n| WHERE page_count > ? AND match(author, ?, {\"minimum_should_match\": ?})\n| LIMIT 5\n", + params=[ + 300, + "Frank Herbert", + 2 + ], +) +print(resp) +---- diff --git a/docs/examples/89f8eac24f3ec6a7668d580aaf0eeefa.asciidoc b/docs/examples/89f8eac24f3ec6a7668d580aaf0eeefa.asciidoc index d608db517..ae121d5b9 100644 --- a/docs/examples/89f8eac24f3ec6a7668d580aaf0eeefa.asciidoc +++ b/docs/examples/89f8eac24f3ec6a7668d580aaf0eeefa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:286 +// indices/analyze.asciidoc:292 [source, python] ---- diff --git a/docs/examples/8a0b5f759de3f27f0801c1176e616117.asciidoc b/docs/examples/8a0b5f759de3f27f0801c1176e616117.asciidoc new file mode 100644 index 000000000..4a66835cb --- /dev/null +++ b/docs/examples/8a0b5f759de3f27f0801c1176e616117.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/semantic-search-semantic-text.asciidoc:36 + +[source, python] +---- +resp = client.indices.create( + index="semantic-embeddings", + mappings={ + "properties": { + "content": { + "type": "semantic_text" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/8a12cd824404d74f098d854716a26899.asciidoc b/docs/examples/8a12cd824404d74f098d854716a26899.asciidoc index b8edf1b62..a97fdd91e 100644 --- a/docs/examples/8a12cd824404d74f098d854716a26899.asciidoc +++ b/docs/examples/8a12cd824404d74f098d854716a26899.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-datafeed.asciidoc:43 +// ml/anomaly-detection/apis/delete-datafeed.asciidoc:49 [source, python] ---- diff --git a/docs/examples/8a1b6eae4893c5dd27b3d81fd8d70f5b.asciidoc b/docs/examples/8a1b6eae4893c5dd27b3d81fd8d70f5b.asciidoc index f670391bd..c46aba59b 100644 --- a/docs/examples/8a1b6eae4893c5dd27b3d81fd8d70f5b.asciidoc +++ b/docs/examples/8a1b6eae4893c5dd27b3d81fd8d70f5b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-inference.asciidoc:89 +// migration/migrate_9_0.asciidoc:467 [source, python] ---- diff --git a/docs/examples/8a1f6cffa653800282c0ae160ee375bc.asciidoc b/docs/examples/8a1f6cffa653800282c0ae160ee375bc.asciidoc index e9aae2f90..5c195ab8f 100644 --- a/docs/examples/8a1f6cffa653800282c0ae160ee375bc.asciidoc +++ b/docs/examples/8a1f6cffa653800282c0ae160ee375bc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:155 +// docs/update.asciidoc:161 [source, python] ---- diff --git a/docs/examples/8aa17bd25a3f2d634e5253b4b72fec4c.asciidoc b/docs/examples/8aa17bd25a3f2d634e5253b4b72fec4c.asciidoc index d6e4a61fb..750d1778b 100644 --- a/docs/examples/8aa17bd25a3f2d634e5253b4b72fec4c.asciidoc +++ b/docs/examples/8aa17bd25a3f2d634e5253b4b72fec4c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/explain-dfanalytics.asciidoc:120 +// ml/df-analytics/apis/explain-dfanalytics.asciidoc:126 [source, python] ---- diff --git a/docs/examples/8b144b3eb20872595fd7cbc6c245c7c8.asciidoc b/docs/examples/8b144b3eb20872595fd7cbc6c245c7c8.asciidoc deleted file mode 100644 index fcb54f662..000000000 --- a/docs/examples/8b144b3eb20872595fd7cbc6c245c7c8.asciidoc +++ /dev/null @@ -1,12 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// rest-api/security/query-role.asciidoc:127 - -[source, python] ----- -resp = client.security.query_role( - sort=[ - "name" - ], -) -print(resp) ----- diff --git a/docs/examples/8b301122cbf42be6eafeda714a36559e.asciidoc b/docs/examples/8b301122cbf42be6eafeda714a36559e.asciidoc index 5d3c43e24..f1161a356 100644 --- a/docs/examples/8b301122cbf42be6eafeda714a36559e.asciidoc +++ b/docs/examples/8b301122cbf42be6eafeda714a36559e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/logstash/put-pipeline.asciidoc:74 +// rest-api/logstash/put-pipeline.asciidoc:80 [source, python] ---- diff --git a/docs/examples/8b3a94495127efd9d56b2cd7f3eecdca.asciidoc b/docs/examples/8b3a94495127efd9d56b2cd7f3eecdca.asciidoc index 2d6c0a251..8e1b601bc 100644 --- a/docs/examples/8b3a94495127efd9d56b2cd7f3eecdca.asciidoc +++ b/docs/examples/8b3a94495127efd9d56b2cd7f3eecdca.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-role-mappings.asciidoc:64 +// rest-api/security/get-role-mappings.asciidoc:70 [source, python] ---- diff --git a/docs/examples/8b8b6aac2111b2d8b93758ac737e6543.asciidoc b/docs/examples/8b8b6aac2111b2d8b93758ac737e6543.asciidoc new file mode 100644 index 000000000..31bfc8362 --- /dev/null +++ b/docs/examples/8b8b6aac2111b2d8b93758ac737e6543.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/fields/synthetic-source.asciidoc:224 + +[source, python] +---- +resp = client.indices.create( + index="idx_keep", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, + mappings={ + "properties": { + "path": { + "type": "object", + "synthetic_source_keep": "all" + }, + "ids": { + "type": "integer", + "synthetic_source_keep": "arrays" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/8bf1e7a6d529547906ba8b1d6501fa0c.asciidoc b/docs/examples/8bf1e7a6d529547906ba8b1d6501fa0c.asciidoc index 74dc43129..0770bb31a 100644 --- a/docs/examples/8bf1e7a6d529547906ba8b1d6501fa0c.asciidoc +++ b/docs/examples/8bf1e7a6d529547906ba8b1d6501fa0c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/set-connector-sync-job-error-api.asciidoc:56 +// connector/apis/set-connector-sync-job-error-api.asciidoc:63 [source, python] ---- diff --git a/docs/examples/8c47c80139f40f25db44f5781ca2dfbe.asciidoc b/docs/examples/8c47c80139f40f25db44f5781ca2dfbe.asciidoc new file mode 100644 index 000000000..8503017e7 --- /dev/null +++ b/docs/examples/8c47c80139f40f25db44f5781ca2dfbe.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:491 + +[source, python] +---- +resp = client.indices.get_alias( + index=".ml-anomalies-custom-example", +) +print(resp) +---- diff --git a/docs/examples/8c5d48252cd6d1ee26a2bb817f89c78e.asciidoc b/docs/examples/8c5d48252cd6d1ee26a2bb817f89c78e.asciidoc index 63cd82aaa..9be0798d3 100644 --- a/docs/examples/8c5d48252cd6d1ee26a2bb817f89c78e.asciidoc +++ b/docs/examples/8c5d48252cd6d1ee26a2bb817f89c78e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-filter.asciidoc:40 +// ml/anomaly-detection/apis/delete-filter.asciidoc:46 [source, python] ---- diff --git a/docs/examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc b/docs/examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc new file mode 100644 index 000000000..124e138f6 --- /dev/null +++ b/docs/examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc @@ -0,0 +1,39 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:738 + +[source, python] +---- +resp = client.search( + index="kibana_sample_data_ecommerce", + size=0, + aggs={ + "categories": { + "terms": { + "field": "category.keyword", + "size": 5, + "order": { + "total_revenue": "desc" + } + }, + "aggs": { + "total_revenue": { + "sum": { + "field": "taxful_total_price" + } + }, + "avg_order_value": { + "avg": { + "field": "taxful_total_price" + } + }, + "total_items": { + "sum": { + "field": "total_quantity" + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/8c6f3bb8abae9ff1d21e776f16ad1c86.asciidoc b/docs/examples/8c6f3bb8abae9ff1d21e776f16ad1c86.asciidoc index 592b9e8bf..95ffe4194 100644 --- a/docs/examples/8c6f3bb8abae9ff1d21e776f16ad1c86.asciidoc +++ b/docs/examples/8c6f3bb8abae9ff1d21e776f16ad1c86.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/put-dfanalytics.asciidoc:574 +// ml/df-analytics/apis/put-dfanalytics.asciidoc:580 [source, python] ---- diff --git a/docs/examples/8c9081dc738d1290fd76071b283fcaec.asciidoc b/docs/examples/8c9081dc738d1290fd76071b283fcaec.asciidoc index bb9df6b30..b062fd8f1 100644 --- a/docs/examples/8c9081dc738d1290fd76071b283fcaec.asciidoc +++ b/docs/examples/8c9081dc738d1290fd76071b283fcaec.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:92 +// docs/get.asciidoc:98 [source, python] ---- diff --git a/docs/examples/8c92c5e87facbae8dc4f58376ec21815.asciidoc b/docs/examples/8c92c5e87facbae8dc4f58376ec21815.asciidoc index 1d0d3cbd6..144aad3e1 100644 --- a/docs/examples/8c92c5e87facbae8dc4f58376ec21815.asciidoc +++ b/docs/examples/8c92c5e87facbae8dc4f58376ec21815.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1040 +// mapping/runtime.asciidoc:1038 [source, python] ---- diff --git a/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc b/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc index 7140c60f2..68ae5624a 100644 --- a/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc +++ b/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/bulk.asciidoc:610 +// docs/bulk.asciidoc:620 [source, python] ---- diff --git a/docs/examples/8d05862be1f9e7edaba162b1888b5677.asciidoc b/docs/examples/8d05862be1f9e7edaba162b1888b5677.asciidoc new file mode 100644 index 000000000..0433809f5 --- /dev/null +++ b/docs/examples/8d05862be1f9e7edaba162b1888b5677.asciidoc @@ -0,0 +1,61 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:50 + +[source, python] +---- +resp = client.indices.put_mapping( + index="cooking_blog", + properties={ + "title": { + "type": "text", + "analyzer": "standard", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + }, + "description": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword" + } + } + }, + "author": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword" + } + } + }, + "date": { + "type": "date", + "format": "yyyy-MM-dd" + }, + "category": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword" + } + } + }, + "tags": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword" + } + } + }, + "rating": { + "type": "float" + } + }, +) +print(resp) +---- diff --git a/docs/examples/8d4dda5d988d568f4f4210a6387e026f.asciidoc b/docs/examples/8d4dda5d988d568f4f4210a6387e026f.asciidoc index dcfbb881e..60df33f6c 100644 --- a/docs/examples/8d4dda5d988d568f4f4210a6387e026f.asciidoc +++ b/docs/examples/8d4dda5d988d568f4f4210a6387e026f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/saml-logout-api.asciidoc:66 +// rest-api/security/saml-logout-api.asciidoc:72 [source, python] ---- diff --git a/docs/examples/8d9b04f2a97f4229dec9e620126de049.asciidoc b/docs/examples/8d9b04f2a97f4229dec9e620126de049.asciidoc index 846594fa0..fdcc89bdb 100644 --- a/docs/examples/8d9b04f2a97f4229dec9e620126de049.asciidoc +++ b/docs/examples/8d9b04f2a97f4229dec9e620126de049.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/repository-s3.asciidoc:580 +// snapshot-restore/repository-s3.asciidoc:609 [source, python] ---- diff --git a/docs/examples/8de6fed6ba2b94ce6a12ce076be2b4d7.asciidoc b/docs/examples/8de6fed6ba2b94ce6a12ce076be2b4d7.asciidoc index 98d0c6ac7..13ad215ea 100644 --- a/docs/examples/8de6fed6ba2b94ce6a12ce076be2b4d7.asciidoc +++ b/docs/examples/8de6fed6ba2b94ce6a12ce076be2b4d7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/segments.asciidoc:127 +// cat/segments.asciidoc:132 [source, python] ---- diff --git a/docs/examples/8e208098a0156c4c92afe0a06960b230.asciidoc b/docs/examples/8e208098a0156c4c92afe0a06960b230.asciidoc index defa6892f..65f5e3558 100644 --- a/docs/examples/8e208098a0156c4c92afe0a06960b230.asciidoc +++ b/docs/examples/8e208098a0156c4c92afe0a06960b230.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/saml-authenticate-api.asciidoc:83 +// rest-api/security/saml-authenticate-api.asciidoc:89 [source, python] ---- diff --git a/docs/examples/8e2bbef535fef688d397e60e09aefa7f.asciidoc b/docs/examples/8e2bbef535fef688d397e60e09aefa7f.asciidoc index b6b5fa22c..d240a9f5e 100644 --- a/docs/examples/8e2bbef535fef688d397e60e09aefa7f.asciidoc +++ b/docs/examples/8e2bbef535fef688d397e60e09aefa7f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/hotspotting.asciidoc:200 +// troubleshooting/common-issues/hotspotting.asciidoc:206 [source, python] ---- diff --git a/docs/examples/8e43bb5b7946143e69d397bb81d87df0.asciidoc b/docs/examples/8e43bb5b7946143e69d397bb81d87df0.asciidoc index db3591bdb..702b5f448 100644 --- a/docs/examples/8e43bb5b7946143e69d397bb81d87df0.asciidoc +++ b/docs/examples/8e43bb5b7946143e69d397bb81d87df0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/get-follow-stats.asciidoc:219 +// ccr/apis/follow/get-follow-stats.asciidoc:225 [source, python] ---- diff --git a/docs/examples/8e89fee0be6a436c4e3d7c152659c47e.asciidoc b/docs/examples/8e89fee0be6a436c4e3d7c152659c47e.asciidoc index 5d065d20d..d8069a2de 100644 --- a/docs/examples/8e89fee0be6a436c4e3d7c152659c47e.asciidoc +++ b/docs/examples/8e89fee0be6a436c4e3d7c152659c47e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-scheduling-api.asciidoc:89 +// connector/apis/update-connector-scheduling-api.asciidoc:96 [source, python] ---- diff --git a/docs/examples/8e9e7dc5fad2b2b8e74ab4dc225d9c53.asciidoc b/docs/examples/8e9e7dc5fad2b2b8e74ab4dc225d9c53.asciidoc index d6d14075f..f2e57ee11 100644 --- a/docs/examples/8e9e7dc5fad2b2b8e74ab4dc225d9c53.asciidoc +++ b/docs/examples/8e9e7dc5fad2b2b8e74ab4dc225d9c53.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/common/apis/set-upgrade-mode.asciidoc:96 +// ml/common/apis/set-upgrade-mode.asciidoc:102 [source, python] ---- diff --git a/docs/examples/8f4a7f68f2ca3698abdf20026a2d8c5f.asciidoc b/docs/examples/8f4a7f68f2ca3698abdf20026a2d8c5f.asciidoc index 3567b8751..c292f8323 100644 --- a/docs/examples/8f4a7f68f2ca3698abdf20026a2d8c5f.asciidoc +++ b/docs/examples/8f4a7f68f2ca3698abdf20026a2d8c5f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:153 +// troubleshooting/common-issues/high-cpu-usage.asciidoc:81 [source, python] ---- diff --git a/docs/examples/90083d93e46fad2524755b8d4d1306fc.asciidoc b/docs/examples/90083d93e46fad2524755b8d4d1306fc.asciidoc index f2fd9f349..9a88ab0c4 100644 --- a/docs/examples/90083d93e46fad2524755b8d4d1306fc.asciidoc +++ b/docs/examples/90083d93e46fad2524755b8d4d1306fc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/set-connector-sync-job-stats-api.asciidoc:74 +// connector/apis/set-connector-sync-job-stats-api.asciidoc:81 [source, python] ---- diff --git a/docs/examples/9054187cbab5c9e1c4ca2a4dba6a5db0.asciidoc b/docs/examples/9054187cbab5c9e1c4ca2a4dba6a5db0.asciidoc index d6939a443..d0e29e412 100644 --- a/docs/examples/9054187cbab5c9e1c4ca2a4dba6a5db0.asciidoc +++ b/docs/examples/9054187cbab5c9e1c4ca2a4dba6a5db0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/info.asciidoc:51 +// rest-api/info.asciidoc:57 [source, python] ---- diff --git a/docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc b/docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc index a4049b5aa..f98a2eab2 100644 --- a/docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc +++ b/docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/indices/request_cache.asciidoc:146 +// shard-request-cache.asciidoc:132 [source, python] ---- diff --git a/docs/examples/90c087560ea6c0b7405f710971c86ef0.asciidoc b/docs/examples/90c087560ea6c0b7405f710971c86ef0.asciidoc index f582f5f81..ce7afe167 100644 --- a/docs/examples/90c087560ea6c0b7405f710971c86ef0.asciidoc +++ b/docs/examples/90c087560ea6c0b7405f710971c86ef0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/put-auto-follow-pattern.asciidoc:113 +// ccr/apis/auto-follow/put-auto-follow-pattern.asciidoc:119 [source, python] ---- diff --git a/docs/examples/90e06d5ec5e454832d8fbd2e73ec2248.asciidoc b/docs/examples/90e06d5ec5e454832d8fbd2e73ec2248.asciidoc index f7a08a261..8799359cf 100644 --- a/docs/examples/90e06d5ec5e454832d8fbd2e73ec2248.asciidoc +++ b/docs/examples/90e06d5ec5e454832d8fbd2e73ec2248.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/delete-autoscaling-policy.asciidoc:79 +// autoscaling/apis/delete-autoscaling-policy.asciidoc:85 [source, python] ---- diff --git a/docs/examples/9116ee8a5b00cc877291ed5559563f24.asciidoc b/docs/examples/9116ee8a5b00cc877291ed5559563f24.asciidoc index 0259220c5..283bb7417 100644 --- a/docs/examples/9116ee8a5b00cc877291ed5559563f24.asciidoc +++ b/docs/examples/9116ee8a5b00cc877291ed5559563f24.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/ack-watch.asciidoc:62 +// rest-api/watcher/ack-watch.asciidoc:68 [source, python] ---- diff --git a/docs/examples/9129dec88d35571b3166c6677297f03b.asciidoc b/docs/examples/9129dec88d35571b3166c6677297f03b.asciidoc index bf613cbd6..7a1da47bb 100644 --- a/docs/examples/9129dec88d35571b3166c6677297f03b.asciidoc +++ b/docs/examples/9129dec88d35571b3166c6677297f03b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/get-transform.asciidoc:109 +// transform/apis/get-transform.asciidoc:115 [source, python] ---- diff --git a/docs/examples/9138550002cb26ab64918cce427963b8.asciidoc b/docs/examples/9138550002cb26ab64918cce427963b8.asciidoc index ce568686c..166525f22 100644 --- a/docs/examples/9138550002cb26ab64918cce427963b8.asciidoc +++ b/docs/examples/9138550002cb26ab64918cce427963b8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template.asciidoc:268 +// indices/put-index-template.asciidoc:277 [source, python] ---- diff --git a/docs/examples/9143be4f137574271953a7a8107e175b.asciidoc b/docs/examples/9143be4f137574271953a7a8107e175b.asciidoc index 56b693906..2bbfd3079 100644 --- a/docs/examples/9143be4f137574271953a7a8107e175b.asciidoc +++ b/docs/examples/9143be4f137574271953a7a8107e175b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-user-profile.asciidoc:63 +// rest-api/security/get-user-profile.asciidoc:69 [source, python] ---- diff --git a/docs/examples/9169d19a80175ec94f80865d0f9bef4c.asciidoc b/docs/examples/9169d19a80175ec94f80865d0f9bef4c.asciidoc new file mode 100644 index 000000000..850788ba4 --- /dev/null +++ b/docs/examples/9169d19a80175ec94f80865d0f9bef4c.asciidoc @@ -0,0 +1,43 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:314 + +[source, python] +---- +resp = client.search( + index="restaurants", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "multi_match": { + "query": "Austria", + "fields": [ + "city", + "region" + ] + } + } + } + }, + { + "knn": { + "field": "vector", + "query_vector": [ + 10, + 22, + 77 + ], + "k": 10, + "num_candidates": 10 + } + } + ], + "rank_constant": 1, + "rank_window_size": 50 + } + }, +) +print(resp) +---- diff --git a/docs/examples/91c01fcad9bf341d039a15dfc593dcd7.asciidoc b/docs/examples/91c01fcad9bf341d039a15dfc593dcd7.asciidoc index cbbebebab..8f764f138 100644 --- a/docs/examples/91c01fcad9bf341d039a15dfc593dcd7.asciidoc +++ b/docs/examples/91c01fcad9bf341d039a15dfc593dcd7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/field-caps.asciidoc:305 +// search/field-caps.asciidoc:310 [source, python] ---- diff --git a/docs/examples/91c925fc71abe0ddfe52457e9130363b.asciidoc b/docs/examples/91c925fc71abe0ddfe52457e9130363b.asciidoc index 6673f2caa..1a1361ffc 100644 --- a/docs/examples/91c925fc71abe0ddfe52457e9130363b.asciidoc +++ b/docs/examples/91c925fc71abe0ddfe52457e9130363b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/grant-api-keys.asciidoc:172 +// rest-api/security/grant-api-keys.asciidoc:178 [source, python] ---- diff --git a/docs/examples/91e106a2affbc8df32cd940684a779ed.asciidoc b/docs/examples/91e106a2affbc8df32cd940684a779ed.asciidoc new file mode 100644 index 000000000..fa050f564 --- /dev/null +++ b/docs/examples/91e106a2affbc8df32cd940684a779ed.asciidoc @@ -0,0 +1,16 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/apis/put-ip-location-database.asciidoc:22 + +[source, python] +---- +resp = client.ingest.put_ip_location_database( + id="my-database-1", + configuration={ + "name": "GeoIP2-Domain", + "maxmind": { + "account_id": "1234567" + } + }, +) +print(resp) +---- diff --git a/docs/examples/9200ed8d5f798a158def4c526e41269e.asciidoc b/docs/examples/9200ed8d5f798a158def4c526e41269e.asciidoc index 935b9089d..4514ba050 100644 --- a/docs/examples/9200ed8d5f798a158def4c526e41269e.asciidoc +++ b/docs/examples/9200ed8d5f798a158def4c526e41269e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/field-caps.asciidoc:186 +// search/field-caps.asciidoc:191 [source, python] ---- diff --git a/docs/examples/9225841fdcddaf83ebdb90c2b0399e20.asciidoc b/docs/examples/9225841fdcddaf83ebdb90c2b0399e20.asciidoc index e2f8526f9..51ebb8041 100644 --- a/docs/examples/9225841fdcddaf83ebdb90c2b0399e20.asciidoc +++ b/docs/examples/9225841fdcddaf83ebdb90c2b0399e20.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/get-trained-models-stats.asciidoc:405 +// ml/trained-models/apis/get-trained-models-stats.asciidoc:412 [source, python] ---- diff --git a/docs/examples/9250ac57ec81d5192e8ad4c462438489.asciidoc b/docs/examples/9250ac57ec81d5192e8ad4c462438489.asciidoc new file mode 100644 index 000000000..192a0dcf3 --- /dev/null +++ b/docs/examples/9250ac57ec81d5192e8ad4c462438489.asciidoc @@ -0,0 +1,39 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-jinaai.asciidoc:204 + +[source, python] +---- +resp = client.bulk( + index="jinaai-index", + operations=[ + { + "index": { + "_index": "jinaai-index", + "_id": "1" + } + }, + { + "content": "Sarah Johnson is a talented marine biologist working at the Oceanographic Institute. Her groundbreaking research on coral reef ecosystems has garnered international attention and numerous accolades." + }, + { + "index": { + "_index": "jinaai-index", + "_id": "2" + } + }, + { + "content": "She spends months at a time diving in remote locations, meticulously documenting the intricate relationships between various marine species. " + }, + { + "index": { + "_index": "jinaai-index", + "_id": "3" + } + }, + { + "content": "Her dedication to preserving these delicate underwater environments has inspired a new generation of conservationists." + } + ], +) +print(resp) +---- diff --git a/docs/examples/926c0134aeaad53bd0f3bdad9c430217.asciidoc b/docs/examples/926c0134aeaad53bd0f3bdad9c430217.asciidoc index 8eed56f99..b40547250 100644 --- a/docs/examples/926c0134aeaad53bd0f3bdad9c430217.asciidoc +++ b/docs/examples/926c0134aeaad53bd0f3bdad9c430217.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:763 +// docs/reindex.asciidoc:769 [source, python] ---- diff --git a/docs/examples/9270964d35d172ea5b193c5fc7a473dd.asciidoc b/docs/examples/9270964d35d172ea5b193c5fc7a473dd.asciidoc index b95bb8eaa..96a0d9589 100644 --- a/docs/examples/9270964d35d172ea5b193c5fc7a473dd.asciidoc +++ b/docs/examples/9270964d35d172ea5b193c5fc7a473dd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/templates.asciidoc:61 +// cat/templates.asciidoc:67 [source, python] ---- diff --git a/docs/examples/927b20a221f975b75d1227b67d0eb7e2.asciidoc b/docs/examples/927b20a221f975b75d1227b67d0eb7e2.asciidoc index 5c64ffb1a..5ba6e11be 100644 --- a/docs/examples/927b20a221f975b75d1227b67d0eb7e2.asciidoc +++ b/docs/examples/927b20a221f975b75d1227b67d0eb7e2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-rest.asciidoc:265 +// esql/esql-rest.asciidoc:268 [source, python] ---- diff --git a/docs/examples/9298aaf8232a819e79b3bf8471245e98.asciidoc b/docs/examples/9298aaf8232a819e79b3bf8471245e98.asciidoc index 5dc7235b5..e926cb058 100644 --- a/docs/examples/9298aaf8232a819e79b3bf8471245e98.asciidoc +++ b/docs/examples/9298aaf8232a819e79b3bf8471245e98.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-job-stats.asciidoc:375 +// ml/anomaly-detection/apis/get-job-stats.asciidoc:381 [source, python] ---- diff --git a/docs/examples/92fa6608673cec5a2ed568a07e80d36b.asciidoc b/docs/examples/92fa6608673cec5a2ed568a07e80d36b.asciidoc index a109e86cc..d82a846d5 100644 --- a/docs/examples/92fa6608673cec5a2ed568a07e80d36b.asciidoc +++ b/docs/examples/92fa6608673cec5a2ed568a07e80d36b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1551 +// mapping/runtime.asciidoc:1549 [source, python] ---- diff --git a/docs/examples/92fe53019958ba466d1272da0834cf53.asciidoc b/docs/examples/92fe53019958ba466d1272da0834cf53.asciidoc index d7be84156..1b810cb98 100644 --- a/docs/examples/92fe53019958ba466d1272da0834cf53.asciidoc +++ b/docs/examples/92fe53019958ba466d1272da0834cf53.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/stats.asciidoc:11 +// indices/stats.asciidoc:17 [source, python] ---- diff --git a/docs/examples/9313f534e1aa266cde7d4af74665497f.asciidoc b/docs/examples/9313f534e1aa266cde7d4af74665497f.asciidoc new file mode 100644 index 000000000..8be94a953 --- /dev/null +++ b/docs/examples/9313f534e1aa266cde7d4af74665497f.asciidoc @@ -0,0 +1,13 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-zoom.asciidoc:219 + +[source, python] +---- +resp = client.connector.put( + connector_id="my-{service-name-stub}-connector", + index_name="my-elasticsearch-index", + name="Content synced from {service-name}", + service_type="{service-name-stub}", +) +print(resp) +---- diff --git a/docs/examples/931817b168e055ecf738785c721125dd.asciidoc b/docs/examples/931817b168e055ecf738785c721125dd.asciidoc new file mode 100644 index 000000000..76c4ea122 --- /dev/null +++ b/docs/examples/931817b168e055ecf738785c721125dd.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/processors/inference.asciidoc:750 + +[source, python] +---- +resp = client.ingest.put_pipeline( + id="query_helper_pipeline", + processors=[ + { + "script": { + "source": "ctx.prompt = 'Please generate an elasticsearch search query on index `articles_index` for the following natural language query. Dates are in the field `@timestamp`, document types are in the field `type` (options are `news`, `publication`), categories in the field `category` and can be multiple (options are `medicine`, `pharmaceuticals`, `technology`), and document names are in the field `title` which should use a fuzzy match. Ignore fields which cannot be determined from the natural language query context: ' + ctx.content" + } + }, + { + "inference": { + "model_id": "openai_chat_completions", + "input_output": { + "input_field": "prompt", + "output_field": "query" + } + } + }, + { + "remove": { + "field": "prompt" + } + } + ], +) +print(resp) +---- diff --git a/docs/examples/934aa38c3adcc4cf74ea40cd8736876c.asciidoc b/docs/examples/934aa38c3adcc4cf74ea40cd8736876c.asciidoc index 6516c85e6..f500cbfae 100644 --- a/docs/examples/934aa38c3adcc4cf74ea40cd8736876c.asciidoc +++ b/docs/examples/934aa38c3adcc4cf74ea40cd8736876c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-index.asciidoc:172 +// indices/create-index.asciidoc:178 [source, python] ---- diff --git a/docs/examples/935566d5426d44ade486a49ec5289741.asciidoc b/docs/examples/935566d5426d44ade486a49ec5289741.asciidoc index 9b2c52446..fade6a47d 100644 --- a/docs/examples/935566d5426d44ade486a49ec5289741.asciidoc +++ b/docs/examples/935566d5426d44ade486a49ec5289741.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-semantic-text.asciidoc:128 +// search/search-your-data/semantic-text-hybrid-search:76 [source, python] ---- diff --git a/docs/examples/9382f022086c692ba05efb0acae65946.asciidoc b/docs/examples/9382f022086c692ba05efb0acae65946.asciidoc index e93dffce6..02ad2f12e 100644 --- a/docs/examples/9382f022086c692ba05efb0acae65946.asciidoc +++ b/docs/examples/9382f022086c692ba05efb0acae65946.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/fields/synthetic-source.asciidoc:59 +// mapping/fields/synthetic-source.asciidoc:63 [source, python] ---- diff --git a/docs/examples/93fb59d3204f37af952198b331fb6bb7.asciidoc b/docs/examples/93fb59d3204f37af952198b331fb6bb7.asciidoc index 93b46d640..23150a3d5 100644 --- a/docs/examples/93fb59d3204f37af952198b331fb6bb7.asciidoc +++ b/docs/examples/93fb59d3204f37af952198b331fb6bb7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:217 +// cluster/tasks.asciidoc:223 [source, python] ---- diff --git a/docs/examples/940e8c2c7ff92d71f489bdb7183c1ce6.asciidoc b/docs/examples/940e8c2c7ff92d71f489bdb7183c1ce6.asciidoc index 61efcb462..c57f84122 100644 --- a/docs/examples/940e8c2c7ff92d71f489bdb7183c1ce6.asciidoc +++ b/docs/examples/940e8c2c7ff92d71f489bdb7183c1ce6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/segments.asciidoc:110 +// indices/segments.asciidoc:116 [source, python] ---- diff --git a/docs/examples/9410af79177dd1df9b7b16229a581e18.asciidoc b/docs/examples/9410af79177dd1df9b7b16229a581e18.asciidoc index e41d2fa89..58e584450 100644 --- a/docs/examples/9410af79177dd1df9b7b16229a581e18.asciidoc +++ b/docs/examples/9410af79177dd1df9b7b16229a581e18.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/change-password.asciidoc:70 +// rest-api/security/change-password.asciidoc:76 [source, python] ---- diff --git a/docs/examples/941c8d05486200e835d97642e4ee05d5.asciidoc b/docs/examples/941c8d05486200e835d97642e4ee05d5.asciidoc index a43bd9f9b..211d8a492 100644 --- a/docs/examples/941c8d05486200e835d97642e4ee05d5.asciidoc +++ b/docs/examples/941c8d05486200e835d97642e4ee05d5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:177 +// docs/termvectors.asciidoc:183 [source, python] ---- diff --git a/docs/examples/94246f45025ed394cd6415ed8d7a0588.asciidoc b/docs/examples/94246f45025ed394cd6415ed8d7a0588.asciidoc index e0925bba8..9071c0bdb 100644 --- a/docs/examples/94246f45025ed394cd6415ed8d7a0588.asciidoc +++ b/docs/examples/94246f45025ed394cd6415ed8d7a0588.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/delete-job.asciidoc:79 +// rollup/apis/delete-job.asciidoc:85 [source, python] ---- diff --git a/docs/examples/944806221eb89f5af2298ccdf2902277.asciidoc b/docs/examples/944806221eb89f5af2298ccdf2902277.asciidoc index 4fa39ab7e..896a4c10f 100644 --- a/docs/examples/944806221eb89f5af2298ccdf2902277.asciidoc +++ b/docs/examples/944806221eb89f5af2298ccdf2902277.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-caps.asciidoc:163 +// rollup/apis/rollup-caps.asciidoc:171 [source, python] ---- diff --git a/docs/examples/946522c26d02bebf5c527ba28e55c724.asciidoc b/docs/examples/946522c26d02bebf5c527ba28e55c724.asciidoc index 1ed6de0de..c817120d6 100644 --- a/docs/examples/946522c26d02bebf5c527ba28e55c724.asciidoc +++ b/docs/examples/946522c26d02bebf5c527ba28e55c724.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:352 +// docs/update-by-query.asciidoc:358 [source, python] ---- diff --git a/docs/examples/947efe87db7f8813c0878f8affc3e2d1.asciidoc b/docs/examples/947efe87db7f8813c0878f8affc3e2d1.asciidoc new file mode 100644 index 000000000..43dfda185 --- /dev/null +++ b/docs/examples/947efe87db7f8813c0878f8affc3e2d1.asciidoc @@ -0,0 +1,8 @@ +// This file is autogenerated, DO NOT EDIT +// indices/resolve-cluster.asciidoc:83 + +[source, python] +---- +resp = client.indices.resolve_cluster() +print(resp) +---- diff --git a/docs/examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc b/docs/examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc new file mode 100644 index 000000000..700fe6f3a --- /dev/null +++ b/docs/examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc @@ -0,0 +1,111 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:715 + +[source, python] +---- +resp = client.indices.create( + index="retrievers_example_nested", + settings={ + "number_of_shards": 1 + }, + mappings={ + "properties": { + "nested_field": { + "type": "nested", + "properties": { + "paragraph_id": { + "type": "keyword" + }, + "nested_vector": { + "type": "dense_vector", + "dims": 3, + "similarity": "l2_norm", + "index": True, + "index_options": { + "type": "flat" + } + } + } + }, + "topic": { + "type": "keyword" + } + } + }, +) +print(resp) + +resp1 = client.index( + index="retrievers_example_nested", + id="1", + document={ + "nested_field": [ + { + "paragraph_id": "1a", + "nested_vector": [ + -1.12, + -0.59, + 0.78 + ] + }, + { + "paragraph_id": "1b", + "nested_vector": [ + -0.12, + 1.56, + 0.42 + ] + }, + { + "paragraph_id": "1c", + "nested_vector": [ + 1, + -1, + 0 + ] + } + ], + "topic": [ + "ai" + ] + }, +) +print(resp1) + +resp2 = client.index( + index="retrievers_example_nested", + id="2", + document={ + "nested_field": [ + { + "paragraph_id": "2a", + "nested_vector": [ + 0.23, + 1.24, + 0.65 + ] + } + ], + "topic": [ + "information_retrieval" + ] + }, +) +print(resp2) + +resp3 = client.index( + index="retrievers_example_nested", + id="3", + document={ + "topic": [ + "ai" + ] + }, +) +print(resp3) + +resp4 = client.indices.refresh( + index="retrievers_example_nested", +) +print(resp4) +---- diff --git a/docs/examples/950f1230536422567f99a205ff4165ec.asciidoc b/docs/examples/950f1230536422567f99a205ff4165ec.asciidoc index 9c6457477..eea712620 100644 --- a/docs/examples/950f1230536422567f99a205ff4165ec.asciidoc +++ b/docs/examples/950f1230536422567f99a205ff4165ec.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:399 +// indices/rollover-index.asciidoc:405 [source, python] ---- diff --git a/docs/examples/95414139c7b1203e3c2d99a354415801.asciidoc b/docs/examples/95414139c7b1203e3c2d99a354415801.asciidoc index 711c56dca..773758b44 100644 --- a/docs/examples/95414139c7b1203e3c2d99a354415801.asciidoc +++ b/docs/examples/95414139c7b1203e3c2d99a354415801.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/recovery.asciidoc:84 +// cat/recovery.asciidoc:89 [source, python] ---- diff --git a/docs/examples/95c1b376652533c352bbf793c74d1b08.asciidoc b/docs/examples/95c1b376652533c352bbf793c74d1b08.asciidoc index 386ee81d0..273d0eb91 100644 --- a/docs/examples/95c1b376652533c352bbf793c74d1b08.asciidoc +++ b/docs/examples/95c1b376652533c352bbf793c74d1b08.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/query-role.asciidoc:227 +// rest-api/security/query-role.asciidoc:247 [source, python] ---- diff --git a/docs/examples/9608820dbeac261ba53fb89bb9400560.asciidoc b/docs/examples/9608820dbeac261ba53fb89bb9400560.asciidoc index 2f6de15c4..16bed42e9 100644 --- a/docs/examples/9608820dbeac261ba53fb89bb9400560.asciidoc +++ b/docs/examples/9608820dbeac261ba53fb89bb9400560.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:233 +// rest-api/security/get-api-keys.asciidoc:239 [source, python] ---- diff --git a/docs/examples/9684e5fa8c22a07a372feb6fc1f5f7c0.asciidoc b/docs/examples/9684e5fa8c22a07a372feb6fc1f5f7c0.asciidoc index 50f6c76d4..9c42ef493 100644 --- a/docs/examples/9684e5fa8c22a07a372feb6fc1f5f7c0.asciidoc +++ b/docs/examples/9684e5fa8c22a07a372feb6fc1f5f7c0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/has-privileges.asciidoc:69 +// rest-api/security/has-privileges.asciidoc:75 [source, python] ---- diff --git a/docs/examples/7e5bee18e61d950e823782da1b733903.asciidoc b/docs/examples/968fb5b92aa65af09544f7c002b0953e.asciidoc similarity index 87% rename from docs/examples/7e5bee18e61d950e823782da1b733903.asciidoc rename to docs/examples/968fb5b92aa65af09544f7c002b0953e.asciidoc index 5fee705ec..3746bf530 100644 --- a/docs/examples/7e5bee18e61d950e823782da1b733903.asciidoc +++ b/docs/examples/968fb5b92aa65af09544f7c002b0953e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-semantic-text.asciidoc:173 +// search/search-your-data/semantic-search-semantic-text.asciidoc:144 [source, python] ---- @@ -7,7 +7,7 @@ resp = client.search( index="semantic-embeddings", query={ "semantic": { - "field": "semantic_text", + "field": "content", "query": "How to avoid muscle soreness while running?" } }, diff --git a/docs/examples/19f1f9f25933f8e7aba59a10881c648b.asciidoc b/docs/examples/96e88611f99e6834bd64b58dc8a282c1.asciidoc similarity index 67% rename from docs/examples/19f1f9f25933f8e7aba59a10881c648b.asciidoc rename to docs/examples/96e88611f99e6834bd64b58dc8a282c1.asciidoc index 3846208d6..61477cef7 100644 --- a/docs/examples/19f1f9f25933f8e7aba59a10881c648b.asciidoc +++ b/docs/examples/96e88611f99e6834bd64b58dc8a282c1.asciidoc @@ -1,15 +1,15 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/semantic-text.asciidoc:22 +// mapping/types/semantic-text.asciidoc:42 [source, python] ---- resp = client.indices.create( - index="my-index-000001", + index="my-index-000002", mappings={ "properties": { "inference_field": { "type": "semantic_text", - "inference_id": "my-elser-endpoint" + "inference_id": "my-openai-endpoint" } } }, diff --git a/docs/examples/971fd23adb81bb5842c7750e0379336a.asciidoc b/docs/examples/971fd23adb81bb5842c7750e0379336a.asciidoc new file mode 100644 index 000000000..a7eb8de57 --- /dev/null +++ b/docs/examples/971fd23adb81bb5842c7750e0379336a.asciidoc @@ -0,0 +1,26 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:764 + +[source, python] +---- +resp = client.search( + index="movies", + retriever={ + "text_similarity_reranker": { + "retriever": { + "standard": { + "query": { + "match": { + "genre": "drama" + } + } + } + }, + "field": "plot", + "inference_id": "my-msmarco-minilm-model", + "inference_text": "films that explore psychological depths" + } + }, +) +print(resp) +---- diff --git a/docs/examples/973a3ff47fc4ce036ecd9bd363fef9f7.asciidoc b/docs/examples/973a3ff47fc4ce036ecd9bd363fef9f7.asciidoc index 635584804..599db64b4 100644 --- a/docs/examples/973a3ff47fc4ce036ecd9bd363fef9f7.asciidoc +++ b/docs/examples/973a3ff47fc4ce036ecd9bd363fef9f7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:843 +// docs/reindex.asciidoc:849 [source, python] ---- diff --git a/docs/examples/975b4b92464d52068516aa2f0f955cc1.asciidoc b/docs/examples/975b4b92464d52068516aa2f0f955cc1.asciidoc index 322e7aacd..367434a52 100644 --- a/docs/examples/975b4b92464d52068516aa2f0f955cc1.asciidoc +++ b/docs/examples/975b4b92464d52068516aa2f0f955cc1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/segments.asciidoc:119 +// indices/segments.asciidoc:125 [source, python] ---- diff --git a/docs/examples/97a3216af3d4b4d805d467d9c715cb3e.asciidoc b/docs/examples/97a3216af3d4b4d805d467d9c715cb3e.asciidoc index efa54ac9f..8cad74cda 100644 --- a/docs/examples/97a3216af3d4b4d805d467d9c715cb3e.asciidoc +++ b/docs/examples/97a3216af3d4b4d805d467d9c715cb3e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/get-desired-balance.asciidoc:21 +// cluster/get-desired-balance.asciidoc:27 [source, python] ---- diff --git a/docs/examples/97babc8d19ef0866774576716eb6d19e.asciidoc b/docs/examples/97babc8d19ef0866774576716eb6d19e.asciidoc index f950aedd0..c86db87c1 100644 --- a/docs/examples/97babc8d19ef0866774576716eb6d19e.asciidoc +++ b/docs/examples/97babc8d19ef0866774576716eb6d19e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:775 +// docs/update-by-query.asciidoc:781 [source, python] ---- diff --git a/docs/examples/97c6c07f46f4177f0565a04bc50924a3.asciidoc b/docs/examples/97c6c07f46f4177f0565a04bc50924a3.asciidoc new file mode 100644 index 000000000..35f2440da --- /dev/null +++ b/docs/examples/97c6c07f46f4177f0565a04bc50924a3.asciidoc @@ -0,0 +1,41 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:113 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "query_string": { + "query": "(information retrieval) OR (artificial intelligence)", + "default_field": "text" + } + } + } + }, + { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + }, + source=False, +) +print(resp) +---- diff --git a/docs/examples/97ea5ab17213cb1faaf6f3ea13607098.asciidoc b/docs/examples/97ea5ab17213cb1faaf6f3ea13607098.asciidoc index 7d382579c..2df9987cc 100644 --- a/docs/examples/97ea5ab17213cb1faaf6f3ea13607098.asciidoc +++ b/docs/examples/97ea5ab17213cb1faaf6f3ea13607098.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/start.asciidoc:43 +// rest-api/watcher/start.asciidoc:49 [source, python] ---- diff --git a/docs/examples/97f5df84efec655f479fad78bc392d4d.asciidoc b/docs/examples/97f5df84efec655f479fad78bc392d4d.asciidoc index 0caa87fcd..7a0dba9f4 100644 --- a/docs/examples/97f5df84efec655f479fad78bc392d4d.asciidoc +++ b/docs/examples/97f5df84efec655f479fad78bc392d4d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/profile.asciidoc:830 +// search/profile.asciidoc:835 [source, python] ---- diff --git a/docs/examples/986f892bfa4dfdf1da8455fdf84a4b0c.asciidoc b/docs/examples/986f892bfa4dfdf1da8455fdf84a4b0c.asciidoc index 627cbc6bb..3e5ded035 100644 --- a/docs/examples/986f892bfa4dfdf1da8455fdf84a4b0c.asciidoc +++ b/docs/examples/986f892bfa4dfdf1da8455fdf84a4b0c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-alibabacloud-ai-search.asciidoc:136 +// inference/service-alibabacloud-ai-search.asciidoc:228 [source, python] ---- diff --git a/docs/examples/98855f4bda8726d5d123aeebf7869e47.asciidoc b/docs/examples/98855f4bda8726d5d123aeebf7869e47.asciidoc index 87e68355f..1acb209f3 100644 --- a/docs/examples/98855f4bda8726d5d123aeebf7869e47.asciidoc +++ b/docs/examples/98855f4bda8726d5d123aeebf7869e47.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/nodeattrs.asciidoc:82 +// cat/nodeattrs.asciidoc:88 [source, python] ---- diff --git a/docs/examples/99160b7c3c3fc1fac98aeb426dbcb3cb.asciidoc b/docs/examples/99160b7c3c3fc1fac98aeb426dbcb3cb.asciidoc index f50ea9075..c20218f95 100644 --- a/docs/examples/99160b7c3c3fc1fac98aeb426dbcb3cb.asciidoc +++ b/docs/examples/99160b7c3c3fc1fac98aeb426dbcb3cb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/fields.asciidoc:171 +// scripting/fields.asciidoc:244 [source, python] ---- diff --git a/docs/examples/991b9ba53f0eccec8ec5a42f8d9b655c.asciidoc b/docs/examples/991b9ba53f0eccec8ec5a42f8d9b655c.asciidoc index 4129bbe4c..04eac66eb 100644 --- a/docs/examples/991b9ba53f0eccec8ec5a42f8d9b655c.asciidoc +++ b/docs/examples/991b9ba53f0eccec8ec5a42f8d9b655c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:616 +// search/search-your-data/highlighting.asciidoc:628 [source, python] ---- diff --git a/docs/examples/99803d7b111b862c0c82e9908e549b16.asciidoc b/docs/examples/99803d7b111b862c0c82e9908e549b16.asciidoc index ceee23cce..a33de7a36 100644 --- a/docs/examples/99803d7b111b862c0c82e9908e549b16.asciidoc +++ b/docs/examples/99803d7b111b862c0c82e9908e549b16.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-mistral.asciidoc:87 +// inference/service-mistral.asciidoc:113 [source, python] ---- diff --git a/docs/examples/998c8479c8704bca0e121d5969859517.asciidoc b/docs/examples/998c8479c8704bca0e121d5969859517.asciidoc new file mode 100644 index 000000000..c7501ec38 --- /dev/null +++ b/docs/examples/998c8479c8704bca0e121d5969859517.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:417 + +[source, python] +---- +resp = client.count( + index="music", +) +print(resp) +---- diff --git a/docs/examples/99c1cfe60f3ccf5bf3abd24c31ed9034.asciidoc b/docs/examples/99c1cfe60f3ccf5bf3abd24c31ed9034.asciidoc index a3bf61263..672e32dbc 100644 --- a/docs/examples/99c1cfe60f3ccf5bf3abd24c31ed9034.asciidoc +++ b/docs/examples/99c1cfe60f3ccf5bf3abd24c31ed9034.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/put-auto-follow-pattern.asciidoc:14 +// ccr/apis/auto-follow/put-auto-follow-pattern.asciidoc:20 [source, python] ---- diff --git a/docs/examples/99fb82d49ac477e6a9dfdd71f9465374.asciidoc b/docs/examples/99fb82d49ac477e6a9dfdd71f9465374.asciidoc new file mode 100644 index 000000000..97135e772 --- /dev/null +++ b/docs/examples/99fb82d49ac477e6a9dfdd71f9465374.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/apis/delete-ip-location-database.asciidoc:58 + +[source, python] +---- +resp = client.ingest.delete_ip_location_database( + id="example-database-id", +) +print(resp) +---- diff --git a/docs/examples/9a05cc10eea1251e23b82a4549913536.asciidoc b/docs/examples/9a05cc10eea1251e23b82a4549913536.asciidoc index 29eb24242..fd2de14ab 100644 --- a/docs/examples/9a05cc10eea1251e23b82a4549913536.asciidoc +++ b/docs/examples/9a05cc10eea1251e23b82a4549913536.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/hotspotting.asciidoc:102 +// troubleshooting/common-issues/hotspotting.asciidoc:108 [source, python] ---- diff --git a/docs/examples/9a09d33ec11e20b6081cae882282ca60.asciidoc b/docs/examples/9a09d33ec11e20b6081cae882282ca60.asciidoc index 352c19931..e006ded1c 100644 --- a/docs/examples/9a09d33ec11e20b6081cae882282ca60.asciidoc +++ b/docs/examples/9a09d33ec11e20b6081cae882282ca60.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-privileges-cache.asciidoc:57 +// rest-api/security/clear-privileges-cache.asciidoc:63 [source, python] ---- diff --git a/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc b/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc index 57789d3dd..3d9cb9247 100644 --- a/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc +++ b/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-cohere.asciidoc:170 +// inference/service-cohere.asciidoc:196 [source, python] ---- diff --git a/docs/examples/9a49b7572d571e00e20dbebdd30f9368.asciidoc b/docs/examples/9a49b7572d571e00e20dbebdd30f9368.asciidoc index d5531c3be..5810962a6 100644 --- a/docs/examples/9a49b7572d571e00e20dbebdd30f9368.asciidoc +++ b/docs/examples/9a49b7572d571e00e20dbebdd30f9368.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-vector-tile-api.asciidoc:114 +// search/search-vector-tile-api.asciidoc:119 [source, python] ---- diff --git a/docs/examples/9a4d5e41c52c20635d1fd9c6e13f6c7a.asciidoc b/docs/examples/9a4d5e41c52c20635d1fd9c6e13f6c7a.asciidoc index 5d558d09f..6a952d37e 100644 --- a/docs/examples/9a4d5e41c52c20635d1fd9c6e13f6c7a.asciidoc +++ b/docs/examples/9a4d5e41c52c20635d1fd9c6e13f6c7a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:827 +// docs/reindex.asciidoc:833 [source, python] ---- diff --git a/docs/examples/9a743b6575c6fe5acdf46024a7fda8a1.asciidoc b/docs/examples/9a743b6575c6fe5acdf46024a7fda8a1.asciidoc index 6cab67aae..435bc627d 100644 --- a/docs/examples/9a743b6575c6fe5acdf46024a7fda8a1.asciidoc +++ b/docs/examples/9a743b6575c6fe5acdf46024a7fda8a1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:537 +// scripting/using.asciidoc:542 [source, python] ---- diff --git a/docs/examples/9ab351893dae65ec97fd8cb6832950fb.asciidoc b/docs/examples/9ab351893dae65ec97fd8cb6832950fb.asciidoc index 6b763a1a6..f3393b1a2 100644 --- a/docs/examples/9ab351893dae65ec97fd8cb6832950fb.asciidoc +++ b/docs/examples/9ab351893dae65ec97fd8cb6832950fb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/knn-search.asciidoc:1124 +// search/search-your-data/knn-search.asciidoc:1288 [source, python] ---- diff --git a/docs/examples/9ae268058c0ea32ef8926568e011c728.asciidoc b/docs/examples/9ae268058c0ea32ef8926568e011c728.asciidoc index f0c74cd8a..381b76a4b 100644 --- a/docs/examples/9ae268058c0ea32ef8926568e011c728.asciidoc +++ b/docs/examples/9ae268058c0ea32ef8926568e011c728.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-features-api.asciidoc:122 +// connector/apis/update-connector-features-api.asciidoc:129 [source, python] ---- diff --git a/docs/examples/2cd8439db5054c93c49f1bf50433e1bb.asciidoc b/docs/examples/9aedc45f83e022732789e8d796f5a43c.asciidoc similarity index 90% rename from docs/examples/2cd8439db5054c93c49f1bf50433e1bb.asciidoc rename to docs/examples/9aedc45f83e022732789e8d796f5a43c.asciidoc index 2b48fd10d..0636b0a05 100644 --- a/docs/examples/2cd8439db5054c93c49f1bf50433e1bb.asciidoc +++ b/docs/examples/9aedc45f83e022732789e8d796f5a43c.asciidoc @@ -1,10 +1,9 @@ // This file is autogenerated, DO NOT EDIT -// cluster/reroute.asciidoc:195 +// cluster/reroute.asciidoc:200 [source, python] ---- resp = client.cluster.reroute( - metric="none", commands=[ { "move": { diff --git a/docs/examples/9af44592fb2e78fb17ad3e834bbef7a7.asciidoc b/docs/examples/9af44592fb2e78fb17ad3e834bbef7a7.asciidoc index 5e62697f9..444b4782d 100644 --- a/docs/examples/9af44592fb2e78fb17ad3e834bbef7a7.asciidoc +++ b/docs/examples/9af44592fb2e78fb17ad3e834bbef7a7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/geoip-stats.asciidoc:11 +// ingest/apis/geoip-stats.asciidoc:17 [source, python] ---- diff --git a/docs/examples/9afa0844883b7471883aa378a8dd10b4.asciidoc b/docs/examples/9afa0844883b7471883aa378a8dd10b4.asciidoc index 15d83c81e..331a8522d 100644 --- a/docs/examples/9afa0844883b7471883aa378a8dd10b4.asciidoc +++ b/docs/examples/9afa0844883b7471883aa378a8dd10b4.asciidoc @@ -1,12 +1,12 @@ // This file is autogenerated, DO NOT EDIT -// behavioral-analytics/apis/post-analytics-collection-event.asciidoc:69 +// behavioral-analytics/apis/post-analytics-collection-event.asciidoc:75 [source, python] ---- resp = client.search_application.post_behavioral_analytics_event( collection_name="my_analytics_collection", event_type="search_click", - body={ + payload={ "session": { "id": "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9" }, diff --git a/docs/examples/9b0f34d122a4b348dc86df7410d6ebb6.asciidoc b/docs/examples/9b0f34d122a4b348dc86df7410d6ebb6.asciidoc index bb2afba6c..40e47d094 100644 --- a/docs/examples/9b0f34d122a4b348dc86df7410d6ebb6.asciidoc +++ b/docs/examples/9b0f34d122a4b348dc86df7410d6ebb6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/cancel-connector-sync-job-api.asciidoc:50 +// connector/apis/cancel-connector-sync-job-api.asciidoc:57 [source, python] ---- diff --git a/docs/examples/9b30a69fec54cf01f7af1b04a6e15239.asciidoc b/docs/examples/9b30a69fec54cf01f7af1b04a6e15239.asciidoc index 215dcff86..29f4fbd77 100644 --- a/docs/examples/9b30a69fec54cf01f7af1b04a6e15239.asciidoc +++ b/docs/examples/9b30a69fec54cf01f7af1b04a6e15239.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/get-ccr-stats.asciidoc:103 +// ccr/apis/get-ccr-stats.asciidoc:109 [source, python] ---- diff --git a/docs/examples/9b345e0bfd45f3a37194585ec9193478.asciidoc b/docs/examples/9b345e0bfd45f3a37194585ec9193478.asciidoc index 5cab8fba7..d7527c836 100644 --- a/docs/examples/9b345e0bfd45f3a37194585ec9193478.asciidoc +++ b/docs/examples/9b345e0bfd45f3a37194585ec9193478.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/forcemerge.asciidoc:173 +// indices/forcemerge.asciidoc:179 [source, python] ---- diff --git a/docs/examples/9bae72e974bdeb56007d9104e73eff92.asciidoc b/docs/examples/9bae72e974bdeb56007d9104e73eff92.asciidoc index 3651a3480..d59016490 100644 --- a/docs/examples/9bae72e974bdeb56007d9104e73eff92.asciidoc +++ b/docs/examples/9bae72e974bdeb56007d9104e73eff92.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:182 +// docs/update.asciidoc:188 [source, python] ---- diff --git a/docs/examples/9bb24fe09e3d1c73a71d00b994ba8cfb.asciidoc b/docs/examples/9bb24fe09e3d1c73a71d00b994ba8cfb.asciidoc index 438842e0f..b586d25dc 100644 --- a/docs/examples/9bb24fe09e3d1c73a71d00b994ba8cfb.asciidoc +++ b/docs/examples/9bb24fe09e3d1c73a71d00b994ba8cfb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/shards.asciidoc:343 +// cat/shards.asciidoc:352 [source, python] ---- diff --git a/docs/examples/9bd5a470ee6d2b4a1f5280adc39675d2.asciidoc b/docs/examples/9bd5a470ee6d2b4a1f5280adc39675d2.asciidoc new file mode 100644 index 000000000..404ca1548 --- /dev/null +++ b/docs/examples/9bd5a470ee6d2b4a1f5280adc39675d2.asciidoc @@ -0,0 +1,35 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-mysql.asciidoc:503 + +[source, python] +---- +resp = client.update( + index=".elastic-connectors", + id="connector_id", + doc={ + "configuration": { + "tables": { + "type": "list", + "value": "*" + }, + "ssl_enabled": { + "type": "bool", + "value": False + }, + "ssl_ca": { + "type": "str", + "value": "" + }, + "fetch_size": { + "type": "int", + "value": 50 + }, + "retry_count": { + "type": "int", + "value": 3 + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/9beb260834f8cfb240f6308950dbb9c2.asciidoc b/docs/examples/9beb260834f8cfb240f6308950dbb9c2.asciidoc index 4e029bc94..aaa229972 100644 --- a/docs/examples/9beb260834f8cfb240f6308950dbb9c2.asciidoc +++ b/docs/examples/9beb260834f8cfb240f6308950dbb9c2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:521 +// search/search-your-data/sort-search-results.asciidoc:523 [source, python] ---- diff --git a/docs/examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc b/docs/examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc index 95150009b..425a0e6c8 100644 --- a/docs/examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc +++ b/docs/examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc @@ -1,15 +1,13 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/oidc-authenticate-api.asciidoc:68 +// rest-api/security/oidc-authenticate-api.asciidoc:74 [source, python] ---- resp = client.security.oidc_authenticate( - body={ - "redirect_uri": "https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", - "state": "4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", - "nonce": "WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM", - "realm": "oidc1" - }, + redirect_uri="https://oidc-kibana.elastic.co:5603/api/security/oidc/callback?code=jtI3Ntt8v3_XvcLzCFGq&state=4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + state="4dbrihtIAt3wBTwo6DxK-vdk-sSyDBV8Yf0AjdkdT5I", + nonce="WaBPH0KqPVdG5HHdSxPRjfoZbXMCicm5v1OiAj0DUFM", + realm="oidc1", ) print(resp) ---- diff --git a/docs/examples/9c021836acf7c0370e289f611325868d.asciidoc b/docs/examples/9c021836acf7c0370e289f611325868d.asciidoc index 9fc291d61..2f6b15f0c 100644 --- a/docs/examples/9c021836acf7c0370e289f611325868d.asciidoc +++ b/docs/examples/9c021836acf7c0370e289f611325868d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-configuration-api.asciidoc:308 +// connector/apis/update-connector-configuration-api.asciidoc:315 [source, python] ---- diff --git a/docs/examples/5b86d54900e2c4c043a54ca7ae2df0f0.asciidoc b/docs/examples/9c2ce0132e4527077443f007d27b1158.asciidoc similarity index 67% rename from docs/examples/5b86d54900e2c4c043a54ca7ae2df0f0.asciidoc rename to docs/examples/9c2ce0132e4527077443f007d27b1158.asciidoc index 31492b541..64eb514f0 100644 --- a/docs/examples/5b86d54900e2c4c043a54ca7ae2df0f0.asciidoc +++ b/docs/examples/9c2ce0132e4527077443f007d27b1158.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/flattened.asciidoc:407 +// mapping/types/flattened.asciidoc:422 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "flattened": { "type": "flattened" diff --git a/docs/examples/9c7c8051592b6af3adb5d7c490849068.asciidoc b/docs/examples/9c7c8051592b6af3adb5d7c490849068.asciidoc index b7dba1f67..d021306cc 100644 --- a/docs/examples/9c7c8051592b6af3adb5d7c490849068.asciidoc +++ b/docs/examples/9c7c8051592b6af3adb5d7c490849068.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/put-datafeed.asciidoc:162 +// ml/anomaly-detection/apis/put-datafeed.asciidoc:168 [source, python] ---- diff --git a/docs/examples/9cb150d67dfa0947f29aa809bcc93c6e.asciidoc b/docs/examples/9cb150d67dfa0947f29aa809bcc93c6e.asciidoc index 6efd75246..ab22d2d4f 100644 --- a/docs/examples/9cb150d67dfa0947f29aa809bcc93c6e.asciidoc +++ b/docs/examples/9cb150d67dfa0947f29aa809bcc93c6e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// datatiers.asciidoc:241 +// datatiers.asciidoc:240 [source, python] ---- diff --git a/docs/examples/9cbb097e5498a9fde39e3b1d3b62a4d2.asciidoc b/docs/examples/9cbb097e5498a9fde39e3b1d3b62a4d2.asciidoc index 15d03e6ab..583aefcb6 100644 --- a/docs/examples/9cbb097e5498a9fde39e3b1d3b62a4d2.asciidoc +++ b/docs/examples/9cbb097e5498a9fde39e3b1d3b62a4d2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/infer-trained-model.asciidoc:945 +// ml/trained-models/apis/infer-trained-model.asciidoc:1052 [source, python] ---- diff --git a/docs/examples/9cc64ab2f60f995f5dbfaca67aa6dd41.asciidoc b/docs/examples/9cc64ab2f60f995f5dbfaca67aa6dd41.asciidoc index 57fbd39dd..b30c1fe6a 100644 --- a/docs/examples/9cc64ab2f60f995f5dbfaca67aa6dd41.asciidoc +++ b/docs/examples/9cc64ab2f60f995f5dbfaca67aa6dd41.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-query-api.asciidoc:10 +// esql/esql-query-api.asciidoc:16 [source, python] ---- diff --git a/docs/examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc b/docs/examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc new file mode 100644 index 000000000..9bb8f645b --- /dev/null +++ b/docs/examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc @@ -0,0 +1,38 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/rank-vectors.asciidoc:42 + +[source, python] +---- +resp = client.indices.create( + index="my-rank-vectors-byte", + mappings={ + "properties": { + "my_vector": { + "type": "rank_vectors", + "element_type": "byte" + } + } + }, +) +print(resp) + +resp1 = client.index( + index="my-rank-vectors-byte", + id="1", + document={ + "my_vector": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ] + ] + }, +) +print(resp1) +---- diff --git a/docs/examples/9cd37d0ccbc66ad47ddb626564b27cc8.asciidoc b/docs/examples/9cd37d0ccbc66ad47ddb626564b27cc8.asciidoc index 21eab8e92..3305bc3e2 100644 --- a/docs/examples/9cd37d0ccbc66ad47ddb626564b27cc8.asciidoc +++ b/docs/examples/9cd37d0ccbc66ad47ddb626564b27cc8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/execute-watch.asciidoc:327 +// rest-api/watcher/execute-watch.asciidoc:333 [source, python] ---- diff --git a/docs/examples/9cf6c7012a4f2bb562bc256aa28c3409.asciidoc b/docs/examples/9cf6c7012a4f2bb562bc256aa28c3409.asciidoc index bcc021bbb..f03f6e8ad 100644 --- a/docs/examples/9cf6c7012a4f2bb562bc256aa28c3409.asciidoc +++ b/docs/examples/9cf6c7012a4f2bb562bc256aa28c3409.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/execute-watch.asciidoc:314 +// rest-api/watcher/execute-watch.asciidoc:320 [source, python] ---- diff --git a/docs/examples/9d396afad93782699d7a929578c85284.asciidoc b/docs/examples/9d396afad93782699d7a929578c85284.asciidoc index 5c4822152..e869a6a92 100644 --- a/docs/examples/9d396afad93782699d7a929578c85284.asciidoc +++ b/docs/examples/9d396afad93782699d7a929578c85284.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/inference-api/infer-api-task.asciidoc:184 +// tab-widgets/inference-api/infer-api-task.asciidoc:192 [source, python] ---- diff --git a/docs/examples/9d66cb59711f24e6b4ff85608c9b5a1b.asciidoc b/docs/examples/9d66cb59711f24e6b4ff85608c9b5a1b.asciidoc new file mode 100644 index 000000000..46b5bc2ff --- /dev/null +++ b/docs/examples/9d66cb59711f24e6b4ff85608c9b5a1b.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// troubleshooting/common-issues/task-queue-backlog.asciidoc:73 + +[source, python] +---- +resp = client.tasks.list( + pretty=True, + human=True, + detailed=True, +) +print(resp) +---- diff --git a/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc b/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc index b6f73d2cb..1895c27ca 100644 --- a/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc +++ b/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// health/health.asciidoc:465 +// health/health.asciidoc:471 [source, python] ---- diff --git a/docs/examples/9de4edafd22a8b9cb557632b2c8779cd.asciidoc b/docs/examples/9de4edafd22a8b9cb557632b2c8779cd.asciidoc index a05788985..435e9f608 100644 --- a/docs/examples/9de4edafd22a8b9cb557632b2c8779cd.asciidoc +++ b/docs/examples/9de4edafd22a8b9cb557632b2c8779cd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-rest.asciidoc:306 +// esql/esql-rest.asciidoc:309 [source, python] ---- diff --git a/docs/examples/9e563b8d5a7845f644db8d5bbf453eb6.asciidoc b/docs/examples/9e563b8d5a7845f644db8d5bbf453eb6.asciidoc index d1b60ef2e..63cadd7c0 100644 --- a/docs/examples/9e563b8d5a7845f644db8d5bbf453eb6.asciidoc +++ b/docs/examples/9e563b8d5a7845f644db8d5bbf453eb6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/put-synonyms-set.asciidoc:61 +// synonyms/apis/put-synonyms-set.asciidoc:67 [source, python] ---- diff --git a/docs/examples/9e9717d9108ae1425bfacf71c7c44539.asciidoc b/docs/examples/9e9717d9108ae1425bfacf71c7c44539.asciidoc index fc588c589..db6f3e51e 100644 --- a/docs/examples/9e9717d9108ae1425bfacf71c7c44539.asciidoc +++ b/docs/examples/9e9717d9108ae1425bfacf71c7c44539.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat.asciidoc:121 +// cat.asciidoc:127 [source, python] ---- diff --git a/docs/examples/9f3341489fefd38c4e439c29f6dcb86c.asciidoc b/docs/examples/9f3341489fefd38c4e439c29f6dcb86c.asciidoc index 76040c776..f73aece74 100644 --- a/docs/examples/9f3341489fefd38c4e439c29f6dcb86c.asciidoc +++ b/docs/examples/9f3341489fefd38c4e439c29f6dcb86c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/terms-set-query.asciidoc:214 +// query-dsl/terms-set-query.asciidoc:224 [source, python] ---- diff --git a/docs/examples/9f99be2d58c48a6bf8e892aa24604197.asciidoc b/docs/examples/9f99be2d58c48a6bf8e892aa24604197.asciidoc index 37a5c6840..cd8037882 100644 --- a/docs/examples/9f99be2d58c48a6bf8e892aa24604197.asciidoc +++ b/docs/examples/9f99be2d58c48a6bf8e892aa24604197.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/update-dfanalytics.asciidoc:92 +// ml/df-analytics/apis/update-dfanalytics.asciidoc:98 [source, python] ---- diff --git a/docs/examples/9fda516a5dc60ba477b970eaad4429db.asciidoc b/docs/examples/9fda516a5dc60ba477b970eaad4429db.asciidoc index c7e75d94a..293ced05a 100644 --- a/docs/examples/9fda516a5dc60ba477b970eaad4429db.asciidoc +++ b/docs/examples/9fda516a5dc60ba477b970eaad4429db.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/lifecycle/apis/get-lifecycle.asciidoc:142 +// data-streams/lifecycle/apis/get-lifecycle.asciidoc:148 [source, python] ---- diff --git a/docs/examples/9feff356f302ea4915347ab71cc4887a.asciidoc b/docs/examples/9feff356f302ea4915347ab71cc4887a.asciidoc index 31a0cbc95..d9508e5ae 100644 --- a/docs/examples/9feff356f302ea4915347ab71cc4887a.asciidoc +++ b/docs/examples/9feff356f302ea4915347ab71cc4887a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/simulate-template.asciidoc:235 +// indices/simulate-template.asciidoc:241 [source, python] ---- diff --git a/docs/examples/9ff9b2a73419a6c82f17a358b4991499.asciidoc b/docs/examples/9ff9b2a73419a6c82f17a358b4991499.asciidoc index 6a64b2870..01ddcfd66 100644 --- a/docs/examples/9ff9b2a73419a6c82f17a358b4991499.asciidoc +++ b/docs/examples/9ff9b2a73419a6c82f17a358b4991499.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/point-in-time-api.asciidoc:159 +// search/point-in-time-api.asciidoc:165 [source, python] ---- diff --git a/docs/examples/a00311843b5f8f3e9f7d511334a828b1.asciidoc b/docs/examples/a00311843b5f8f3e9f7d511334a828b1.asciidoc index 21debb682..9d5f860ed 100644 --- a/docs/examples/a00311843b5f8f3e9f7d511334a828b1.asciidoc +++ b/docs/examples/a00311843b5f8f3e9f7d511334a828b1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-caps.asciidoc:91 +// rollup/apis/rollup-caps.asciidoc:98 [source, python] ---- diff --git a/docs/examples/a0f4e902d18460337684d74ea932fbe9.asciidoc b/docs/examples/a0f4e902d18460337684d74ea932fbe9.asciidoc index 80ed4b788..3865fe048 100644 --- a/docs/examples/a0f4e902d18460337684d74ea932fbe9.asciidoc +++ b/docs/examples/a0f4e902d18460337684d74ea932fbe9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:257 +// docs/update.asciidoc:263 [source, python] ---- diff --git a/docs/examples/a1070cf2f5969d42d71cda057223f152.asciidoc b/docs/examples/a1070cf2f5969d42d71cda057223f152.asciidoc index 5c00da449..2de683ba9 100644 --- a/docs/examples/a1070cf2f5969d42d71cda057223f152.asciidoc +++ b/docs/examples/a1070cf2f5969d42d71cda057223f152.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:247 +// how-to/size-your-shards.asciidoc:248 [source, python] ---- diff --git a/docs/examples/a159e1ce0cba7a35ce44db9bebad22f3.asciidoc b/docs/examples/a159e1ce0cba7a35ce44db9bebad22f3.asciidoc index 79193519b..4690f73d9 100644 --- a/docs/examples/a159e1ce0cba7a35ce44db9bebad22f3.asciidoc +++ b/docs/examples/a159e1ce0cba7a35ce44db9bebad22f3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-get.asciidoc:126 +// slm/apis/slm-get.asciidoc:132 [source, python] ---- diff --git a/docs/examples/a162eb50853331c80596f5994e9d1c38.asciidoc b/docs/examples/a162eb50853331c80596f5994e9d1c38.asciidoc index 2866e98b4..407bfdda7 100644 --- a/docs/examples/a162eb50853331c80596f5994e9d1c38.asciidoc +++ b/docs/examples/a162eb50853331c80596f5994e9d1c38.asciidoc @@ -5,10 +5,8 @@ ---- resp = client.search_application.render_query( name="my_search_application", - body={ - "params": { - "query_string": "rock climbing" - } + params={ + "query_string": "rock climbing" }, ) print(resp) diff --git a/docs/examples/f38262ef72f73816ec35fa4c9c85760d.asciidoc b/docs/examples/a1b668795243398f5bc40bcc9bead884.asciidoc similarity index 81% rename from docs/examples/f38262ef72f73816ec35fa4c9c85760d.asciidoc rename to docs/examples/a1b668795243398f5bc40bcc9bead884.asciidoc index 9de3a3deb..56d50d1b9 100644 --- a/docs/examples/f38262ef72f73816ec35fa4c9c85760d.asciidoc +++ b/docs/examples/a1b668795243398f5bc40bcc9bead884.asciidoc @@ -5,10 +5,16 @@ ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "my_range": { "type": "long_range" diff --git a/docs/examples/a1d0603b24a5b048f0959975d8057534.asciidoc b/docs/examples/a1d0603b24a5b048f0959975d8057534.asciidoc index 750fec900..840358da8 100644 --- a/docs/examples/a1d0603b24a5b048f0959975d8057534.asciidoc +++ b/docs/examples/a1d0603b24a5b048f0959975d8057534.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:354 +// docs/termvectors.asciidoc:360 [source, python] ---- diff --git a/docs/examples/a1dda7e7c01be96a4acf7b725d70385f.asciidoc b/docs/examples/a1dda7e7c01be96a4acf7b725d70385f.asciidoc new file mode 100644 index 000000000..304ea62c6 --- /dev/null +++ b/docs/examples/a1dda7e7c01be96a4acf7b725d70385f.asciidoc @@ -0,0 +1,28 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:684 + +[source, python] +---- +resp = client.search( + index="index", + retriever={ + "text_similarity_reranker": { + "retriever": { + "standard": { + "query": { + "match_phrase": { + "text": "landmark in Paris" + } + } + } + }, + "field": "text", + "inference_id": "my-cohere-rerank-model", + "inference_text": "Most famous landmark in Paris", + "rank_window_size": 100, + "min_score": 0.5 + } + }, +) +print(resp) +---- diff --git a/docs/examples/a1f70bc71b763b58206814c40a7440e7.asciidoc b/docs/examples/a1f70bc71b763b58206814c40a7440e7.asciidoc index 88c3ac6fb..103eacdfc 100644 --- a/docs/examples/a1f70bc71b763b58206814c40a7440e7.asciidoc +++ b/docs/examples/a1f70bc71b763b58206814c40a7440e7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/update-settings.asciidoc:41 +// rest-api/watcher/update-settings.asciidoc:47 [source, python] ---- diff --git a/docs/examples/a2b2ce031120dac49b5120b26eea8758.asciidoc b/docs/examples/a2b2ce031120dac49b5120b26eea8758.asciidoc index d90984516..0612348a0 100644 --- a/docs/examples/a2b2ce031120dac49b5120b26eea8758.asciidoc +++ b/docs/examples/a2b2ce031120dac49b5120b26eea8758.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/indices.asciidoc:109 +// cat/indices.asciidoc:119 [source, python] ---- diff --git a/docs/examples/a2c3e284354e8d49cf51bb8dd5ef3613.asciidoc b/docs/examples/a2c3e284354e8d49cf51bb8dd5ef3613.asciidoc index 90db588fa..fcf84bb43 100644 --- a/docs/examples/a2c3e284354e8d49cf51bb8dd5ef3613.asciidoc +++ b/docs/examples/a2c3e284354e8d49cf51bb8dd5ef3613.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/upgrade-transforms.asciidoc:97 +// transform/apis/upgrade-transforms.asciidoc:103 [source, python] ---- diff --git a/docs/examples/a34e758e019f563d323ca90ad9fd6e3e.asciidoc b/docs/examples/a34e758e019f563d323ca90ad9fd6e3e.asciidoc index 366706ece..7571d51c7 100644 --- a/docs/examples/a34e758e019f563d323ca90ad9fd6e3e.asciidoc +++ b/docs/examples/a34e758e019f563d323ca90ad9fd6e3e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:266 +// alias.asciidoc:268 [source, python] ---- diff --git a/docs/examples/a3646b59da66b9ab68bdbc8dc2e6a9be.asciidoc b/docs/examples/a3646b59da66b9ab68bdbc8dc2e6a9be.asciidoc new file mode 100644 index 000000000..a1a4feb8b --- /dev/null +++ b/docs/examples/a3646b59da66b9ab68bdbc8dc2e6a9be.asciidoc @@ -0,0 +1,32 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:159 + +[source, python] +---- +resp = client.search( + index="restaurants", + retriever={ + "standard": { + "query": { + "bool": { + "should": [ + { + "match": { + "region": "Austria" + } + } + ], + "filter": [ + { + "term": { + "year": "2019" + } + } + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/a3779f21f132787c48681bfb50453592.asciidoc b/docs/examples/a3779f21f132787c48681bfb50453592.asciidoc new file mode 100644 index 000000000..6b0436b24 --- /dev/null +++ b/docs/examples/a3779f21f132787c48681bfb50453592.asciidoc @@ -0,0 +1,34 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/processors/ip-location.asciidoc:85 + +[source, python] +---- +resp = client.ingest.put_pipeline( + id="ip_location", + description="Add ip geolocation info", + processors=[ + { + "ip_location": { + "field": "ip" + } + } + ], +) +print(resp) + +resp1 = client.index( + index="my-index-000001", + id="my_id", + pipeline="ip_location", + document={ + "ip": "89.160.20.128" + }, +) +print(resp1) + +resp2 = client.get( + index="my-index-000001", + id="my_id", +) +print(resp2) +---- diff --git a/docs/examples/a3a2856ac2338a624a1fa5f31aec4db4.asciidoc b/docs/examples/a3a2856ac2338a624a1fa5f31aec4db4.asciidoc index 638ba69a9..193ddffd0 100644 --- a/docs/examples/a3a2856ac2338a624a1fa5f31aec4db4.asciidoc +++ b/docs/examples/a3a2856ac2338a624a1fa5f31aec4db4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:92 +// rest-api/security/get-api-keys.asciidoc:98 [source, python] ---- diff --git a/docs/examples/a3a64d568fe93a22b042a8b31b9905b0.asciidoc b/docs/examples/a3a64d568fe93a22b042a8b31b9905b0.asciidoc index f03b8da79..2a51f08db 100644 --- a/docs/examples/a3a64d568fe93a22b042a8b31b9905b0.asciidoc +++ b/docs/examples/a3a64d568fe93a22b042a8b31b9905b0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/simulate-pipeline.asciidoc:303 +// ingest/apis/simulate-pipeline.asciidoc:309 [source, python] ---- diff --git a/docs/examples/a3ce0cfe2176f3d8a36959a5916995f0.asciidoc b/docs/examples/a3ce0cfe2176f3d8a36959a5916995f0.asciidoc index d332c6b9c..c48e04756 100644 --- a/docs/examples/a3ce0cfe2176f3d8a36959a5916995f0.asciidoc +++ b/docs/examples/a3ce0cfe2176f3d8a36959a5916995f0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:277 +// cluster/tasks.asciidoc:283 [source, python] ---- diff --git a/docs/examples/a3cfd350c73a104b99a998c6be931408.asciidoc b/docs/examples/a3cfd350c73a104b99a998c6be931408.asciidoc index b2548ae41..35bf10f1f 100644 --- a/docs/examples/a3cfd350c73a104b99a998c6be931408.asciidoc +++ b/docs/examples/a3cfd350c73a104b99a998c6be931408.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/state.asciidoc:158 +// cluster/state.asciidoc:164 [source, python] ---- diff --git a/docs/examples/a3d943ac9d45b4eff4aa0c679b4eceb3.asciidoc b/docs/examples/a3d943ac9d45b4eff4aa0c679b4eceb3.asciidoc index 9ac1d1d70..2969b0a95 100644 --- a/docs/examples/a3d943ac9d45b4eff4aa0c679b4eceb3.asciidoc +++ b/docs/examples/a3d943ac9d45b4eff4aa0c679b4eceb3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/dangling-index-import.asciidoc:13 +// indices/dangling-index-import.asciidoc:19 [source, python] ---- diff --git a/docs/examples/a3e79d6c626a490341c5b731acbb4a5d.asciidoc b/docs/examples/a3e79d6c626a490341c5b731acbb4a5d.asciidoc index 9c4fef882..8694e9d34 100644 --- a/docs/examples/a3e79d6c626a490341c5b731acbb4a5d.asciidoc +++ b/docs/examples/a3e79d6c626a490341c5b731acbb4a5d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:307 +// docs/get.asciidoc:313 [source, python] ---- diff --git a/docs/examples/a45605347d6438e7aecdf3b37198616d.asciidoc b/docs/examples/a45605347d6438e7aecdf3b37198616d.asciidoc index 7f083b5a2..e9fbcec25 100644 --- a/docs/examples/a45605347d6438e7aecdf3b37198616d.asciidoc +++ b/docs/examples/a45605347d6438e7aecdf3b37198616d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/move-to-step.asciidoc:150 +// ilm/apis/move-to-step.asciidoc:156 [source, python] ---- diff --git a/docs/examples/a46f566ca031375658c22f89b87dc6d2.asciidoc b/docs/examples/a46f566ca031375658c22f89b87dc6d2.asciidoc new file mode 100644 index 000000000..b046f9db2 --- /dev/null +++ b/docs/examples/a46f566ca031375658c22f89b87dc6d2.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:379 + +[source, python] +---- +resp = client.cat.indices( + index=".ml-anomalies-custom-example", + v=True, + h="index,store.size", +) +print(resp) +---- diff --git a/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc b/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc index cc4db4e1d..fd57a63b9 100644 --- a/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc +++ b/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/get-inference.asciidoc:73 +// inference/get-inference.asciidoc:74 [source, python] ---- diff --git a/docs/examples/a4ee2214d621bcfaf768c46d21325958.asciidoc b/docs/examples/a4ee2214d621bcfaf768c46d21325958.asciidoc index 7c2c97f72..b00e53429 100644 --- a/docs/examples/a4ee2214d621bcfaf768c46d21325958.asciidoc +++ b/docs/examples/a4ee2214d621bcfaf768c46d21325958.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/inference-api/infer-api-task.asciidoc:66 +// tab-widgets/inference-api/infer-api-task.asciidoc:74 [source, python] ---- diff --git a/docs/examples/a520168c1c8b454a8f102d6a13027c73.asciidoc b/docs/examples/a520168c1c8b454a8f102d6a13027c73.asciidoc index 41527cb83..51a025513 100644 --- a/docs/examples/a520168c1c8b454a8f102d6a13027c73.asciidoc +++ b/docs/examples/a520168c1c8b454a8f102d6a13027c73.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/get-follow-info.asciidoc:143 +// ccr/apis/follow/get-follow-info.asciidoc:149 [source, python] ---- diff --git a/docs/examples/a547bb926c25f670078b98fbe67de3cc.asciidoc b/docs/examples/a547bb926c25f670078b98fbe67de3cc.asciidoc index 335b78c15..a98628f53 100644 --- a/docs/examples/a547bb926c25f670078b98fbe67de3cc.asciidoc +++ b/docs/examples/a547bb926c25f670078b98fbe67de3cc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/delete-synonym-rule.asciidoc:103 +// synonyms/apis/delete-synonym-rule.asciidoc:108 [source, python] ---- diff --git a/docs/examples/a594f05459d9eecc8050c73fc8da336f.asciidoc b/docs/examples/a594f05459d9eecc8050c73fc8da336f.asciidoc index c714c6bd4..60d534ece 100644 --- a/docs/examples/a594f05459d9eecc8050c73fc8da336f.asciidoc +++ b/docs/examples/a594f05459d9eecc8050c73fc8da336f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// tab-widgets/inference-api/infer-api-task.asciidoc:121 +// tab-widgets/inference-api/infer-api-task.asciidoc:129 [source, python] ---- diff --git a/docs/examples/14a49c13c399840e64c00b487aa820c9.asciidoc b/docs/examples/a5aeb2c8bdf91f6146026ec8edc476b6.asciidoc similarity index 67% rename from docs/examples/14a49c13c399840e64c00b487aa820c9.asciidoc rename to docs/examples/a5aeb2c8bdf91f6146026ec8edc476b6.asciidoc index 733cdfc77..48329183c 100644 --- a/docs/examples/14a49c13c399840e64c00b487aa820c9.asciidoc +++ b/docs/examples/a5aeb2c8bdf91f6146026ec8edc476b6.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/date_nanos.asciidoc:160 +// mapping/types/date_nanos.asciidoc:155 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "date": { "type": "date_nanos" diff --git a/docs/examples/a5dfcfd1cfb3558e7912456669c92eee.asciidoc b/docs/examples/a5dfcfd1cfb3558e7912456669c92eee.asciidoc index c1c77e7c9..f9c66d797 100644 --- a/docs/examples/a5dfcfd1cfb3558e7912456669c92eee.asciidoc +++ b/docs/examples/a5dfcfd1cfb3558e7912456669c92eee.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/saml-prepare-authentication-api.asciidoc:79 +// rest-api/security/saml-prepare-authentication-api.asciidoc:85 [source, python] ---- diff --git a/docs/examples/a5e2b3588258430f2e595abda98e3943.asciidoc b/docs/examples/a5e2b3588258430f2e595abda98e3943.asciidoc index c3786c06d..dde1af6c9 100644 --- a/docs/examples/a5e2b3588258430f2e595abda98e3943.asciidoc +++ b/docs/examples/a5e2b3588258430f2e595abda98e3943.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-cache.asciidoc:54 +// rest-api/security/clear-cache.asciidoc:60 [source, python] ---- diff --git a/docs/examples/a5e793d82a4455cf4105dac82a156617.asciidoc b/docs/examples/a5e793d82a4455cf4105dac82a156617.asciidoc index 36414e53b..001ced277 100644 --- a/docs/examples/a5e793d82a4455cf4105dac82a156617.asciidoc +++ b/docs/examples/a5e793d82a4455cf4105dac82a156617.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/validate.asciidoc:208 +// search/validate.asciidoc:214 [source, python] ---- diff --git a/docs/examples/a5f9eb40087921e67d820775acf71522.asciidoc b/docs/examples/a5f9eb40087921e67d820775acf71522.asciidoc index 77b52e796..c85c3543d 100644 --- a/docs/examples/a5f9eb40087921e67d820775acf71522.asciidoc +++ b/docs/examples/a5f9eb40087921e67d820775acf71522.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:212 +// indices/put-mapping.asciidoc:218 [source, python] ---- diff --git a/docs/examples/a60aaed30d7d26eaacbb2c0ed4ddc66d.asciidoc b/docs/examples/a60aaed30d7d26eaacbb2c0ed4ddc66d.asciidoc new file mode 100644 index 000000000..9c66465db --- /dev/null +++ b/docs/examples/a60aaed30d7d26eaacbb2c0ed4ddc66d.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/data-stream-reindex-cancel.asciidoc:41 + +[source, python] +---- +resp = client.indices.cancel_migrate_reindex( + index="my-data-stream", +) +print(resp) +---- diff --git a/docs/examples/a6204edaa0bcf7b82a89ab4f6bda0914.asciidoc b/docs/examples/a6204edaa0bcf7b82a89ab4f6bda0914.asciidoc index b1ada6b8c..97ef9d659 100644 --- a/docs/examples/a6204edaa0bcf7b82a89ab4f6bda0914.asciidoc +++ b/docs/examples/a6204edaa0bcf7b82a89ab4f6bda0914.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/open-job.asciidoc:68 +// ml/anomaly-detection/apis/open-job.asciidoc:74 [source, python] ---- diff --git a/docs/examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc b/docs/examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc new file mode 100644 index 000000000..ec9d585b8 --- /dev/null +++ b/docs/examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/data-stream-reindex.asciidoc:310 + +[source, python] +---- +resp = client.indices.get( + index=".migrated-ds-my-data-stream-2025.01.23-000001", + human=True, + filter_path="*.settings.index.version.created_string", +) +print(resp) +---- diff --git a/docs/examples/a692b4c0ca7825c467880b346841f5a5.asciidoc b/docs/examples/a692b4c0ca7825c467880b346841f5a5.asciidoc index 24eacbc92..4069ff6d3 100644 --- a/docs/examples/a692b4c0ca7825c467880b346841f5a5.asciidoc +++ b/docs/examples/a692b4c0ca7825c467880b346841f5a5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:156 +// indices/put-mapping.asciidoc:162 [source, python] ---- diff --git a/docs/examples/a69b1ce5cc9528fb3639185eaf241ae3.asciidoc b/docs/examples/a69b1ce5cc9528fb3639185eaf241ae3.asciidoc index ef8c2ddb1..d143f7f3c 100644 --- a/docs/examples/a69b1ce5cc9528fb3639185eaf241ae3.asciidoc +++ b/docs/examples/a69b1ce5cc9528fb3639185eaf241ae3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/clear-scroll-api.asciidoc:25 +// search/clear-scroll-api.asciidoc:31 [source, python] ---- diff --git a/docs/examples/a6bb306ca250cf651f19cae808b97012.asciidoc b/docs/examples/a6bb306ca250cf651f19cae808b97012.asciidoc index 9358bbc19..a0f30908c 100644 --- a/docs/examples/a6bb306ca250cf651f19cae808b97012.asciidoc +++ b/docs/examples/a6bb306ca250cf651f19cae808b97012.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-index.asciidoc:11 +// indices/get-index.asciidoc:17 [source, python] ---- diff --git a/docs/examples/a6be6c1cb4a556866fdccb0dee2f1dea.asciidoc b/docs/examples/a6be6c1cb4a556866fdccb0dee2f1dea.asciidoc index f4930b061..6ca864c52 100644 --- a/docs/examples/a6be6c1cb4a556866fdccb0dee2f1dea.asciidoc +++ b/docs/examples/a6be6c1cb4a556866fdccb0dee2f1dea.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/index-template-exists-v1.asciidoc:17 +// indices/index-template-exists-v1.asciidoc:23 [source, python] ---- diff --git a/docs/examples/a6fdd0100cd362df54af6c95d1055c96.asciidoc b/docs/examples/a6fdd0100cd362df54af6c95d1055c96.asciidoc index fe4ad1147..80137273d 100644 --- a/docs/examples/a6fdd0100cd362df54af6c95d1055c96.asciidoc +++ b/docs/examples/a6fdd0100cd362df54af6c95d1055c96.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-mapping.asciidoc:11 +// indices/get-mapping.asciidoc:17 [source, python] ---- diff --git a/docs/examples/a72613de3774571ba24def4b495161b5.asciidoc b/docs/examples/a72613de3774571ba24def4b495161b5.asciidoc index 1742374e6..790292f7e 100644 --- a/docs/examples/a72613de3774571ba24def4b495161b5.asciidoc +++ b/docs/examples/a72613de3774571ba24def4b495161b5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:422 +// indices/put-mapping.asciidoc:428 [source, python] ---- diff --git a/docs/examples/a75765e3fb130421dde6c3c2f12e8acb.asciidoc b/docs/examples/a75765e3fb130421dde6c3c2f12e8acb.asciidoc index 4642ae26e..34aaf2c4c 100644 --- a/docs/examples/a75765e3fb130421dde6c3c2f12e8acb.asciidoc +++ b/docs/examples/a75765e3fb130421dde6c3c2f12e8acb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/claim-connector-sync-job-api.asciidoc:62 +// connector/apis/claim-connector-sync-job-api.asciidoc:69 [source, python] ---- diff --git a/docs/examples/82eff1d681a5d0d1538ef011bb32ab9a.asciidoc b/docs/examples/a769d696bf12f5e9de4b3250646d250c.asciidoc similarity index 83% rename from docs/examples/82eff1d681a5d0d1538ef011bb32ab9a.asciidoc rename to docs/examples/a769d696bf12f5e9de4b3250646d250c.asciidoc index 87c70a6f3..dff590d07 100644 --- a/docs/examples/82eff1d681a5d0d1538ef011bb32ab9a.asciidoc +++ b/docs/examples/a769d696bf12f5e9de4b3250646d250c.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "alibabacloud-ai-search-embeddings", - "pipeline": "alibabacloud_ai_search_embeddings" + "pipeline": "alibabacloud_ai_search_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/a78dfb844d385405d4b0fb0e09b4a5a4.asciidoc b/docs/examples/a78dfb844d385405d4b0fb0e09b4a5a4.asciidoc index 93e49ac7c..470fb6c3a 100644 --- a/docs/examples/a78dfb844d385405d4b0fb0e09b4a5a4.asciidoc +++ b/docs/examples/a78dfb844d385405d4b0fb0e09b4a5a4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:205 +// docs/update.asciidoc:211 [source, python] ---- diff --git a/docs/examples/a7cf31f4b907e4c00132aca75f55790c.asciidoc b/docs/examples/a7cf31f4b907e4c00132aca75f55790c.asciidoc index 189272ce5..8638b6fa9 100644 --- a/docs/examples/a7cf31f4b907e4c00132aca75f55790c.asciidoc +++ b/docs/examples/a7cf31f4b907e4c00132aca75f55790c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/delete-pipeline.asciidoc:73 +// ingest/apis/delete-pipeline.asciidoc:79 [source, python] ---- diff --git a/docs/examples/2826510e4aeb1c0d8dc43d317ed7624a.asciidoc b/docs/examples/a7d814caf2a995d2aeadecc3495011be.asciidoc similarity index 67% rename from docs/examples/2826510e4aeb1c0d8dc43d317ed7624a.asciidoc rename to docs/examples/a7d814caf2a995d2aeadecc3495011be.asciidoc index 088c4262a..5801198e8 100644 --- a/docs/examples/2826510e4aeb1c0d8dc43d317ed7624a.asciidoc +++ b/docs/examples/a7d814caf2a995d2aeadecc3495011be.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/boolean.asciidoc:249 +// mapping/types/boolean.asciidoc:248 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "bool": { "type": "boolean" diff --git a/docs/examples/a811b82ba4632bdd9065829085188bc9.asciidoc b/docs/examples/a811b82ba4632bdd9065829085188bc9.asciidoc index ad8fa8a52..109001514 100644 --- a/docs/examples/a811b82ba4632bdd9065829085188bc9.asciidoc +++ b/docs/examples/a811b82ba4632bdd9065829085188bc9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-api.asciidoc:44 +// snapshot-restore/apis/get-snapshot-api.asciidoc:50 [source, python] ---- diff --git a/docs/examples/a861a89f52008610e813b9f073951c58.asciidoc b/docs/examples/a861a89f52008610e813b9f073951c58.asciidoc index 7d9b3e32a..6cf9dfbf6 100644 --- a/docs/examples/a861a89f52008610e813b9f073951c58.asciidoc +++ b/docs/examples/a861a89f52008610e813b9f073951c58.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/stats.asciidoc:129 +// indices/stats.asciidoc:135 [source, python] ---- diff --git a/docs/examples/794d9a321b944347d2a8834a07b5eb22.asciidoc b/docs/examples/a8dff54362184b2732b9bd248cf6df8a.asciidoc similarity index 66% rename from docs/examples/794d9a321b944347d2a8834a07b5eb22.asciidoc rename to docs/examples/a8dff54362184b2732b9bd248cf6df8a.asciidoc index 45c76d191..2881a6771 100644 --- a/docs/examples/794d9a321b944347d2a8834a07b5eb22.asciidoc +++ b/docs/examples/a8dff54362184b2732b9bd248cf6df8a.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/range.asciidoc:394 +// mapping/types/range.asciidoc:418 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "my_range": { "type": "integer_range" diff --git a/docs/examples/a9280b55a7284952f604ec7bece712f6.asciidoc b/docs/examples/a9280b55a7284952f604ec7bece712f6.asciidoc index 2b8beb63d..b67cae301 100644 --- a/docs/examples/a9280b55a7284952f604ec7bece712f6.asciidoc +++ b/docs/examples/a9280b55a7284952f604ec7bece712f6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1188 +// mapping/runtime.asciidoc:1186 [source, python] ---- diff --git a/docs/examples/a9554396506888e392a1aee0ca28e6fc.asciidoc b/docs/examples/a9554396506888e392a1aee0ca28e6fc.asciidoc index 4b8648d66..6b99effea 100644 --- a/docs/examples/a9554396506888e392a1aee0ca28e6fc.asciidoc +++ b/docs/examples/a9554396506888e392a1aee0ca28e6fc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:327 +// alias.asciidoc:329 [source, python] ---- diff --git a/docs/examples/a95a123b9f862e52ab1e8f875961c852.asciidoc b/docs/examples/a95a123b9f862e52ab1e8f875961c852.asciidoc index 37a2b6565..e0f8c052a 100644 --- a/docs/examples/a95a123b9f862e52ab1e8f875961c852.asciidoc +++ b/docs/examples/a95a123b9f862e52ab1e8f875961c852.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/search-multiple-indices.asciidoc:90 +// search/search-your-data/search-multiple-indices.asciidoc:124 [source, python] ---- diff --git a/docs/examples/0ba5acede9d43af424e85428e7d35420.asciidoc b/docs/examples/a95ae76fca7c3e273e4bd10323b3caa6.asciidoc similarity index 91% rename from docs/examples/0ba5acede9d43af424e85428e7d35420.asciidoc rename to docs/examples/a95ae76fca7c3e273e4bd10323b3caa6.asciidoc index b1c6f894b..20be5e1e3 100644 --- a/docs/examples/0ba5acede9d43af424e85428e7d35420.asciidoc +++ b/docs/examples/a95ae76fca7c3e273e4bd10323b3caa6.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="azure_openai_embeddings", + id="azure_openai_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/a960b43e720b4934edb74ab4b085ca77.asciidoc b/docs/examples/a960b43e720b4934edb74ab4b085ca77.asciidoc index 6bf107489..b48cffe85 100644 --- a/docs/examples/a960b43e720b4934edb74ab4b085ca77.asciidoc +++ b/docs/examples/a960b43e720b4934edb74ab4b085ca77.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connectors-api.asciidoc:78 +// connector/apis/list-connectors-api.asciidoc:88 [source, python] ---- diff --git a/docs/examples/a985e6b7b2ead9c3f30a9bc97d8b598e.asciidoc b/docs/examples/a985e6b7b2ead9c3f30a9bc97d8b598e.asciidoc index a03a4fe75..11daa71b0 100644 --- a/docs/examples/a985e6b7b2ead9c3f30a9bc97d8b598e.asciidoc +++ b/docs/examples/a985e6b7b2ead9c3f30a9bc97d8b598e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/field-caps.asciidoc:196 +// search/field-caps.asciidoc:201 [source, python] ---- diff --git a/docs/examples/a98692a565904ec0783884d81a7b71fc.asciidoc b/docs/examples/a98692a565904ec0783884d81a7b71fc.asciidoc index d28575ab0..35ca56e9a 100644 --- a/docs/examples/a98692a565904ec0783884d81a7b71fc.asciidoc +++ b/docs/examples/a98692a565904ec0783884d81a7b71fc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/health.asciidoc:81 +// cat/health.asciidoc:87 [source, python] ---- diff --git a/docs/examples/a999b5661bebb802bbbfe04faacf1971.asciidoc b/docs/examples/a999b5661bebb802bbbfe04faacf1971.asciidoc index b8c02fe91..77df3aaa7 100644 --- a/docs/examples/a999b5661bebb802bbbfe04faacf1971.asciidoc +++ b/docs/examples/a999b5661bebb802bbbfe04faacf1971.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:510 +// how-to/size-your-shards.asciidoc:511 [source, python] ---- diff --git a/docs/examples/a9c08023354aa9b9023807962df71d13.asciidoc b/docs/examples/a9c08023354aa9b9023807962df71d13.asciidoc index b80b858fe..9e7df3d34 100644 --- a/docs/examples/a9c08023354aa9b9023807962df71d13.asciidoc +++ b/docs/examples/a9c08023354aa9b9023807962df71d13.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/forcemerge.asciidoc:183 +// indices/forcemerge.asciidoc:189 [source, python] ---- diff --git a/docs/examples/a9dd9595e96c307b8c798beaeb571521.asciidoc b/docs/examples/a9dd9595e96c307b8c798beaeb571521.asciidoc index dd6329c4f..25524cba2 100644 --- a/docs/examples/a9dd9595e96c307b8c798beaeb571521.asciidoc +++ b/docs/examples/a9dd9595e96c307b8c798beaeb571521.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/upgrade-job-model-snapshot.asciidoc:77 +// ml/anomaly-detection/apis/upgrade-job-model-snapshot.asciidoc:83 [source, python] ---- diff --git a/docs/examples/a9f14efc26fdd3c37a71f06c310163d9.asciidoc b/docs/examples/a9f14efc26fdd3c37a71f06c310163d9.asciidoc new file mode 100644 index 000000000..79fb403e2 --- /dev/null +++ b/docs/examples/a9f14efc26fdd3c37a71f06c310163d9.asciidoc @@ -0,0 +1,27 @@ +// This file is autogenerated, DO NOT EDIT +// search/retriever.asciidoc:650 + +[source, python] +---- +resp = client.search( + retriever={ + "text_similarity_reranker": { + "retriever": { + "standard": { + "query": { + "match": { + "text": "How often does the moon hide the sun?" + } + } + } + }, + "field": "text", + "inference_id": "my-elastic-rerank", + "inference_text": "How often does the moon hide the sun?", + "rank_window_size": 100, + "min_score": 0.5 + } + }, +) +print(resp) +---- diff --git a/docs/examples/a9fe70387d9c96a07830e1859c57efbb.asciidoc b/docs/examples/a9fe70387d9c96a07830e1859c57efbb.asciidoc index 013117b0e..fd3951ad4 100644 --- a/docs/examples/a9fe70387d9c96a07830e1859c57efbb.asciidoc +++ b/docs/examples/a9fe70387d9c96a07830e1859c57efbb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-index.asciidoc:148 +// indices/create-index.asciidoc:154 [source, python] ---- diff --git a/docs/examples/aa6282d4bc92c753c4bd7a5b166abece.asciidoc b/docs/examples/aa6282d4bc92c753c4bd7a5b166abece.asciidoc index 10ebcd52e..2bde61912 100644 --- a/docs/examples/aa6282d4bc92c753c4bd7a5b166abece.asciidoc +++ b/docs/examples/aa6282d4bc92c753c4bd7a5b166abece.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/start-trained-model-deployment.asciidoc:160 +// ml/trained-models/apis/start-trained-model-deployment.asciidoc:166 [source, python] ---- diff --git a/docs/examples/aa676d54a59dee87ecd28bcc1edce59b.asciidoc b/docs/examples/aa676d54a59dee87ecd28bcc1edce59b.asciidoc index f921fe239..d6bbbd75a 100644 --- a/docs/examples/aa676d54a59dee87ecd28bcc1edce59b.asciidoc +++ b/docs/examples/aa676d54a59dee87ecd28bcc1edce59b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-alibabacloud-ai-search.asciidoc:172 +// inference/service-alibabacloud-ai-search.asciidoc:192 [source, python] ---- diff --git a/docs/examples/aa7cf5df36b867aee5e3314ac4b4fa68.asciidoc b/docs/examples/aa7cf5df36b867aee5e3314ac4b4fa68.asciidoc index 9b46dc0dd..2008fab55 100644 --- a/docs/examples/aa7cf5df36b867aee5e3314ac4b4fa68.asciidoc +++ b/docs/examples/aa7cf5df36b867aee5e3314ac4b4fa68.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-put.asciidoc:119 +// slm/apis/slm-put.asciidoc:124 [source, python] ---- diff --git a/docs/examples/aa7f62279b487989440d423c1ed4a1c0.asciidoc b/docs/examples/aa7f62279b487989440d423c1ed4a1c0.asciidoc index 3a7f885af..d54d81586 100644 --- a/docs/examples/aa7f62279b487989440d423c1ed4a1c0.asciidoc +++ b/docs/examples/aa7f62279b487989440d423c1ed4a1c0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/restore-snapshot-api.asciidoc:88 +// snapshot-restore/apis/restore-snapshot-api.asciidoc:94 [source, python] ---- diff --git a/docs/examples/aa814309ad5f1630886ba75255b444f5.asciidoc b/docs/examples/aa814309ad5f1630886ba75255b444f5.asciidoc new file mode 100644 index 000000000..9ced73fdc --- /dev/null +++ b/docs/examples/aa814309ad5f1630886ba75255b444f5.asciidoc @@ -0,0 +1,8 @@ +// This file is autogenerated, DO NOT EDIT +// troubleshooting/common-issues/task-queue-backlog.asciidoc:104 + +[source, python] +---- +resp = client.cluster.pending_tasks() +print(resp) +---- diff --git a/docs/examples/aab3de5a8a3fefbe012fc2ed50dfe4d6.asciidoc b/docs/examples/aab3de5a8a3fefbe012fc2ed50dfe4d6.asciidoc index d84bb077f..c991347e3 100644 --- a/docs/examples/aab3de5a8a3fefbe012fc2ed50dfe4d6.asciidoc +++ b/docs/examples/aab3de5a8a3fefbe012fc2ed50dfe4d6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// searchable-snapshots/apis/node-cache-stats.asciidoc:96 +// searchable-snapshots/apis/node-cache-stats.asciidoc:102 [source, python] ---- diff --git a/docs/examples/aab810de3314d5e11bd564ea096785b8.asciidoc b/docs/examples/aab810de3314d5e11bd564ea096785b8.asciidoc new file mode 100644 index 000000000..0fb61ac72 --- /dev/null +++ b/docs/examples/aab810de3314d5e11bd564ea096785b8.asciidoc @@ -0,0 +1,21 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:428 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "bool": { + "filter": [ + { + "term": { + "category.keyword": "Breakfast" + } + } + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/aaba346e0becdf12db13658296e0b8a1.asciidoc b/docs/examples/aaba346e0becdf12db13658296e0b8a1.asciidoc index e775fb30d..1969a302d 100644 --- a/docs/examples/aaba346e0becdf12db13658296e0b8a1.asciidoc +++ b/docs/examples/aaba346e0becdf12db13658296e0b8a1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/error-handling.asciidoc:38 +// ilm/error-handling.asciidoc:42 [source, python] ---- diff --git a/docs/examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc b/docs/examples/aad7d80990a6a3c391ff555ce09ae9dc.asciidoc similarity index 65% rename from docs/examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc rename to docs/examples/aad7d80990a6a3c391ff555ce09ae9dc.asciidoc index 07bbf1dbd..adf825bb3 100644 --- a/docs/examples/0e5db64154a722a5cbdb84b588ce2ce8.asciidoc +++ b/docs/examples/aad7d80990a6a3c391ff555ce09ae9dc.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/numeric.asciidoc:287 +// mapping/types/numeric.asciidoc:295 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "f": { "type": "scaled_float", diff --git a/docs/examples/ab24bfdfd8c1c7b3044b21a3b4684370.asciidoc b/docs/examples/ab24bfdfd8c1c7b3044b21a3b4684370.asciidoc index 3d433144a..538069d22 100644 --- a/docs/examples/ab24bfdfd8c1c7b3044b21a3b4684370.asciidoc +++ b/docs/examples/ab24bfdfd8c1c7b3044b21a3b4684370.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/fields.asciidoc:94 +// scripting/fields.asciidoc:167 [source, python] ---- diff --git a/docs/examples/ab8b4537fad80107bc88f633d4039a52.asciidoc b/docs/examples/ab8b4537fad80107bc88f633d4039a52.asciidoc index 74d6fa5df..f1e5f2da2 100644 --- a/docs/examples/ab8b4537fad80107bc88f633d4039a52.asciidoc +++ b/docs/examples/ab8b4537fad80107bc88f633d4039a52.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-index.asciidoc:210 +// indices/create-index.asciidoc:216 [source, python] ---- diff --git a/docs/examples/ab8de34fcfc0277901cb39618ecfc9d5.asciidoc b/docs/examples/ab8de34fcfc0277901cb39618ecfc9d5.asciidoc index 9b2ff6473..e3ea8cd47 100644 --- a/docs/examples/ab8de34fcfc0277901cb39618ecfc9d5.asciidoc +++ b/docs/examples/ab8de34fcfc0277901cb39618ecfc9d5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/allocation-explain.asciidoc:102 +// cluster/allocation-explain.asciidoc:108 [source, python] ---- diff --git a/docs/examples/abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc b/docs/examples/abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc index 94b61315a..2c6b64a28 100644 --- a/docs/examples/abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc +++ b/docs/examples/abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:748 +// docs/update-by-query.asciidoc:754 [source, python] ---- diff --git a/docs/examples/abdbc81e799e28c833556b1c29f03ba6.asciidoc b/docs/examples/abdbc81e799e28c833556b1c29f03ba6.asciidoc index e2b8bbbe6..a71cdd46d 100644 --- a/docs/examples/abdbc81e799e28c833556b1c29f03ba6.asciidoc +++ b/docs/examples/abdbc81e799e28c833556b1c29f03ba6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-users.asciidoc:113 +// rest-api/security/get-users.asciidoc:118 [source, python] ---- diff --git a/docs/examples/ac22cc2b0f4ad659055feed2852a2d59.asciidoc b/docs/examples/ac22cc2b0f4ad659055feed2852a2d59.asciidoc new file mode 100644 index 000000000..b722f9c00 --- /dev/null +++ b/docs/examples/ac22cc2b0f4ad659055feed2852a2d59.asciidoc @@ -0,0 +1,39 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:1485 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "text_similarity_reranker": { + "retriever": { + "text_similarity_reranker": { + "retriever": { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + }, + "rank_window_size": 100, + "field": "text", + "inference_id": "my-rerank-model", + "inference_text": "What are the state of the art applications of AI in information retrieval?" + } + }, + "rank_window_size": 10, + "field": "text", + "inference_id": "my-other-more-expensive-rerank-model", + "inference_text": "Applications of Large Language Models in technology and their impact on user satisfaction" + } + }, + source=False, +) +print(resp) +---- diff --git a/docs/examples/ac497917ef707538198a8458ae3d5c6b.asciidoc b/docs/examples/ac497917ef707538198a8458ae3d5c6b.asciidoc index 63187d6b3..d0c229186 100644 --- a/docs/examples/ac497917ef707538198a8458ae3d5c6b.asciidoc +++ b/docs/examples/ac497917ef707538198a8458ae3d5c6b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/match-query.asciidoc:161 +// query-dsl/match-query.asciidoc:165 [source, python] ---- diff --git a/docs/examples/f9cb2547ab04461a12bfd25a35be5f96.asciidoc b/docs/examples/ac5b91aa75696f9880451c9439fd9eec.asciidoc similarity index 73% rename from docs/examples/f9cb2547ab04461a12bfd25a35be5f96.asciidoc rename to docs/examples/ac5b91aa75696f9880451c9439fd9eec.asciidoc index ebf203e52..84f62b3bf 100644 --- a/docs/examples/f9cb2547ab04461a12bfd25a35be5f96.asciidoc +++ b/docs/examples/ac5b91aa75696f9880451c9439fd9eec.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/range.asciidoc:429 +// mapping/types/range.asciidoc:461 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "my_range": { "type": "date_range" diff --git a/docs/examples/ac85e05c0bf2fd5099fbcb9c492f447e.asciidoc b/docs/examples/ac85e05c0bf2fd5099fbcb9c492f447e.asciidoc index b53368172..ffc3002f0 100644 --- a/docs/examples/ac85e05c0bf2fd5099fbcb9c492f447e.asciidoc +++ b/docs/examples/ac85e05c0bf2fd5099fbcb9c492f447e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/update-settings.asciidoc:68 +// cluster/update-settings.asciidoc:73 [source, python] ---- diff --git a/docs/examples/ac9fe9b64891095bcf84066f719b3dc4.asciidoc b/docs/examples/ac9fe9b64891095bcf84066f719b3dc4.asciidoc index 2b0c50721..c65434081 100644 --- a/docs/examples/ac9fe9b64891095bcf84066f719b3dc4.asciidoc +++ b/docs/examples/ac9fe9b64891095bcf84066f719b3dc4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/repository-source-only.asciidoc:38 +// snapshot-restore/repository-source-only.asciidoc:41 [source, python] ---- diff --git a/docs/examples/acb10091ad335ddd15d71021aaf23c62.asciidoc b/docs/examples/acb10091ad335ddd15d71021aaf23c62.asciidoc index 376de04ba..ba72e08ea 100644 --- a/docs/examples/acb10091ad335ddd15d71021aaf23c62.asciidoc +++ b/docs/examples/acb10091ad335ddd15d71021aaf23c62.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:629 +// search/search-your-data/sort-search-results.asciidoc:631 [source, python] ---- diff --git a/docs/examples/acb850c08f51226eadb75be09e336076.asciidoc b/docs/examples/acb850c08f51226eadb75be09e336076.asciidoc index 959f8d18b..8eb4dcb33 100644 --- a/docs/examples/acb850c08f51226eadb75be09e336076.asciidoc +++ b/docs/examples/acb850c08f51226eadb75be09e336076.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/async-search.asciidoc:253 +// search/async-search.asciidoc:259 [source, python] ---- diff --git a/docs/examples/8f0a3d7b5fbdf5351750a23c493cc078.asciidoc b/docs/examples/acc44366a9908684b2c8c2b119a4fb2b.asciidoc similarity index 56% rename from docs/examples/8f0a3d7b5fbdf5351750a23c493cc078.asciidoc rename to docs/examples/acc44366a9908684b2c8c2b119a4fb2b.asciidoc index 769097bfb..daf9f50cf 100644 --- a/docs/examples/8f0a3d7b5fbdf5351750a23c493cc078.asciidoc +++ b/docs/examples/acc44366a9908684b2c8c2b119a4fb2b.asciidoc @@ -1,15 +1,19 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/search-using-query-rules.asciidoc:200 +// search/search-your-data/search-using-query-rules.asciidoc:202 [source, python] ---- resp = client.search( index="my-index-000001", - query={ + retriever={ "rule": { - "organic": { - "query_string": { - "query": "puggles" + "retriever": { + "standard": { + "query": { + "query_string": { + "query": "puggles" + } + } } }, "match_criteria": { diff --git a/docs/examples/ad2b8aed84c67cdc295917b47a12d3dc.asciidoc b/docs/examples/ad2b8aed84c67cdc295917b47a12d3dc.asciidoc index 3744722f8..ed67692fc 100644 --- a/docs/examples/ad2b8aed84c67cdc295917b47a12d3dc.asciidoc +++ b/docs/examples/ad2b8aed84c67cdc295917b47a12d3dc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/knn-query.asciidoc:42 +// query-dsl/knn-query.asciidoc:43 [source, python] ---- diff --git a/docs/examples/ad3b159657d4bcb373623fdc61acc3bf.asciidoc b/docs/examples/ad3b159657d4bcb373623fdc61acc3bf.asciidoc index e6101c4b9..82e77bf11 100644 --- a/docs/examples/ad3b159657d4bcb373623fdc61acc3bf.asciidoc +++ b/docs/examples/ad3b159657d4bcb373623fdc61acc3bf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/count.asciidoc:10 +// search/count.asciidoc:16 [source, python] ---- diff --git a/docs/examples/ad88e46bb06739991498dee248850223.asciidoc b/docs/examples/ad88e46bb06739991498dee248850223.asciidoc index 7b3e08bcb..83c9b17fd 100644 --- a/docs/examples/ad88e46bb06739991498dee248850223.asciidoc +++ b/docs/examples/ad88e46bb06739991498dee248850223.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/thread_pool.asciidoc:136 +// cat/thread_pool.asciidoc:142 [source, python] ---- diff --git a/docs/examples/ad92a1a8bb1b0f26d1536fe8ba4ffd17.asciidoc b/docs/examples/ad92a1a8bb1b0f26d1536fe8ba4ffd17.asciidoc index dd83f695e..4f80d30ef 100644 --- a/docs/examples/ad92a1a8bb1b0f26d1536fe8ba4ffd17.asciidoc +++ b/docs/examples/ad92a1a8bb1b0f26d1536fe8ba4ffd17.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/render-search-template-api.asciidoc:33 +// search/render-search-template-api.asciidoc:39 [source, python] ---- diff --git a/docs/examples/ad9889fd8a4b5930e312a51f3bc996dc.asciidoc b/docs/examples/ad9889fd8a4b5930e312a51f3bc996dc.asciidoc new file mode 100644 index 000000000..1a8d6ba81 --- /dev/null +++ b/docs/examples/ad9889fd8a4b5930e312a51f3bc996dc.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-elasticsearch.asciidoc:140 + +[source, python] +---- +resp = client.inference.put( + task_type="sparse_embedding", + inference_id="my-elser-model", + inference_config={ + "service": "elasticsearch", + "service_settings": { + "adaptive_allocations": { + "enabled": True, + "min_number_of_allocations": 1, + "max_number_of_allocations": 4 + }, + "num_threads": 1, + "model_id": ".elser_model_2" + } + }, +) +print(resp) +---- diff --git a/docs/examples/adc18ca0c344d81d68ec3b9422b54ff5.asciidoc b/docs/examples/adc18ca0c344d81d68ec3b9422b54ff5.asciidoc index c4abb1185..bdd6602d9 100644 --- a/docs/examples/adc18ca0c344d81d68ec3b9422b54ff5.asciidoc +++ b/docs/examples/adc18ca0c344d81d68ec3b9422b54ff5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/multi-search.asciidoc:312 +// search/multi-search.asciidoc:318 [source, python] ---- diff --git a/docs/examples/adced6e22ef03c2ae3b14aa5bdd24fd9.asciidoc b/docs/examples/adced6e22ef03c2ae3b14aa5bdd24fd9.asciidoc new file mode 100644 index 000000000..d3a25bc3d --- /dev/null +++ b/docs/examples/adced6e22ef03c2ae3b14aa5bdd24fd9.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/data-stream-reindex-status.asciidoc:130 + +[source, python] +---- +resp = client.indices.get_migrate_reindex_status( + index="my-data-stream", +) +print(resp) +---- diff --git a/docs/examples/add82cbe7cd95c4be5ce1c9958f2f208.asciidoc b/docs/examples/add82cbe7cd95c4be5ce1c9958f2f208.asciidoc new file mode 100644 index 000000000..a6715d19e --- /dev/null +++ b/docs/examples/add82cbe7cd95c4be5ce1c9958f2f208.asciidoc @@ -0,0 +1,20 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:335 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "multi_match": { + "query": "vegetarian curry", + "fields": [ + "title^3", + "description^2", + "tags" + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/adf36e2d8fc05c3719c91912481c4e19.asciidoc b/docs/examples/adf36e2d8fc05c3719c91912481c4e19.asciidoc index e78abe0de..3a7314c80 100644 --- a/docs/examples/adf36e2d8fc05c3719c91912481c4e19.asciidoc +++ b/docs/examples/adf36e2d8fc05c3719c91912481c4e19.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/enable-users.asciidoc:44 +// rest-api/security/enable-users.asciidoc:50 [source, python] ---- diff --git a/docs/examples/ae3473adaf1515afcf7773f26c018e5c.asciidoc b/docs/examples/ae3473adaf1515afcf7773f26c018e5c.asciidoc new file mode 100644 index 000000000..262513d43 --- /dev/null +++ b/docs/examples/ae3473adaf1515afcf7773f26c018e5c.asciidoc @@ -0,0 +1,14 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-zoom.asciidoc:60 + +[source, python] +---- +resp = client.connector.put( + connector_id="my-{service-name-stub}-connector", + index_name="my-elasticsearch-index", + name="Content synced from {service-name}", + service_type="{service-name-stub}", + is_native=True, +) +print(resp) +---- diff --git a/docs/examples/ae4aa368617637a390074535df86e64b.asciidoc b/docs/examples/ae4aa368617637a390074535df86e64b.asciidoc index 86c8a2122..586e248d5 100644 --- a/docs/examples/ae4aa368617637a390074535df86e64b.asciidoc +++ b/docs/examples/ae4aa368617637a390074535df86e64b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/common/apis/set-upgrade-mode.asciidoc:74 +// ml/common/apis/set-upgrade-mode.asciidoc:80 [source, python] ---- diff --git a/docs/examples/ae82eb17c23cb8e5761cb6240a5ed0a6.asciidoc b/docs/examples/ae82eb17c23cb8e5761cb6240a5ed0a6.asciidoc index 92158eaad..99c88443b 100644 --- a/docs/examples/ae82eb17c23cb8e5761cb6240a5ed0a6.asciidoc +++ b/docs/examples/ae82eb17c23cb8e5761cb6240a5ed0a6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/put-dfanalytics.asciidoc:787 +// ml/df-analytics/apis/put-dfanalytics.asciidoc:793 [source, python] ---- diff --git a/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc b/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc index 1651f5822..0e01584d8 100644 --- a/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc +++ b/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/bulk.asciidoc:499 +// docs/bulk.asciidoc:509 [source, python] ---- diff --git a/docs/examples/aeaa97939a05f5b2f3f2c43b771f35e3.asciidoc b/docs/examples/aeaa97939a05f5b2f3f2c43b771f35e3.asciidoc index bdc24bf70..4801a2961 100644 --- a/docs/examples/aeaa97939a05f5b2f3f2c43b771f35e3.asciidoc +++ b/docs/examples/aeaa97939a05f5b2f3f2c43b771f35e3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:310 +// docs/termvectors.asciidoc:316 [source, python] ---- diff --git a/docs/examples/aee4734ee63dbbbd12a21ee886f7a829.asciidoc b/docs/examples/aee4734ee63dbbbd12a21ee886f7a829.asciidoc index cb793773a..e9097b421 100644 --- a/docs/examples/aee4734ee63dbbbd12a21ee886f7a829.asciidoc +++ b/docs/examples/aee4734ee63dbbbd12a21ee886f7a829.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:546 +// search/search-your-data/sort-search-results.asciidoc:548 [source, python] ---- diff --git a/docs/examples/af18f5c5fb2364ae23c6a14431820aba.asciidoc b/docs/examples/af18f5c5fb2364ae23c6a14431820aba.asciidoc index f89b0e83c..6607a5085 100644 --- a/docs/examples/af18f5c5fb2364ae23c6a14431820aba.asciidoc +++ b/docs/examples/af18f5c5fb2364ae23c6a14431820aba.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/enrich/get-enrich-policy.asciidoc:88 +// ingest/apis/enrich/get-enrich-policy.asciidoc:94 [source, python] ---- diff --git a/docs/examples/af517b6936fa41d124d68b107b2efdc3.asciidoc b/docs/examples/af517b6936fa41d124d68b107b2efdc3.asciidoc index 2835b2069..fff63c281 100644 --- a/docs/examples/af517b6936fa41d124d68b107b2efdc3.asciidoc +++ b/docs/examples/af517b6936fa41d124d68b107b2efdc3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/delete-lifecycle.asciidoc:76 +// ilm/apis/delete-lifecycle.asciidoc:82 [source, python] ---- diff --git a/docs/examples/af607715d0693587dd12962266359a96.asciidoc b/docs/examples/af607715d0693587dd12962266359a96.asciidoc index c05664775..afd7cc471 100644 --- a/docs/examples/af607715d0693587dd12962266359a96.asciidoc +++ b/docs/examples/af607715d0693587dd12962266359a96.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/repository-s3.asciidoc:225 +// snapshot-restore/repository-s3.asciidoc:232 [source, python] ---- diff --git a/docs/examples/af91019991bee136df5460e2fd4ac72a.asciidoc b/docs/examples/af91019991bee136df5460e2fd4ac72a.asciidoc index 30977ee75..207f8fade 100644 --- a/docs/examples/af91019991bee136df5460e2fd4ac72a.asciidoc +++ b/docs/examples/af91019991bee136df5460e2fd4ac72a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:237 +// indices/rollover-index.asciidoc:243 [source, python] ---- diff --git a/docs/examples/af970eb8b93cdea52209e1256eba9d8c.asciidoc b/docs/examples/af970eb8b93cdea52209e1256eba9d8c.asciidoc index 04a36f456..ff65558a3 100644 --- a/docs/examples/af970eb8b93cdea52209e1256eba9d8c.asciidoc +++ b/docs/examples/af970eb8b93cdea52209e1256eba9d8c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shard-stores.asciidoc:124 +// indices/shard-stores.asciidoc:130 [source, python] ---- diff --git a/docs/examples/afbea723c4ba0d50c67d04ebb73a4101.asciidoc b/docs/examples/afbea723c4ba0d50c67d04ebb73a4101.asciidoc index 97e849ed6..3e12c53f2 100644 --- a/docs/examples/afbea723c4ba0d50c67d04ebb73a4101.asciidoc +++ b/docs/examples/afbea723c4ba0d50c67d04ebb73a4101.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search-application/apis/delete-search-application.asciidoc:70 +// search-application/apis/delete-search-application.asciidoc:75 [source, python] ---- diff --git a/docs/examples/afc0a9cffc0100797a3f093094394763.asciidoc b/docs/examples/afc0a9cffc0100797a3f093094394763.asciidoc index a7d9d4dd4..46d056150 100644 --- a/docs/examples/afc0a9cffc0100797a3f093094394763.asciidoc +++ b/docs/examples/afc0a9cffc0100797a3f093094394763.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/saml-invalidate-api.asciidoc:82 +// rest-api/security/saml-invalidate-api.asciidoc:88 [source, python] ---- diff --git a/docs/examples/afe30f159937b38d74c869570cfcd369.asciidoc b/docs/examples/afe30f159937b38d74c869570cfcd369.asciidoc index 844a2f7cd..72df106f6 100644 --- a/docs/examples/afe30f159937b38d74c869570cfcd369.asciidoc +++ b/docs/examples/afe30f159937b38d74c869570cfcd369.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/restore-snapshot-api.asciidoc:268 +// snapshot-restore/apis/restore-snapshot-api.asciidoc:274 [source, python] ---- diff --git a/docs/examples/afe87a2850326e0328fbebbefec2e839.asciidoc b/docs/examples/afe87a2850326e0328fbebbefec2e839.asciidoc index 8a84f7103..689fa2c78 100644 --- a/docs/examples/afe87a2850326e0328fbebbefec2e839.asciidoc +++ b/docs/examples/afe87a2850326e0328fbebbefec2e839.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-shards.asciidoc:171 +// search/search-shards.asciidoc:177 [source, python] ---- diff --git a/docs/examples/afef5cac988592b97ae289ab39c2f437.asciidoc b/docs/examples/afef5cac988592b97ae289ab39c2f437.asciidoc index b669c17e3..681761170 100644 --- a/docs/examples/afef5cac988592b97ae289ab39c2f437.asciidoc +++ b/docs/examples/afef5cac988592b97ae289ab39c2f437.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/text.asciidoc:295 +// mapping/types/text.asciidoc:307 [source, python] ---- diff --git a/docs/examples/b02e4907c9936c1adc16ccce9d49900d.asciidoc b/docs/examples/b02e4907c9936c1adc16ccce9d49900d.asciidoc index bb7fc6ce1..f88cd7811 100644 --- a/docs/examples/b02e4907c9936c1adc16ccce9d49900d.asciidoc +++ b/docs/examples/b02e4907c9936c1adc16ccce9d49900d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/health.asciidoc:159 +// cluster/health.asciidoc:165 [source, python] ---- diff --git a/docs/examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc b/docs/examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc index 2ac514f11..d3c2b9d84 100644 --- a/docs/examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc +++ b/docs/examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc @@ -5,7 +5,6 @@ ---- resp = client.search_application.render_query( name="my_search_application", - body=None, ) print(resp) ---- diff --git a/docs/examples/b577e7e7eb5ce9d16cb582356e2cc45c.asciidoc b/docs/examples/b0ee6f19875fe5bad8aab02d60e3532c.asciidoc similarity index 85% rename from docs/examples/b577e7e7eb5ce9d16cb582356e2cc45c.asciidoc rename to docs/examples/b0ee6f19875fe5bad8aab02d60e3532c.asciidoc index 8a8e061a5..610238476 100644 --- a/docs/examples/b577e7e7eb5ce9d16cb582356e2cc45c.asciidoc +++ b/docs/examples/b0ee6f19875fe5bad8aab02d60e3532c.asciidoc @@ -1,11 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/geoip.asciidoc:83 +// ingest/processors/geoip.asciidoc:85 [source, python] ---- resp = client.ingest.put_pipeline( id="geoip", - description="Add geoip info", + description="Add ip geolocation info", processors=[ { "geoip": { diff --git a/docs/examples/b0fa301cd3c6b9db128e34114f0c1e8f.asciidoc b/docs/examples/b0fa301cd3c6b9db128e34114f0c1e8f.asciidoc index 720cd29ba..23a519fbc 100644 --- a/docs/examples/b0fa301cd3c6b9db128e34114f0c1e8f.asciidoc +++ b/docs/examples/b0fa301cd3c6b9db128e34114f0c1e8f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:105 +// docs/update.asciidoc:111 [source, python] ---- diff --git a/docs/examples/b0fe9a7c8e519995258786be4bef36c4.asciidoc b/docs/examples/b0fe9a7c8e519995258786be4bef36c4.asciidoc index 90b70da87..6ef842f01 100644 --- a/docs/examples/b0fe9a7c8e519995258786be4bef36c4.asciidoc +++ b/docs/examples/b0fe9a7c8e519995258786be4bef36c4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-inference.asciidoc:97 +// search/search-your-data/semantic-search-elser.asciidoc:170 [source, python] ---- diff --git a/docs/examples/b11a0675e49df0709be693297ca73a2c.asciidoc b/docs/examples/b11a0675e49df0709be693297ca73a2c.asciidoc index 8eab9b4d7..d86bed6c9 100644 --- a/docs/examples/b11a0675e49df0709be693297ca73a2c.asciidoc +++ b/docs/examples/b11a0675e49df0709be693297ca73a2c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/info.asciidoc:193 +// rest-api/info.asciidoc:199 [source, python] ---- diff --git a/docs/examples/b16700002af3aa70639f3e88c733bf35.asciidoc b/docs/examples/b16700002af3aa70639f3e88c733bf35.asciidoc index 7667385c2..09c525941 100644 --- a/docs/examples/b16700002af3aa70639f3e88c733bf35.asciidoc +++ b/docs/examples/b16700002af3aa70639f3e88c733bf35.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/point-in-time-api.asciidoc:95 +// search/point-in-time-api.asciidoc:101 [source, python] ---- diff --git a/docs/examples/b176e0d428726705298184ef39ad5cb2.asciidoc b/docs/examples/b176e0d428726705298184ef39ad5cb2.asciidoc index a3853583b..0f2a5076f 100644 --- a/docs/examples/b176e0d428726705298184ef39ad5cb2.asciidoc +++ b/docs/examples/b176e0d428726705298184ef39ad5cb2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:147 +// rest-api/security/create-role-mappings.asciidoc:153 [source, python] ---- diff --git a/docs/examples/b1e81b70b874a1f0cf75a0ec6e430ddc.asciidoc b/docs/examples/b1e81b70b874a1f0cf75a0ec6e430ddc.asciidoc new file mode 100644 index 000000000..bec033a8c --- /dev/null +++ b/docs/examples/b1e81b70b874a1f0cf75a0ec6e430ddc.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// esql/esql-async-query-stop-api.asciidoc:25 + +[source, python] +---- +resp = client.esql.async_query_stop( + id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=", +) +print(resp) +---- diff --git a/docs/examples/b1ee1b0b5f7af596e5f81743cfd3755f.asciidoc b/docs/examples/b1ee1b0b5f7af596e5f81743cfd3755f.asciidoc index e49919089..f98f4b160 100644 --- a/docs/examples/b1ee1b0b5f7af596e5f81743cfd3755f.asciidoc +++ b/docs/examples/b1ee1b0b5f7af596e5f81743cfd3755f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:369 +// indices/rollover-index.asciidoc:375 [source, python] ---- diff --git a/docs/examples/b1efa1c51a34dd5ab5511b71a399f5b1.asciidoc b/docs/examples/b1efa1c51a34dd5ab5511b71a399f5b1.asciidoc index 52dccbd9a..4b66f35f8 100644 --- a/docs/examples/b1efa1c51a34dd5ab5511b71a399f5b1.asciidoc +++ b/docs/examples/b1efa1c51a34dd5ab5511b71a399f5b1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:450 +// docs/reindex.asciidoc:456 [source, python] ---- diff --git a/docs/examples/b22559a7c319f90bc63a41cac1c39b4c.asciidoc b/docs/examples/b22559a7c319f90bc63a41cac1c39b4c.asciidoc index df4bced52..b84d482e7 100644 --- a/docs/examples/b22559a7c319f90bc63a41cac1c39b4c.asciidoc +++ b/docs/examples/b22559a7c319f90bc63a41cac1c39b4c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-api-keys.asciidoc:156 +// rest-api/security/invalidate-api-keys.asciidoc:162 [source, python] ---- diff --git a/docs/examples/b23ed357dce8ec0014708b7b2850a8fb.asciidoc b/docs/examples/b23ed357dce8ec0014708b7b2850a8fb.asciidoc index 068770a3d..a30a7bf5e 100644 --- a/docs/examples/b23ed357dce8ec0014708b7b2850a8fb.asciidoc +++ b/docs/examples/b23ed357dce8ec0014708b7b2850a8fb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/tasks.asciidoc:78 +// cat/tasks.asciidoc:84 [source, python] ---- diff --git a/docs/examples/b2440b492149b705ef107137fdccb0c2.asciidoc b/docs/examples/b2440b492149b705ef107137fdccb0c2.asciidoc index de487a140..a53fd2170 100644 --- a/docs/examples/b2440b492149b705ef107137fdccb0c2.asciidoc +++ b/docs/examples/b2440b492149b705ef107137fdccb0c2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/get-follow-info.asciidoc:28 +// ccr/apis/follow/get-follow-info.asciidoc:34 [source, python] ---- diff --git a/docs/examples/b25256ed615cd837461b0bfa590526b7.asciidoc b/docs/examples/b25256ed615cd837461b0bfa590526b7.asciidoc index 4c2b3480e..216d8f1da 100644 --- a/docs/examples/b25256ed615cd837461b0bfa590526b7.asciidoc +++ b/docs/examples/b25256ed615cd837461b0bfa590526b7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/pause-auto-follow-pattern.asciidoc:79 +// ccr/apis/auto-follow/pause-auto-follow-pattern.asciidoc:85 [source, python] ---- diff --git a/docs/examples/c1bb395546102279296534522061829f.asciidoc b/docs/examples/b3479ee4586c15020549afae58d94d65.asciidoc similarity index 71% rename from docs/examples/c1bb395546102279296534522061829f.asciidoc rename to docs/examples/b3479ee4586c15020549afae58d94d65.asciidoc index 2df09de38..2ae2dff35 100644 --- a/docs/examples/c1bb395546102279296534522061829f.asciidoc +++ b/docs/examples/b3479ee4586c15020549afae58d94d65.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/geo-point.asciidoc:229 +// mapping/types/geo-point.asciidoc:225 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "point": { "type": "geo_point" diff --git a/docs/examples/b3756e700d0f6c7e8919003bdf26bc8f.asciidoc b/docs/examples/b3756e700d0f6c7e8919003bdf26bc8f.asciidoc index 03ee84804..c146919a8 100644 --- a/docs/examples/b3756e700d0f6c7e8919003bdf26bc8f.asciidoc +++ b/docs/examples/b3756e700d0f6c7e8919003bdf26bc8f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/delete-desired-balance.asciidoc:21 +// troubleshooting/troubleshooting-unbalanced-cluster.asciidoc:76 [source, python] ---- diff --git a/docs/examples/b37919cc438b47477343833b4e522408.asciidoc b/docs/examples/b37919cc438b47477343833b4e522408.asciidoc index 527c4a589..234facd65 100644 --- a/docs/examples/b37919cc438b47477343833b4e522408.asciidoc +++ b/docs/examples/b37919cc438b47477343833b4e522408.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:418 +// docs/termvectors.asciidoc:424 [source, python] ---- diff --git a/docs/examples/b3a711c3deddcdb8a3f6623184a8b794.asciidoc b/docs/examples/b3a711c3deddcdb8a3f6623184a8b794.asciidoc index 1bb60badb..8d664f1b6 100644 --- a/docs/examples/b3a711c3deddcdb8a3f6623184a8b794.asciidoc +++ b/docs/examples/b3a711c3deddcdb8a3f6623184a8b794.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:118 +// docs/update.asciidoc:124 [source, python] ---- diff --git a/docs/examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc b/docs/examples/b3cd07f02059165fd62a2f148be3dc58.asciidoc similarity index 73% rename from docs/examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc rename to docs/examples/b3cd07f02059165fd62a2f148be3dc58.asciidoc index 6ece85e77..be7f57a49 100644 --- a/docs/examples/36063ff9a318dba7bb0be3a230655dc8.asciidoc +++ b/docs/examples/b3cd07f02059165fd62a2f148be3dc58.asciidoc @@ -5,10 +5,16 @@ ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "long": { "type": "long" diff --git a/docs/examples/51390ca10aa22d7104e8970f09ea4512.asciidoc b/docs/examples/b3f442a7d9eb391121dcab991787f9d6.asciidoc similarity index 73% rename from docs/examples/51390ca10aa22d7104e8970f09ea4512.asciidoc rename to docs/examples/b3f442a7d9eb391121dcab991787f9d6.asciidoc index 83ee3f394..0f1dbf105 100644 --- a/docs/examples/51390ca10aa22d7104e8970f09ea4512.asciidoc +++ b/docs/examples/b3f442a7d9eb391121dcab991787f9d6.asciidoc @@ -5,10 +5,16 @@ ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "binary": { "type": "binary", diff --git a/docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc b/docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc index 9b704644e..fe563aefe 100644 --- a/docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc +++ b/docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/post-inference.asciidoc:106 +// inference/post-inference.asciidoc:107 [source, python] ---- diff --git a/docs/examples/b47945c7db8868dd36ba079b742f2a90.asciidoc b/docs/examples/b47945c7db8868dd36ba079b742f2a90.asciidoc index 063d7e389..63aa846a0 100644 --- a/docs/examples/b47945c7db8868dd36ba079b742f2a90.asciidoc +++ b/docs/examples/b47945c7db8868dd36ba079b742f2a90.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search-application/apis/put-search-application.asciidoc:197 +// search-application/apis/put-search-application.asciidoc:202 [source, python] ---- diff --git a/docs/examples/b4aec2a1d353852507c091bdb629b765.asciidoc b/docs/examples/b4aec2a1d353852507c091bdb629b765.asciidoc index 8e73e995a..c8e4248f3 100644 --- a/docs/examples/b4aec2a1d353852507c091bdb629b765.asciidoc +++ b/docs/examples/b4aec2a1d353852507c091bdb629b765.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/put-filter.asciidoc:51 +// ml/anomaly-detection/apis/put-filter.asciidoc:57 [source, python] ---- diff --git a/docs/examples/b515427f8685ca7d79176def672d19fa.asciidoc b/docs/examples/b515427f8685ca7d79176def672d19fa.asciidoc index 968ed6448..16018d578 100644 --- a/docs/examples/b515427f8685ca7d79176def672d19fa.asciidoc +++ b/docs/examples/b515427f8685ca7d79176def672d19fa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:612 +// docs/update-by-query.asciidoc:618 [source, python] ---- diff --git a/docs/examples/b583bf8d3a2f49d633aa2cfed5606418.asciidoc b/docs/examples/b583bf8d3a2f49d633aa2cfed5606418.asciidoc index 104cdbd91..797108412 100644 --- a/docs/examples/b583bf8d3a2f49d633aa2cfed5606418.asciidoc +++ b/docs/examples/b583bf8d3a2f49d633aa2cfed5606418.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-component-template.asciidoc:186 +// indices/put-component-template.asciidoc:196 [source, python] ---- diff --git a/docs/examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc b/docs/examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc new file mode 100644 index 000000000..9cec50aa5 --- /dev/null +++ b/docs/examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:299 + +[source, python] +---- +resp = client.search( + index="kibana_sample_data_ecommerce", + size=0, + aggs={ + "avg_order_value": { + "avg": { + "field": "taxful_total_price" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/b5bc1bb7278f2f95bc54790c78c928e0.asciidoc b/docs/examples/b5bc1bb7278f2f95bc54790c78c928e0.asciidoc index 5f3f94bdc..0e8d41aca 100644 --- a/docs/examples/b5bc1bb7278f2f95bc54790c78c928e0.asciidoc +++ b/docs/examples/b5bc1bb7278f2f95bc54790c78c928e0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/get-job.asciidoc:163 +// rollup/apis/get-job.asciidoc:170 [source, python] ---- diff --git a/docs/examples/b607eea422295a3e9acd75f9ed1c8cb7.asciidoc b/docs/examples/b607eea422295a3e9acd75f9ed1c8cb7.asciidoc index c1251db36..799a9e6fc 100644 --- a/docs/examples/b607eea422295a3e9acd75f9ed1c8cb7.asciidoc +++ b/docs/examples/b607eea422295a3e9acd75f9ed1c8cb7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:370 +// search/search-your-data/sort-search-results.asciidoc:372 [source, python] ---- diff --git a/docs/examples/b61afb7ca29a11243232ffcc8b5a43cf.asciidoc b/docs/examples/b61afb7ca29a11243232ffcc8b5a43cf.asciidoc index 115fa8975..1741306a9 100644 --- a/docs/examples/b61afb7ca29a11243232ffcc8b5a43cf.asciidoc +++ b/docs/examples/b61afb7ca29a11243232ffcc8b5a43cf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-field-mapping.asciidoc:165 +// indices/get-field-mapping.asciidoc:171 [source, python] ---- diff --git a/docs/examples/b620ef4400d2f660fe2c67835938442c.asciidoc b/docs/examples/b620ef4400d2f660fe2c67835938442c.asciidoc index 1960d81c3..ac87bba6e 100644 --- a/docs/examples/b620ef4400d2f660fe2c67835938442c.asciidoc +++ b/docs/examples/b620ef4400d2f660fe2c67835938442c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/delete-autoscaling-policy.asciidoc:62 +// autoscaling/apis/delete-autoscaling-policy.asciidoc:68 [source, python] ---- diff --git a/docs/examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc b/docs/examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc index a785417c2..5e79af3af 100644 --- a/docs/examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc +++ b/docs/examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// text-structure/apis/find-field-structure.asciidoc:89 +// text-structure/apis/find-field-structure.asciidoc:95 [source, python] ---- @@ -189,7 +189,6 @@ print(resp) resp1 = client.text_structure.find_field_structure( index="test-logs", field="message", - body=None, ) print(resp1) ---- diff --git a/docs/examples/b66be1daf6c220eb66d94e708b2fae39.asciidoc b/docs/examples/b66be1daf6c220eb66d94e708b2fae39.asciidoc index 8902c863a..aef59ca57 100644 --- a/docs/examples/b66be1daf6c220eb66d94e708b2fae39.asciidoc +++ b/docs/examples/b66be1daf6c220eb66d94e708b2fae39.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/state.asciidoc:144 +// cluster/state.asciidoc:150 [source, python] ---- diff --git a/docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc b/docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc index 16ae792b9..7a0389714 100644 --- a/docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc +++ b/docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/cluster/remote-clusters-migration.asciidoc:96 +// modules/cluster/remote-clusters-migration.asciidoc:97 [source, python] ---- diff --git a/docs/examples/b6a7ffd2003c38f4aa321f067d162be5.asciidoc b/docs/examples/b6a7ffd2003c38f4aa321f067d162be5.asciidoc index 5bcfbbfb9..f75a30daa 100644 --- a/docs/examples/b6a7ffd2003c38f4aa321f067d162be5.asciidoc +++ b/docs/examples/b6a7ffd2003c38f4aa321f067d162be5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-elser.asciidoc:248 +// search/search-your-data/semantic-search-elser.asciidoc:260 [source, python] ---- diff --git a/docs/examples/b6d278737d27973e498ac61cda9e5126.asciidoc b/docs/examples/b6d278737d27973e498ac61cda9e5126.asciidoc new file mode 100644 index 000000000..cb466a7e1 --- /dev/null +++ b/docs/examples/b6d278737d27973e498ac61cda9e5126.asciidoc @@ -0,0 +1,21 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:509 + +[source, python] +---- +resp = client.search( + index="kibana_sample_data_ecommerce", + size=0, + aggs={ + "daily_orders": { + "date_histogram": { + "field": "order_date", + "calendar_interval": "day", + "format": "yyyy-MM-dd", + "min_doc_count": 0 + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/b6e385760e036e36827f719b540d9c11.asciidoc b/docs/examples/b6e385760e036e36827f719b540d9c11.asciidoc index c8743faa1..57c5190f5 100644 --- a/docs/examples/b6e385760e036e36827f719b540d9c11.asciidoc +++ b/docs/examples/b6e385760e036e36827f719b540d9c11.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/profile.asciidoc:1181 +// search/profile.asciidoc:1186 [source, python] ---- diff --git a/docs/examples/b6f690896001f8f9ad5bf24e1304a552.asciidoc b/docs/examples/b6f690896001f8f9ad5bf24e1304a552.asciidoc index 9d4e68d83..c228264e0 100644 --- a/docs/examples/b6f690896001f8f9ad5bf24e1304a552.asciidoc +++ b/docs/examples/b6f690896001f8f9ad5bf24e1304a552.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:158 +// mapping/types/dense-vector.asciidoc:162 [source, python] ---- diff --git a/docs/examples/b728d6ba226dba719aadcd8b8099cc74.asciidoc b/docs/examples/b728d6ba226dba719aadcd8b8099cc74.asciidoc index 73ab3b7f8..6f3abd146 100644 --- a/docs/examples/b728d6ba226dba719aadcd8b8099cc74.asciidoc +++ b/docs/examples/b728d6ba226dba719aadcd8b8099cc74.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:174 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:177 [source, python] ---- diff --git a/docs/examples/b7df0848b2dc3093f931976db5b8cfff.asciidoc b/docs/examples/b7df0848b2dc3093f931976db5b8cfff.asciidoc index eb44d6b47..3e7d9c41b 100644 --- a/docs/examples/b7df0848b2dc3093f931976db5b8cfff.asciidoc +++ b/docs/examples/b7df0848b2dc3093f931976db5b8cfff.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:32 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:38 [source, python] ---- diff --git a/docs/examples/b7f8bd33c22f3c93336ab57c2e091f73.asciidoc b/docs/examples/b7f8bd33c22f3c93336ab57c2e091f73.asciidoc index 45fac83a4..0e2e2908a 100644 --- a/docs/examples/b7f8bd33c22f3c93336ab57c2e091f73.asciidoc +++ b/docs/examples/b7f8bd33c22f3c93336ab57c2e091f73.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-rules/apis/delete-query-rule.asciidoc:72 +// query-rules/apis/delete-query-rule.asciidoc:78 [source, python] ---- diff --git a/docs/examples/b80e1f5b26bae4f3c2f8a604b7caaf17.asciidoc b/docs/examples/b80e1f5b26bae4f3c2f8a604b7caaf17.asciidoc index df7cab9e6..5eba3747c 100644 --- a/docs/examples/b80e1f5b26bae4f3c2f8a604b7caaf17.asciidoc +++ b/docs/examples/b80e1f5b26bae4f3c2f8a604b7caaf17.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:284 +// rest-api/security/create-role-mappings.asciidoc:290 [source, python] ---- diff --git a/docs/examples/b839f79a5d58506baed5714f1876ab55.asciidoc b/docs/examples/b839f79a5d58506baed5714f1876ab55.asciidoc index 59095bc1a..10e3d1228 100644 --- a/docs/examples/b839f79a5d58506baed5714f1876ab55.asciidoc +++ b/docs/examples/b839f79a5d58506baed5714f1876ab55.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// eql/eql-search-api.asciidoc:24 +// eql/eql-search-api.asciidoc:30 [source, python] ---- diff --git a/docs/examples/b8400dbe39215705060500f0e569f452.asciidoc b/docs/examples/b8400dbe39215705060500f0e569f452.asciidoc new file mode 100644 index 000000000..b2122a3d6 --- /dev/null +++ b/docs/examples/b8400dbe39215705060500f0e569f452.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:312 + +[source, python] +---- +resp = client.connector.get( + connector_id="my-connector-id", +) +print(resp) +---- diff --git a/docs/examples/b85716ba42a57096452665c38995da7d.asciidoc b/docs/examples/b85716ba42a57096452665c38995da7d.asciidoc index d6e72e9ce..7110472c4 100644 --- a/docs/examples/b85716ba42a57096452665c38995da7d.asciidoc +++ b/docs/examples/b85716ba42a57096452665c38995da7d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/preview-dfanalytics.asciidoc:69 +// ml/df-analytics/apis/preview-dfanalytics.asciidoc:75 [source, python] ---- diff --git a/docs/examples/b88a2d96da1401d548a4540cca223d27.asciidoc b/docs/examples/b88a2d96da1401d548a4540cca223d27.asciidoc index 87c9d8ad7..eb6b9ac44 100644 --- a/docs/examples/b88a2d96da1401d548a4540cca223d27.asciidoc +++ b/docs/examples/b88a2d96da1401d548a4540cca223d27.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-vector-tile-api.asciidoc:702 +// search/search-vector-tile-api.asciidoc:707 [source, python] ---- diff --git a/docs/examples/b9ba66209b7fcc111a7bcef0b3e00052.asciidoc b/docs/examples/b9ba66209b7fcc111a7bcef0b3e00052.asciidoc new file mode 100644 index 000000000..32a6c03a0 --- /dev/null +++ b/docs/examples/b9ba66209b7fcc111a7bcef0b3e00052.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/passthrough.asciidoc:77 + +[source, python] +---- +resp = client.index( + index="my-index-000001", + id="1", + document={ + "attributes": { + "id": "foo" + }, + "id": "bar" + }, +) +print(resp) +---- diff --git a/docs/examples/357edc9d10e98ed776401c7a439a1a55.asciidoc b/docs/examples/ba0e7e0b18fc9ec6c623d40186d1f61b.asciidoc similarity index 78% rename from docs/examples/357edc9d10e98ed776401c7a439a1a55.asciidoc rename to docs/examples/ba0e7e0b18fc9ec6c623d40186d1f61b.asciidoc index 69fe16b28..c25ea798e 100644 --- a/docs/examples/357edc9d10e98ed776401c7a439a1a55.asciidoc +++ b/docs/examples/ba0e7e0b18fc9ec6c623d40186d1f61b.asciidoc @@ -1,11 +1,12 @@ // This file is autogenerated, DO NOT EDIT -// indices/resolve-cluster.asciidoc:206 +// indices/resolve-cluster.asciidoc:271 [source, python] ---- resp = client.indices.resolve_cluster( name="not-present,clust*:my-index*,oldcluster:*", ignore_unavailable=False, + timeout="5s", ) print(resp) ---- diff --git a/docs/examples/ba10b644a4e9a2e7d78744ca607355d0.asciidoc b/docs/examples/ba10b644a4e9a2e7d78744ca607355d0.asciidoc index 4458c3d08..6d90b2c6e 100644 --- a/docs/examples/ba10b644a4e9a2e7d78744ca607355d0.asciidoc +++ b/docs/examples/ba10b644a4e9a2e7d78744ca607355d0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/put-follow.asciidoc:85 +// ccr/apis/follow/put-follow.asciidoc:91 [source, python] ---- diff --git a/docs/examples/ba21a7fbb74180ff138d97032f28ace7.asciidoc b/docs/examples/ba21a7fbb74180ff138d97032f28ace7.asciidoc index 7895c8e6c..a03ce6cb0 100644 --- a/docs/examples/ba21a7fbb74180ff138d97032f28ace7.asciidoc +++ b/docs/examples/ba21a7fbb74180ff138d97032f28ace7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-user-profile-data.asciidoc:100 +// rest-api/security/update-user-profile-data.asciidoc:106 [source, python] ---- diff --git a/docs/examples/ba6040de55afb2c8fb9e5b24bb038820.asciidoc b/docs/examples/ba6040de55afb2c8fb9e5b24bb038820.asciidoc index 1655222d3..400d32098 100644 --- a/docs/examples/ba6040de55afb2c8fb9e5b24bb038820.asciidoc +++ b/docs/examples/ba6040de55afb2c8fb9e5b24bb038820.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-index-template-v1.asciidoc:88 +// indices/get-index-template-v1.asciidoc:94 [source, python] ---- diff --git a/docs/examples/fe6a21b4a6b33cd6abc522947d6f3ea2.asciidoc b/docs/examples/ba650046f9063f6c43d76f47e0f94403.asciidoc similarity index 67% rename from docs/examples/fe6a21b4a6b33cd6abc522947d6f3ea2.asciidoc rename to docs/examples/ba650046f9063f6c43d76f47e0f94403.asciidoc index f6aaa06b4..9b94f645f 100644 --- a/docs/examples/fe6a21b4a6b33cd6abc522947d6f3ea2.asciidoc +++ b/docs/examples/ba650046f9063f6c43d76f47e0f94403.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/date.asciidoc:249 +// mapping/types/date.asciidoc:244 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "date": { "type": "date" diff --git a/docs/examples/baadbfffcd0c16f51eb3537f516dc3ed.asciidoc b/docs/examples/baadbfffcd0c16f51eb3537f516dc3ed.asciidoc index 3cc6bcd3f..b85e9ca70 100644 --- a/docs/examples/baadbfffcd0c16f51eb3537f516dc3ed.asciidoc +++ b/docs/examples/baadbfffcd0c16f51eb3537f516dc3ed.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/disable-user-profile.asciidoc:59 +// rest-api/security/disable-user-profile.asciidoc:65 [source, python] ---- diff --git a/docs/examples/bb293e1bdf0c6f6d9069eeb7edc9d399.asciidoc b/docs/examples/bb293e1bdf0c6f6d9069eeb7edc9d399.asciidoc index 29b3df548..ec608f476 100644 --- a/docs/examples/bb293e1bdf0c6f6d9069eeb7edc9d399.asciidoc +++ b/docs/examples/bb293e1bdf0c6f6d9069eeb7edc9d399.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/disable-users.asciidoc:45 +// rest-api/security/disable-users.asciidoc:51 [source, python] ---- diff --git a/docs/examples/bb2ba5d1885f87506f90dbb002e518f4.asciidoc b/docs/examples/bb2ba5d1885f87506f90dbb002e518f4.asciidoc new file mode 100644 index 000000000..f1cecf299 --- /dev/null +++ b/docs/examples/bb2ba5d1885f87506f90dbb002e518f4.asciidoc @@ -0,0 +1,49 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:604 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "query_string": { + "query": "(information retrieval) OR (artificial intelligence)", + "default_field": "text" + } + } + } + }, + { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + }, + highlight={ + "fields": { + "text": { + "fragment_size": 150, + "number_of_fragments": 3 + } + } + }, + source=False, +) +print(resp) +---- diff --git a/docs/examples/bb5a67e3d2d9cd3016e487e627769fe8.asciidoc b/docs/examples/bb5a67e3d2d9cd3016e487e627769fe8.asciidoc new file mode 100644 index 000000000..94bea00eb --- /dev/null +++ b/docs/examples/bb5a67e3d2d9cd3016e487e627769fe8.asciidoc @@ -0,0 +1,105 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:129 + +[source, python] +---- +resp = client.bulk( + index="cooking_blog", + refresh="wait_for", + operations=[ + { + "index": { + "_id": "1" + } + }, + { + "title": "Perfect Pancakes: A Fluffy Breakfast Delight", + "description": "Learn the secrets to making the fluffiest pancakes, so amazing you won't believe your tastebuds. This recipe uses buttermilk and a special folding technique to create light, airy pancakes that are perfect for lazy Sunday mornings.", + "author": "Maria Rodriguez", + "date": "2023-05-01", + "category": "Breakfast", + "tags": [ + "pancakes", + "breakfast", + "easy recipes" + ], + "rating": 4.8 + }, + { + "index": { + "_id": "2" + } + }, + { + "title": "Spicy Thai Green Curry: A Vegetarian Adventure", + "description": "Dive into the flavors of Thailand with this vibrant green curry. Packed with vegetables and aromatic herbs, this dish is both healthy and satisfying. Don't worry about the heat - you can easily adjust the spice level to your liking.", + "author": "Liam Chen", + "date": "2023-05-05", + "category": "Main Course", + "tags": [ + "thai", + "vegetarian", + "curry", + "spicy" + ], + "rating": 4.6 + }, + { + "index": { + "_id": "3" + } + }, + { + "title": "Classic Beef Stroganoff: A Creamy Comfort Food", + "description": "Indulge in this rich and creamy beef stroganoff. Tender strips of beef in a savory mushroom sauce, served over a bed of egg noodles. It's the ultimate comfort food for chilly evenings.", + "author": "Emma Watson", + "date": "2023-05-10", + "category": "Main Course", + "tags": [ + "beef", + "pasta", + "comfort food" + ], + "rating": 4.7 + }, + { + "index": { + "_id": "4" + } + }, + { + "title": "Vegan Chocolate Avocado Mousse", + "description": "Discover the magic of avocado in this rich, vegan chocolate mousse. Creamy, indulgent, and secretly healthy, it's the perfect guilt-free dessert for chocolate lovers.", + "author": "Alex Green", + "date": "2023-05-15", + "category": "Dessert", + "tags": [ + "vegan", + "chocolate", + "avocado", + "healthy dessert" + ], + "rating": 4.5 + }, + { + "index": { + "_id": "5" + } + }, + { + "title": "Crispy Oven-Fried Chicken", + "description": "Get that perfect crunch without the deep fryer! This oven-fried chicken recipe delivers crispy, juicy results every time. A healthier take on the classic comfort food.", + "author": "Maria Rodriguez", + "date": "2023-05-20", + "category": "Main Course", + "tags": [ + "chicken", + "oven-fried", + "healthy" + ], + "rating": 4.9 + } + ], +) +print(resp) +---- diff --git a/docs/examples/bb9e268ec62d19ca2a6366cbb48fae68.asciidoc b/docs/examples/bb9e268ec62d19ca2a6366cbb48fae68.asciidoc index 3c0f50533..6545eae47 100644 --- a/docs/examples/bb9e268ec62d19ca2a6366cbb48fae68.asciidoc +++ b/docs/examples/bb9e268ec62d19ca2a6366cbb48fae68.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/count.asciidoc:89 +// cat/count.asciidoc:95 [source, python] ---- diff --git a/docs/examples/bc01aee2ab2ce1690986374bd836e1c7.asciidoc b/docs/examples/bc01aee2ab2ce1690986374bd836e1c7.asciidoc new file mode 100644 index 000000000..f1a16aa7d --- /dev/null +++ b/docs/examples/bc01aee2ab2ce1690986374bd836e1c7.asciidoc @@ -0,0 +1,20 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:317 + +[source, python] +---- +resp = client.search( + index="cooking_blog", + query={ + "multi_match": { + "query": "vegetarian curry", + "fields": [ + "title", + "description", + "tags" + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/bcae0f00ae1e6f08fa395ca741fe84f9.asciidoc b/docs/examples/bcae0f00ae1e6f08fa395ca741fe84f9.asciidoc index a58da8614..90a19379d 100644 --- a/docs/examples/bcae0f00ae1e6f08fa395ca741fe84f9.asciidoc +++ b/docs/examples/bcae0f00ae1e6f08fa395ca741fe84f9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rank-eval.asciidoc:397 +// search/rank-eval.asciidoc:403 [source, python] ---- diff --git a/docs/examples/bcb572658986d69ae17c28ddd7e4bfd8.asciidoc b/docs/examples/bcb572658986d69ae17c28ddd7e4bfd8.asciidoc index 6725aea3d..ba7480151 100644 --- a/docs/examples/bcb572658986d69ae17c28ddd7e4bfd8.asciidoc +++ b/docs/examples/bcb572658986d69ae17c28ddd7e4bfd8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/field-usage-stats.asciidoc:166 +// indices/field-usage-stats.asciidoc:172 [source, python] ---- diff --git a/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc b/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc index 0c0ab5ce9..7d635906f 100644 --- a/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc +++ b/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// quickstart/getting-started.asciidoc:227 +// quickstart/getting-started.asciidoc:419 [source, python] ---- diff --git a/docs/examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc b/docs/examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc new file mode 100644 index 000000000..76f96d817 --- /dev/null +++ b/docs/examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// index-modules/slowlog.asciidoc:102 + +[source, python] +---- +resp = client.indices.get_settings( + index="_all", + expand_wildcards="all", + filter_path="*.settings.index.*.slowlog", +) +print(resp) +---- diff --git a/docs/examples/bcd1afb793240b1dddd9fa5d3f21192b.asciidoc b/docs/examples/bcd1afb793240b1dddd9fa5d3f21192b.asciidoc new file mode 100644 index 000000000..bc2e08cf0 --- /dev/null +++ b/docs/examples/bcd1afb793240b1dddd9fa5d3f21192b.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// docs/update.asciidoc:315 + +[source, python] +---- +resp = client.update( + index="test", + id="1", + doc={ + "product_price": 100 + }, + upsert={ + "product_price": 50 + }, +) +print(resp) +---- diff --git a/docs/examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc b/docs/examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc index 0672fc36d..05c952c57 100644 --- a/docs/examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc +++ b/docs/examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc @@ -1,37 +1,35 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/simulate-ingest.asciidoc:278 +// ingest/apis/simulate-ingest.asciidoc:352 [source, python] ---- resp = client.simulate.ingest( - body={ - "docs": [ - { - "_index": "my-index", - "_id": "123", - "_source": { - "foo": "bar" - } - }, - { - "_index": "my-index", - "_id": "456", - "_source": { - "foo": "rab" - } + docs=[ + { + "_index": "my-index", + "_id": "123", + "_source": { + "foo": "bar" } - ], - "pipeline_substitutions": { - "my-pipeline": { - "processors": [ - { - "uppercase": { - "field": "foo" - } - } - ] + }, + { + "_index": "my-index", + "_id": "456", + "_source": { + "foo": "rab" } } + ], + pipeline_substitutions={ + "my-pipeline": { + "processors": [ + { + "uppercase": { + "field": "foo" + } + } + ] + } }, ) print(resp) diff --git a/docs/examples/bd23c3a03907b1238dcb07ab9eecae7b.asciidoc b/docs/examples/bd23c3a03907b1238dcb07ab9eecae7b.asciidoc index c26a90e71..6e789e961 100644 --- a/docs/examples/bd23c3a03907b1238dcb07ab9eecae7b.asciidoc +++ b/docs/examples/bd23c3a03907b1238dcb07ab9eecae7b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:361 +// docs/update-by-query.asciidoc:367 [source, python] ---- diff --git a/docs/examples/bd3d710ec50a151453e141691163af72.asciidoc b/docs/examples/bd3d710ec50a151453e141691163af72.asciidoc index 2c7c56029..d0315498f 100644 --- a/docs/examples/bd3d710ec50a151453e141691163af72.asciidoc +++ b/docs/examples/bd3d710ec50a151453e141691163af72.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:270 +// cluster/tasks.asciidoc:276 [source, python] ---- diff --git a/docs/examples/bd458073196a19ecdeb24a8016488c20.asciidoc b/docs/examples/bd458073196a19ecdeb24a8016488c20.asciidoc index de4ff9093..5e1f43e88 100644 --- a/docs/examples/bd458073196a19ecdeb24a8016488c20.asciidoc +++ b/docs/examples/bd458073196a19ecdeb24a8016488c20.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/delete-index-template.asciidoc:26 +// indices/delete-index-template.asciidoc:32 [source, python] ---- diff --git a/docs/examples/bd57976bc93ca64b2d3e001df9f06c82.asciidoc b/docs/examples/bd57976bc93ca64b2d3e001df9f06c82.asciidoc index 15a587aaa..29151f6fe 100644 --- a/docs/examples/bd57976bc93ca64b2d3e001df9f06c82.asciidoc +++ b/docs/examples/bd57976bc93ca64b2d3e001df9f06c82.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/resolve.asciidoc:101 +// indices/resolve.asciidoc:107 [source, python] ---- diff --git a/docs/examples/bd5bd5d8b3d81241335fe1e5747080ac.asciidoc b/docs/examples/bd5bd5d8b3d81241335fe1e5747080ac.asciidoc index 93a5c32dc..24c08784c 100644 --- a/docs/examples/bd5bd5d8b3d81241335fe1e5747080ac.asciidoc +++ b/docs/examples/bd5bd5d8b3d81241335fe1e5747080ac.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/error-handling.asciidoc:118 +// ilm/error-handling.asciidoc:122 [source, python] ---- diff --git a/docs/examples/bd68666ca2e0be12f7624016317a62bc.asciidoc b/docs/examples/bd68666ca2e0be12f7624016317a62bc.asciidoc index bdab504e3..c11eee665 100644 --- a/docs/examples/bd68666ca2e0be12f7624016317a62bc.asciidoc +++ b/docs/examples/bd68666ca2e0be12f7624016317a62bc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-stats.asciidoc:2563 +// cluster/nodes-stats.asciidoc:2573 [source, python] ---- diff --git a/docs/examples/bd6f30e3caa3632260da42d9ff82c98c.asciidoc b/docs/examples/bd6f30e3caa3632260da42d9ff82c98c.asciidoc index b9da78352..af92a432c 100644 --- a/docs/examples/bd6f30e3caa3632260da42d9ff82c98c.asciidoc +++ b/docs/examples/bd6f30e3caa3632260da42d9ff82c98c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-api-key-cache.asciidoc:57 +// rest-api/security/clear-api-key-cache.asciidoc:63 [source, python] ---- diff --git a/docs/examples/bd7a1417fc27b5a801334ec44462b376.asciidoc b/docs/examples/bd7a1417fc27b5a801334ec44462b376.asciidoc index 6ba29e06c..09be0234b 100644 --- a/docs/examples/bd7a1417fc27b5a801334ec44462b376.asciidoc +++ b/docs/examples/bd7a1417fc27b5a801334ec44462b376.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/datafeeds.asciidoc:124 +// cat/datafeeds.asciidoc:130 [source, python] ---- diff --git a/docs/examples/63d1c07d22a3ca3b0ec6d950547c011c.asciidoc b/docs/examples/bdaf00d791706d7fde25fd65d3735b94.asciidoc similarity index 67% rename from docs/examples/63d1c07d22a3ca3b0ec6d950547c011c.asciidoc rename to docs/examples/bdaf00d791706d7fde25fd65d3735b94.asciidoc index cc72b2cce..08227226e 100644 --- a/docs/examples/63d1c07d22a3ca3b0ec6d950547c011c.asciidoc +++ b/docs/examples/bdaf00d791706d7fde25fd65d3735b94.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/keyword.asciidoc:189 +// mapping/types/keyword.asciidoc:184 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "kwd": { "type": "keyword" diff --git a/docs/examples/bdb30dd52d32f50994008f4f9c0da5f0.asciidoc b/docs/examples/bdb30dd52d32f50994008f4f9c0da5f0.asciidoc index d7b3c2505..c0d5fa7e2 100644 --- a/docs/examples/bdb30dd52d32f50994008f4f9c0da5f0.asciidoc +++ b/docs/examples/bdb30dd52d32f50994008f4f9c0da5f0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:565 +// docs/update-by-query.asciidoc:571 [source, python] ---- diff --git a/docs/examples/bdc1afd2181154bb78797360f9dbb1a0.asciidoc b/docs/examples/bdc1afd2181154bb78797360f9dbb1a0.asciidoc index 3754d13f6..5728f3c24 100644 --- a/docs/examples/bdc1afd2181154bb78797360f9dbb1a0.asciidoc +++ b/docs/examples/bdc1afd2181154bb78797360f9dbb1a0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/ack-watch.asciidoc:134 +// rest-api/watcher/ack-watch.asciidoc:140 [source, python] ---- diff --git a/docs/examples/bdc55256fa5f701680631a149dbb75a9.asciidoc b/docs/examples/bdc55256fa5f701680631a149dbb75a9.asciidoc new file mode 100644 index 000000000..7699e4d0e --- /dev/null +++ b/docs/examples/bdc55256fa5f701680631a149dbb75a9.asciidoc @@ -0,0 +1,22 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:420 + +[source, python] +---- +resp = client.search( + index="kibana_sample_data_ecommerce", + size=0, + aggs={ + "sales_by_category": { + "terms": { + "field": "category.keyword", + "size": 5, + "order": { + "_count": "desc" + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/bdd28276618235487ac96bd6679bc206.asciidoc b/docs/examples/bdd28276618235487ac96bd6679bc206.asciidoc new file mode 100644 index 000000000..a5bf8f7df --- /dev/null +++ b/docs/examples/bdd28276618235487ac96bd6679bc206.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/aggs-tutorial.asciidoc:1770 + +[source, python] +---- +resp = client.search( + index="kibana_sample_data_ecommerce", + size=0, + aggs={ + "daily_sales": { + "date_histogram": { + "field": "order_date", + "calendar_interval": "day" + }, + "aggs": { + "revenue": { + "sum": { + "field": "taxful_total_price" + } + }, + "cumulative_revenue": { + "cumulative_sum": { + "buckets_path": "revenue" + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/bde74dbbcef8ebf8541cae2c1711255f.asciidoc b/docs/examples/bde74dbbcef8ebf8541cae2c1711255f.asciidoc index 1e4a1811f..df2a86237 100644 --- a/docs/examples/bde74dbbcef8ebf8541cae2c1711255f.asciidoc +++ b/docs/examples/bde74dbbcef8ebf8541cae2c1711255f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search-application/apis/get-search-application.asciidoc:88 +// search-application/apis/get-search-application.asciidoc:93 [source, python] ---- diff --git a/docs/examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc b/docs/examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc index aede29898..ab9ea6048 100644 --- a/docs/examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc +++ b/docs/examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:526 +// docs/update-by-query.asciidoc:532 [source, python] ---- diff --git a/docs/examples/be5b415d7f33d6f0397ac2f8b5c10521.asciidoc b/docs/examples/be5b415d7f33d6f0397ac2f8b5c10521.asciidoc index efc1ccbce..fce193164 100644 --- a/docs/examples/be5b415d7f33d6f0397ac2f8b5c10521.asciidoc +++ b/docs/examples/be5b415d7f33d6f0397ac2f8b5c10521.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:641 +// docs/update-by-query.asciidoc:647 [source, python] ---- diff --git a/docs/examples/be5c5a9c25901737585e4fff9195da3c.asciidoc b/docs/examples/be5c5a9c25901737585e4fff9195da3c.asciidoc index 0959081b9..1590cce0b 100644 --- a/docs/examples/be5c5a9c25901737585e4fff9195da3c.asciidoc +++ b/docs/examples/be5c5a9c25901737585e4fff9195da3c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:406 +// mapping/types/dense-vector.asciidoc:435 [source, python] ---- diff --git a/docs/examples/be5fef0640c3a650ee96f84e3376a1be.asciidoc b/docs/examples/be5fef0640c3a650ee96f84e3376a1be.asciidoc index d57c9b600..2c5b4ba3a 100644 --- a/docs/examples/be5fef0640c3a650ee96f84e3376a1be.asciidoc +++ b/docs/examples/be5fef0640c3a650ee96f84e3376a1be.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:333 +// docs/update.asciidoc:335 [source, python] ---- diff --git a/docs/examples/be6b0bfcdce1ef100af89f74da5d4748.asciidoc b/docs/examples/be6b0bfcdce1ef100af89f74da5d4748.asciidoc index e049ea57e..b0059ab57 100644 --- a/docs/examples/be6b0bfcdce1ef100af89f74da5d4748.asciidoc +++ b/docs/examples/be6b0bfcdce1ef100af89f74da5d4748.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/put-trained-model-definition-part.asciidoc:64 +// ml/trained-models/apis/put-trained-model-definition-part.asciidoc:70 [source, python] ---- diff --git a/docs/examples/be9836fe55c5fada404a2adc1663d832.asciidoc b/docs/examples/be9836fe55c5fada404a2adc1663d832.asciidoc index 8a151046b..0e75ab6c5 100644 --- a/docs/examples/be9836fe55c5fada404a2adc1663d832.asciidoc +++ b/docs/examples/be9836fe55c5fada404a2adc1663d832.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1437 +// mapping/runtime.asciidoc:1435 [source, python] ---- diff --git a/docs/examples/beaf43b274b0f32cf3cf48f59e5cb1f2.asciidoc b/docs/examples/beaf43b274b0f32cf3cf48f59e5cb1f2.asciidoc index 3248655ee..81658ef75 100644 --- a/docs/examples/beaf43b274b0f32cf3cf48f59e5cb1f2.asciidoc +++ b/docs/examples/beaf43b274b0f32cf3cf48f59e5cb1f2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-api.asciidoc:745 +// snapshot-restore/apis/get-snapshot-api.asciidoc:751 [source, python] ---- diff --git a/docs/examples/beb0b9ff4f68672273fcff1b7bae706b.asciidoc b/docs/examples/beb0b9ff4f68672273fcff1b7bae706b.asciidoc index 916bf24f0..4f6931ca5 100644 --- a/docs/examples/beb0b9ff4f68672273fcff1b7bae706b.asciidoc +++ b/docs/examples/beb0b9ff4f68672273fcff1b7bae706b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:405 +// indices/put-mapping.asciidoc:411 [source, python] ---- diff --git a/docs/examples/befa73a8a419fcf3b7798548b54a20bf.asciidoc b/docs/examples/befa73a8a419fcf3b7798548b54a20bf.asciidoc new file mode 100644 index 000000000..7bd330d62 --- /dev/null +++ b/docs/examples/befa73a8a419fcf3b7798548b54a20bf.asciidoc @@ -0,0 +1,47 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/knn-search.asciidoc:1146 + +[source, python] +---- +resp = client.search( + index="my-index", + size=10, + knn={ + "query_vector": [ + 0.04283529, + 0.85670587, + -0.51402352, + 0 + ], + "field": "my_int4_vector", + "k": 20, + "num_candidates": 50 + }, + rescore={ + "window_size": 20, + "query": { + "rescore_query": { + "script_score": { + "query": { + "match_all": {} + }, + "script": { + "source": "(dotProduct(params.queryVector, 'my_int4_vector') + 1.0)", + "params": { + "queryVector": [ + 0.04283529, + 0.85670587, + -0.51402352, + 0 + ] + } + } + } + }, + "query_weight": 0, + "rescore_query_weight": 1 + } + }, +) +print(resp) +---- diff --git a/docs/examples/bf1de9fa1b825fa875d27fa08821a6d1.asciidoc b/docs/examples/bf1de9fa1b825fa875d27fa08821a6d1.asciidoc index 767c6efdf..7e2332729 100644 --- a/docs/examples/bf1de9fa1b825fa875d27fa08821a6d1.asciidoc +++ b/docs/examples/bf1de9fa1b825fa875d27fa08821a6d1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-across-clusters.asciidoc:114 +// esql/esql-across-clusters.asciidoc:119 [source, python] ---- diff --git a/docs/examples/bf3c3bc41c593a80faebef1df353e483.asciidoc b/docs/examples/bf3c3bc41c593a80faebef1df353e483.asciidoc new file mode 100644 index 000000000..7ea310dd1 --- /dev/null +++ b/docs/examples/bf3c3bc41c593a80faebef1df353e483.asciidoc @@ -0,0 +1,22 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-jinaai.asciidoc:169 + +[source, python] +---- +resp = client.inference.put( + task_type="rerank", + inference_id="jinaai-rerank", + inference_config={ + "service": "jinaai", + "service_settings": { + "api_key": "", + "model_id": "jina-reranker-v2-base-multilingual" + }, + "task_settings": { + "top_n": 10, + "return_documents": True + } + }, +) +print(resp) +---- diff --git a/docs/examples/bf3f520b47581d861e802730aaf2a519.asciidoc b/docs/examples/bf3f520b47581d861e802730aaf2a519.asciidoc index dfc5bc6f9..87ce2230e 100644 --- a/docs/examples/bf3f520b47581d861e802730aaf2a519.asciidoc +++ b/docs/examples/bf3f520b47581d861e802730aaf2a519.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:33 +// alias.asciidoc:35 [source, python] ---- diff --git a/docs/examples/bfb8a15cd05b43094ffbce8078bad3e1.asciidoc b/docs/examples/bfb8a15cd05b43094ffbce8078bad3e1.asciidoc index 2b3be1a00..23d0c7749 100644 --- a/docs/examples/bfb8a15cd05b43094ffbce8078bad3e1.asciidoc +++ b/docs/examples/bfb8a15cd05b43094ffbce8078bad3e1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-api.asciidoc:351 +// snapshot-restore/apis/get-snapshot-api.asciidoc:357 [source, python] ---- diff --git a/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc b/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc index 1cca191c4..f252a8b5a 100644 --- a/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc +++ b/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/bulk.asciidoc:711 +// docs/bulk.asciidoc:721 [source, python] ---- diff --git a/docs/examples/c00c9412609832ebceb9e786dd9542df.asciidoc b/docs/examples/c00c9412609832ebceb9e786dd9542df.asciidoc index ea55b13c7..e98a75057 100644 --- a/docs/examples/c00c9412609832ebceb9e786dd9542df.asciidoc +++ b/docs/examples/c00c9412609832ebceb9e786dd9542df.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-name-description-api.asciidoc:79 +// connector/apis/update-connector-name-description-api.asciidoc:85 [source, python] ---- diff --git a/docs/examples/c067182d385f59ce5952fb9a716fbf05.asciidoc b/docs/examples/c067182d385f59ce5952fb9a716fbf05.asciidoc index 4a33d82c0..44ec44783 100644 --- a/docs/examples/c067182d385f59ce5952fb9a716fbf05.asciidoc +++ b/docs/examples/c067182d385f59ce5952fb9a716fbf05.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/post-calendar-event.asciidoc:63 +// ml/anomaly-detection/apis/post-calendar-event.asciidoc:85 [source, python] ---- diff --git a/docs/examples/c088ce5291ae28650b6091cdec489398.asciidoc b/docs/examples/c088ce5291ae28650b6091cdec489398.asciidoc index 283484b2e..275200553 100644 --- a/docs/examples/c088ce5291ae28650b6091cdec489398.asciidoc +++ b/docs/examples/c088ce5291ae28650b6091cdec489398.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/point-in-time-api.asciidoc:49 +// search/point-in-time-api.asciidoc:55 [source, python] ---- diff --git a/docs/examples/c0ddfb2e6315f5bcf0d3ef414b5bbed3.asciidoc b/docs/examples/c0ddfb2e6315f5bcf0d3ef414b5bbed3.asciidoc index d005a58f0..2c089393c 100644 --- a/docs/examples/c0ddfb2e6315f5bcf0d3ef414b5bbed3.asciidoc +++ b/docs/examples/c0ddfb2e6315f5bcf0d3ef414b5bbed3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-configuration-api.asciidoc:335 +// connector/apis/update-connector-configuration-api.asciidoc:342 [source, python] ---- diff --git a/docs/examples/c0ebaa33e750b87555dc352073f692e8.asciidoc b/docs/examples/c0ebaa33e750b87555dc352073f692e8.asciidoc index 8d65ebc46..a0352b7c5 100644 --- a/docs/examples/c0ebaa33e750b87555dc352073f692e8.asciidoc +++ b/docs/examples/c0ebaa33e750b87555dc352073f692e8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/update-settings.asciidoc:181 +// indices/update-settings.asciidoc:187 [source, python] ---- diff --git a/docs/examples/c0ff8b3db994c4736f7579dde18097d2.asciidoc b/docs/examples/c0ff8b3db994c4736f7579dde18097d2.asciidoc index aaccc1288..79ce5358c 100644 --- a/docs/examples/c0ff8b3db994c4736f7579dde18097d2.asciidoc +++ b/docs/examples/c0ff8b3db994c4736f7579dde18097d2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:297 +// docs/get.asciidoc:303 [source, python] ---- diff --git a/docs/examples/c12d6e962f083c728f9397932f05202e.asciidoc b/docs/examples/c12d6e962f083c728f9397932f05202e.asciidoc index b3e1432ec..a8aaad14e 100644 --- a/docs/examples/c12d6e962f083c728f9397932f05202e.asciidoc +++ b/docs/examples/c12d6e962f083c728f9397932f05202e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connector-sync-jobs-api.asciidoc:71 +// connector/apis/list-connector-sync-jobs-api.asciidoc:78 [source, python] ---- diff --git a/docs/examples/c1409f591a01589638d9b00436ce42c0.asciidoc b/docs/examples/c1409f591a01589638d9b00436ce42c0.asciidoc index 34d8ac063..9ee6afc5d 100644 --- a/docs/examples/c1409f591a01589638d9b00436ce42c0.asciidoc +++ b/docs/examples/c1409f591a01589638d9b00436ce42c0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-cache.asciidoc:61 +// rest-api/security/clear-cache.asciidoc:67 [source, python] ---- diff --git a/docs/examples/c147de68fd6da032ad4a3c1bf626f5d6.asciidoc b/docs/examples/c147de68fd6da032ad4a3c1bf626f5d6.asciidoc index 0c6394b4a..e2f4cc12b 100644 --- a/docs/examples/c147de68fd6da032ad4a3c1bf626f5d6.asciidoc +++ b/docs/examples/c147de68fd6da032ad4a3c1bf626f5d6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:410 +// search/search-your-data/highlighting.asciidoc:422 [source, python] ---- diff --git a/docs/examples/c18100d62ed31bc9e05f62900156e6a8.asciidoc b/docs/examples/c18100d62ed31bc9e05f62900156e6a8.asciidoc index 0be644e92..0df79b777 100644 --- a/docs/examples/c18100d62ed31bc9e05f62900156e6a8.asciidoc +++ b/docs/examples/c18100d62ed31bc9e05f62900156e6a8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connectors-api.asciidoc:92 +// connector/apis/list-connectors-api.asciidoc:102 [source, python] ---- diff --git a/docs/examples/c186ecf6f799ddff7add1abdecea5821.asciidoc b/docs/examples/c186ecf6f799ddff7add1abdecea5821.asciidoc index 6a9a3035a..9a2e3a3b4 100644 --- a/docs/examples/c186ecf6f799ddff7add1abdecea5821.asciidoc +++ b/docs/examples/c186ecf6f799ddff7add1abdecea5821.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/fields.asciidoc:214 +// scripting/fields.asciidoc:287 [source, python] ---- diff --git a/docs/examples/c187b52646cedeebe0716327add65642.asciidoc b/docs/examples/c187b52646cedeebe0716327add65642.asciidoc index 876d69159..cd37f933e 100644 --- a/docs/examples/c187b52646cedeebe0716327add65642.asciidoc +++ b/docs/examples/c187b52646cedeebe0716327add65642.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// sql/apis/get-async-sql-search-api.asciidoc:12 +// sql/apis/get-async-sql-search-api.asciidoc:18 [source, python] ---- diff --git a/docs/examples/c1ac9e53b04f7acee4b4933969d6b574.asciidoc b/docs/examples/c1ac9e53b04f7acee4b4933969d6b574.asciidoc index 2f923d81d..36082bf5e 100644 --- a/docs/examples/c1ac9e53b04f7acee4b4933969d6b574.asciidoc +++ b/docs/examples/c1ac9e53b04f7acee4b4933969d6b574.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/preview-transform.asciidoc:290 +// transform/apis/preview-transform.asciidoc:296 [source, python] ---- diff --git a/docs/examples/c1ad9ff64728a5bfeeb485e60ec694a1.asciidoc b/docs/examples/c1ad9ff64728a5bfeeb485e60ec694a1.asciidoc index 14f229c73..0217abf41 100644 --- a/docs/examples/c1ad9ff64728a5bfeeb485e60ec694a1.asciidoc +++ b/docs/examples/c1ad9ff64728a5bfeeb485e60ec694a1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rank-eval.asciidoc:453 +// search/rank-eval.asciidoc:459 [source, python] ---- diff --git a/docs/examples/c208a06212dc0cf6ac413d4f2c154296.asciidoc b/docs/examples/c208a06212dc0cf6ac413d4f2c154296.asciidoc index 6c5826271..527a3cbe2 100644 --- a/docs/examples/c208a06212dc0cf6ac413d4f2c154296.asciidoc +++ b/docs/examples/c208a06212dc0cf6ac413d4f2c154296.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/flush.asciidoc:131 +// indices/flush.asciidoc:137 [source, python] ---- diff --git a/docs/examples/c21aaedb5752a83489476fa3b5e2e9ff.asciidoc b/docs/examples/c21aaedb5752a83489476fa3b5e2e9ff.asciidoc index a30469252..fc46fa4b8 100644 --- a/docs/examples/c21aaedb5752a83489476fa3b5e2e9ff.asciidoc +++ b/docs/examples/c21aaedb5752a83489476fa3b5e2e9ff.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-rules/apis/put-query-rule.asciidoc:114 +// query-rules/apis/put-query-rule.asciidoc:120 [source, python] ---- diff --git a/docs/examples/c21eb4bc30087188241cbba6b6b89999.asciidoc b/docs/examples/c21eb4bc30087188241cbba6b6b89999.asciidoc index f2ad14f33..56ad7bb67 100644 --- a/docs/examples/c21eb4bc30087188241cbba6b6b89999.asciidoc +++ b/docs/examples/c21eb4bc30087188241cbba6b6b89999.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-service-type-api.asciidoc:77 +// connector/apis/update-connector-service-type-api.asciidoc:84 [source, python] ---- diff --git a/docs/examples/c23e32775340d7bc6f46820313014d8a.asciidoc b/docs/examples/c23e32775340d7bc6f46820313014d8a.asciidoc index b7197b25f..55a754aa6 100644 --- a/docs/examples/c23e32775340d7bc6f46820313014d8a.asciidoc +++ b/docs/examples/c23e32775340d7bc6f46820313014d8a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:520 +// scripting/using.asciidoc:525 [source, python] ---- diff --git a/docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc b/docs/examples/c26b185952ddf9842e18493aca2de147.asciidoc similarity index 86% rename from docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc rename to docs/examples/c26b185952ddf9842e18493aca2de147.asciidoc index 3b64158d3..9b4b57ad4 100644 --- a/docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc +++ b/docs/examples/c26b185952ddf9842e18493aca2de147.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// quickstart/getting-started.asciidoc:64 +// quickstart/getting-started.asciidoc:102 [source, python] ---- diff --git a/docs/examples/c27b7d9836aa4ea756f59e9c42911721.asciidoc b/docs/examples/c27b7d9836aa4ea756f59e9c42911721.asciidoc index 090491b43..baaf5ca47 100644 --- a/docs/examples/c27b7d9836aa4ea756f59e9c42911721.asciidoc +++ b/docs/examples/c27b7d9836aa4ea756f59e9c42911721.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/scroll-api.asciidoc:29 +// search/scroll-api.asciidoc:35 [source, python] ---- diff --git a/docs/examples/c38c882c642dd412e8fa4c3eed49d12f.asciidoc b/docs/examples/c38c882c642dd412e8fa4c3eed49d12f.asciidoc index c08062c1d..951ff74b1 100644 --- a/docs/examples/c38c882c642dd412e8fa4c3eed49d12f.asciidoc +++ b/docs/examples/c38c882c642dd412e8fa4c3eed49d12f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/search-as-you-type.asciidoc:147 +// mapping/types/search-as-you-type.asciidoc:162 [source, python] ---- diff --git a/docs/examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc b/docs/examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc new file mode 100644 index 000000000..09b688408 --- /dev/null +++ b/docs/examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// esql/esql-syntax.asciidoc:187 + +[source, python] +---- +resp = client.esql.query( + query="\nFROM library\n| WHERE match(author, \"Frank Herbert\", {\"minimum_should_match\": 2, \"operator\": \"AND\"})\n| LIMIT 5\n", +) +print(resp) +---- diff --git a/docs/examples/c4607ca79b2bcde39305d6f4f21cad37.asciidoc b/docs/examples/c4607ca79b2bcde39305d6f4f21cad37.asciidoc index 9e77a3417..fd2d55854 100644 --- a/docs/examples/c4607ca79b2bcde39305d6f4f21cad37.asciidoc +++ b/docs/examples/c4607ca79b2bcde39305d6f4f21cad37.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/esql-rest.asciidoc:223 +// esql/esql-rest.asciidoc:226 [source, python] ---- diff --git a/docs/examples/c47f030216a3c89f92f31787fc4d5df5.asciidoc b/docs/examples/c47f030216a3c89f92f31787fc4d5df5.asciidoc index 9aa8729a4..5a205275c 100644 --- a/docs/examples/c47f030216a3c89f92f31787fc4d5df5.asciidoc +++ b/docs/examples/c47f030216a3c89f92f31787fc4d5df5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/plugins.asciidoc:51 +// cat/plugins.asciidoc:56 [source, python] ---- diff --git a/docs/examples/c4a1d03dcfb82913d0724a42b0a89f20.asciidoc b/docs/examples/c4a1d03dcfb82913d0724a42b0a89f20.asciidoc index 671dab80f..982758f0e 100644 --- a/docs/examples/c4a1d03dcfb82913d0724a42b0a89f20.asciidoc +++ b/docs/examples/c4a1d03dcfb82913d0724a42b0a89f20.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/clearcache.asciidoc:152 +// indices/clearcache.asciidoc:158 [source, python] ---- diff --git a/docs/examples/c4b727723b57052b6504bb74fe09abc6.asciidoc b/docs/examples/c4b727723b57052b6504bb74fe09abc6.asciidoc index 6f9e84063..0a0dda82a 100644 --- a/docs/examples/c4b727723b57052b6504bb74fe09abc6.asciidoc +++ b/docs/examples/c4b727723b57052b6504bb74fe09abc6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template.asciidoc:12 +// indices/put-index-template.asciidoc:18 [source, python] ---- diff --git a/docs/examples/c526fca1609b4c3c1d12dfd218d69a50.asciidoc b/docs/examples/c526fca1609b4c3c1d12dfd218d69a50.asciidoc index 1134d03e1..8ff744913 100644 --- a/docs/examples/c526fca1609b4c3c1d12dfd218d69a50.asciidoc +++ b/docs/examples/c526fca1609b4c3c1d12dfd218d69a50.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:377 +// indices/put-mapping.asciidoc:383 [source, python] ---- diff --git a/docs/examples/c54597143ac86540726f6422fd98b22e.asciidoc b/docs/examples/c54597143ac86540726f6422fd98b22e.asciidoc index 62e88c770..88ab8810e 100644 --- a/docs/examples/c54597143ac86540726f6422fd98b22e.asciidoc +++ b/docs/examples/c54597143ac86540726f6422fd98b22e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-settings.asciidoc:50 +// rest-api/security/update-settings.asciidoc:56 [source, python] ---- diff --git a/docs/examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc b/docs/examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc index 3d3044f4a..267309f1b 100644 --- a/docs/examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc +++ b/docs/examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc @@ -1,16 +1,14 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-update-api-keys.asciidoc:236 +// rest-api/security/bulk-update-api-keys.asciidoc:242 [source, python] ---- resp = client.security.bulk_update_api_keys( - body={ - "ids": [ - "VuaCfGcBCdbkQm-e5aOx", - "H3_AhoIBA9hmeQJdg7ij" - ], - "role_descriptors": {} - }, + ids=[ + "VuaCfGcBCdbkQm-e5aOx", + "H3_AhoIBA9hmeQJdg7ij" + ], + role_descriptors={}, ) print(resp) ---- diff --git a/docs/examples/c5ba7c4badb5ef5ca32740106e4aa6b6.asciidoc b/docs/examples/c5ba7c4badb5ef5ca32740106e4aa6b6.asciidoc index fa3ef8edf..641c97480 100644 --- a/docs/examples/c5ba7c4badb5ef5ca32740106e4aa6b6.asciidoc +++ b/docs/examples/c5ba7c4badb5ef5ca32740106e4aa6b6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:36 +// docs/termvectors.asciidoc:42 [source, python] ---- diff --git a/docs/examples/c6339d09f85000a6432304b0ec63b8f6.asciidoc b/docs/examples/c6339d09f85000a6432304b0ec63b8f6.asciidoc index 50b57646c..514f0f8aa 100644 --- a/docs/examples/c6339d09f85000a6432304b0ec63b8f6.asciidoc +++ b/docs/examples/c6339d09f85000a6432304b0ec63b8f6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-component-template.asciidoc:226 +// indices/put-component-template.asciidoc:236 [source, python] ---- diff --git a/docs/examples/c64b61bedb21b9def8fce5092e677af9.asciidoc b/docs/examples/c64b61bedb21b9def8fce5092e677af9.asciidoc index d7ae6d555..645a460ed 100644 --- a/docs/examples/c64b61bedb21b9def8fce5092e677af9.asciidoc +++ b/docs/examples/c64b61bedb21b9def8fce5092e677af9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/suggesters.asciidoc:46 +// search/suggesters.asciidoc:52 [source, python] ---- diff --git a/docs/examples/c65b00a285f510dcd2865aa3539b4e03.asciidoc b/docs/examples/c65b00a285f510dcd2865aa3539b4e03.asciidoc index 23e572ea8..acb1e92e7 100644 --- a/docs/examples/c65b00a285f510dcd2865aa3539b4e03.asciidoc +++ b/docs/examples/c65b00a285f510dcd2865aa3539b4e03.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/apis/get-transform.asciidoc:100 +// transform/apis/get-transform.asciidoc:106 [source, python] ---- diff --git a/docs/examples/c67b0f00c2e690303c0e5af2f51e0fea.asciidoc b/docs/examples/c67b0f00c2e690303c0e5af2f51e0fea.asciidoc index 15e29b183..19869bb83 100644 --- a/docs/examples/c67b0f00c2e690303c0e5af2f51e0fea.asciidoc +++ b/docs/examples/c67b0f00c2e690303c0e5af2f51e0fea.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/suggesters.asciidoc:7 +// search/suggesters.asciidoc:13 [source, python] ---- diff --git a/docs/examples/c6b5c695a9b757b5e7325345b206bde5.asciidoc b/docs/examples/c6b5c695a9b757b5e7325345b206bde5.asciidoc index 6d84b16b7..cf1c2d5e0 100644 --- a/docs/examples/c6b5c695a9b757b5e7325345b206bde5.asciidoc +++ b/docs/examples/c6b5c695a9b757b5e7325345b206bde5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/delete-pipeline.asciidoc:82 +// ingest/apis/delete-pipeline.asciidoc:88 [source, python] ---- diff --git a/docs/examples/c6bdd5c7de79d6d9ac8e33a397b511e8.asciidoc b/docs/examples/c6bdd5c7de79d6d9ac8e33a397b511e8.asciidoc index 95bf11903..0fe500a97 100644 --- a/docs/examples/c6bdd5c7de79d6d9ac8e33a397b511e8.asciidoc +++ b/docs/examples/c6bdd5c7de79d6d9ac8e33a397b511e8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:321 +// indices/put-mapping.asciidoc:327 [source, python] ---- diff --git a/docs/examples/c765ce78f3605c0e70d213f22aac8a53.asciidoc b/docs/examples/c765ce78f3605c0e70d213f22aac8a53.asciidoc index 8164e0fb0..6385d38d3 100644 --- a/docs/examples/c765ce78f3605c0e70d213f22aac8a53.asciidoc +++ b/docs/examples/c765ce78f3605c0e70d213f22aac8a53.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/put-autoscaling-policy.asciidoc:67 +// autoscaling/apis/put-autoscaling-policy.asciidoc:73 [source, python] ---- diff --git a/docs/examples/e566e898902e432bc7ea0568400f0c50.asciidoc b/docs/examples/c793efe7280e9b6e09981c4d4f832348.asciidoc similarity index 71% rename from docs/examples/e566e898902e432bc7ea0568400f0c50.asciidoc rename to docs/examples/c793efe7280e9b6e09981c4d4f832348.asciidoc index 1d39f8a28..dcdc437f8 100644 --- a/docs/examples/e566e898902e432bc7ea0568400f0c50.asciidoc +++ b/docs/examples/c793efe7280e9b6e09981c4d4f832348.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/ip.asciidoc:170 +// mapping/types/ip.asciidoc:166 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "ip": { "type": "ip" diff --git a/docs/examples/c87038b96ab06d9a741a130f94de4f02.asciidoc b/docs/examples/c87038b96ab06d9a741a130f94de4f02.asciidoc index aae4b0770..ea01b3863 100644 --- a/docs/examples/c87038b96ab06d9a741a130f94de4f02.asciidoc +++ b/docs/examples/c87038b96ab06d9a741a130f94de4f02.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/delete.asciidoc:138 +// docs/delete.asciidoc:144 [source, python] ---- diff --git a/docs/examples/c873f9cd093e26515148f052e28c7805.asciidoc b/docs/examples/c873f9cd093e26515148f052e28c7805.asciidoc index 3c8efb1f1..c1b267238 100644 --- a/docs/examples/c873f9cd093e26515148f052e28c7805.asciidoc +++ b/docs/examples/c873f9cd093e26515148f052e28c7805.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-snapshot.asciidoc:242 +// ml/anomaly-detection/apis/get-snapshot.asciidoc:248 [source, python] ---- diff --git a/docs/examples/c8aa8e8c0ac160b8c4efd1ac3b9f48f3.asciidoc b/docs/examples/c8aa8e8c0ac160b8c4efd1ac3b9f48f3.asciidoc new file mode 100644 index 000000000..93dba34c8 --- /dev/null +++ b/docs/examples/c8aa8e8c0ac160b8c4efd1ac3b9f48f3.asciidoc @@ -0,0 +1,23 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/ingest-vectors.asciidoc:35 + +[source, python] +---- +resp = client.indices.create( + index="amazon-reviews", + mappings={ + "properties": { + "review_vector": { + "type": "dense_vector", + "dims": 8, + "index": True, + "similarity": "cosine" + }, + "review_text": { + "type": "text" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/c8e2109b19d50467ab83a40006462e9f.asciidoc b/docs/examples/c8e2109b19d50467ab83a40006462e9f.asciidoc index 3a0678550..1d983ce69 100644 --- a/docs/examples/c8e2109b19d50467ab83a40006462e9f.asciidoc +++ b/docs/examples/c8e2109b19d50467ab83a40006462e9f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/enrich/execute-enrich-policy.asciidoc:39 +// ingest/apis/enrich/execute-enrich-policy.asciidoc:45 [source, python] ---- diff --git a/docs/examples/c956bf1f0829a5f0357c0494ed8b6ca3.asciidoc b/docs/examples/c956bf1f0829a5f0357c0494ed8b6ca3.asciidoc index 24b3619a6..76e31cb91 100644 --- a/docs/examples/c956bf1f0829a5f0357c0494ed8b6ca3.asciidoc +++ b/docs/examples/c956bf1f0829a5f0357c0494ed8b6ca3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-template-api.asciidoc:37 +// search/search-template-api.asciidoc:43 [source, python] ---- diff --git a/docs/examples/c97fd95ebdcf56cc973582e37f732ed2.asciidoc b/docs/examples/c97fd95ebdcf56cc973582e37f732ed2.asciidoc index 75fc57939..b131ee6dc 100644 --- a/docs/examples/c97fd95ebdcf56cc973582e37f732ed2.asciidoc +++ b/docs/examples/c97fd95ebdcf56cc973582e37f732ed2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/enrich/get-enrich-policy.asciidoc:176 +// ingest/apis/enrich/get-enrich-policy.asciidoc:182 [source, python] ---- diff --git a/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc b/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc index 0bfaabd41..e300dd9bb 100644 --- a/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc +++ b/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/bulk.asciidoc:764 +// docs/bulk.asciidoc:774 [source, python] ---- diff --git a/docs/examples/c9ce07a7d3d8a317f08535bdd3aa69a3.asciidoc b/docs/examples/c9ce07a7d3d8a317f08535bdd3aa69a3.asciidoc index 3716ae2e5..477e99432 100644 --- a/docs/examples/c9ce07a7d3d8a317f08535bdd3aa69a3.asciidoc +++ b/docs/examples/c9ce07a7d3d8a317f08535bdd3aa69a3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:218 +// docs/update.asciidoc:224 [source, python] ---- diff --git a/docs/examples/ca3bcd6278510ebced5f74484033cb36.asciidoc b/docs/examples/ca3bcd6278510ebced5f74484033cb36.asciidoc index b28f8a28a..09d949b21 100644 --- a/docs/examples/ca3bcd6278510ebced5f74484033cb36.asciidoc +++ b/docs/examples/ca3bcd6278510ebced5f74484033cb36.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/apis/get-script-languages-api.asciidoc:11 +// scripting/apis/get-script-languages-api.asciidoc:17 [source, python] ---- diff --git a/docs/examples/ca5ae0eb7709f3807bc6239cd4bd9141.asciidoc b/docs/examples/ca5ae0eb7709f3807bc6239cd4bd9141.asciidoc index d9c529956..87288c597 100644 --- a/docs/examples/ca5ae0eb7709f3807bc6239cd4bd9141.asciidoc +++ b/docs/examples/ca5ae0eb7709f3807bc6239cd4bd9141.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:240 +// rest-api/security/get-api-keys.asciidoc:246 [source, python] ---- diff --git a/docs/examples/ca5dda98e977125d40a7fe1e178e213f.asciidoc b/docs/examples/ca5dda98e977125d40a7fe1e178e213f.asciidoc index 2d19bb671..a6c8c5cb1 100644 --- a/docs/examples/ca5dda98e977125d40a7fe1e178e213f.asciidoc +++ b/docs/examples/ca5dda98e977125d40a7fe1e178e213f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/sparse-vector-query.asciidoc:129 +// query-dsl/sparse-vector-query.asciidoc:134 [source, python] ---- diff --git a/docs/examples/ca98afbd6a90f63e02f62239d225313b.asciidoc b/docs/examples/ca98afbd6a90f63e02f62239d225313b.asciidoc index 44fc24e51..a41fd0d74 100644 --- a/docs/examples/ca98afbd6a90f63e02f62239d225313b.asciidoc +++ b/docs/examples/ca98afbd6a90f63e02f62239d225313b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/dangling-index-import.asciidoc:59 +// indices/dangling-index-import.asciidoc:65 [source, python] ---- diff --git a/docs/examples/caaafef1a76c2bec677704c2dc233218.asciidoc b/docs/examples/caaafef1a76c2bec677704c2dc233218.asciidoc index 79cb3d0fa..eda82a171 100644 --- a/docs/examples/caaafef1a76c2bec677704c2dc233218.asciidoc +++ b/docs/examples/caaafef1a76c2bec677704c2dc233218.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/simulate-index.asciidoc:33 +// indices/simulate-index.asciidoc:39 [source, python] ---- diff --git a/docs/examples/caab99520d3fe41f6154d74a7f696057.asciidoc b/docs/examples/caab99520d3fe41f6154d74a7f696057.asciidoc index 5ee574efc..bfb5bdd7b 100644 --- a/docs/examples/caab99520d3fe41f6154d74a7f696057.asciidoc +++ b/docs/examples/caab99520d3fe41f6154d74a7f696057.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/delete-index.asciidoc:10 +// indices/delete-index.asciidoc:16 [source, python] ---- diff --git a/docs/examples/cafed0e2c2b1d1574eb4a5ecd514a97a.asciidoc b/docs/examples/cafed0e2c2b1d1574eb4a5ecd514a97a.asciidoc index ca255c59b..783d37942 100644 --- a/docs/examples/cafed0e2c2b1d1574eb4a5ecd514a97a.asciidoc +++ b/docs/examples/cafed0e2c2b1d1574eb4a5ecd514a97a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/split-index.asciidoc:10 +// indices/split-index.asciidoc:16 [source, python] ---- diff --git a/docs/examples/cb0c3223fd45148497df73adfba2e9ce.asciidoc b/docs/examples/cb0c3223fd45148497df73adfba2e9ce.asciidoc index 96a7054cf..aabe1e15b 100644 --- a/docs/examples/cb0c3223fd45148497df73adfba2e9ce.asciidoc +++ b/docs/examples/cb0c3223fd45148497df73adfba2e9ce.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:668 +// docs/reindex.asciidoc:674 [source, python] ---- diff --git a/docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc b/docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc index 881808964..e79ec43a7 100644 --- a/docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc +++ b/docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/indices/request_cache.asciidoc:47 +// shard-request-cache.asciidoc:49 [source, python] ---- diff --git a/docs/examples/cb71332115c92cfb89375abd30b8bbbb.asciidoc b/docs/examples/cb71332115c92cfb89375abd30b8bbbb.asciidoc index 1070f618e..1c2f2e4ab 100644 --- a/docs/examples/cb71332115c92cfb89375abd30b8bbbb.asciidoc +++ b/docs/examples/cb71332115c92cfb89375abd30b8bbbb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat.asciidoc:36 +// cat.asciidoc:42 [source, python] ---- diff --git a/docs/examples/cba3462a307e2483c14e3e198f6960e3.asciidoc b/docs/examples/cba3462a307e2483c14e3e198f6960e3.asciidoc index d135a1805..8901f62e7 100644 --- a/docs/examples/cba3462a307e2483c14e3e198f6960e3.asciidoc +++ b/docs/examples/cba3462a307e2483c14e3e198f6960e3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/put-lifecycle.asciidoc:60 +// ilm/apis/put-lifecycle.asciidoc:66 [source, python] ---- diff --git a/docs/examples/cbfd6f23f8283e64ec3157c65bb722c4.asciidoc b/docs/examples/cbfd6f23f8283e64ec3157c65bb722c4.asciidoc index b962ea061..b0c8c3ee0 100644 --- a/docs/examples/cbfd6f23f8283e64ec3157c65bb722c4.asciidoc +++ b/docs/examples/cbfd6f23f8283e64ec3157c65bb722c4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat.asciidoc:212 +// cat.asciidoc:218 [source, python] ---- diff --git a/docs/examples/cc56be758d5d75febbd975786187c861.asciidoc b/docs/examples/cc56be758d5d75febbd975786187c861.asciidoc index 3af0ff287..6e3db1557 100644 --- a/docs/examples/cc56be758d5d75febbd975786187c861.asciidoc +++ b/docs/examples/cc56be758d5d75febbd975786187c861.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-service-token.asciidoc:97 +// rest-api/security/create-service-token.asciidoc:103 [source, python] ---- diff --git a/docs/examples/cc5eefcc2102aae7e87b0c87b4af10b8.asciidoc b/docs/examples/cc5eefcc2102aae7e87b0c87b4af10b8.asciidoc index d9b7e66b8..b994f1ee9 100644 --- a/docs/examples/cc5eefcc2102aae7e87b0c87b4af10b8.asciidoc +++ b/docs/examples/cc5eefcc2102aae7e87b0c87b4af10b8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/multivalued-fields.asciidoc:50 +// esql/multivalued-fields.asciidoc:54 [source, python] ---- diff --git a/docs/examples/cc90639f2e65bd89cb73296cac6135cf.asciidoc b/docs/examples/cc90639f2e65bd89cb73296cac6135cf.asciidoc index 58814beee..6f32a16b9 100644 --- a/docs/examples/cc90639f2e65bd89cb73296cac6135cf.asciidoc +++ b/docs/examples/cc90639f2e65bd89cb73296cac6135cf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/delete-trained-models.asciidoc:54 +// ml/trained-models/apis/delete-trained-models.asciidoc:60 [source, python] ---- diff --git a/docs/examples/cc9dac8db7a1482e2fbe3235197c3de1.asciidoc b/docs/examples/cc9dac8db7a1482e2fbe3235197c3de1.asciidoc index 6ea9a977e..e9f3ea560 100644 --- a/docs/examples/cc9dac8db7a1482e2fbe3235197c3de1.asciidoc +++ b/docs/examples/cc9dac8db7a1482e2fbe3235197c3de1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/restore-snapshot-api.asciidoc:242 +// snapshot-restore/apis/restore-snapshot-api.asciidoc:248 [source, python] ---- diff --git a/docs/examples/ccc613951c61f0b17e1ed8a2d3ae54a2.asciidoc b/docs/examples/ccc613951c61f0b17e1ed8a2d3ae54a2.asciidoc new file mode 100644 index 000000000..8de3e1f3e --- /dev/null +++ b/docs/examples/ccc613951c61f0b17e1ed8a2d3ae54a2.asciidoc @@ -0,0 +1,75 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/apis/simulate-ingest.asciidoc:62 + +[source, python] +---- +resp = client.simulate.ingest( + docs=[ + { + "_index": "my-index", + "_id": "id", + "_source": { + "foo": "bar" + } + }, + { + "_index": "my-index", + "_id": "id", + "_source": { + "foo": "rab" + } + } + ], + pipeline_substitutions={ + "my-pipeline": { + "processors": [ + { + "set": { + "field": "field3", + "value": "value3" + } + } + ] + } + }, + component_template_substitutions={ + "my-component-template": { + "template": { + "mappings": { + "dynamic": "true", + "properties": { + "field3": { + "type": "keyword" + } + } + }, + "settings": { + "index": { + "default_pipeline": "my-pipeline" + } + } + } + } + }, + index_template_substitutions={ + "my-index-template": { + "index_patterns": [ + "my-index-*" + ], + "composed_of": [ + "component_template_1", + "component_template_2" + ] + } + }, + mapping_addition={ + "dynamic": "strict", + "properties": { + "foo": { + "type": "keyword" + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/ccec66fb20d5ede6c691e0890cfe402a.asciidoc b/docs/examples/ccec66fb20d5ede6c691e0890cfe402a.asciidoc index 1dc1475d9..944545aec 100644 --- a/docs/examples/ccec66fb20d5ede6c691e0890cfe402a.asciidoc +++ b/docs/examples/ccec66fb20d5ede6c691e0890cfe402a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-job.asciidoc:85 +// ml/anomaly-detection/apis/delete-job.asciidoc:91 [source, python] ---- diff --git a/docs/examples/cd373a6eb1ef4748616500b26fab3006.asciidoc b/docs/examples/cd373a6eb1ef4748616500b26fab3006.asciidoc index 4c58be4f3..50cdf22c1 100644 --- a/docs/examples/cd373a6eb1ef4748616500b26fab3006.asciidoc +++ b/docs/examples/cd373a6eb1ef4748616500b26fab3006.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/async-search.asciidoc:15 +// search/async-search.asciidoc:21 [source, python] ---- diff --git a/docs/examples/cd38c601ab293a6ec0e2df71d0c96b58.asciidoc b/docs/examples/cd38c601ab293a6ec0e2df71d0c96b58.asciidoc index 4f4c3fcf1..c1c4768d6 100644 --- a/docs/examples/cd38c601ab293a6ec0e2df71d0c96b58.asciidoc +++ b/docs/examples/cd38c601ab293a6ec0e2df71d0c96b58.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template.asciidoc:344 +// indices/put-index-template.asciidoc:353 [source, python] ---- diff --git a/docs/examples/cd67ad2c09fafef2d441c3502d0bb3d7.asciidoc b/docs/examples/cd67ad2c09fafef2d441c3502d0bb3d7.asciidoc index fc5ff0439..2a2f8d0a3 100644 --- a/docs/examples/cd67ad2c09fafef2d441c3502d0bb3d7.asciidoc +++ b/docs/examples/cd67ad2c09fafef2d441c3502d0bb3d7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/lifecycle/apis/put-lifecycle.asciidoc:78 +// data-streams/lifecycle/apis/put-lifecycle.asciidoc:84 [source, python] ---- diff --git a/docs/examples/cd7da0c3769682f546cc1888e569382e.asciidoc b/docs/examples/cd7da0c3769682f546cc1888e569382e.asciidoc index b117cb26f..ded893b21 100644 --- a/docs/examples/cd7da0c3769682f546cc1888e569382e.asciidoc +++ b/docs/examples/cd7da0c3769682f546cc1888e569382e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:764 +// search/search-your-data/highlighting.asciidoc:776 [source, python] ---- diff --git a/docs/examples/cd8006165ac64f1ef99af48e5a35a25b.asciidoc b/docs/examples/cd8006165ac64f1ef99af48e5a35a25b.asciidoc index 75d163ad4..3decea8d2 100644 --- a/docs/examples/cd8006165ac64f1ef99af48e5a35a25b.asciidoc +++ b/docs/examples/cd8006165ac64f1ef99af48e5a35a25b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-app-privileges.asciidoc:58 +// rest-api/security/get-app-privileges.asciidoc:64 [source, python] ---- diff --git a/docs/examples/cd93919e13f656ad2e6629f45c579b93.asciidoc b/docs/examples/cd93919e13f656ad2e6629f45c579b93.asciidoc index c922da32f..b59f5e22a 100644 --- a/docs/examples/cd93919e13f656ad2e6629f45c579b93.asciidoc +++ b/docs/examples/cd93919e13f656ad2e6629f45c579b93.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shard-stores.asciidoc:114 +// indices/shard-stores.asciidoc:120 [source, python] ---- diff --git a/docs/examples/cdb68b3f565df7c85e52a55864b37d40.asciidoc b/docs/examples/cdb68b3f565df7c85e52a55864b37d40.asciidoc index 3009eb74b..f3ee218e6 100644 --- a/docs/examples/cdb68b3f565df7c85e52a55864b37d40.asciidoc +++ b/docs/examples/cdb68b3f565df7c85e52a55864b37d40.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:358 +// indices/put-mapping.asciidoc:364 [source, python] ---- diff --git a/docs/examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc b/docs/examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc new file mode 100644 index 000000000..ec203bab7 --- /dev/null +++ b/docs/examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc @@ -0,0 +1,35 @@ +// This file is autogenerated, DO NOT EDIT +// query-dsl/intervals-query.asciidoc:497 + +[source, python] +---- +resp = client.search( + query={ + "intervals": { + "my_text": { + "all_of": { + "ordered": True, + "max_gaps": 1, + "intervals": [ + { + "match": { + "query": "my favorite food", + "max_gaps": 0, + "ordered": True + } + }, + { + "match": { + "query": "cold porridge", + "max_gaps": 4, + "ordered": True + } + } + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/cdce7bc083dfb36e6f1d465a5c9d5049.asciidoc b/docs/examples/cdce7bc083dfb36e6f1d465a5c9d5049.asciidoc index 710a66fea..ec6802cda 100644 --- a/docs/examples/cdce7bc083dfb36e6f1d465a5c9d5049.asciidoc +++ b/docs/examples/cdce7bc083dfb36e6f1d465a5c9d5049.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connector-sync-jobs-api.asciidoc:49 +// connector/apis/list-connector-sync-jobs-api.asciidoc:56 [source, python] ---- diff --git a/docs/examples/cdd29b01e730b3996de68a2788050021.asciidoc b/docs/examples/cdd29b01e730b3996de68a2788050021.asciidoc index 0e2c7e21c..6646dfebc 100644 --- a/docs/examples/cdd29b01e730b3996de68a2788050021.asciidoc +++ b/docs/examples/cdd29b01e730b3996de68a2788050021.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/enrich/delete-enrich-policy.asciidoc:36 +// ingest/apis/enrich/delete-enrich-policy.asciidoc:42 [source, python] ---- diff --git a/docs/examples/cde4104a29dfe942d55863cdd8718627.asciidoc b/docs/examples/cde4104a29dfe942d55863cdd8718627.asciidoc index 839bb42dd..0dc636282 100644 --- a/docs/examples/cde4104a29dfe942d55863cdd8718627.asciidoc +++ b/docs/examples/cde4104a29dfe942d55863cdd8718627.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-get-status.asciidoc:42 +// tab-widgets/troubleshooting/data/start-slm.asciidoc:76 [source, python] ---- diff --git a/docs/examples/cdf400299acd1c7b1b7bb42e284e3d08.asciidoc b/docs/examples/cdf400299acd1c7b1b7bb42e284e3d08.asciidoc index a7e4c711d..e4f4228bc 100644 --- a/docs/examples/cdf400299acd1c7b1b7bb42e284e3d08.asciidoc +++ b/docs/examples/cdf400299acd1c7b1b7bb42e284e3d08.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:135 +// docs/update.asciidoc:141 [source, python] ---- diff --git a/docs/examples/cdfd4fef983c1c0fe8d7417f67d01eae.asciidoc b/docs/examples/cdfd4fef983c1c0fe8d7417f67d01eae.asciidoc index d61b8b76f..f73420eb9 100644 --- a/docs/examples/cdfd4fef983c1c0fe8d7417f67d01eae.asciidoc +++ b/docs/examples/cdfd4fef983c1c0fe8d7417f67d01eae.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:153 +// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:157 [source, python] ---- diff --git a/docs/examples/ce0c3d7330727f7673cf68fc9a1cfb86.asciidoc b/docs/examples/ce0c3d7330727f7673cf68fc9a1cfb86.asciidoc index c0642da1f..feef5c26f 100644 --- a/docs/examples/ce0c3d7330727f7673cf68fc9a1cfb86.asciidoc +++ b/docs/examples/ce0c3d7330727f7673cf68fc9a1cfb86.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/clearcache.asciidoc:11 +// indices/clearcache.asciidoc:17 [source, python] ---- diff --git a/docs/examples/ce2c2e8f5a2e4daf051b6e10122e5aae.asciidoc b/docs/examples/ce2c2e8f5a2e4daf051b6e10122e5aae.asciidoc index aeeb761ae..2e8eefb75 100644 --- a/docs/examples/ce2c2e8f5a2e4daf051b6e10122e5aae.asciidoc +++ b/docs/examples/ce2c2e8f5a2e4daf051b6e10122e5aae.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:490 +// mapping/types/dense-vector.asciidoc:519 [source, python] ---- diff --git a/docs/examples/ce3c391c2b1915cfc44a2917bca71d19.asciidoc b/docs/examples/ce3c391c2b1915cfc44a2917bca71d19.asciidoc index b1166bc60..e039c088e 100644 --- a/docs/examples/ce3c391c2b1915cfc44a2917bca71d19.asciidoc +++ b/docs/examples/ce3c391c2b1915cfc44a2917bca71d19.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/put-dfanalytics.asciidoc:644 +// ml/df-analytics/apis/put-dfanalytics.asciidoc:650 [source, python] ---- diff --git a/docs/examples/ce8471d31e5d60309e142feb040fd2f8.asciidoc b/docs/examples/ce8471d31e5d60309e142feb040fd2f8.asciidoc index 99b1f9058..6f6452a25 100644 --- a/docs/examples/ce8471d31e5d60309e142feb040fd2f8.asciidoc +++ b/docs/examples/ce8471d31e5d60309e142feb040fd2f8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/query-watches.asciidoc:67 +// rest-api/watcher/query-watches.asciidoc:73 [source, python] ---- diff --git a/docs/examples/ce8eebfb810335803630abe83278bee7.asciidoc b/docs/examples/ce8eebfb810335803630abe83278bee7.asciidoc index 7ca152642..7ea39330f 100644 --- a/docs/examples/ce8eebfb810335803630abe83278bee7.asciidoc +++ b/docs/examples/ce8eebfb810335803630abe83278bee7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:247 +// rest-api/security/get-api-keys.asciidoc:253 [source, python] ---- diff --git a/docs/examples/b26b5574438e4eaf146b2428bf537c51.asciidoc b/docs/examples/cecfaa659af6646b3b67d7b311586fa0.asciidoc similarity index 91% rename from docs/examples/b26b5574438e4eaf146b2428bf537c51.asciidoc rename to docs/examples/cecfaa659af6646b3b67d7b311586fa0.asciidoc index ad8b79e9a..dd81ff102 100644 --- a/docs/examples/b26b5574438e4eaf146b2428bf537c51.asciidoc +++ b/docs/examples/cecfaa659af6646b3b67d7b311586fa0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/attachment.asciidoc:349 +// ingest/processors/attachment.asciidoc:396 [source, python] ---- @@ -14,7 +14,7 @@ resp = client.ingest.put_pipeline( "attachment": { "target_field": "_ingest._value.attachment", "field": "_ingest._value.data", - "remove_binary": False + "remove_binary": True } } } diff --git a/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc b/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc index 9f552c719..f9a7673cd 100644 --- a/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc +++ b/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-elser.asciidoc:91 +// inference/service-elser.asciidoc:157 [source, python] ---- diff --git a/docs/examples/cee491dd0a8d10ed0cb11a2faa0c99f0.asciidoc b/docs/examples/cee491dd0a8d10ed0cb11a2faa0c99f0.asciidoc index c500aef2f..9f939fd21 100644 --- a/docs/examples/cee491dd0a8d10ed0cb11a2faa0c99f0.asciidoc +++ b/docs/examples/cee491dd0a8d10ed0cb11a2faa0c99f0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/infer-trained-model.asciidoc:1078 +// ml/trained-models/apis/infer-trained-model.asciidoc:1185 [source, python] ---- diff --git a/docs/examples/cee591c1fc70d4f180c623a3a6d07755.asciidoc b/docs/examples/cee591c1fc70d4f180c623a3a6d07755.asciidoc index 5b7dabd86..074c899a4 100644 --- a/docs/examples/cee591c1fc70d4f180c623a3a6d07755.asciidoc +++ b/docs/examples/cee591c1fc70d4f180c623a3a6d07755.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-tokens.asciidoc:72 +// rest-api/security/invalidate-tokens.asciidoc:78 [source, python] ---- diff --git a/docs/examples/cf23f18761df33f08bc6f6d1875496fd.asciidoc b/docs/examples/cf23f18761df33f08bc6f6d1875496fd.asciidoc index 79ac096c2..b4b4bdf4e 100644 --- a/docs/examples/cf23f18761df33f08bc6f6d1875496fd.asciidoc +++ b/docs/examples/cf23f18761df33f08bc6f6d1875496fd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:398 +// how-to/size-your-shards.asciidoc:399 [source, python] ---- diff --git a/docs/examples/cf8ca470156698dbf47fdc822d0a714f.asciidoc b/docs/examples/cf8ca470156698dbf47fdc822d0a714f.asciidoc index 1210a1941..b3a8628a7 100644 --- a/docs/examples/cf8ca470156698dbf47fdc822d0a714f.asciidoc +++ b/docs/examples/cf8ca470156698dbf47fdc822d0a714f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/get-desired-nodes.asciidoc:64 +// cluster/get-desired-nodes.asciidoc:70 [source, python] ---- diff --git a/docs/examples/cfad3631be0634ee49c424f9ccec62d9.asciidoc b/docs/examples/cfad3631be0634ee49c424f9ccec62d9.asciidoc index dba931e60..3259ea16f 100644 --- a/docs/examples/cfad3631be0634ee49c424f9ccec62d9.asciidoc +++ b/docs/examples/cfad3631be0634ee49c424f9ccec62d9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-api-keys.asciidoc:168 +// rest-api/security/invalidate-api-keys.asciidoc:174 [source, python] ---- diff --git a/docs/examples/cffce059425d3d21e7f9571500d63524.asciidoc b/docs/examples/cffce059425d3d21e7f9571500d63524.asciidoc index 8f33f2bdc..398be53fe 100644 --- a/docs/examples/cffce059425d3d21e7f9571500d63524.asciidoc +++ b/docs/examples/cffce059425d3d21e7f9571500d63524.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/delete-roles.asciidoc:40 +// rest-api/security/delete-roles.asciidoc:46 [source, python] ---- diff --git a/docs/examples/d003f9110e5a474230abe11f36da9297.asciidoc b/docs/examples/d003f9110e5a474230abe11f36da9297.asciidoc index dc2540244..6c38ffc2b 100644 --- a/docs/examples/d003f9110e5a474230abe11f36da9297.asciidoc +++ b/docs/examples/d003f9110e5a474230abe11f36da9297.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/redact.asciidoc:49 +// ingest/processors/redact.asciidoc:50 [source, python] ---- diff --git a/docs/examples/d01a590fa9ea8a0cb34ed8dda502296c.asciidoc b/docs/examples/d01a590fa9ea8a0cb34ed8dda502296c.asciidoc deleted file mode 100644 index 2aa1436ea..000000000 --- a/docs/examples/d01a590fa9ea8a0cb34ed8dda502296c.asciidoc +++ /dev/null @@ -1,11 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// migration/transient-settings-migration-guide.asciidoc:38 - -[source, python] ----- -resp = client.cluster.get_settings( - flat_settings=True, - filter_path="transient", -) -print(resp) ----- diff --git a/docs/examples/d01d309b0257d6fbca6d0941adeb3256.asciidoc b/docs/examples/d01d309b0257d6fbca6d0941adeb3256.asciidoc index 971c4b3e6..aaa4270d5 100644 --- a/docs/examples/d01d309b0257d6fbca6d0941adeb3256.asciidoc +++ b/docs/examples/d01d309b0257d6fbca6d0941adeb3256.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/simulate-index.asciidoc:145 +// indices/simulate-index.asciidoc:151 [source, python] ---- diff --git a/docs/examples/d03139a851888db53f8b7affd85eb495.asciidoc b/docs/examples/d03139a851888db53f8b7affd85eb495.asciidoc index 15826f686..c003a5730 100644 --- a/docs/examples/d03139a851888db53f8b7affd85eb495.asciidoc +++ b/docs/examples/d03139a851888db53f8b7affd85eb495.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/check-in-connector-api.asciidoc:68 +// connector/apis/check-in-connector-api.asciidoc:75 [source, python] ---- diff --git a/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc b/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc index 442757e57..94cd61b48 100644 --- a/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc +++ b/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// quickstart/getting-started.asciidoc:103 +// quickstart/getting-started.asciidoc:155 [source, python] ---- diff --git a/docs/examples/d095b422d9803c02b62c01adffc85376.asciidoc b/docs/examples/d095b422d9803c02b62c01adffc85376.asciidoc index c56dbd0a0..8a4331655 100644 --- a/docs/examples/d095b422d9803c02b62c01adffc85376.asciidoc +++ b/docs/examples/d095b422d9803c02b62c01adffc85376.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/get-job.asciidoc:88 +// rollup/apis/get-job.asciidoc:94 [source, python] ---- diff --git a/docs/examples/d14fe5838fc02224f4b5ade2626d6026.asciidoc b/docs/examples/d14fe5838fc02224f4b5ade2626d6026.asciidoc index cb72ce548..eefd5c71b 100644 --- a/docs/examples/d14fe5838fc02224f4b5ade2626d6026.asciidoc +++ b/docs/examples/d14fe5838fc02224f4b5ade2626d6026.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ilm/apis/explain.asciidoc:100 +// ilm/apis/explain.asciidoc:106 [source, python] ---- diff --git a/docs/examples/d1b53bc9794e8609bd6f2245624bf977.asciidoc b/docs/examples/d1b53bc9794e8609bd6f2245624bf977.asciidoc index f7b027a88..872762ff1 100644 --- a/docs/examples/d1b53bc9794e8609bd6f2245624bf977.asciidoc +++ b/docs/examples/d1b53bc9794e8609bd6f2245624bf977.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/estimate-model-memory.asciidoc:54 +// ml/anomaly-detection/apis/estimate-model-memory.asciidoc:60 [source, python] ---- diff --git a/docs/examples/d1d8b6e642db1a7c70dbbf0fe6d8e92d.asciidoc b/docs/examples/d1d8b6e642db1a7c70dbbf0fe6d8e92d.asciidoc index 22b7b5a16..45bd12593 100644 --- a/docs/examples/d1d8b6e642db1a7c70dbbf0fe6d8e92d.asciidoc +++ b/docs/examples/d1d8b6e642db1a7c70dbbf0fe6d8e92d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/sparse-vector-query.asciidoc:190 +// query-dsl/sparse-vector-query.asciidoc:195 [source, python] ---- diff --git a/docs/examples/d1e0fee64389e7c8d4c092030626b61f.asciidoc b/docs/examples/d1e0fee64389e7c8d4c092030626b61f.asciidoc index f7602e3f4..bec485a6c 100644 --- a/docs/examples/d1e0fee64389e7c8d4c092030626b61f.asciidoc +++ b/docs/examples/d1e0fee64389e7c8d4c092030626b61f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:209 +// rest-api/security/get-api-keys.asciidoc:215 [source, python] ---- diff --git a/docs/examples/d1ea13e1e8372cbf1480a414723ff55a.asciidoc b/docs/examples/d1ea13e1e8372cbf1480a414723ff55a.asciidoc new file mode 100644 index 000000000..3fd7d3beb --- /dev/null +++ b/docs/examples/d1ea13e1e8372cbf1480a414723ff55a.asciidoc @@ -0,0 +1,31 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-zoom.asciidoc:247 + +[source, python] +---- +resp = client.security.create_api_key( + name="connector_name-connector-api-key", + role_descriptors={ + "connector_name-connector-role": { + "cluster": [ + "monitor", + "manage_connector" + ], + "indices": [ + { + "names": [ + "index_name", + ".search-acl-filter-index_name", + ".elastic-connectors*" + ], + "privileges": [ + "all" + ], + "allow_restricted_indices": False + } + ] + } + }, +) +print(resp) +---- diff --git a/docs/examples/d1fde25de1980b7e84fa878289fd0bcb.asciidoc b/docs/examples/d1fde25de1980b7e84fa878289fd0bcb.asciidoc index 38483671b..712879b6b 100644 --- a/docs/examples/d1fde25de1980b7e84fa878289fd0bcb.asciidoc +++ b/docs/examples/d1fde25de1980b7e84fa878289fd0bcb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:654 +// docs/update-by-query.asciidoc:660 [source, python] ---- diff --git a/docs/examples/d260225cf97e068ead2a8a6bb5aefd90.asciidoc b/docs/examples/d260225cf97e068ead2a8a6bb5aefd90.asciidoc index 7aaf95c43..691f89eb5 100644 --- a/docs/examples/d260225cf97e068ead2a8a6bb5aefd90.asciidoc +++ b/docs/examples/d260225cf97e068ead2a8a6bb5aefd90.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1550 +// analysis/analyzers/lang-analyzer.asciidoc:1551 [source, python] ---- diff --git a/docs/examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc b/docs/examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc new file mode 100644 index 000000000..713900e56 --- /dev/null +++ b/docs/examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc @@ -0,0 +1,11 @@ +// This file is autogenerated, DO NOT EDIT +// api-conventions.asciidoc:260 + +[source, python] +---- +resp = client.cluster.state( + metric="metadata", + filter_path="metadata.indices.*.system", +) +print(resp) +---- diff --git a/docs/examples/d3263afc69b6f969b9bbd8738cd07b97.asciidoc b/docs/examples/d3263afc69b6f969b9bbd8738cd07b97.asciidoc index d0717b7b6..3301055fa 100644 --- a/docs/examples/d3263afc69b6f969b9bbd8738cd07b97.asciidoc +++ b/docs/examples/d3263afc69b6f969b9bbd8738cd07b97.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/post-pause-follow.asciidoc:67 +// ccr/apis/follow/post-pause-follow.asciidoc:73 [source, python] ---- diff --git a/docs/examples/443f0e8fbba83777b2df624879d188d5.asciidoc b/docs/examples/d3440ec81dde5f1a01c0206cb35e539c.asciidoc similarity index 85% rename from docs/examples/443f0e8fbba83777b2df624879d188d5.asciidoc rename to docs/examples/d3440ec81dde5f1a01c0206cb35e539c.asciidoc index 19b41f3a9..63436572c 100644 --- a/docs/examples/443f0e8fbba83777b2df624879d188d5.asciidoc +++ b/docs/examples/d3440ec81dde5f1a01c0206cb35e539c.asciidoc @@ -11,7 +11,7 @@ resp = client.reindex( }, dest={ "index": "azure-openai-embeddings", - "pipeline": "azure_openai_embeddings" + "pipeline": "azure_openai_embeddings_pipeline" }, ) print(resp) diff --git a/docs/examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc b/docs/examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc index 4edb74f87..210dfef8d 100644 --- a/docs/examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc +++ b/docs/examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc @@ -1,13 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/oidc-prepare-authentication-api.asciidoc:128 +// rest-api/security/oidc-prepare-authentication-api.asciidoc:134 [source, python] ---- resp = client.security.oidc_prepare_authentication( - body={ - "iss": "http://127.0.0.1:8080", - "login_hint": "this_is_an_opaque_string" - }, + iss="http://127.0.0.1:8080", + login_hint="this_is_an_opaque_string", ) print(resp) ---- diff --git a/docs/examples/d3672a87a857ddb87519788236e57497.asciidoc b/docs/examples/d3672a87a857ddb87519788236e57497.asciidoc new file mode 100644 index 000000000..756cdf5be --- /dev/null +++ b/docs/examples/d3672a87a857ddb87519788236e57497.asciidoc @@ -0,0 +1,28 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-jinaai.asciidoc:232 + +[source, python] +---- +resp = client.search( + index="jinaai-index", + retriever={ + "text_similarity_reranker": { + "retriever": { + "standard": { + "query": { + "semantic": { + "field": "content", + "query": "who inspired taking care of the sea?" + } + } + } + }, + "field": "content", + "rank_window_size": 100, + "inference_id": "jinaai-rerank", + "inference_text": "who inspired taking care of the sea?" + } + }, +) +print(resp) +---- diff --git a/docs/examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc b/docs/examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc new file mode 100644 index 000000000..fdf783f2b --- /dev/null +++ b/docs/examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc @@ -0,0 +1,48 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:221 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "linear": { + "retrievers": [ + { + "retriever": { + "standard": { + "query": { + "query_string": { + "query": "(information retrieval) OR (artificial intelligence)", + "default_field": "text" + } + } + } + }, + "weight": 2, + "normalizer": "minmax" + }, + { + "retriever": { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + }, + "weight": 1.5, + "normalizer": "minmax" + } + ], + "rank_window_size": 10 + } + }, + source=False, +) +print(resp) +---- diff --git a/docs/examples/d3a5b70d493e0bd77b3f2b586341c83c.asciidoc b/docs/examples/d3a5b70d493e0bd77b3f2b586341c83c.asciidoc index 4129b9464..8fbb8c4fe 100644 --- a/docs/examples/d3a5b70d493e0bd77b3f2b586341c83c.asciidoc +++ b/docs/examples/d3a5b70d493e0bd77b3f2b586341c83c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1637 +// mapping/runtime.asciidoc:1635 [source, python] ---- diff --git a/docs/examples/d3e5edac5b461020017fd9d8ec7a91fa.asciidoc b/docs/examples/d3e5edac5b461020017fd9d8ec7a91fa.asciidoc index f1500d9b5..38d2830d9 100644 --- a/docs/examples/d3e5edac5b461020017fd9d8ec7a91fa.asciidoc +++ b/docs/examples/d3e5edac5b461020017fd9d8ec7a91fa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// security/authorization/managing-roles.asciidoc:264 +// security/authorization/managing-roles.asciidoc:262 [source, python] ---- diff --git a/docs/examples/d4158d486e7fee2702a14068b69e3b33.asciidoc b/docs/examples/d4158d486e7fee2702a14068b69e3b33.asciidoc new file mode 100644 index 000000000..917e7bfd7 --- /dev/null +++ b/docs/examples/d4158d486e7fee2702a14068b69e3b33.asciidoc @@ -0,0 +1,156 @@ +// This file is autogenerated, DO NOT EDIT +// data-streams/downsampling-dsl.asciidoc:45 + +[source, python] +---- +resp = client.indices.put_index_template( + name="datastream_template", + index_patterns=[ + "datastream*" + ], + data_stream={}, + template={ + "lifecycle": { + "downsampling": [ + { + "after": "1m", + "fixed_interval": "1h" + } + ] + }, + "settings": { + "index": { + "mode": "time_series" + } + }, + "mappings": { + "properties": { + "@timestamp": { + "type": "date" + }, + "kubernetes": { + "properties": { + "container": { + "properties": { + "cpu": { + "properties": { + "usage": { + "properties": { + "core": { + "properties": { + "ns": { + "type": "long" + } + } + }, + "limit": { + "properties": { + "pct": { + "type": "float" + } + } + }, + "nanocores": { + "type": "long", + "time_series_metric": "gauge" + }, + "node": { + "properties": { + "pct": { + "type": "float" + } + } + } + } + } + } + }, + "memory": { + "properties": { + "available": { + "properties": { + "bytes": { + "type": "long", + "time_series_metric": "gauge" + } + } + }, + "majorpagefaults": { + "type": "long" + }, + "pagefaults": { + "type": "long", + "time_series_metric": "gauge" + }, + "rss": { + "properties": { + "bytes": { + "type": "long", + "time_series_metric": "gauge" + } + } + }, + "usage": { + "properties": { + "bytes": { + "type": "long", + "time_series_metric": "gauge" + }, + "limit": { + "properties": { + "pct": { + "type": "float" + } + } + }, + "node": { + "properties": { + "pct": { + "type": "float" + } + } + } + } + }, + "workingset": { + "properties": { + "bytes": { + "type": "long", + "time_series_metric": "gauge" + } + } + } + } + }, + "name": { + "type": "keyword" + }, + "start_time": { + "type": "date" + } + } + }, + "host": { + "type": "keyword", + "time_series_dimension": True + }, + "namespace": { + "type": "keyword", + "time_series_dimension": True + }, + "node": { + "type": "keyword", + "time_series_dimension": True + }, + "pod": { + "type": "keyword", + "time_series_dimension": True + } + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/d4323be84152fa91abd76e966d4751dc.asciidoc b/docs/examples/d4323be84152fa91abd76e966d4751dc.asciidoc index 4e212eaf9..66d97f60e 100644 --- a/docs/examples/d4323be84152fa91abd76e966d4751dc.asciidoc +++ b/docs/examples/d4323be84152fa91abd76e966d4751dc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/query-api-key.asciidoc:469 +// rest-api/security/query-api-key.asciidoc:474 [source, python] ---- diff --git a/docs/examples/d46e9739bbf25eb2f7225f58ab08b2a7.asciidoc b/docs/examples/d46e9739bbf25eb2f7225f58ab08b2a7.asciidoc index 920b8ddb3..f52d17618 100644 --- a/docs/examples/d46e9739bbf25eb2f7225f58ab08b2a7.asciidoc +++ b/docs/examples/d46e9739bbf25eb2f7225f58ab08b2a7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/saml-complete-logout-api.asciidoc:83 +// rest-api/security/saml-complete-logout-api.asciidoc:89 [source, python] ---- diff --git a/docs/examples/d48b274a4b6098ffef0c016c6c945fb9.asciidoc b/docs/examples/d48b274a4b6098ffef0c016c6c945fb9.asciidoc index 77bb46877..bf5f7a444 100644 --- a/docs/examples/d48b274a4b6098ffef0c016c6c945fb9.asciidoc +++ b/docs/examples/d48b274a4b6098ffef0c016c6c945fb9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-tokens.asciidoc:216 +// rest-api/security/get-tokens.asciidoc:222 [source, python] ---- diff --git a/docs/examples/d4b405ef0302227e050ac8f0e39068e1.asciidoc b/docs/examples/d4b405ef0302227e050ac8f0e39068e1.asciidoc index 0a0a05e6a..2ea22c903 100644 --- a/docs/examples/d4b405ef0302227e050ac8f0e39068e1.asciidoc +++ b/docs/examples/d4b405ef0302227e050ac8f0e39068e1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:253 +// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:259 [source, python] ---- diff --git a/docs/examples/d4d450f536d747d5ef5050d2d8c66f09.asciidoc b/docs/examples/d4d450f536d747d5ef5050d2d8c66f09.asciidoc index b1a92fc25..4837789c1 100644 --- a/docs/examples/d4d450f536d747d5ef5050d2d8c66f09.asciidoc +++ b/docs/examples/d4d450f536d747d5ef5050d2d8c66f09.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/validate.asciidoc:87 +// search/validate.asciidoc:93 [source, python] ---- diff --git a/docs/examples/d4df39f72d3a3b80cd4042f6a21c3f19.asciidoc b/docs/examples/d4df39f72d3a3b80cd4042f6a21c3f19.asciidoc new file mode 100644 index 000000000..d277e6a15 --- /dev/null +++ b/docs/examples/d4df39f72d3a3b80cd4042f6a21c3f19.asciidoc @@ -0,0 +1,14 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/apis/put-ip-location-database.asciidoc:40 + +[source, python] +---- +resp = client.ingest.put_ip_location_database( + id="my-database-2", + configuration={ + "name": "standard_location", + "ipinfo": {} + }, +) +print(resp) +---- diff --git a/docs/examples/d4ef6ac034c4d42cb75d830ec69146e6.asciidoc b/docs/examples/d4ef6ac034c4d42cb75d830ec69146e6.asciidoc index 76daae69a..cac078e13 100644 --- a/docs/examples/d4ef6ac034c4d42cb75d830ec69146e6.asciidoc +++ b/docs/examples/d4ef6ac034c4d42cb75d830ec69146e6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/delete-auto-follow-pattern.asciidoc:69 +// ccr/apis/auto-follow/delete-auto-follow-pattern.asciidoc:75 [source, python] ---- diff --git a/docs/examples/d50b030edfe6d1128eb76aa5ba9d4e27.asciidoc b/docs/examples/d50b030edfe6d1128eb76aa5ba9d4e27.asciidoc index 0d4378362..acf3c899e 100644 --- a/docs/examples/d50b030edfe6d1128eb76aa5ba9d4e27.asciidoc +++ b/docs/examples/d50b030edfe6d1128eb76aa5ba9d4e27.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/put-trained-models-aliases.asciidoc:94 +// ml/trained-models/apis/put-trained-models-aliases.asciidoc:99 [source, python] ---- diff --git a/docs/examples/35fd9549350926f8d57dc1765e2f40d3.asciidoc b/docs/examples/d5242b1ab0213f25e5e0742032274ce6.asciidoc similarity index 94% rename from docs/examples/35fd9549350926f8d57dc1765e2f40d3.asciidoc rename to docs/examples/d5242b1ab0213f25e5e0742032274ce6.asciidoc index f70f2943f..1598f7708 100644 --- a/docs/examples/35fd9549350926f8d57dc1765e2f40d3.asciidoc +++ b/docs/examples/d5242b1ab0213f25e5e0742032274ce6.asciidoc @@ -10,7 +10,7 @@ resp = client.ingest.put_pipeline( { "attachment": { "field": "data", - "remove_binary": False + "remove_binary": True } } ], diff --git a/docs/examples/d524db57be9f16abac5396895b9a2a59.asciidoc b/docs/examples/d524db57be9f16abac5396895b9a2a59.asciidoc index b16084909..02b65b221 100644 --- a/docs/examples/d524db57be9f16abac5396895b9a2a59.asciidoc +++ b/docs/examples/d524db57be9f16abac5396895b9a2a59.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/resolve.asciidoc:47 +// indices/resolve.asciidoc:53 [source, python] ---- diff --git a/docs/examples/d5533f08f5cc0479f07a46c761f0786b.asciidoc b/docs/examples/d5533f08f5cc0479f07a46c761f0786b.asciidoc index bc24e9978..12f1b6a1a 100644 --- a/docs/examples/d5533f08f5cc0479f07a46c761f0786b.asciidoc +++ b/docs/examples/d5533f08f5cc0479f07a46c761f0786b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:321 +// docs/get.asciidoc:327 [source, python] ---- diff --git a/docs/examples/d56a9d89282df56adbbc34b91390ac17.asciidoc b/docs/examples/d56a9d89282df56adbbc34b91390ac17.asciidoc index fdc2e6aba..8f9d5911f 100644 --- a/docs/examples/d56a9d89282df56adbbc34b91390ac17.asciidoc +++ b/docs/examples/d56a9d89282df56adbbc34b91390ac17.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:49 +// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:55 [source, python] ---- diff --git a/docs/examples/d5d0ecf75843ddb5f92cfebd089e53e9.asciidoc b/docs/examples/d5d0ecf75843ddb5f92cfebd089e53e9.asciidoc index 4b4e8163c..d871dbc9f 100644 --- a/docs/examples/d5d0ecf75843ddb5f92cfebd089e53e9.asciidoc +++ b/docs/examples/d5d0ecf75843ddb5f92cfebd089e53e9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:742 +// docs/reindex.asciidoc:748 [source, python] ---- diff --git a/docs/examples/d5ead6aacbfbedc8396f87bb34acc880.asciidoc b/docs/examples/d5ead6aacbfbedc8396f87bb34acc880.asciidoc index 50b1633ff..d728103a6 100644 --- a/docs/examples/d5ead6aacbfbedc8396f87bb34acc880.asciidoc +++ b/docs/examples/d5ead6aacbfbedc8396f87bb34acc880.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// eql/get-async-eql-search-api.asciidoc:14 +// eql/get-async-eql-search-api.asciidoc:20 [source, python] ---- diff --git a/docs/examples/d603e76ab70131f7ec6b08758f95a0e3.asciidoc b/docs/examples/d603e76ab70131f7ec6b08758f95a0e3.asciidoc index b7e295f92..b2a1f1635 100644 --- a/docs/examples/d603e76ab70131f7ec6b08758f95a0e3.asciidoc +++ b/docs/examples/d603e76ab70131f7ec6b08758f95a0e3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/recovery.asciidoc:143 +// cat/recovery.asciidoc:148 [source, python] ---- diff --git a/docs/examples/d681508a745b2bc777d47ba606d24224.asciidoc b/docs/examples/d681508a745b2bc777d47ba606d24224.asciidoc index ac543ef18..3e907d7a5 100644 --- a/docs/examples/d681508a745b2bc777d47ba606d24224.asciidoc +++ b/docs/examples/d681508a745b2bc777d47ba606d24224.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/fielddata.asciidoc:152 +// cat/fielddata.asciidoc:158 [source, python] ---- diff --git a/docs/examples/d69bd36335774c8ae1286cee21310241.asciidoc b/docs/examples/d69bd36335774c8ae1286cee21310241.asciidoc index 846c0f023..686b8d63b 100644 --- a/docs/examples/d69bd36335774c8ae1286cee21310241.asciidoc +++ b/docs/examples/d69bd36335774c8ae1286cee21310241.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// security/authentication/remote-clusters-privileges-api-key.asciidoc:71 +// security/authentication/remote-clusters-privileges-api-key.asciidoc:72 [source, python] ---- diff --git a/docs/examples/d6a21afa4a94b9baa734eac430940bcf.asciidoc b/docs/examples/d6a21afa4a94b9baa734eac430940bcf.asciidoc index c7fca7b67..44333100e 100644 --- a/docs/examples/d6a21afa4a94b9baa734eac430940bcf.asciidoc +++ b/docs/examples/d6a21afa4a94b9baa734eac430940bcf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connectors-api.asciidoc:85 +// connector/apis/list-connectors-api.asciidoc:95 [source, python] ---- diff --git a/docs/examples/d6a4548b29e939fb197189c20c7c016f.asciidoc b/docs/examples/d6a4548b29e939fb197189c20c7c016f.asciidoc new file mode 100644 index 000000000..55232f34a --- /dev/null +++ b/docs/examples/d6a4548b29e939fb197189c20c7c016f.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// inference/elastic-infer-service.asciidoc:115 + +[source, python] +---- +resp = client.inference.put( + task_type="chat_completion", + inference_id="chat-completion-endpoint", + inference_config={ + "service": "elastic", + "service_settings": { + "model_id": "model-1" + } + }, +) +print(resp) +---- diff --git a/docs/examples/d7141bd4d0db964f5cc4a872ad79dce9.asciidoc b/docs/examples/d7141bd4d0db964f5cc4a872ad79dce9.asciidoc index 6c9d7e7d0..2b3a76482 100644 --- a/docs/examples/d7141bd4d0db964f5cc4a872ad79dce9.asciidoc +++ b/docs/examples/d7141bd4d0db964f5cc4a872ad79dce9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// features/apis/reset-features-api.asciidoc:14 +// features/apis/reset-features-api.asciidoc:20 [source, python] ---- diff --git a/docs/examples/d775836a0d7abecc6637aa988f204c30.asciidoc b/docs/examples/d775836a0d7abecc6637aa988f204c30.asciidoc index 46b21f906..8a55e35ce 100644 --- a/docs/examples/d775836a0d7abecc6637aa988f204c30.asciidoc +++ b/docs/examples/d775836a0d7abecc6637aa988f204c30.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:218 +// docs/termvectors.asciidoc:224 [source, python] ---- diff --git a/docs/examples/d7898526d239d2aea83727fb982f8f77.asciidoc b/docs/examples/d7898526d239d2aea83727fb982f8f77.asciidoc index d02e7b8c5..fbf8ababd 100644 --- a/docs/examples/d7898526d239d2aea83727fb982f8f77.asciidoc +++ b/docs/examples/d7898526d239d2aea83727fb982f8f77.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/refresh.asciidoc:113 +// indices/refresh.asciidoc:119 [source, python] ---- diff --git a/docs/examples/d7919fb6f4d02dde1390775eb8365b79.asciidoc b/docs/examples/d7919fb6f4d02dde1390775eb8365b79.asciidoc index 8a23680f6..3103cc120 100644 --- a/docs/examples/d7919fb6f4d02dde1390775eb8365b79.asciidoc +++ b/docs/examples/d7919fb6f4d02dde1390775eb8365b79.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/text.asciidoc:323 +// mapping/types/text.asciidoc:335 [source, python] ---- diff --git a/docs/examples/d7ae456f119246e95f2f4c37e7544b8c.asciidoc b/docs/examples/d7ae456f119246e95f2f4c37e7544b8c.asciidoc index ed5729b4f..8f3de184f 100644 --- a/docs/examples/d7ae456f119246e95f2f4c37e7544b8c.asciidoc +++ b/docs/examples/d7ae456f119246e95f2f4c37e7544b8c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/start-datafeed.asciidoc:109 +// ml/anomaly-detection/apis/start-datafeed.asciidoc:115 [source, python] ---- diff --git a/docs/examples/d7fe687201ac87b307cd06ed015dd317.asciidoc b/docs/examples/d7fe687201ac87b307cd06ed015dd317.asciidoc index f77b3758f..e713f4ada 100644 --- a/docs/examples/d7fe687201ac87b307cd06ed015dd317.asciidoc +++ b/docs/examples/d7fe687201ac87b307cd06ed015dd317.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:282 +// indices/put-mapping.asciidoc:288 [source, python] ---- diff --git a/docs/examples/d80ac403d8d936ca9dec185c7da13f2f.asciidoc b/docs/examples/d80ac403d8d936ca9dec185c7da13f2f.asciidoc index 8a73c0098..592d64248 100644 --- a/docs/examples/d80ac403d8d936ca9dec185c7da13f2f.asciidoc +++ b/docs/examples/d80ac403d8d936ca9dec185c7da13f2f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/apis/create-stored-script-api.asciidoc:11 +// scripting/apis/create-stored-script-api.asciidoc:17 [source, python] ---- diff --git a/docs/examples/d870d5bd1f97fc75872a298fcddec513.asciidoc b/docs/examples/d870d5bd1f97fc75872a298fcddec513.asciidoc index e128de0b6..adc5382ea 100644 --- a/docs/examples/d870d5bd1f97fc75872a298fcddec513.asciidoc +++ b/docs/examples/d870d5bd1f97fc75872a298fcddec513.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// text-structure/apis/find-structure.asciidoc:95 +// text-structure/apis/find-structure.asciidoc:101 [source, python] ---- diff --git a/docs/examples/d87175daed2327565d4325528c6d8b38.asciidoc b/docs/examples/d87175daed2327565d4325528c6d8b38.asciidoc index 2aca8df64..7f274a06b 100644 --- a/docs/examples/d87175daed2327565d4325528c6d8b38.asciidoc +++ b/docs/examples/d87175daed2327565d4325528c6d8b38.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:229 +// docs/get.asciidoc:235 [source, python] ---- diff --git a/docs/examples/d89d36741d906a71eca6c144e8d83889.asciidoc b/docs/examples/d89d36741d906a71eca6c144e8d83889.asciidoc index 66975ea95..de73d93f5 100644 --- a/docs/examples/d89d36741d906a71eca6c144e8d83889.asciidoc +++ b/docs/examples/d89d36741d906a71eca6c144e8d83889.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/tasks.asciidoc:237 +// cluster/tasks.asciidoc:243 [source, python] ---- diff --git a/docs/examples/d8a82511cb94f49b4fe4828fee3ba074.asciidoc b/docs/examples/d8a82511cb94f49b4fe4828fee3ba074.asciidoc index 7f8a3b734..393d427ca 100644 --- a/docs/examples/d8a82511cb94f49b4fe4828fee3ba074.asciidoc +++ b/docs/examples/d8a82511cb94f49b4fe4828fee3ba074.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:56 +// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:63 [source, python] ---- diff --git a/docs/examples/d8c053ee26c1533ce936ec81101d8e1b.asciidoc b/docs/examples/d8c053ee26c1533ce936ec81101d8e1b.asciidoc new file mode 100644 index 000000000..3be18be28 --- /dev/null +++ b/docs/examples/d8c053ee26c1533ce936ec81101d8e1b.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/apis/get-ip-location-database.asciidoc:61 + +[source, python] +---- +resp = client.ingest.get_ip_location_database( + id="my-database-id", +) +print(resp) +---- diff --git a/docs/examples/d93d52b6057a7aff3d0766ca44c505e0.asciidoc b/docs/examples/d93d52b6057a7aff3d0766ca44c505e0.asciidoc index d6d263200..ccde60cca 100644 --- a/docs/examples/d93d52b6057a7aff3d0766ca44c505e0.asciidoc +++ b/docs/examples/d93d52b6057a7aff3d0766ca44c505e0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:204 +// alias.asciidoc:206 [source, python] ---- diff --git a/docs/examples/d98fb2ff2cdd154dff4a576430755d98.asciidoc b/docs/examples/d98fb2ff2cdd154dff4a576430755d98.asciidoc index a76e0c4c3..469ffe6ca 100644 --- a/docs/examples/d98fb2ff2cdd154dff4a576430755d98.asciidoc +++ b/docs/examples/d98fb2ff2cdd154dff4a576430755d98.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1124 +// mapping/runtime.asciidoc:1122 [source, python] ---- diff --git a/docs/examples/da0fe1316e5b8fd68e2a8525bcd8b0f6.asciidoc b/docs/examples/da0fe1316e5b8fd68e2a8525bcd8b0f6.asciidoc index 6670d51f8..b2d4e5719 100644 --- a/docs/examples/da0fe1316e5b8fd68e2a8525bcd8b0f6.asciidoc +++ b/docs/examples/da0fe1316e5b8fd68e2a8525bcd8b0f6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/recipes/scoring.asciidoc:168 +// how-to/recipes/scoring.asciidoc:169 [source, python] ---- diff --git a/docs/examples/da18bae37cda566c0254b30c15221b01.asciidoc b/docs/examples/da18bae37cda566c0254b30c15221b01.asciidoc index 9f1939a58..5d577108a 100644 --- a/docs/examples/da18bae37cda566c0254b30c15221b01.asciidoc +++ b/docs/examples/da18bae37cda566c0254b30c15221b01.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-service-token-caches.asciidoc:55 +// rest-api/security/clear-service-token-caches.asciidoc:61 [source, python] ---- diff --git a/docs/examples/da3f280bc65b581fb3097be768061bee.asciidoc b/docs/examples/da3f280bc65b581fb3097be768061bee.asciidoc index 7dfabdaa3..0b88203ea 100644 --- a/docs/examples/da3f280bc65b581fb3097be768061bee.asciidoc +++ b/docs/examples/da3f280bc65b581fb3097be768061bee.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/saml-prepare-authentication-api.asciidoc:90 +// rest-api/security/saml-prepare-authentication-api.asciidoc:96 [source, python] ---- diff --git a/docs/examples/daae2e6acebc84e537764f4ba07f2e6e.asciidoc b/docs/examples/daae2e6acebc84e537764f4ba07f2e6e.asciidoc index 1205c8e57..213e662a8 100644 --- a/docs/examples/daae2e6acebc84e537764f4ba07f2e6e.asciidoc +++ b/docs/examples/daae2e6acebc84e537764f4ba07f2e6e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// setup/important-settings/path-settings.asciidoc:95 +// path-settings-overview.asciidoc:75 [source, python] ---- diff --git a/docs/examples/dac8ec8547bc446637fd97d9fa872f4f.asciidoc b/docs/examples/dac8ec8547bc446637fd97d9fa872f4f.asciidoc index d5957ecad..d0da2cfd8 100644 --- a/docs/examples/dac8ec8547bc446637fd97d9fa872f4f.asciidoc +++ b/docs/examples/dac8ec8547bc446637fd97d9fa872f4f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/put-dfanalytics.asciidoc:816 +// ml/df-analytics/apis/put-dfanalytics.asciidoc:822 [source, python] ---- diff --git a/docs/examples/db19cc7a26ca80106d86d688f4be67a8.asciidoc b/docs/examples/db19cc7a26ca80106d86d688f4be67a8.asciidoc index 707ba862c..b6a2076b6 100644 --- a/docs/examples/db19cc7a26ca80106d86d688f4be67a8.asciidoc +++ b/docs/examples/db19cc7a26ca80106d86d688f4be67a8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/stop-dfanalytics.asciidoc:69 +// ml/df-analytics/apis/stop-dfanalytics.asciidoc:75 [source, python] ---- diff --git a/docs/examples/db773f690edf659ac9b044dc854c77eb.asciidoc b/docs/examples/db773f690edf659ac9b044dc854c77eb.asciidoc index b579ccc7f..1082dab75 100644 --- a/docs/examples/db773f690edf659ac9b044dc854c77eb.asciidoc +++ b/docs/examples/db773f690edf659ac9b044dc854c77eb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-vector-tile-api.asciidoc:666 +// search/search-vector-tile-api.asciidoc:671 [source, python] ---- diff --git a/docs/examples/db8710a9793ae0817a45892d33468160.asciidoc b/docs/examples/db8710a9793ae0817a45892d33468160.asciidoc index ec6ab218d..48ecd1500 100644 --- a/docs/examples/db8710a9793ae0817a45892d33468160.asciidoc +++ b/docs/examples/db8710a9793ae0817a45892d33468160.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/diskusage.asciidoc:69 +// indices/diskusage.asciidoc:75 [source, python] ---- diff --git a/docs/examples/dbc50b8c934171e94604575a8b36f349.asciidoc b/docs/examples/dbc50b8c934171e94604575a8b36f349.asciidoc index 77af53991..a3f05c019 100644 --- a/docs/examples/dbc50b8c934171e94604575a8b36f349.asciidoc +++ b/docs/examples/dbc50b8c934171e94604575a8b36f349.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/update-settings.asciidoc:145 +// indices/update-settings.asciidoc:151 [source, python] ---- diff --git a/docs/examples/dbdd58cdeac9ef20b42ff73e4864e697.asciidoc b/docs/examples/dbdd58cdeac9ef20b42ff73e4864e697.asciidoc index 9371ae3f1..1fe7a327f 100644 --- a/docs/examples/dbdd58cdeac9ef20b42ff73e4864e697.asciidoc +++ b/docs/examples/dbdd58cdeac9ef20b42ff73e4864e697.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-field-mapping.asciidoc:245 +// indices/get-field-mapping.asciidoc:251 [source, python] ---- diff --git a/docs/examples/dbf93d02ab86a09929a21232b19709cc.asciidoc b/docs/examples/dbf93d02ab86a09929a21232b19709cc.asciidoc index bbdbc2287..b4f4b70ce 100644 --- a/docs/examples/dbf93d02ab86a09929a21232b19709cc.asciidoc +++ b/docs/examples/dbf93d02ab86a09929a21232b19709cc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/stop-trained-model-deployment.asciidoc:67 +// ml/trained-models/apis/stop-trained-model-deployment.asciidoc:73 [source, python] ---- diff --git a/docs/examples/dbf9abc37899352751dab0ede62af2fd.asciidoc b/docs/examples/dbf9abc37899352751dab0ede62af2fd.asciidoc index eeccebacc..029f025ca 100644 --- a/docs/examples/dbf9abc37899352751dab0ede62af2fd.asciidoc +++ b/docs/examples/dbf9abc37899352751dab0ede62af2fd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-tokens.asciidoc:115 +// rest-api/security/invalidate-tokens.asciidoc:121 [source, python] ---- diff --git a/docs/examples/dc468865da947b4a9136a5b92878d918.asciidoc b/docs/examples/dc468865da947b4a9136a5b92878d918.asciidoc index 856c3b54b..959201872 100644 --- a/docs/examples/dc468865da947b4a9136a5b92878d918.asciidoc +++ b/docs/examples/dc468865da947b4a9136a5b92878d918.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-update-api-keys.asciidoc:125 +// rest-api/security/bulk-update-api-keys.asciidoc:131 [source, python] ---- diff --git a/docs/examples/dc8c94c9bef1f879282caea5c406f36e.asciidoc b/docs/examples/dc8c94c9bef1f879282caea5c406f36e.asciidoc index 9e0d71ce6..4c04a5ddc 100644 --- a/docs/examples/dc8c94c9bef1f879282caea5c406f36e.asciidoc +++ b/docs/examples/dc8c94c9bef1f879282caea5c406f36e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:183 +// indices/analyze.asciidoc:189 [source, python] ---- diff --git a/docs/examples/dcc02ad69da0a5aa10c4e53b34be8ec0.asciidoc b/docs/examples/dcc02ad69da0a5aa10c4e53b34be8ec0.asciidoc index d5a65b419..b769cd037 100644 --- a/docs/examples/dcc02ad69da0a5aa10c4e53b34be8ec0.asciidoc +++ b/docs/examples/dcc02ad69da0a5aa10c4e53b34be8ec0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/multi-get.asciidoc:10 +// docs/multi-get.asciidoc:16 [source, python] ---- diff --git a/docs/examples/dcee24dba43050e4b01b6e3a3211ce09.asciidoc b/docs/examples/dcee24dba43050e4b01b6e3a3211ce09.asciidoc index 21686169d..af347fdfc 100644 --- a/docs/examples/dcee24dba43050e4b01b6e3a3211ce09.asciidoc +++ b/docs/examples/dcee24dba43050e4b01b6e3a3211ce09.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1283 +// mapping/runtime.asciidoc:1281 [source, python] ---- diff --git a/docs/examples/dcf82f3aacae49c0bb4ccbc673f13e9f.asciidoc b/docs/examples/dcf82f3aacae49c0bb4ccbc673f13e9f.asciidoc new file mode 100644 index 000000000..c98d06e98 --- /dev/null +++ b/docs/examples/dcf82f3aacae49c0bb4ccbc673f13e9f.asciidoc @@ -0,0 +1,38 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/knn-search.asciidoc:1202 + +[source, python] +---- +resp = client.search( + index="my-index", + size=10, + query={ + "script_score": { + "query": { + "knn": { + "query_vector": [ + 0.04283529, + 0.85670587, + -0.51402352, + 0 + ], + "field": "my_int4_vector", + "num_candidates": 20 + } + }, + "script": { + "source": "(dotProduct(params.queryVector, 'my_int4_vector') + 1.0)", + "params": { + "queryVector": [ + 0.04283529, + 0.85670587, + -0.51402352, + 0 + ] + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/dcfa7f479a33f459a2d222a92e651451.asciidoc b/docs/examples/dcfa7f479a33f459a2d222a92e651451.asciidoc index a52fb6c46..e49e3a06e 100644 --- a/docs/examples/dcfa7f479a33f459a2d222a92e651451.asciidoc +++ b/docs/examples/dcfa7f479a33f459a2d222a92e651451.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-roles.asciidoc:107 +// rest-api/security/create-roles.asciidoc:126 [source, python] ---- diff --git a/docs/examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc b/docs/examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc new file mode 100644 index 000000000..8ffce9166 --- /dev/null +++ b/docs/examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc @@ -0,0 +1,57 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:535 + +[source, python] +---- +resp = client.indices.update_aliases( + actions=[ + { + "add": { + "index": ".reindexed-v9-ml-anomalies-custom-example", + "alias": ".ml-anomalies-example1", + "filter": { + "term": { + "job_id": { + "value": "example1" + } + } + }, + "is_hidden": True + } + }, + { + "add": { + "index": ".reindexed-v9-ml-anomalies-custom-example", + "alias": ".ml-anomalies-example2", + "filter": { + "term": { + "job_id": { + "value": "example2" + } + } + }, + "is_hidden": True + } + }, + { + "remove": { + "index": ".ml-anomalies-custom-example", + "aliases": ".ml-anomalies-*" + } + }, + { + "remove_index": { + "index": ".ml-anomalies-custom-example" + } + }, + { + "add": { + "index": ".reindexed-v9-ml-anomalies-custom-example", + "alias": ".ml-anomalies-custom-example", + "is_hidden": True + } + } + ], +) +print(resp) +---- diff --git a/docs/examples/3ff634a50e2e4556bad7ea8553576992.asciidoc b/docs/examples/dd3ee00ab2af607b32532180d60a41d4.asciidoc similarity index 85% rename from docs/examples/3ff634a50e2e4556bad7ea8553576992.asciidoc rename to docs/examples/dd3ee00ab2af607b32532180d60a41d4.asciidoc index fd08ed485..11b180706 100644 --- a/docs/examples/3ff634a50e2e4556bad7ea8553576992.asciidoc +++ b/docs/examples/dd3ee00ab2af607b32532180d60a41d4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/tokenfilters/snowball-tokenfilter.asciidoc:17 +// analysis/tokenfilters/snowball-tokenfilter.asciidoc:19 [source, python] ---- @@ -19,7 +19,7 @@ resp = client.indices.create( "filter": { "my_snow": { "type": "snowball", - "language": "Lovins" + "language": "English" } } } diff --git a/docs/examples/dd4f051ab62f0507e3b6e3d6f333e85f.asciidoc b/docs/examples/dd4f051ab62f0507e3b6e3d6f333e85f.asciidoc index bbab73fed..62d99f7e9 100644 --- a/docs/examples/dd4f051ab62f0507e3b6e3d6f333e85f.asciidoc +++ b/docs/examples/dd4f051ab62f0507e3b6e3d6f333e85f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-component-template.asciidoc:95 +// indices/get-component-template.asciidoc:101 [source, python] ---- diff --git a/docs/examples/dd71b0c9f9197684ff29c61062c55660.asciidoc b/docs/examples/dd71b0c9f9197684ff29c61062c55660.asciidoc index 9c29e08a5..6acf42c3f 100644 --- a/docs/examples/dd71b0c9f9197684ff29c61062c55660.asciidoc +++ b/docs/examples/dd71b0c9f9197684ff29c61062c55660.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-settings.asciidoc:32 +// rest-api/security/get-settings.asciidoc:38 [source, python] ---- diff --git a/docs/examples/0e3abd15dde97a2334621190c4ad4f96.asciidoc b/docs/examples/dd7814258121d3c2e576a7f00469d7e3.asciidoc similarity index 92% rename from docs/examples/0e3abd15dde97a2334621190c4ad4f96.asciidoc rename to docs/examples/dd7814258121d3c2e576a7f00469d7e3.asciidoc index 1067fa1a5..93b2779f4 100644 --- a/docs/examples/0e3abd15dde97a2334621190c4ad4f96.asciidoc +++ b/docs/examples/dd7814258121d3c2e576a7f00469d7e3.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="mistral_embeddings", + id="mistral_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/dd792bb53703a57f9207e36d16e26255.asciidoc b/docs/examples/dd792bb53703a57f9207e36d16e26255.asciidoc index a37ac7dc1..9b303bc15 100644 --- a/docs/examples/dd792bb53703a57f9207e36d16e26255.asciidoc +++ b/docs/examples/dd792bb53703a57f9207e36d16e26255.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:1164 +// mapping/runtime.asciidoc:1162 [source, python] ---- diff --git a/docs/examples/dda949d20d07a9edbe64cefc623df945.asciidoc b/docs/examples/dda949d20d07a9edbe64cefc623df945.asciidoc index 744a4739f..bbb44713f 100644 --- a/docs/examples/dda949d20d07a9edbe64cefc623df945.asciidoc +++ b/docs/examples/dda949d20d07a9edbe64cefc623df945.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:467 +// scripting/using.asciidoc:472 [source, python] ---- diff --git a/docs/examples/dddb6a6ebd145f8411c5b4910d332f87.asciidoc b/docs/examples/dddb6a6ebd145f8411c5b4910d332f87.asciidoc index 534bd51fb..79eadab36 100644 --- a/docs/examples/dddb6a6ebd145f8411c5b4910d332f87.asciidoc +++ b/docs/examples/dddb6a6ebd145f8411c5b4910d332f87.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// esql/multivalued-fields.asciidoc:186 +// esql/multivalued-fields.asciidoc:233 [source, python] ---- diff --git a/docs/examples/dde283eab92608e7bfbfa09c6482a12e.asciidoc b/docs/examples/dde283eab92608e7bfbfa09c6482a12e.asciidoc index c8f32431a..17a42fe0b 100644 --- a/docs/examples/dde283eab92608e7bfbfa09c6482a12e.asciidoc +++ b/docs/examples/dde283eab92608e7bfbfa09c6482a12e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-api-keys.asciidoc:134 +// rest-api/security/invalidate-api-keys.asciidoc:140 [source, python] ---- diff --git a/docs/examples/dde92fdf3469349ffe2c81764333543a.asciidoc b/docs/examples/dde92fdf3469349ffe2c81764333543a.asciidoc new file mode 100644 index 000000000..2df1ba4b3 --- /dev/null +++ b/docs/examples/dde92fdf3469349ffe2c81764333543a.asciidoc @@ -0,0 +1,14 @@ +// This file is autogenerated, DO NOT EDIT +// migration/apis/create-index-from-source.asciidoc:137 + +[source, python] +---- +resp = client.indices.create_from( + source="my-index", + dest="my-new-index", + create_from={ + "remove_index_blocks": False + }, +) +print(resp) +---- diff --git a/docs/examples/ddf375e4b6175d830fa4097ea0b41536.asciidoc b/docs/examples/ddf375e4b6175d830fa4097ea0b41536.asciidoc index ca50fe2d1..914be135b 100644 --- a/docs/examples/ddf375e4b6175d830fa4097ea0b41536.asciidoc +++ b/docs/examples/ddf375e4b6175d830fa4097ea0b41536.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/delete-desired-nodes.asciidoc:55 +// cluster/delete-desired-nodes.asciidoc:61 [source, python] ---- diff --git a/docs/examples/ddf56782ecc7eaeb3115e150c4830013.asciidoc b/docs/examples/ddf56782ecc7eaeb3115e150c4830013.asciidoc index c21a7216f..b77c1e337 100644 --- a/docs/examples/ddf56782ecc7eaeb3115e150c4830013.asciidoc +++ b/docs/examples/ddf56782ecc7eaeb3115e150c4830013.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:585 +// docs/update-by-query.asciidoc:591 [source, python] ---- diff --git a/docs/examples/de139866a220124360e5e27d1a736ea4.asciidoc b/docs/examples/de139866a220124360e5e27d1a736ea4.asciidoc index a65c0590d..122457dad 100644 --- a/docs/examples/de139866a220124360e5e27d1a736ea4.asciidoc +++ b/docs/examples/de139866a220124360e5e27d1a736ea4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:286 +// search/search-your-data/sort-search-results.asciidoc:288 [source, python] ---- diff --git a/docs/examples/de2f59887737de3a27716177b60393a2.asciidoc b/docs/examples/de2f59887737de3a27716177b60393a2.asciidoc index 12fb371a6..d0f8746de 100644 --- a/docs/examples/de2f59887737de3a27716177b60393a2.asciidoc +++ b/docs/examples/de2f59887737de3a27716177b60393a2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:239 +// indices/analyze.asciidoc:245 [source, python] ---- diff --git a/docs/examples/de876505acc75d371d1f6f484c449197.asciidoc b/docs/examples/de876505acc75d371d1f6f484c449197.asciidoc index c3fb4ff3c..a82a998b3 100644 --- a/docs/examples/de876505acc75d371d1f6f484c449197.asciidoc +++ b/docs/examples/de876505acc75d371d1f6f484c449197.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-index.asciidoc:251 +// indices/create-index.asciidoc:257 [source, python] ---- diff --git a/docs/examples/de90249caeac6f1601a7e7e9f98f1bec.asciidoc b/docs/examples/de90249caeac6f1601a7e7e9f98f1bec.asciidoc index 70c2d979b..0b7c4e510 100644 --- a/docs/examples/de90249caeac6f1601a7e7e9f98f1bec.asciidoc +++ b/docs/examples/de90249caeac6f1601a7e7e9f98f1bec.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/query-api-key.asciidoc:395 +// rest-api/security/query-api-key.asciidoc:400 [source, python] ---- diff --git a/docs/examples/df04e2e9af66d5e30b1bfdbd458cab13.asciidoc b/docs/examples/df04e2e9af66d5e30b1bfdbd458cab13.asciidoc index e4d62925c..ce180edf2 100644 --- a/docs/examples/df04e2e9af66d5e30b1bfdbd458cab13.asciidoc +++ b/docs/examples/df04e2e9af66d5e30b1bfdbd458cab13.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:238 +// how-to/size-your-shards.asciidoc:239 [source, python] ---- diff --git a/docs/examples/df0d27d3abd286b75aef7ddcf0e6c66c.asciidoc b/docs/examples/df0d27d3abd286b75aef7ddcf0e6c66c.asciidoc index 4d21c00df..bba0cb949 100644 --- a/docs/examples/df0d27d3abd286b75aef7ddcf0e6c66c.asciidoc +++ b/docs/examples/df0d27d3abd286b75aef7ddcf0e6c66c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/apis/reload-analyzers.asciidoc:110 +// indices/apis/reload-analyzers.asciidoc:116 [source, python] ---- diff --git a/docs/examples/df7dbac966b67404b8bfa9cdda5ef480.asciidoc b/docs/examples/df7dbac966b67404b8bfa9cdda5ef480.asciidoc index ffbfb83ee..e1a3e6284 100644 --- a/docs/examples/df7dbac966b67404b8bfa9cdda5ef480.asciidoc +++ b/docs/examples/df7dbac966b67404b8bfa9cdda5ef480.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/ack-watch.asciidoc:253 +// rest-api/watcher/ack-watch.asciidoc:259 [source, python] ---- diff --git a/docs/examples/df7ed126d8c92ddd3655c59ce4f305c9.asciidoc b/docs/examples/df7ed126d8c92ddd3655c59ce4f305c9.asciidoc index 3c77d1754..a6d31b62b 100644 --- a/docs/examples/df7ed126d8c92ddd3655c59ce4f305c9.asciidoc +++ b/docs/examples/df7ed126d8c92ddd3655c59ce4f305c9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/thread_pool.asciidoc:172 +// cat/thread_pool.asciidoc:178 [source, python] ---- diff --git a/docs/examples/a225fc8c134cb21a85bc6025dac9368b.asciidoc b/docs/examples/df81b88a2192dd6f9912e0c948a44487.asciidoc similarity index 91% rename from docs/examples/a225fc8c134cb21a85bc6025dac9368b.asciidoc rename to docs/examples/df81b88a2192dd6f9912e0c948a44487.asciidoc index 073a56a4e..7241e1518 100644 --- a/docs/examples/a225fc8c134cb21a85bc6025dac9368b.asciidoc +++ b/docs/examples/df81b88a2192dd6f9912e0c948a44487.asciidoc @@ -7,7 +7,7 @@ resp = client.inference.put( task_type="sparse_embedding", inference_id="elser_embeddings", inference_config={ - "service": "elser", + "service": "elasticsearch", "service_settings": { "num_allocations": 1, "num_threads": 1 diff --git a/docs/examples/dfcdcd3ea6753dcc391a4a52cf640527.asciidoc b/docs/examples/dfcdcd3ea6753dcc391a4a52cf640527.asciidoc index 5176519eb..bd66391fb 100644 --- a/docs/examples/dfcdcd3ea6753dcc391a4a52cf640527.asciidoc +++ b/docs/examples/dfcdcd3ea6753dcc391a4a52cf640527.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/update-desired-nodes.asciidoc:112 +// cluster/update-desired-nodes.asciidoc:118 [source, python] ---- diff --git a/docs/examples/dfce1be1d035aff0b8fdf4a8839f7795.asciidoc b/docs/examples/dfce1be1d035aff0b8fdf4a8839f7795.asciidoc index 4d49fe44f..d57f7495d 100644 --- a/docs/examples/dfce1be1d035aff0b8fdf4a8839f7795.asciidoc +++ b/docs/examples/dfce1be1d035aff0b8fdf4a8839f7795.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/update-trained-model-deployment.asciidoc:115 +// ml/trained-models/apis/update-trained-model-deployment.asciidoc:121 [source, python] ---- diff --git a/docs/examples/dff61a76d5ef9ca8cbe59a416269a84b.asciidoc b/docs/examples/dff61a76d5ef9ca8cbe59a416269a84b.asciidoc index 50fae83d8..85539c607 100644 --- a/docs/examples/dff61a76d5ef9ca8cbe59a416269a84b.asciidoc +++ b/docs/examples/dff61a76d5ef9ca8cbe59a416269a84b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/apis/delete-pipeline.asciidoc:28 +// ingest/apis/delete-pipeline.asciidoc:34 [source, python] ---- diff --git a/docs/examples/dffbbdc4025e5777c647d8818847b960.asciidoc b/docs/examples/dffbbdc4025e5777c647d8818847b960.asciidoc index b0758980c..05eb40de6 100644 --- a/docs/examples/dffbbdc4025e5777c647d8818847b960.asciidoc +++ b/docs/examples/dffbbdc4025e5777c647d8818847b960.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-api-keys.asciidoc:269 +// rest-api/security/get-api-keys.asciidoc:275 [source, python] ---- diff --git a/docs/examples/e017c2de6f93a8dd97f5c6e002dd5c4f.asciidoc b/docs/examples/e017c2de6f93a8dd97f5c6e002dd5c4f.asciidoc new file mode 100644 index 000000000..ad5ef4204 --- /dev/null +++ b/docs/examples/e017c2de6f93a8dd97f5c6e002dd5c4f.asciidoc @@ -0,0 +1,28 @@ +// This file is autogenerated, DO NOT EDIT +// ml/anomaly-detection/apis/post-calendar-event.asciidoc:132 + +[source, python] +---- +resp = client.ml.post_calendar_events( + calendar_id="dst-germany", + events=[ + { + "description": "Fall 2024", + "start_time": 1729994400000, + "end_time": 1730167200000, + "skip_result": False, + "skip_model_update": False, + "force_time_shift": -3600 + }, + { + "description": "Spring 2025", + "start_time": 1743296400000, + "end_time": 1743469200000, + "skip_result": False, + "skip_model_update": False, + "force_time_shift": 3600 + } + ], +) +print(resp) +---- diff --git a/docs/examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc b/docs/examples/e04267ffc50d916800b919c6cdc9622a.asciidoc similarity index 52% rename from docs/examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc rename to docs/examples/e04267ffc50d916800b919c6cdc9622a.asciidoc index 41820a845..58e605469 100644 --- a/docs/examples/34cdeefb09bbbe5206957a8bc1bd513d.asciidoc +++ b/docs/examples/e04267ffc50d916800b919c6cdc9622a.asciidoc @@ -1,12 +1,12 @@ // This file is autogenerated, DO NOT EDIT -// index-modules/slowlog.asciidoc:66 +// mapping/params/ignore-above.asciidoc:74 [source, python] ---- -resp = client.indices.put_settings( +resp = client.indices.create( index="my-index-000001", settings={ - "index.search.slowlog.include.user": True + "index.mapping.ignore_above": 256 }, ) print(resp) diff --git a/docs/examples/e095fc96504efecc588f97673912e3d3.asciidoc b/docs/examples/e095fc96504efecc588f97673912e3d3.asciidoc index d4ec08315..32766347f 100644 --- a/docs/examples/e095fc96504efecc588f97673912e3d3.asciidoc +++ b/docs/examples/e095fc96504efecc588f97673912e3d3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/put-job.asciidoc:414 +// ml/anomaly-detection/apis/put-job.asciidoc:420 [source, python] ---- diff --git a/docs/examples/e0a7c730ef0f22e3edffe9a254bc56e7.asciidoc b/docs/examples/e0a7c730ef0f22e3edffe9a254bc56e7.asciidoc index acefd9f2b..b6d91ff3a 100644 --- a/docs/examples/e0a7c730ef0f22e3edffe9a254bc56e7.asciidoc +++ b/docs/examples/e0a7c730ef0f22e3edffe9a254bc56e7.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:234 +// docs/reindex.asciidoc:240 [source, python] ---- diff --git a/docs/examples/e0b2f56c34e33ff52f8f9658be2f7ca1.asciidoc b/docs/examples/e0b2f56c34e33ff52f8f9658be2f7ca1.asciidoc index 977bd87df..90b9f0ad8 100644 --- a/docs/examples/e0b2f56c34e33ff52f8f9658be2f7ca1.asciidoc +++ b/docs/examples/e0b2f56c34e33ff52f8f9658be2f7ca1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/stats.asciidoc:105 +// indices/stats.asciidoc:111 [source, python] ---- diff --git a/docs/examples/e0bbfb368eae307e9508ab8d6e9cf23c.asciidoc b/docs/examples/e0bbfb368eae307e9508ab8d6e9cf23c.asciidoc index cfae9905a..ace4a2891 100644 --- a/docs/examples/e0bbfb368eae307e9508ab8d6e9cf23c.asciidoc +++ b/docs/examples/e0bbfb368eae307e9508ab8d6e9cf23c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/fielddata.asciidoc:102 +// cat/fielddata.asciidoc:108 [source, python] ---- diff --git a/docs/examples/e0d4a800de2d8f4062e69433586c38db.asciidoc b/docs/examples/e0d4a800de2d8f4062e69433586c38db.asciidoc index 089cc5b46..ae7a86e03 100644 --- a/docs/examples/e0d4a800de2d8f4062e69433586c38db.asciidoc +++ b/docs/examples/e0d4a800de2d8f4062e69433586c38db.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/saml-complete-logout-api.asciidoc:69 +// rest-api/security/saml-complete-logout-api.asciidoc:75 [source, python] ---- diff --git a/docs/examples/e0fcef99656799de6b88117d56f131e2.asciidoc b/docs/examples/e0fcef99656799de6b88117d56f131e2.asciidoc index 2610b22e0..a7851c6c4 100644 --- a/docs/examples/e0fcef99656799de6b88117d56f131e2.asciidoc +++ b/docs/examples/e0fcef99656799de6b88117d56f131e2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/explain.asciidoc:99 +// troubleshooting/troubleshooting-searches.asciidoc:276 [source, python] ---- diff --git a/docs/examples/e1337c6b76defd5a46d05220f9d9c9fc.asciidoc b/docs/examples/e1337c6b76defd5a46d05220f9d9c9fc.asciidoc index d6324f804..5d4c3eedc 100644 --- a/docs/examples/e1337c6b76defd5a46d05220f9d9c9fc.asciidoc +++ b/docs/examples/e1337c6b76defd5a46d05220f9d9c9fc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-tokens.asciidoc:128 +// rest-api/security/invalidate-tokens.asciidoc:134 [source, python] ---- diff --git a/docs/examples/e14a5a5a1c880031486bfff43031fa3a.asciidoc b/docs/examples/e14a5a5a1c880031486bfff43031fa3a.asciidoc index 12335ef7e..655560a56 100644 --- a/docs/examples/e14a5a5a1c880031486bfff43031fa3a.asciidoc +++ b/docs/examples/e14a5a5a1c880031486bfff43031fa3a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:64 +// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:71 [source, python] ---- diff --git a/docs/examples/e1d6ecab4148b09f4c605474157e7dbd.asciidoc b/docs/examples/e1d6ecab4148b09f4c605474157e7dbd.asciidoc index 75fd178c1..0f1f01902 100644 --- a/docs/examples/e1d6ecab4148b09f4c605474157e7dbd.asciidoc +++ b/docs/examples/e1d6ecab4148b09f4c605474157e7dbd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-settings.asciidoc:11 +// troubleshooting/troubleshooting-searches.asciidoc:305 [source, python] ---- diff --git a/docs/examples/e20037f66bf54bcac7d10f536f031f34.asciidoc b/docs/examples/e20037f66bf54bcac7d10f536f031f34.asciidoc deleted file mode 100644 index 57dd81542..000000000 --- a/docs/examples/e20037f66bf54bcac7d10f536f031f34.asciidoc +++ /dev/null @@ -1,13 +0,0 @@ -// This file is autogenerated, DO NOT EDIT -// modules/cluster/disk_allocator.asciidoc:108 - -[source, python] ----- -resp = client.indices.put_settings( - index="my-index-000001", - settings={ - "index.blocks.read_only_allow_delete": None - }, -) -print(resp) ----- diff --git a/docs/examples/e22a1da3c622611be6855e534c0709ae.asciidoc b/docs/examples/e22a1da3c622611be6855e534c0709ae.asciidoc new file mode 100644 index 000000000..54e333bee --- /dev/null +++ b/docs/examples/e22a1da3c622611be6855e534c0709ae.asciidoc @@ -0,0 +1,13 @@ +// This file is autogenerated, DO NOT EDIT +// query-rules/apis/test-query-ruleset.asciidoc:117 + +[source, python] +---- +resp = client.query_rules.test( + ruleset_id="my-ruleset", + match_criteria={ + "query_string": "puggles" + }, +) +print(resp) +---- diff --git a/docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc b/docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc index 3e39921e1..aff66e7d7 100644 --- a/docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc +++ b/docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// modules/indices/request_cache.asciidoc:72 +// shard-request-cache.asciidoc:74 [source, python] ---- diff --git a/docs/examples/e2a22c6fd58cc0becf4c383134a08f8b.asciidoc b/docs/examples/e2a22c6fd58cc0becf4c383134a08f8b.asciidoc index 112f6dd18..e4114ca17 100644 --- a/docs/examples/e2a22c6fd58cc0becf4c383134a08f8b.asciidoc +++ b/docs/examples/e2a22c6fd58cc0becf4c383134a08f8b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/intervals-query.asciidoc:374 +// query-dsl/intervals-query.asciidoc:455 [source, python] ---- diff --git a/docs/examples/e2a753029b450942a3228e3003a55a7d.asciidoc b/docs/examples/e2a753029b450942a3228e3003a55a7d.asciidoc index 1c1422a21..8c8a3bb03 100644 --- a/docs/examples/e2a753029b450942a3228e3003a55a7d.asciidoc +++ b/docs/examples/e2a753029b450942a3228e3003a55a7d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/lifecycle/apis/put-lifecycle.asciidoc:105 +// data-streams/lifecycle/apis/put-lifecycle.asciidoc:111 [source, python] ---- diff --git a/docs/examples/e2bcc8f4ed2b4de82729e7a5a7c8f634.asciidoc b/docs/examples/e2bcc8f4ed2b4de82729e7a5a7c8f634.asciidoc index d266cb8a5..ff2f3c34e 100644 --- a/docs/examples/e2bcc8f4ed2b4de82729e7a5a7c8f634.asciidoc +++ b/docs/examples/e2bcc8f4ed2b4de82729e7a5a7c8f634.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// synonyms/apis/list-synonyms-sets.asciidoc:80 +// synonyms/apis/list-synonyms-sets.asciidoc:86 [source, python] ---- diff --git a/docs/examples/e2ec9e867f7141b304b53ebc59098f2a.asciidoc b/docs/examples/e2ec9e867f7141b304b53ebc59098f2a.asciidoc index 05f401af0..3f77c725d 100644 --- a/docs/examples/e2ec9e867f7141b304b53ebc59098f2a.asciidoc +++ b/docs/examples/e2ec9e867f7141b304b53ebc59098f2a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/update-api-key.asciidoc:252 +// rest-api/security/update-api-key.asciidoc:258 [source, python] ---- diff --git a/docs/examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc b/docs/examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc index cc0793e90..17fc821e9 100644 --- a/docs/examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc +++ b/docs/examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc @@ -1,12 +1,10 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/oidc-prepare-authentication-api.asciidoc:72 +// rest-api/security/oidc-prepare-authentication-api.asciidoc:78 [source, python] ---- resp = client.security.oidc_prepare_authentication( - body={ - "realm": "oidc1" - }, + realm="oidc1", ) print(resp) ---- diff --git a/docs/examples/e308899a306e61d1a590868308689955.asciidoc b/docs/examples/e308899a306e61d1a590868308689955.asciidoc new file mode 100644 index 000000000..8773d24c2 --- /dev/null +++ b/docs/examples/e308899a306e61d1a590868308689955.asciidoc @@ -0,0 +1,36 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/processors/ip-location.asciidoc:136 + +[source, python] +---- +resp = client.ingest.put_pipeline( + id="ip_location", + description="Add ip geolocation info", + processors=[ + { + "ip_location": { + "field": "ip", + "target_field": "geo", + "database_file": "GeoLite2-Country.mmdb" + } + } + ], +) +print(resp) + +resp1 = client.index( + index="my-index-000001", + id="my_id", + pipeline="ip_location", + document={ + "ip": "89.160.20.128" + }, +) +print(resp1) + +resp2 = client.get( + index="my-index-000001", + id="my_id", +) +print(resp2) +---- diff --git a/docs/examples/e35abc9403e4aef7d538ab29ccc363b3.asciidoc b/docs/examples/e35abc9403e4aef7d538ab29ccc363b3.asciidoc index 5bd24e6e3..bc7a2001b 100644 --- a/docs/examples/e35abc9403e4aef7d538ab29ccc363b3.asciidoc +++ b/docs/examples/e35abc9403e4aef7d538ab29ccc363b3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/prevalidate-node-removal.asciidoc:105 +// cluster/prevalidate-node-removal.asciidoc:111 [source, python] ---- diff --git a/docs/examples/e375c7da666276c4df6664c6821cd5f4.asciidoc b/docs/examples/e375c7da666276c4df6664c6821cd5f4.asciidoc new file mode 100644 index 000000000..3d9beee42 --- /dev/null +++ b/docs/examples/e375c7da666276c4df6664c6821cd5f4.asciidoc @@ -0,0 +1,37 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/rank-vectors.asciidoc:17 + +[source, python] +---- +resp = client.indices.create( + index="my-rank-vectors-float", + mappings={ + "properties": { + "my_vector": { + "type": "rank_vectors" + } + } + }, +) +print(resp) + +resp1 = client.index( + index="my-rank-vectors-float", + id="1", + document={ + "my_vector": [ + [ + 0.5, + 10, + 6 + ], + [ + -0.5, + 10, + 10 + ] + ] + }, +) +print(resp1) +---- diff --git a/docs/examples/e3fe842951dc873d7d00c8f6a010c53f.asciidoc b/docs/examples/e3fe842951dc873d7d00c8f6a010c53f.asciidoc new file mode 100644 index 000000000..d9002cd4d --- /dev/null +++ b/docs/examples/e3fe842951dc873d7d00c8f6a010c53f.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// troubleshooting/common-issues/task-queue-backlog.asciidoc:90 + +[source, python] +---- +resp = client.tasks.list( + human=True, + detailed=True, + actions="indices:data/write/search", +) +print(resp) +---- diff --git a/docs/examples/e48e7da65c2b32d724fd7e3bfa175c6f.asciidoc b/docs/examples/e48e7da65c2b32d724fd7e3bfa175c6f.asciidoc index 3d3a03d23..86bfe67dc 100644 --- a/docs/examples/e48e7da65c2b32d724fd7e3bfa175c6f.asciidoc +++ b/docs/examples/e48e7da65c2b32d724fd7e3bfa175c6f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-overall-buckets.asciidoc:130 +// ml/anomaly-detection/apis/get-overall-buckets.asciidoc:136 [source, python] ---- diff --git a/docs/examples/e4b38973c74037335378d8480f1ce894.asciidoc b/docs/examples/e4b38973c74037335378d8480f1ce894.asciidoc new file mode 100644 index 000000000..bdf7f710d --- /dev/null +++ b/docs/examples/e4b38973c74037335378d8480f1ce894.asciidoc @@ -0,0 +1,42 @@ +// This file is autogenerated, DO NOT EDIT +// ingest/apis/simulate-ingest.asciidoc:435 + +[source, python] +---- +resp = client.simulate.ingest( + docs=[ + { + "_index": "my-index", + "_id": "123", + "_source": { + "foo": "foo" + } + }, + { + "_index": "my-index", + "_id": "456", + "_source": { + "bar": "rab" + } + } + ], + component_template_substitutions={ + "my-mappings_template": { + "template": { + "mappings": { + "dynamic": "strict", + "properties": { + "foo": { + "type": "keyword" + }, + "bar": { + "type": "keyword" + } + } + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/e4b64b8277af259a52c8d3940157b5fa.asciidoc b/docs/examples/e4b64b8277af259a52c8d3940157b5fa.asciidoc index 096deae8c..fda164182 100644 --- a/docs/examples/e4b64b8277af259a52c8d3940157b5fa.asciidoc +++ b/docs/examples/e4b64b8277af259a52c8d3940157b5fa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// transform/painless-examples.asciidoc:397 +// transform/painless-examples.asciidoc:402 [source, python] ---- diff --git a/docs/examples/e4b6a6a921c97b4c0bbe97bd89f4cf33.asciidoc b/docs/examples/e4b6a6a921c97b4c0bbe97bd89f4cf33.asciidoc index dc93de433..fcc4bd7da 100644 --- a/docs/examples/e4b6a6a921c97b4c0bbe97bd89f4cf33.asciidoc +++ b/docs/examples/e4b6a6a921c97b4c0bbe97bd89f4cf33.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// data-streams/promote-data-stream-api.asciidoc:22 +// data-streams/promote-data-stream-api.asciidoc:32 [source, python] ---- diff --git a/docs/examples/e4be53736bcc02b03068fd72fdbfe271.asciidoc b/docs/examples/e4be53736bcc02b03068fd72fdbfe271.asciidoc index 990f57ccb..ee96d3031 100644 --- a/docs/examples/e4be53736bcc02b03068fd72fdbfe271.asciidoc +++ b/docs/examples/e4be53736bcc02b03068fd72fdbfe271.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:108 +// indices/put-mapping.asciidoc:114 [source, python] ---- diff --git a/docs/examples/e4d1f01c025fb797a1d87f372760eabf.asciidoc b/docs/examples/e4d1f01c025fb797a1d87f372760eabf.asciidoc index 106dc3a6c..e07e9e82c 100644 --- a/docs/examples/e4d1f01c025fb797a1d87f372760eabf.asciidoc +++ b/docs/examples/e4d1f01c025fb797a1d87f372760eabf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/hotspotting.asciidoc:265 +// troubleshooting/common-issues/hotspotting.asciidoc:271 [source, python] ---- diff --git a/docs/examples/e51a86b666f447cda5f634547a8e1a4a.asciidoc b/docs/examples/e51a86b666f447cda5f634547a8e1a4a.asciidoc index 78145f5de..a385a5114 100644 --- a/docs/examples/e51a86b666f447cda5f634547a8e1a4a.asciidoc +++ b/docs/examples/e51a86b666f447cda5f634547a8e1a4a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-data-stream.asciidoc:22 +// indices/create-data-stream.asciidoc:28 [source, python] ---- diff --git a/docs/examples/e551ea38a2d8f8deac110b33304200cc.asciidoc b/docs/examples/e551ea38a2d8f8deac110b33304200cc.asciidoc index a69bf2834..3d6783dc1 100644 --- a/docs/examples/e551ea38a2d8f8deac110b33304200cc.asciidoc +++ b/docs/examples/e551ea38a2d8f8deac110b33304200cc.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/learning-to-rank-search-usage.asciidoc:17 +// reranking/learning-to-rank-search-usage.asciidoc:17 [source, python] ---- diff --git a/docs/examples/e58833449d01379df20ad06dc28144d8.asciidoc b/docs/examples/e58833449d01379df20ad06dc28144d8.asciidoc index 38181abf0..c0b720faf 100644 --- a/docs/examples/e58833449d01379df20ad06dc28144d8.asciidoc +++ b/docs/examples/e58833449d01379df20ad06dc28144d8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update-by-query.asciidoc:325 +// docs/update-by-query.asciidoc:331 [source, python] ---- diff --git a/docs/examples/e5901f48eb8a419b878fc2cb815d8691.asciidoc b/docs/examples/e5901f48eb8a419b878fc2cb815d8691.asciidoc index 76d26ada5..2debf6d13 100644 --- a/docs/examples/e5901f48eb8a419b878fc2cb815d8691.asciidoc +++ b/docs/examples/e5901f48eb8a419b878fc2cb815d8691.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/update-settings.asciidoc:45 +// cluster/update-settings.asciidoc:50 [source, python] ---- diff --git a/docs/examples/e5f50b31f165462d883ecbff45f74985.asciidoc b/docs/examples/e5f50b31f165462d883ecbff45f74985.asciidoc index 8fa533456..9d3eb5f2a 100644 --- a/docs/examples/e5f50b31f165462d883ecbff45f74985.asciidoc +++ b/docs/examples/e5f50b31f165462d883ecbff45f74985.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-index-template-v1.asciidoc:14 +// indices/put-index-template-v1.asciidoc:20 [source, python] ---- diff --git a/docs/examples/e5f89a04f50df707a0a53ec0f2eecbbd.asciidoc b/docs/examples/e5f89a04f50df707a0a53ec0f2eecbbd.asciidoc index a4fc3d5f2..f160683fc 100644 --- a/docs/examples/e5f89a04f50df707a0a53ec0f2eecbbd.asciidoc +++ b/docs/examples/e5f89a04f50df707a0a53ec0f2eecbbd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:71 +// docs/get.asciidoc:77 [source, python] ---- diff --git a/docs/examples/e60b7f75ca806f2c74927c3d9409a986.asciidoc b/docs/examples/e60b7f75ca806f2c74927c3d9409a986.asciidoc index 0935cf182..01e53f9b6 100644 --- a/docs/examples/e60b7f75ca806f2c74927c3d9409a986.asciidoc +++ b/docs/examples/e60b7f75ca806f2c74927c3d9409a986.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/create-role-mappings.asciidoc:160 +// rest-api/security/create-role-mappings.asciidoc:166 [source, python] ---- diff --git a/docs/examples/e61b5abe85000cc954a42e2cd74f3a26.asciidoc b/docs/examples/e61b5abe85000cc954a42e2cd74f3a26.asciidoc index afc63dda5..dfea2bee0 100644 --- a/docs/examples/e61b5abe85000cc954a42e2cd74f3a26.asciidoc +++ b/docs/examples/e61b5abe85000cc954a42e2cd74f3a26.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/put-calendar.asciidoc:44 +// ml/anomaly-detection/apis/put-calendar.asciidoc:50 [source, python] ---- diff --git a/docs/examples/e63775a2ff22b945ab9d5f630b80c506.asciidoc b/docs/examples/e63775a2ff22b945ab9d5f630b80c506.asciidoc index 648bd4ab1..2fd176ff4 100644 --- a/docs/examples/e63775a2ff22b945ab9d5f630b80c506.asciidoc +++ b/docs/examples/e63775a2ff22b945ab9d5f630b80c506.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/health.asciidoc:196 +// cluster/health.asciidoc:202 [source, python] ---- diff --git a/docs/examples/e650d73c57ab313e686fec01e3b0c90f.asciidoc b/docs/examples/e650d73c57ab313e686fec01e3b0c90f.asciidoc index 23631b956..a18141565 100644 --- a/docs/examples/e650d73c57ab313e686fec01e3b0c90f.asciidoc +++ b/docs/examples/e650d73c57ab313e686fec01e3b0c90f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:909 +// docs/reindex.asciidoc:915 [source, python] ---- diff --git a/docs/examples/e6ccd979c34ba03007e625c6ec3e71a9.asciidoc b/docs/examples/e6ccd979c34ba03007e625c6ec3e71a9.asciidoc index 4e2a2d9e7..d7d7853cb 100644 --- a/docs/examples/e6ccd979c34ba03007e625c6ec3e71a9.asciidoc +++ b/docs/examples/e6ccd979c34ba03007e625c6ec3e71a9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:258 +// alias.asciidoc:260 [source, python] ---- diff --git a/docs/examples/e6dcc2911d2416a65eaec9846b956e15.asciidoc b/docs/examples/e6dcc2911d2416a65eaec9846b956e15.asciidoc index 559139160..452027669 100644 --- a/docs/examples/e6dcc2911d2416a65eaec9846b956e15.asciidoc +++ b/docs/examples/e6dcc2911d2416a65eaec9846b956e15.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/refresh.asciidoc:13 +// indices/refresh.asciidoc:19 [source, python] ---- diff --git a/docs/examples/e6f6d3aeea7ecea47cfd5c3d727f7004.asciidoc b/docs/examples/e6f6d3aeea7ecea47cfd5c3d727f7004.asciidoc new file mode 100644 index 000000000..28e0f8426 --- /dev/null +++ b/docs/examples/e6f6d3aeea7ecea47cfd5c3d727f7004.asciidoc @@ -0,0 +1,50 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:448 + +[source, python] +---- +resp = client.search( + index="retrievers_example", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "query_string": { + "query": "(information retrieval) OR (artificial intelligence)", + "default_field": "text" + } + } + } + }, + { + "knn": { + "field": "vector", + "query_vector": [ + 0.23, + 0.67, + 0.89 + ], + "k": 3, + "num_candidates": 5 + } + } + ], + "rank_window_size": 10, + "rank_constant": 1 + } + }, + collapse={ + "field": "year", + "inner_hits": { + "name": "topic related documents", + "_source": [ + "year" + ] + } + }, + source=False, +) +print(resp) +---- diff --git a/docs/examples/e6faae2e272ee57727f38e55a3de5bb2.asciidoc b/docs/examples/e6faae2e272ee57727f38e55a3de5bb2.asciidoc index 5efa745d0..a3e95dd72 100644 --- a/docs/examples/e6faae2e272ee57727f38e55a3de5bb2.asciidoc +++ b/docs/examples/e6faae2e272ee57727f38e55a3de5bb2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:545 +// search/search-your-data/highlighting.asciidoc:557 [source, python] ---- diff --git a/docs/examples/e715fb8c792bf09ac98f0ceca99beb84.asciidoc b/docs/examples/e715fb8c792bf09ac98f0ceca99beb84.asciidoc new file mode 100644 index 000000000..e799bf64f --- /dev/null +++ b/docs/examples/e715fb8c792bf09ac98f0ceca99beb84.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:345 + +[source, python] +---- +resp = client.migration.deprecations( + index=".ml-anomalies-*", +) +print(resp) +---- diff --git a/docs/examples/e71d300cd87f09a9527cf45395dd7eb1.asciidoc b/docs/examples/e71d300cd87f09a9527cf45395dd7eb1.asciidoc index fdc0e6034..bf278d586 100644 --- a/docs/examples/e71d300cd87f09a9527cf45395dd7eb1.asciidoc +++ b/docs/examples/e71d300cd87f09a9527cf45395dd7eb1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-execute-retention.asciidoc:34 +// slm/apis/slm-execute-retention.asciidoc:40 [source, python] ---- diff --git a/docs/examples/5ba32ebaa7ee28a339c7693696d305ca.asciidoc b/docs/examples/e77c2f41a7eca765b0c5f734a66d919f.asciidoc similarity index 83% rename from docs/examples/5ba32ebaa7ee28a339c7693696d305ca.asciidoc rename to docs/examples/e77c2f41a7eca765b0c5f734a66d919f.asciidoc index 95de4965d..2cd80bb0e 100644 --- a/docs/examples/5ba32ebaa7ee28a339c7693696d305ca.asciidoc +++ b/docs/examples/e77c2f41a7eca765b0c5f734a66d919f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/attachment.asciidoc:137 +// ingest/processors/attachment.asciidoc:133 [source, python] ---- @@ -14,7 +14,7 @@ resp = client.ingest.put_pipeline( "content", "title" ], - "remove_binary": False + "remove_binary": True } } ], diff --git a/docs/examples/e784fc00894635470adfd78a0c46b427.asciidoc b/docs/examples/e784fc00894635470adfd78a0c46b427.asciidoc index ee0c04115..a5c0ed26a 100644 --- a/docs/examples/e784fc00894635470adfd78a0c46b427.asciidoc +++ b/docs/examples/e784fc00894635470adfd78a0c46b427.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-component-template.asciidoc:13 +// indices/put-component-template.asciidoc:19 [source, python] ---- diff --git a/docs/examples/e7d819634d765cde269e2669e2dc677f.asciidoc b/docs/examples/e7d819634d765cde269e2669e2dc677f.asciidoc index 6f60455fb..38ce37cf7 100644 --- a/docs/examples/e7d819634d765cde269e2669e2dc677f.asciidoc +++ b/docs/examples/e7d819634d765cde269e2669e2dc677f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-api-keys.asciidoc:145 +// rest-api/security/invalidate-api-keys.asciidoc:151 [source, python] ---- diff --git a/docs/examples/e8211247c280a3fbbbdd32850b743b7b.asciidoc b/docs/examples/e8211247c280a3fbbbdd32850b743b7b.asciidoc index 47c64fe27..64b82529b 100644 --- a/docs/examples/e8211247c280a3fbbbdd32850b743b7b.asciidoc +++ b/docs/examples/e8211247c280a3fbbbdd32850b743b7b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/put-dfanalytics.asciidoc:717 +// ml/df-analytics/apis/put-dfanalytics.asciidoc:723 [source, python] ---- diff --git a/docs/examples/e821d27a8b810821707ba860e31f8b78.asciidoc b/docs/examples/e821d27a8b810821707ba860e31f8b78.asciidoc index 2e60eeb2f..d5cfc9760 100644 --- a/docs/examples/e821d27a8b810821707ba860e31f8b78.asciidoc +++ b/docs/examples/e821d27a8b810821707ba860e31f8b78.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/put-mapping.asciidoc:232 +// indices/put-mapping.asciidoc:238 [source, python] ---- diff --git a/docs/examples/e827a9040e137410d62d10bb3b3cbb71.asciidoc b/docs/examples/e827a9040e137410d62d10bb3b3cbb71.asciidoc index 1b6b284b1..5a1aa8a01 100644 --- a/docs/examples/e827a9040e137410d62d10bb3b3cbb71.asciidoc +++ b/docs/examples/e827a9040e137410d62d10bb3b3cbb71.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/get-watch.asciidoc:49 +// rest-api/watcher/get-watch.asciidoc:55 [source, python] ---- diff --git a/docs/examples/e84e23232c7ecc8d6377ec2c16a60269.asciidoc b/docs/examples/e84e23232c7ecc8d6377ec2c16a60269.asciidoc index ec4c69a47..c75b01feb 100644 --- a/docs/examples/e84e23232c7ecc8d6377ec2c16a60269.asciidoc +++ b/docs/examples/e84e23232c7ecc8d6377ec2c16a60269.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-index.asciidoc:192 +// indices/create-index.asciidoc:198 [source, python] ---- diff --git a/docs/examples/e8c348cabe15dfe58ab4c3cc13a963fe.asciidoc b/docs/examples/e8c348cabe15dfe58ab4c3cc13a963fe.asciidoc index 4c3ecc511..93350f484 100644 --- a/docs/examples/e8c348cabe15dfe58ab4c3cc13a963fe.asciidoc +++ b/docs/examples/e8c348cabe15dfe58ab4c3cc13a963fe.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-shards.asciidoc:72 +// search/search-shards.asciidoc:78 [source, python] ---- diff --git a/docs/examples/e8f1c9ee003d115ec8f55e57990df6e4.asciidoc b/docs/examples/e8f1c9ee003d115ec8f55e57990df6e4.asciidoc index d59f83d38..d499ba26c 100644 --- a/docs/examples/e8f1c9ee003d115ec8f55e57990df6e4.asciidoc +++ b/docs/examples/e8f1c9ee003d115ec8f55e57990df6e4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-category.asciidoc:148 +// ml/anomaly-detection/apis/get-category.asciidoc:154 [source, python] ---- diff --git a/docs/examples/e93ff228ab3e63738e1c83fdfb7424b9.asciidoc b/docs/examples/e93ff228ab3e63738e1c83fdfb7424b9.asciidoc index daca718ee..92bdbacaf 100644 --- a/docs/examples/e93ff228ab3e63738e1c83fdfb7424b9.asciidoc +++ b/docs/examples/e93ff228ab3e63738e1c83fdfb7424b9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:434 +// search/search-your-data/highlighting.asciidoc:446 [source, python] ---- diff --git a/docs/examples/4655c3dea0c61935b7ecf1e57441df66.asciidoc b/docs/examples/e9625da419bff6470ffd9927c59ca159.asciidoc similarity index 53% rename from docs/examples/4655c3dea0c61935b7ecf1e57441df66.asciidoc rename to docs/examples/e9625da419bff6470ffd9927c59ca159.asciidoc index 98b608366..1e71e2b91 100644 --- a/docs/examples/4655c3dea0c61935b7ecf1e57441df66.asciidoc +++ b/docs/examples/e9625da419bff6470ffd9927c59ca159.asciidoc @@ -1,11 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/rejected-requests.asciidoc:25 +// troubleshooting/common-issues/rejected-requests.asciidoc:29 [source, python] ---- resp = client.cat.thread_pool( v=True, - h="id,name,active,rejected,completed", + h="id,name,queue,active,rejected,completed", ) print(resp) ---- diff --git a/docs/examples/e9a0b450af6219772631703d602c7092.asciidoc b/docs/examples/e9a0b450af6219772631703d602c7092.asciidoc index 9c1d7c061..27cbd28d2 100644 --- a/docs/examples/e9a0b450af6219772631703d602c7092.asciidoc +++ b/docs/examples/e9a0b450af6219772631703d602c7092.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/text-expansion-query.asciidoc:222 +// query-dsl/text-expansion-query.asciidoc:229 [source, python] ---- diff --git a/docs/examples/e9fc47015922d51c2b05e502ce9c622e.asciidoc b/docs/examples/e9fc47015922d51c2b05e502ce9c622e.asciidoc index 1e857e8bf..55cc01563 100644 --- a/docs/examples/e9fc47015922d51c2b05e502ce9c622e.asciidoc +++ b/docs/examples/e9fc47015922d51c2b05e502ce9c622e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-google-ai-studio.asciidoc:77 +// inference/service-google-ai-studio.asciidoc:103 [source, python] ---- diff --git a/docs/examples/ea5391267ced860c00214c096e08c8d4.asciidoc b/docs/examples/ea5391267ced860c00214c096e08c8d4.asciidoc index b9988415e..d2b271c51 100644 --- a/docs/examples/ea5391267ced860c00214c096e08c8d4.asciidoc +++ b/docs/examples/ea5391267ced860c00214c096e08c8d4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/update-settings.asciidoc:13 +// indices/update-settings.asciidoc:19 [source, python] ---- diff --git a/docs/examples/ea68e3428cc2ca3455bf312d09451489.asciidoc b/docs/examples/ea68e3428cc2ca3455bf312d09451489.asciidoc index cfee2236c..a6ec582ef 100644 --- a/docs/examples/ea68e3428cc2ca3455bf312d09451489.asciidoc +++ b/docs/examples/ea68e3428cc2ca3455bf312d09451489.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/knn-search.asciidoc:1080 +// search/search-your-data/knn-search.asciidoc:1244 [source, python] ---- diff --git a/docs/examples/bb5a1319c496acc862c670cc7224e59a.asciidoc b/docs/examples/ea8c4229afa6dd4f1321355542be9912.asciidoc similarity index 89% rename from docs/examples/bb5a1319c496acc862c670cc7224e59a.asciidoc rename to docs/examples/ea8c4229afa6dd4f1321355542be9912.asciidoc index 672d06ae5..8936ca63a 100644 --- a/docs/examples/bb5a1319c496acc862c670cc7224e59a.asciidoc +++ b/docs/examples/ea8c4229afa6dd4f1321355542be9912.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/attachment.asciidoc:219 +// ingest/processors/attachment.asciidoc:268 [source, python] ---- @@ -12,7 +12,7 @@ resp = client.ingest.put_pipeline( "field": "data", "indexed_chars": 11, "indexed_chars_field": "max_size", - "remove_binary": False + "remove_binary": True } } ], diff --git a/docs/examples/eac3bc428d03eb4926fa51f74b9bc4d5.asciidoc b/docs/examples/eac3bc428d03eb4926fa51f74b9bc4d5.asciidoc index 1e1e3bad5..d9273b092 100644 --- a/docs/examples/eac3bc428d03eb4926fa51f74b9bc4d5.asciidoc +++ b/docs/examples/eac3bc428d03eb4926fa51f74b9bc4d5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/highlighting.asciidoc:342 +// search/search-your-data/highlighting.asciidoc:354 [source, python] ---- diff --git a/docs/examples/eafdabe80b21b90495555fa6d9089412.asciidoc b/docs/examples/eafdabe80b21b90495555fa6d9089412.asciidoc index fb29b3198..ac0090fc3 100644 --- a/docs/examples/eafdabe80b21b90495555fa6d9089412.asciidoc +++ b/docs/examples/eafdabe80b21b90495555fa6d9089412.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-service-token-caches.asciidoc:62 +// rest-api/security/clear-service-token-caches.asciidoc:68 [source, python] ---- diff --git a/docs/examples/eb14cedd3bdda9ffef3c118f3d528dcd.asciidoc b/docs/examples/eb14cedd3bdda9ffef3c118f3d528dcd.asciidoc index 63e6844bc..73b38e5d7 100644 --- a/docs/examples/eb14cedd3bdda9ffef3c118f3d528dcd.asciidoc +++ b/docs/examples/eb14cedd3bdda9ffef3c118f3d528dcd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/update.asciidoc:172 +// docs/update.asciidoc:178 [source, python] ---- diff --git a/docs/examples/eb4e43b47867b54214a8630172dd0e21.asciidoc b/docs/examples/eb4e43b47867b54214a8630172dd0e21.asciidoc index 71fc1718f..4789a526e 100644 --- a/docs/examples/eb4e43b47867b54214a8630172dd0e21.asciidoc +++ b/docs/examples/eb4e43b47867b54214a8630172dd0e21.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-forecast.asciidoc:69 +// ml/anomaly-detection/apis/delete-forecast.asciidoc:75 [source, python] ---- diff --git a/docs/examples/eb54506fbc71a7d250e86b22d0600114.asciidoc b/docs/examples/eb54506fbc71a7d250e86b22d0600114.asciidoc index e4e933248..1b7faae1f 100644 --- a/docs/examples/eb54506fbc71a7d250e86b22d0600114.asciidoc +++ b/docs/examples/eb54506fbc71a7d250e86b22d0600114.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/list-connectors-api.asciidoc:107 +// connector/apis/list-connectors-api.asciidoc:117 [source, python] ---- diff --git a/docs/examples/eb964d8d7f27c057a4542448ba5b74e4.asciidoc b/docs/examples/eb964d8d7f27c057a4542448ba5b74e4.asciidoc index 8fde55ac3..c534fe21a 100644 --- a/docs/examples/eb964d8d7f27c057a4542448ba5b74e4.asciidoc +++ b/docs/examples/eb964d8d7f27c057a4542448ba5b74e4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/get-snapshot-api.asciidoc:482 +// snapshot-restore/apis/get-snapshot-api.asciidoc:488 [source, python] ---- diff --git a/docs/examples/eb96d7dd5f3116a50f7a86b729f1a934.asciidoc b/docs/examples/eb96d7dd5f3116a50f7a86b729f1a934.asciidoc index 8f52a9370..1edc39f32 100644 --- a/docs/examples/eb96d7dd5f3116a50f7a86b729f1a934.asciidoc +++ b/docs/examples/eb96d7dd5f3116a50f7a86b729f1a934.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-scheduling-api.asciidoc:119 +// connector/apis/update-connector-scheduling-api.asciidoc:126 [source, python] ---- diff --git a/docs/examples/eb9a41f7fc8bdf5559bb9db822ae3a65.asciidoc b/docs/examples/eb9a41f7fc8bdf5559bb9db822ae3a65.asciidoc index 62fa7fdbc..ae9694132 100644 --- a/docs/examples/eb9a41f7fc8bdf5559bb9db822ae3a65.asciidoc +++ b/docs/examples/eb9a41f7fc8bdf5559bb9db822ae3a65.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/bulk-create-roles.asciidoc:217 +// rest-api/security/bulk-create-roles.asciidoc:236 [source, python] ---- diff --git a/docs/examples/ebb1c7554e91adb4552599f3e5de1865.asciidoc b/docs/examples/ebb1c7554e91adb4552599f3e5de1865.asciidoc index eeaf1d1f8..f48d32f16 100644 --- a/docs/examples/ebb1c7554e91adb4552599f3e5de1865.asciidoc +++ b/docs/examples/ebb1c7554e91adb4552599f3e5de1865.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/split-index.asciidoc:84 +// indices/split-index.asciidoc:90 [source, python] ---- diff --git a/docs/examples/ebd76a45e153c4656c5871e23b7b5508.asciidoc b/docs/examples/ebd76a45e153c4656c5871e23b7b5508.asciidoc index 65636068e..e7b081d20 100644 --- a/docs/examples/ebd76a45e153c4656c5871e23b7b5508.asciidoc +++ b/docs/examples/ebd76a45e153c4656c5871e23b7b5508.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/delete-app-privileges.asciidoc:41 +// rest-api/security/delete-app-privileges.asciidoc:47 [source, python] ---- diff --git a/docs/examples/ec0e50f78390b8622cef4e0b0cd45967.asciidoc b/docs/examples/ec0e50f78390b8622cef4e0b0cd45967.asciidoc index 494db9504..810df64ac 100644 --- a/docs/examples/ec0e50f78390b8622cef4e0b0cd45967.asciidoc +++ b/docs/examples/ec0e50f78390b8622cef4e0b0cd45967.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// eql/eql-search-api.asciidoc:533 +// eql/eql-search-api.asciidoc:586 [source, python] ---- diff --git a/docs/examples/ec135f0cc0d3f526df68000b2a95c65b.asciidoc b/docs/examples/ec135f0cc0d3f526df68000b2a95c65b.asciidoc new file mode 100644 index 000000000..10f0be019 --- /dev/null +++ b/docs/examples/ec135f0cc0d3f526df68000b2a95c65b.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// migration/migrate_9_0.asciidoc:403 + +[source, python] +---- +resp = client.indices.create_from( + source=".ml-anomalies-custom-example", + dest=".reindexed-v9-ml-anomalies-custom-example", + create_from=None, +) +print(resp) +---- diff --git a/docs/examples/ec4b43c3ebd8816799fa004596b2f0cb.asciidoc b/docs/examples/ec4b43c3ebd8816799fa004596b2f0cb.asciidoc new file mode 100644 index 000000000..effaf77bd --- /dev/null +++ b/docs/examples/ec4b43c3ebd8816799fa004596b2f0cb.asciidoc @@ -0,0 +1,14 @@ +// This file is autogenerated, DO NOT EDIT +// index-modules/slowlog.asciidoc:232 + +[source, python] +---- +resp = client.indices.put_settings( + index="*", + settings={ + "index.indexing.slowlog.include.user": True, + "index.indexing.slowlog.threshold.index.warn": "30s" + }, +) +print(resp) +---- diff --git a/docs/examples/ecfd0d94dd14ef05dfa861f22544b388.asciidoc b/docs/examples/ecfd0d94dd14ef05dfa861f22544b388.asciidoc index 39218d68e..961ca9008 100644 --- a/docs/examples/ecfd0d94dd14ef05dfa861f22544b388.asciidoc +++ b/docs/examples/ecfd0d94dd14ef05dfa861f22544b388.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-error-api.asciidoc:80 +// connector/apis/update-connector-error-api.asciidoc:87 [source, python] ---- diff --git a/docs/examples/ed09432c6069e41409f0a5e0d1d3842a.asciidoc b/docs/examples/ed09432c6069e41409f0a5e0d1d3842a.asciidoc index d056e9d33..d7e084598 100644 --- a/docs/examples/ed09432c6069e41409f0a5e0d1d3842a.asciidoc +++ b/docs/examples/ed09432c6069e41409f0a5e0d1d3842a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/apis/reload-analyzers.asciidoc:10 +// indices/apis/reload-analyzers.asciidoc:16 [source, python] ---- diff --git a/docs/examples/ed3bdf4d6799b43526851e92b6a60c55.asciidoc b/docs/examples/ed3bdf4d6799b43526851e92b6a60c55.asciidoc index fa96997d3..460e9b642 100644 --- a/docs/examples/ed3bdf4d6799b43526851e92b6a60c55.asciidoc +++ b/docs/examples/ed3bdf4d6799b43526851e92b6a60c55.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-field-mapping.asciidoc:129 +// indices/get-field-mapping.asciidoc:135 [source, python] ---- diff --git a/docs/examples/ed5bfa68d01e079aac94de78dc5caddf.asciidoc b/docs/examples/ed5bfa68d01e079aac94de78dc5caddf.asciidoc index 85db15e13..8da4f139b 100644 --- a/docs/examples/ed5bfa68d01e079aac94de78dc5caddf.asciidoc +++ b/docs/examples/ed5bfa68d01e079aac94de78dc5caddf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/master.asciidoc:51 +// cat/master.asciidoc:57 [source, python] ---- diff --git a/docs/examples/ed5c3b45e8de912faba44507d827eb93.asciidoc b/docs/examples/ed5c3b45e8de912faba44507d827eb93.asciidoc index a099a031c..e6ca4ba6b 100644 --- a/docs/examples/ed5c3b45e8de912faba44507d827eb93.asciidoc +++ b/docs/examples/ed5c3b45e8de912faba44507d827eb93.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:499 +// search/search-your-data/sort-search-results.asciidoc:501 [source, python] ---- diff --git a/docs/examples/edae616e1244babf6032aecc6aaaf836.asciidoc b/docs/examples/edae616e1244babf6032aecc6aaaf836.asciidoc index 342dde9e2..d47895fb1 100644 --- a/docs/examples/edae616e1244babf6032aecc6aaaf836.asciidoc +++ b/docs/examples/edae616e1244babf6032aecc6aaaf836.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:472 +// search/search-your-data/sort-search-results.asciidoc:474 [source, python] ---- diff --git a/docs/examples/edb25dc0162b039d477cb06aed2d6275.asciidoc b/docs/examples/edb25dc0162b039d477cb06aed2d6275.asciidoc index fa681946d..76902ca50 100644 --- a/docs/examples/edb25dc0162b039d477cb06aed2d6275.asciidoc +++ b/docs/examples/edb25dc0162b039d477cb06aed2d6275.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/sparse-vector-query.asciidoc:147 +// query-dsl/sparse-vector-query.asciidoc:152 [source, python] ---- diff --git a/docs/examples/ee08328cd157d547de19b4abe867b23e.asciidoc b/docs/examples/ee08328cd157d547de19b4abe867b23e.asciidoc index b149f81c4..b50d454fe 100644 --- a/docs/examples/ee08328cd157d547de19b4abe867b23e.asciidoc +++ b/docs/examples/ee08328cd157d547de19b4abe867b23e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// alias.asciidoc:275 +// alias.asciidoc:277 [source, python] ---- diff --git a/docs/examples/ee223e604bb695cad2517d28ae63ac34.asciidoc b/docs/examples/ee223e604bb695cad2517d28ae63ac34.asciidoc index 5604e2e2c..3efa63670 100644 --- a/docs/examples/ee223e604bb695cad2517d28ae63ac34.asciidoc +++ b/docs/examples/ee223e604bb695cad2517d28ae63ac34.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rrf.asciidoc:49 +// search/rrf.asciidoc:53 [source, python] ---- diff --git a/docs/examples/ee577c4c7cc723e99569ea2d1137adba.asciidoc b/docs/examples/ee577c4c7cc723e99569ea2d1137adba.asciidoc index 51d611002..642fb80df 100644 --- a/docs/examples/ee577c4c7cc723e99569ea2d1137adba.asciidoc +++ b/docs/examples/ee577c4c7cc723e99569ea2d1137adba.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-roles-cache.asciidoc:42 +// rest-api/security/clear-roles-cache.asciidoc:48 [source, python] ---- diff --git a/docs/examples/ee90d1fb22b59d30da339d825303b912.asciidoc b/docs/examples/ee90d1fb22b59d30da339d825303b912.asciidoc index 52d677d20..0d1fd70aa 100644 --- a/docs/examples/ee90d1fb22b59d30da339d825303b912.asciidoc +++ b/docs/examples/ee90d1fb22b59d30da339d825303b912.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/put-app-privileges.asciidoc:130 +// rest-api/security/put-app-privileges.asciidoc:136 [source, python] ---- diff --git a/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc b/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc index cab93affd..cb381a406 100644 --- a/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc +++ b/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search.asciidoc:907 +// search/search.asciidoc:915 [source, python] ---- diff --git a/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc b/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc index a342f7ada..d15d395da 100644 --- a/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc +++ b/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-hugging-face.asciidoc:81 +// inference/service-hugging-face.asciidoc:107 [source, python] ---- diff --git a/docs/examples/ef22234b97cc06d7dd620b4ce7c97b31.asciidoc b/docs/examples/ef22234b97cc06d7dd620b4ce7c97b31.asciidoc index 7235ecc06..47af1f873 100644 --- a/docs/examples/ef22234b97cc06d7dd620b4ce7c97b31.asciidoc +++ b/docs/examples/ef22234b97cc06d7dd620b4ce7c97b31.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:694 +// docs/reindex.asciidoc:700 [source, python] ---- diff --git a/docs/examples/ef33b3b373f7040b874146599db5d557.asciidoc b/docs/examples/ef33b3b373f7040b874146599db5d557.asciidoc index 97a18cef8..c901f6a56 100644 --- a/docs/examples/ef33b3b373f7040b874146599db5d557.asciidoc +++ b/docs/examples/ef33b3b373f7040b874146599db5d557.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:173 +// indices/analyze.asciidoc:179 [source, python] ---- diff --git a/docs/examples/ef643bab44e7de6ddddde23a2eece5c7.asciidoc b/docs/examples/ef643bab44e7de6ddddde23a2eece5c7.asciidoc new file mode 100644 index 000000000..64764eb76 --- /dev/null +++ b/docs/examples/ef643bab44e7de6ddddde23a2eece5c7.asciidoc @@ -0,0 +1,17 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/getting-started.asciidoc:283 + +[source, python] +---- +resp = client.index( + index="books", + document={ + "name": "The Great Gatsby", + "author": "F. Scott Fitzgerald", + "release_date": "1925-04-10", + "page_count": 180, + "language": "EN" + }, +) +print(resp) +---- diff --git a/docs/examples/ef9c29759459904fef162acd223462c4.asciidoc b/docs/examples/ef9c29759459904fef162acd223462c4.asciidoc index 920357cbd..62ab676bd 100644 --- a/docs/examples/ef9c29759459904fef162acd223462c4.asciidoc +++ b/docs/examples/ef9c29759459904fef162acd223462c4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-stats.asciidoc:2585 +// cluster/nodes-stats.asciidoc:2595 [source, python] ---- diff --git a/docs/examples/eff8ecaed1ed084909c64450fc363a20.asciidoc b/docs/examples/eff8ecaed1ed084909c64450fc363a20.asciidoc index b87269ad4..09d50fdfd 100644 --- a/docs/examples/eff8ecaed1ed084909c64450fc363a20.asciidoc +++ b/docs/examples/eff8ecaed1ed084909c64450fc363a20.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/update-settings.asciidoc:96 +// cluster/update-settings.asciidoc:101 [source, python] ---- diff --git a/docs/examples/349823d86980d40ac45248c19a59e339.asciidoc b/docs/examples/f03352bb1129938a89f97e4b650038dd.asciidoc similarity index 91% rename from docs/examples/349823d86980d40ac45248c19a59e339.asciidoc rename to docs/examples/f03352bb1129938a89f97e4b650038dd.asciidoc index d770f3f54..ef19c0301 100644 --- a/docs/examples/349823d86980d40ac45248c19a59e339.asciidoc +++ b/docs/examples/f03352bb1129938a89f97e4b650038dd.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="amazon_bedrock_embeddings", + id="amazon_bedrock_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/f04e1284d09ceb4443d67b2ef9c7f476.asciidoc b/docs/examples/f04e1284d09ceb4443d67b2ef9c7f476.asciidoc index 7b8b3092d..04374468a 100644 --- a/docs/examples/f04e1284d09ceb4443d67b2ef9c7f476.asciidoc +++ b/docs/examples/f04e1284d09ceb4443d67b2ef9c7f476.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/delete-snapshot-api.asciidoc:30 +// snapshot-restore/apis/delete-snapshot-api.asciidoc:36 [source, python] ---- diff --git a/docs/examples/f0816beb8ac21cb0940858b72f6b1946.asciidoc b/docs/examples/f0816beb8ac21cb0940858b72f6b1946.asciidoc index 903a04c6c..f7e0379a5 100644 --- a/docs/examples/f0816beb8ac21cb0940858b72f6b1946.asciidoc +++ b/docs/examples/f0816beb8ac21cb0940858b72f6b1946.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/fielddata.asciidoc:126 +// cat/fielddata.asciidoc:132 [source, python] ---- diff --git a/docs/examples/f097c02541056f3c0fc855e7bbeef8a8.asciidoc b/docs/examples/f097c02541056f3c0fc855e7bbeef8a8.asciidoc index 373fbf824..dedc1caaa 100644 --- a/docs/examples/f097c02541056f3c0fc855e7bbeef8a8.asciidoc +++ b/docs/examples/f097c02541056f3c0fc855e7bbeef8a8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// analysis/analyzers/lang-analyzer.asciidoc:1745 +// analysis/analyzers/lang-analyzer.asciidoc:1746 [source, python] ---- diff --git a/docs/examples/f128a9dff5051b47efe2c53c4454a68f.asciidoc b/docs/examples/f128a9dff5051b47efe2c53c4454a68f.asciidoc index 9a2bc95e0..1569cc402 100644 --- a/docs/examples/f128a9dff5051b47efe2c53c4454a68f.asciidoc +++ b/docs/examples/f128a9dff5051b47efe2c53c4454a68f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/rollover-index.asciidoc:255 +// indices/rollover-index.asciidoc:261 [source, python] ---- diff --git a/docs/examples/f160561efab38e40c2feebf5a2542ab5.asciidoc b/docs/examples/f160561efab38e40c2feebf5a2542ab5.asciidoc index e119375b9..aa6a1e78c 100644 --- a/docs/examples/f160561efab38e40c2feebf5a2542ab5.asciidoc +++ b/docs/examples/f160561efab38e40c2feebf5a2542ab5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/nodes-stats.asciidoc:2593 +// cluster/nodes-stats.asciidoc:2603 [source, python] ---- diff --git a/docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc b/docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc index 2464c2786..a23aeb237 100644 --- a/docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc +++ b/docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/post-inference.asciidoc:137 +// inference/post-inference.asciidoc:138 [source, python] ---- diff --git a/docs/examples/f1bf0c03581b79c3324cfa3246a60e4d.asciidoc b/docs/examples/f1bf0c03581b79c3324cfa3246a60e4d.asciidoc new file mode 100644 index 000000000..594d3bd47 --- /dev/null +++ b/docs/examples/f1bf0c03581b79c3324cfa3246a60e4d.asciidoc @@ -0,0 +1,22 @@ +// This file is autogenerated, DO NOT EDIT +// mapping/types/dense-vector.asciidoc:183 + +[source, python] +---- +resp = client.indices.create( + index="my-byte-quantized-index", + mappings={ + "properties": { + "my_vector": { + "type": "dense_vector", + "dims": 64, + "index": True, + "index_options": { + "type": "bbq_hnsw" + } + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/f1e2af6dbb30fc5335e7d0b5507a2a93.asciidoc b/docs/examples/f1e2af6dbb30fc5335e7d0b5507a2a93.asciidoc index 075670f1c..3b9a26d8c 100644 --- a/docs/examples/f1e2af6dbb30fc5335e7d0b5507a2a93.asciidoc +++ b/docs/examples/f1e2af6dbb30fc5335e7d0b5507a2a93.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/reset-job.asciidoc:56 +// ml/anomaly-detection/apis/reset-job.asciidoc:62 [source, python] ---- diff --git a/docs/examples/f2175feadc2abe545899889e6d4ffcad.asciidoc b/docs/examples/f2175feadc2abe545899889e6d4ffcad.asciidoc index bcfa55c34..5e628b0ae 100644 --- a/docs/examples/f2175feadc2abe545899889e6d4ffcad.asciidoc +++ b/docs/examples/f2175feadc2abe545899889e6d4ffcad.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// slm/apis/slm-get.asciidoc:71 +// slm/apis/slm-get.asciidoc:77 [source, python] ---- diff --git a/docs/examples/f27c28ddbf4c266b5f42d14da837b8de.asciidoc b/docs/examples/f27c28ddbf4c266b5f42d14da837b8de.asciidoc index cf0fa265f..613c5fe07 100644 --- a/docs/examples/f27c28ddbf4c266b5f42d14da837b8de.asciidoc +++ b/docs/examples/f27c28ddbf4c266b5f42d14da837b8de.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/flush.asciidoc:141 +// indices/flush.asciidoc:147 [source, python] ---- diff --git a/docs/examples/f298c4eb50ea97b34c57f8756eb350d3.asciidoc b/docs/examples/f298c4eb50ea97b34c57f8756eb350d3.asciidoc index 1fbfb3e2a..e6b401225 100644 --- a/docs/examples/f298c4eb50ea97b34c57f8756eb350d3.asciidoc +++ b/docs/examples/f298c4eb50ea97b34c57f8756eb350d3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cat/pending_tasks.asciidoc:52 +// cat/pending_tasks.asciidoc:57 [source, python] ---- diff --git a/docs/examples/f29a28fffa7ec604a33a838f48f7ea79.asciidoc b/docs/examples/f29a28fffa7ec604a33a838f48f7ea79.asciidoc index db0efa4a5..4399e8556 100644 --- a/docs/examples/f29a28fffa7ec604a33a838f48f7ea79.asciidoc +++ b/docs/examples/f29a28fffa7ec604a33a838f48f7ea79.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/query_filter_context.asciidoc:62 +// query-dsl/query_filter_context.asciidoc:81 [source, python] ---- diff --git a/docs/examples/f29b2674299ddf51a25ed87619025ede.asciidoc b/docs/examples/f29b2674299ddf51a25ed87619025ede.asciidoc index 1c6f7e551..dfae20141 100644 --- a/docs/examples/f29b2674299ddf51a25ed87619025ede.asciidoc +++ b/docs/examples/f29b2674299ddf51a25ed87619025ede.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-search.asciidoc:115 +// rollup/apis/rollup-search.asciidoc:122 [source, python] ---- diff --git a/docs/examples/f2a5f77f929cc7b893b80f4bd5b1a192.asciidoc b/docs/examples/f2a5f77f929cc7b893b80f4bd5b1a192.asciidoc index 5f93f7a79..322a5d096 100644 --- a/docs/examples/f2a5f77f929cc7b893b80f4bd5b1a192.asciidoc +++ b/docs/examples/f2a5f77f929cc7b893b80f4bd5b1a192.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/get-connector-api.asciidoc:64 +// connector/apis/get-connector-api.asciidoc:74 [source, python] ---- diff --git a/docs/examples/f2e854b6c99659ccc1824e86c096e433.asciidoc b/docs/examples/f2e854b6c99659ccc1824e86c096e433.asciidoc index 580ae0c8f..c42f37698 100644 --- a/docs/examples/f2e854b6c99659ccc1824e86c096e433.asciidoc +++ b/docs/examples/f2e854b6c99659ccc1824e86c096e433.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/auto-follow/resume-auto-follow-pattern.asciidoc:80 +// ccr/apis/auto-follow/resume-auto-follow-pattern.asciidoc:86 [source, python] ---- diff --git a/docs/examples/f2ec53c0ef5025de8890d0ff8ec287a0.asciidoc b/docs/examples/f2ec53c0ef5025de8890d0ff8ec287a0.asciidoc index 9fb946dc7..16fb92c4c 100644 --- a/docs/examples/f2ec53c0ef5025de8890d0ff8ec287a0.asciidoc +++ b/docs/examples/f2ec53c0ef5025de8890d0ff8ec287a0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rank-eval.asciidoc:353 +// search/rank-eval.asciidoc:359 [source, python] ---- diff --git a/docs/examples/f2f1cae094855a45fd8f73478bec8e70.asciidoc b/docs/examples/f2f1cae094855a45fd8f73478bec8e70.asciidoc index 2a5e63f3e..d3824a920 100644 --- a/docs/examples/f2f1cae094855a45fd8f73478bec8e70.asciidoc +++ b/docs/examples/f2f1cae094855a45fd8f73478bec8e70.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/split-index.asciidoc:203 +// indices/split-index.asciidoc:209 [source, python] ---- diff --git a/docs/examples/f321d4e92aa83d573ecf52bf56b0b774.asciidoc b/docs/examples/f321d4e92aa83d573ecf52bf56b0b774.asciidoc new file mode 100644 index 000000000..aa1c9cb27 --- /dev/null +++ b/docs/examples/f321d4e92aa83d573ecf52bf56b0b774.asciidoc @@ -0,0 +1,16 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:377 + +[source, python] +---- +resp = client.perform_request( + "POST", + "/_connector/_sync_job", + headers={"Content-Type": "application/json"}, + body={ + "id": "my-connector-id", + "job_type": "full" + }, +) +print(resp) +---- diff --git a/docs/examples/f3594de7ef39ab09b0bb12c1e76bfe6b.asciidoc b/docs/examples/f3594de7ef39ab09b0bb12c1e76bfe6b.asciidoc index 5f7cd0dd9..c0d76f3e8 100644 --- a/docs/examples/f3594de7ef39ab09b0bb12c1e76bfe6b.asciidoc +++ b/docs/examples/f3594de7ef39ab09b0bb12c1e76bfe6b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/shrink-index.asciidoc:119 +// indices/shrink-index.asciidoc:125 [source, python] ---- diff --git a/docs/examples/f3697682a886ab129530f3e5c1b30632.asciidoc b/docs/examples/f3697682a886ab129530f3e5c1b30632.asciidoc index bee2d347e..2d3e503da 100644 --- a/docs/examples/f3697682a886ab129530f3e5c1b30632.asciidoc +++ b/docs/examples/f3697682a886ab129530f3e5c1b30632.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/termvectors.asciidoc:10 +// docs/termvectors.asciidoc:16 [source, python] ---- diff --git a/docs/examples/f37173a75cd1b0d683c6f67819dd1de3.asciidoc b/docs/examples/f37173a75cd1b0d683c6f67819dd1de3.asciidoc index 3d3d9027a..3b030c27d 100644 --- a/docs/examples/f37173a75cd1b0d683c6f67819dd1de3.asciidoc +++ b/docs/examples/f37173a75cd1b0d683c6f67819dd1de3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:794 +// docs/reindex.asciidoc:800 [source, python] ---- diff --git a/docs/examples/f388e571224dd6850f8c9f9f08fca3da.asciidoc b/docs/examples/f388e571224dd6850f8c9f9f08fca3da.asciidoc index b062c34a7..4231f47ea 100644 --- a/docs/examples/f388e571224dd6850f8c9f9f08fca3da.asciidoc +++ b/docs/examples/f388e571224dd6850f8c9f9f08fca3da.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/invalidate-api-keys.asciidoc:123 +// rest-api/security/invalidate-api-keys.asciidoc:129 [source, python] ---- diff --git a/docs/examples/f39512478cae2db8f4566a1e4af9e8f5.asciidoc b/docs/examples/f39512478cae2db8f4566a1e4af9e8f5.asciidoc index 271a51425..569f9d2ad 100644 --- a/docs/examples/f39512478cae2db8f4566a1e4af9e8f5.asciidoc +++ b/docs/examples/f39512478cae2db8f4566a1e4af9e8f5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/rollup-getting-started.asciidoc:213 +// rollup/rollup-getting-started.asciidoc:217 [source, python] ---- diff --git a/docs/examples/f3b185131f40687c25d2f85e1231d8bd.asciidoc b/docs/examples/f3b185131f40687c25d2f85e1231d8bd.asciidoc index 96ab82784..9fbd49437 100644 --- a/docs/examples/f3b185131f40687c25d2f85e1231d8bd.asciidoc +++ b/docs/examples/f3b185131f40687c25d2f85e1231d8bd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/validate.asciidoc:99 +// search/validate.asciidoc:105 [source, python] ---- diff --git a/docs/examples/f3fb3cba44988b6e9fee93316138b2cf.asciidoc b/docs/examples/f3fb3cba44988b6e9fee93316138b2cf.asciidoc index eaaa1b0ec..0dd4534b2 100644 --- a/docs/examples/f3fb3cba44988b6e9fee93316138b2cf.asciidoc +++ b/docs/examples/f3fb3cba44988b6e9fee93316138b2cf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-privileges-cache.asciidoc:50 +// rest-api/security/clear-privileges-cache.asciidoc:56 [source, python] ---- diff --git a/docs/examples/f3fb52680482925c202c2e2f8af6f044.asciidoc b/docs/examples/f3fb52680482925c202c2e2f8af6f044.asciidoc index 260106272..bd1263028 100644 --- a/docs/examples/f3fb52680482925c202c2e2f8af6f044.asciidoc +++ b/docs/examples/f3fb52680482925c202c2e2f8af6f044.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:458 +// how-to/size-your-shards.asciidoc:459 [source, python] ---- diff --git a/docs/examples/f43ec4041e3b72bbde063452990bfc4b.asciidoc b/docs/examples/f43ec4041e3b72bbde063452990bfc4b.asciidoc index b1c76f31a..d5e608559 100644 --- a/docs/examples/f43ec4041e3b72bbde063452990bfc4b.asciidoc +++ b/docs/examples/f43ec4041e3b72bbde063452990bfc4b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/clearcache.asciidoc:142 +// indices/clearcache.asciidoc:148 [source, python] ---- diff --git a/docs/examples/f44d287c6937785eb09b91353c1deb1e.asciidoc b/docs/examples/f44d287c6937785eb09b91353c1deb1e.asciidoc index 8d7c695cc..6a44a94e9 100644 --- a/docs/examples/f44d287c6937785eb09b91353c1deb1e.asciidoc +++ b/docs/examples/f44d287c6937785eb09b91353c1deb1e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-datafeed-stats.asciidoc:177 +// ml/anomaly-detection/apis/get-datafeed-stats.asciidoc:183 [source, python] ---- diff --git a/docs/examples/f454e3f8ad5f5bd82a4a25af7dee9ca1.asciidoc b/docs/examples/f454e3f8ad5f5bd82a4a25af7dee9ca1.asciidoc index 8f571685d..4bc61fdf6 100644 --- a/docs/examples/f454e3f8ad5f5bd82a4a25af7dee9ca1.asciidoc +++ b/docs/examples/f454e3f8ad5f5bd82a4a25af7dee9ca1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/array.asciidoc:42 +// mapping/types/array.asciidoc:39 [source, python] ---- diff --git a/docs/examples/f45990264f8755b96b11c69c12c90ff4.asciidoc b/docs/examples/f45990264f8755b96b11c69c12c90ff4.asciidoc index df8d497cf..8050dc60c 100644 --- a/docs/examples/f45990264f8755b96b11c69c12c90ff4.asciidoc +++ b/docs/examples/f45990264f8755b96b11c69c12c90ff4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/indices-exists.asciidoc:10 +// troubleshooting/troubleshooting-searches.asciidoc:21 [source, python] ---- diff --git a/docs/examples/f49ac80f0130cae8d0ea6f4472a149dd.asciidoc b/docs/examples/f49ac80f0130cae8d0ea6f4472a149dd.asciidoc index df68fc906..2cccf26e2 100644 --- a/docs/examples/f49ac80f0130cae8d0ea6f4472a149dd.asciidoc +++ b/docs/examples/f49ac80f0130cae8d0ea6f4472a149dd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/knn-query.asciidoc:17 +// query-dsl/knn-query.asciidoc:18 [source, python] ---- diff --git a/docs/examples/f4b9baed3c6a82be3672cbc8999c2368.asciidoc b/docs/examples/f4b9baed3c6a82be3672cbc8999c2368.asciidoc index 5ad334f01..9adf5ba34 100644 --- a/docs/examples/f4b9baed3c6a82be3672cbc8999c2368.asciidoc +++ b/docs/examples/f4b9baed3c6a82be3672cbc8999c2368.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/terms-enum.asciidoc:13 +// search/terms-enum.asciidoc:19 [source, python] ---- diff --git a/docs/examples/f4dc1286d0a2f8d1fde64fbf12fd9f8d.asciidoc b/docs/examples/f4dc1286d0a2f8d1fde64fbf12fd9f8d.asciidoc index b48e2704b..920da5537 100644 --- a/docs/examples/f4dc1286d0a2f8d1fde64fbf12fd9f8d.asciidoc +++ b/docs/examples/f4dc1286d0a2f8d1fde64fbf12fd9f8d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:86 +// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:90 [source, python] ---- diff --git a/docs/examples/f4f557716049b23f8840d58d71e748f0.asciidoc b/docs/examples/f4f557716049b23f8840d58d71e748f0.asciidoc index 087424acd..7ff14c5da 100644 --- a/docs/examples/f4f557716049b23f8840d58d71e748f0.asciidoc +++ b/docs/examples/f4f557716049b23f8840d58d71e748f0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/update-settings.asciidoc:115 +// indices/update-settings.asciidoc:121 [source, python] ---- diff --git a/docs/examples/f4fdfe52ecba65eec6beb30d8deb8bbf.asciidoc b/docs/examples/f4fdfe52ecba65eec6beb30d8deb8bbf.asciidoc index ceca7cc8a..6ed6fd1bf 100644 --- a/docs/examples/f4fdfe52ecba65eec6beb30d8deb8bbf.asciidoc +++ b/docs/examples/f4fdfe52ecba65eec6beb30d8deb8bbf.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/post-forget-follower.asciidoc:35 +// ccr/apis/follow/post-forget-follower.asciidoc:41 [source, python] ---- diff --git a/docs/examples/f5140f08f56c64b5789357539f8b9ba8.asciidoc b/docs/examples/f5140f08f56c64b5789357539f8b9ba8.asciidoc index f0e6a2bcd..ac21cc555 100644 --- a/docs/examples/f5140f08f56c64b5789357539f8b9ba8.asciidoc +++ b/docs/examples/f5140f08f56c64b5789357539f8b9ba8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/delete-alias.asciidoc:10 +// indices/delete-alias.asciidoc:16 [source, python] ---- diff --git a/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc b/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc index 47691a06e..c72602223 100644 --- a/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc +++ b/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// inference/service-azure-openai.asciidoc:139 +// inference/service-azure-openai.asciidoc:165 [source, python] ---- diff --git a/docs/examples/f58fd031597e2c3df78bf0efd07206e3.asciidoc b/docs/examples/f58fd031597e2c3df78bf0efd07206e3.asciidoc index a2222067f..a9ea7f209 100644 --- a/docs/examples/f58fd031597e2c3df78bf0efd07206e3.asciidoc +++ b/docs/examples/f58fd031597e2c3df78bf0efd07206e3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// licensing/start-basic.asciidoc:62 +// licensing/start-basic.asciidoc:68 [source, python] ---- diff --git a/docs/examples/f625fdbbe78c4198d9e40b35f3f008b3.asciidoc b/docs/examples/f625fdbbe78c4198d9e40b35f3f008b3.asciidoc new file mode 100644 index 000000000..5e65d8231 --- /dev/null +++ b/docs/examples/f625fdbbe78c4198d9e40b35f3f008b3.asciidoc @@ -0,0 +1,14 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-known-issues.asciidoc:99 + +[source, python] +---- +resp = client.update( + index=".elastic-connectors", + id="connector-id", + doc={ + "custom_scheduling": {} + }, +) +print(resp) +---- diff --git a/docs/examples/f63f6343e74bd5c844854272e746de14.asciidoc b/docs/examples/f63f6343e74bd5c844854272e746de14.asciidoc index 00f67f60f..a317cea4e 100644 --- a/docs/examples/f63f6343e74bd5c844854272e746de14.asciidoc +++ b/docs/examples/f63f6343e74bd5c844854272e746de14.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/deactivate-watch.asciidoc:82 +// rest-api/watcher/deactivate-watch.asciidoc:88 [source, python] ---- diff --git a/docs/examples/f6566395f85d3afe917228643d7318d6.asciidoc b/docs/examples/f6566395f85d3afe917228643d7318d6.asciidoc index 1a38176a3..c5bc986e9 100644 --- a/docs/examples/f6566395f85d3afe917228643d7318d6.asciidoc +++ b/docs/examples/f6566395f85d3afe917228643d7318d6.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/size-your-shards.asciidoc:468 +// how-to/size-your-shards.asciidoc:469 [source, python] ---- diff --git a/docs/examples/f656c1e64268293ecc8ebd8065628faa.asciidoc b/docs/examples/f656c1e64268293ecc8ebd8065628faa.asciidoc index 1b4e85d1d..084364977 100644 --- a/docs/examples/f656c1e64268293ecc8ebd8065628faa.asciidoc +++ b/docs/examples/f656c1e64268293ecc8ebd8065628faa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-service-token-caches.asciidoc:70 +// rest-api/security/clear-service-token-caches.asciidoc:76 [source, python] ---- diff --git a/docs/examples/f66643c54999426c5afa6d5a87435d4e.asciidoc b/docs/examples/f66643c54999426c5afa6d5a87435d4e.asciidoc index 767b7ced6..ce8785026 100644 --- a/docs/examples/f66643c54999426c5afa6d5a87435d4e.asciidoc +++ b/docs/examples/f66643c54999426c5afa6d5a87435d4e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-api-key-cache.asciidoc:43 +// rest-api/security/clear-api-key-cache.asciidoc:49 [source, python] ---- diff --git a/docs/examples/f679e414de48b8fe25e458844be05618.asciidoc b/docs/examples/f679e414de48b8fe25e458844be05618.asciidoc new file mode 100644 index 000000000..4a98eeb2d --- /dev/null +++ b/docs/examples/f679e414de48b8fe25e458844be05618.asciidoc @@ -0,0 +1,13 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/connectors-API-tutorial.asciidoc:179 + +[source, python] +---- +resp = client.connector.put( + connector_id="my-connector-id", + name="Music catalog", + index_name="music", + service_type="postgresql", +) +print(resp) +---- diff --git a/docs/examples/f6982ff80b9a64cd5fcac5b20908c906.asciidoc b/docs/examples/f6982ff80b9a64cd5fcac5b20908c906.asciidoc index 08be9d126..74a46c58a 100644 --- a/docs/examples/f6982ff80b9a64cd5fcac5b20908c906.asciidoc +++ b/docs/examples/f6982ff80b9a64cd5fcac5b20908c906.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/delete-calendar-event.asciidoc:43 +// ml/anomaly-detection/apis/delete-calendar-event.asciidoc:49 [source, python] ---- diff --git a/docs/examples/f6d493650b4344f17297b568016fb445.asciidoc b/docs/examples/f6d493650b4344f17297b568016fb445.asciidoc index 8e1f1d499..674327bf6 100644 --- a/docs/examples/f6d493650b4344f17297b568016fb445.asciidoc +++ b/docs/examples/f6d493650b4344f17297b568016fb445.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ccr/apis/follow/post-unfollow.asciidoc:33 +// ccr/apis/follow/post-unfollow.asciidoc:39 [source, python] ---- diff --git a/docs/examples/f6df4acf3c7a4f85706ff314b21ebcb2.asciidoc b/docs/examples/f6df4acf3c7a4f85706ff314b21ebcb2.asciidoc index a030da158..b21d0e61f 100644 --- a/docs/examples/f6df4acf3c7a4f85706ff314b21ebcb2.asciidoc +++ b/docs/examples/f6df4acf3c7a4f85706ff314b21ebcb2.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/clear-privileges-cache.asciidoc:43 +// rest-api/security/clear-privileges-cache.asciidoc:49 [source, python] ---- diff --git a/docs/examples/f6ead39c5505045543b9225deca7367d.asciidoc b/docs/examples/f6ead39c5505045543b9225deca7367d.asciidoc index e133cf10f..c07d7f415 100644 --- a/docs/examples/f6ead39c5505045543b9225deca7367d.asciidoc +++ b/docs/examples/f6ead39c5505045543b9225deca7367d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// cluster/voting-exclusions.asciidoc:105 +// cluster/voting-exclusions.asciidoc:115 [source, python] ---- diff --git a/docs/examples/f6eff830fb0fad200ebfb1e3e46f6f0e.asciidoc b/docs/examples/f6eff830fb0fad200ebfb1e3e46f6f0e.asciidoc index eb34a6f82..521fed98e 100644 --- a/docs/examples/f6eff830fb0fad200ebfb1e3e46f6f0e.asciidoc +++ b/docs/examples/f6eff830fb0fad200ebfb1e3e46f6f0e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/execute-watch.asciidoc:155 +// rest-api/watcher/execute-watch.asciidoc:161 [source, python] ---- diff --git a/docs/examples/f6f647eb644a2d236637ff05f833cb73.asciidoc b/docs/examples/f6f647eb644a2d236637ff05f833cb73.asciidoc new file mode 100644 index 000000000..1e70a342e --- /dev/null +++ b/docs/examples/f6f647eb644a2d236637ff05f833cb73.asciidoc @@ -0,0 +1,15 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/_connectors-create-native-api-key.asciidoc:43 + +[source, python] +---- +resp = client.perform_request( + "POST", + "/_connector/_secret", + headers={"Content-Type": "application/json"}, + body={ + "value": "encoded_api_key" + }, +) +print(resp) +---- diff --git a/docs/examples/f70a54cd9a9f4811bf962e469f2ca2ea.asciidoc b/docs/examples/f70a54cd9a9f4811bf962e469f2ca2ea.asciidoc index 5d8f859d7..9506f1299 100644 --- a/docs/examples/f70a54cd9a9f4811bf962e469f2ca2ea.asciidoc +++ b/docs/examples/f70a54cd9a9f4811bf962e469f2ca2ea.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/bool-query.asciidoc:88 +// query-dsl/bool-query.asciidoc:91 [source, python] ---- diff --git a/docs/examples/f70ff57c80cdbce3f1e7c63ee307c92d.asciidoc b/docs/examples/f70ff57c80cdbce3f1e7c63ee307c92d.asciidoc index 2decbc5f1..efb71a223 100644 --- a/docs/examples/f70ff57c80cdbce3f1e7c63ee307c92d.asciidoc +++ b/docs/examples/f70ff57c80cdbce3f1e7c63ee307c92d.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:503 +// scripting/using.asciidoc:508 [source, python] ---- diff --git a/docs/examples/f785b5d17eb59f8d2a353c2dee66eb5b.asciidoc b/docs/examples/f785b5d17eb59f8d2a353c2dee66eb5b.asciidoc index 47d3faaab..db64e8c7c 100644 --- a/docs/examples/f785b5d17eb59f8d2a353c2dee66eb5b.asciidoc +++ b/docs/examples/f785b5d17eb59f8d2a353c2dee66eb5b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/get-connector-sync-job-api.asciidoc:44 +// connector/apis/get-connector-sync-job-api.asciidoc:51 [source, python] ---- diff --git a/docs/examples/f8525c2460a577edfef156c13f55b8a7.asciidoc b/docs/examples/f7b20e4bb8366f6d2e4486f3bf4211bc.asciidoc similarity index 94% rename from docs/examples/f8525c2460a577edfef156c13f55b8a7.asciidoc rename to docs/examples/f7b20e4bb8366f6d2e4486f3bf4211bc.asciidoc index af1900d64..dc5b9522d 100644 --- a/docs/examples/f8525c2460a577edfef156c13f55b8a7.asciidoc +++ b/docs/examples/f7b20e4bb8366f6d2e4486f3bf4211bc.asciidoc @@ -11,7 +11,7 @@ resp = client.search( "filter": { "range": { "price": { - "to": "500" + "lte": "500" } } } diff --git a/docs/examples/f823e4b87ed181b27f73ebc51351f0ee.asciidoc b/docs/examples/f823e4b87ed181b27f73ebc51351f0ee.asciidoc index 0de27db07..dcc03a130 100644 --- a/docs/examples/f823e4b87ed181b27f73ebc51351f0ee.asciidoc +++ b/docs/examples/f823e4b87ed181b27f73ebc51351f0ee.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/delete-data-stream.asciidoc:26 +// indices/delete-data-stream.asciidoc:32 [source, python] ---- diff --git a/docs/examples/517d291044c3e4448b8804322616ab4a.asciidoc b/docs/examples/f86337e13526c968848cfe29a52d658f.asciidoc similarity index 92% rename from docs/examples/517d291044c3e4448b8804322616ab4a.asciidoc rename to docs/examples/f86337e13526c968848cfe29a52d658f.asciidoc index 4fc02a67c..613de0527 100644 --- a/docs/examples/517d291044c3e4448b8804322616ab4a.asciidoc +++ b/docs/examples/f86337e13526c968848cfe29a52d658f.asciidoc @@ -4,7 +4,7 @@ [source, python] ---- resp = client.ingest.put_pipeline( - id="elser_embeddings", + id="elser_embeddings_pipeline", processors=[ { "inference": { diff --git a/docs/examples/f8a0010753b1ff563dc42d703902d2fa.asciidoc b/docs/examples/f8a0010753b1ff563dc42d703902d2fa.asciidoc index fb0ec2cb8..ef6a5206b 100644 --- a/docs/examples/f8a0010753b1ff563dc42d703902d2fa.asciidoc +++ b/docs/examples/f8a0010753b1ff563dc42d703902d2fa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/bool-query.asciidoc:36 +// query-dsl/bool-query.asciidoc:39 [source, python] ---- diff --git a/docs/examples/f8cb1a04c2e487ff006b5ae0e1a7afbd.asciidoc b/docs/examples/f8cb1a04c2e487ff006b5ae0e1a7afbd.asciidoc index f6c6cbba9..f851ff1bc 100644 --- a/docs/examples/f8cb1a04c2e487ff006b5ae0e1a7afbd.asciidoc +++ b/docs/examples/f8cb1a04c2e487ff006b5ae0e1a7afbd.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/apis/rollup-caps.asciidoc:172 +// rollup/apis/rollup-caps.asciidoc:181 [source, python] ---- diff --git a/docs/examples/f8f960550104c33e00dc78bc8723ccef.asciidoc b/docs/examples/f8f960550104c33e00dc78bc8723ccef.asciidoc new file mode 100644 index 000000000..9b0699474 --- /dev/null +++ b/docs/examples/f8f960550104c33e00dc78bc8723ccef.asciidoc @@ -0,0 +1,10 @@ +// This file is autogenerated, DO NOT EDIT +// quickstart/full-text-filtering-tutorial.asciidoc:42 + +[source, python] +---- +resp = client.indices.create( + index="cooking_blog", +) +print(resp) +---- diff --git a/docs/examples/f92d2f5018a8843ffbb56ade15f84406.asciidoc b/docs/examples/f92d2f5018a8843ffbb56ade15f84406.asciidoc index 148bc6c38..2ea838669 100644 --- a/docs/examples/f92d2f5018a8843ffbb56ade15f84406.asciidoc +++ b/docs/examples/f92d2f5018a8843ffbb56ade15f84406.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// licensing/get-basic-status.asciidoc:35 +// licensing/get-basic-status.asciidoc:41 [source, python] ---- diff --git a/docs/examples/1af9742c71ce0587cd49a73ec7fc1f6c.asciidoc b/docs/examples/f95a4d7ab02bf400246c8822f0245f02.asciidoc similarity index 75% rename from docs/examples/1af9742c71ce0587cd49a73ec7fc1f6c.asciidoc rename to docs/examples/f95a4d7ab02bf400246c8822f0245f02.asciidoc index 669023540..0d7391c3e 100644 --- a/docs/examples/1af9742c71ce0587cd49a73ec7fc1f6c.asciidoc +++ b/docs/examples/f95a4d7ab02bf400246c8822f0245f02.asciidoc @@ -1,11 +1,11 @@ // This file is autogenerated, DO NOT EDIT -// cat/trainedmodel.asciidoc:118 +// cat/trainedmodel.asciidoc:124 [source, python] ---- resp = client.cat.ml_trained_models( h="c,o,l,ct,v", - v="ture", + v=True, ) print(resp) ---- diff --git a/docs/examples/f96d4614f2fc294339fef325b794355f.asciidoc b/docs/examples/f96d4614f2fc294339fef325b794355f.asciidoc index a10bf05e0..0ab525d3e 100644 --- a/docs/examples/f96d4614f2fc294339fef325b794355f.asciidoc +++ b/docs/examples/f96d4614f2fc294339fef325b794355f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/get-bucket.asciidoc:202 +// ml/anomaly-detection/apis/get-bucket.asciidoc:208 [source, python] ---- diff --git a/docs/examples/f96d8131e8a592fbf6dfd686173940a9.asciidoc b/docs/examples/f96d8131e8a592fbf6dfd686173940a9.asciidoc index edb0c9a7b..051fb6d52 100644 --- a/docs/examples/f96d8131e8a592fbf6dfd686173940a9.asciidoc +++ b/docs/examples/f96d8131e8a592fbf6dfd686173940a9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/watcher/update-settings.asciidoc:16 +// rest-api/watcher/update-settings.asciidoc:22 [source, python] ---- diff --git a/docs/examples/f978088f5117d4addd55c11ee3777312.asciidoc b/docs/examples/f978088f5117d4addd55c11ee3777312.asciidoc index 7739d7a40..06db79737 100644 --- a/docs/examples/f978088f5117d4addd55c11ee3777312.asciidoc +++ b/docs/examples/f978088f5117d4addd55c11ee3777312.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/get-service-credentials.asciidoc:51 +// rest-api/security/get-service-credentials.asciidoc:56 [source, python] ---- diff --git a/docs/examples/f97aa2efabbf11a534073041eb2658c9.asciidoc b/docs/examples/f97aa2efabbf11a534073041eb2658c9.asciidoc index 915d3739b..c928e6e09 100644 --- a/docs/examples/f97aa2efabbf11a534073041eb2658c9.asciidoc +++ b/docs/examples/f97aa2efabbf11a534073041eb2658c9.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/apis/delete-stored-script-api.asciidoc:24 +// scripting/apis/delete-stored-script-api.asciidoc:30 [source, python] ---- diff --git a/docs/examples/f994498dd6576be657dedce2822d2b9e.asciidoc b/docs/examples/f994498dd6576be657dedce2822d2b9e.asciidoc new file mode 100644 index 000000000..b29501e73 --- /dev/null +++ b/docs/examples/f994498dd6576be657dedce2822d2b9e.asciidoc @@ -0,0 +1,42 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/semantic-text-hybrid-search:119 + +[source, python] +---- +resp = client.search( + index="semantic-embeddings", + retriever={ + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "match": { + "content": "How to avoid muscle soreness while running?" + } + } + } + }, + { + "standard": { + "query": { + "semantic": { + "field": "semantic_text", + "query": "How to avoid muscle soreness while running?" + } + } + } + } + ] + } + }, + highlight={ + "fields": { + "semantic_text": { + "number_of_fragments": 2 + } + } + }, +) +print(resp) +---- diff --git a/docs/examples/1e0f203aced9344382081ab095c44dde.asciidoc b/docs/examples/f9bad6fd369764185e1cb09b89ee39cc.asciidoc similarity index 70% rename from docs/examples/1e0f203aced9344382081ab095c44dde.asciidoc rename to docs/examples/f9bad6fd369764185e1cb09b89ee39cc.asciidoc index 9c3bb543d..64d5b6209 100644 --- a/docs/examples/1e0f203aced9344382081ab095c44dde.asciidoc +++ b/docs/examples/f9bad6fd369764185e1cb09b89ee39cc.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/text.asciidoc:233 +// mapping/types/text.asciidoc:237 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "text": { "type": "text", diff --git a/docs/examples/f9c8245cc13770dff052b6759a749efa.asciidoc b/docs/examples/f9c8245cc13770dff052b6759a749efa.asciidoc index c8e370454..6d189efc6 100644 --- a/docs/examples/f9c8245cc13770dff052b6759a749efa.asciidoc +++ b/docs/examples/f9c8245cc13770dff052b6759a749efa.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/get.asciidoc:288 +// docs/get.asciidoc:294 [source, python] ---- diff --git a/docs/examples/fa42ae3bf6a300420cd0f77ba006458a.asciidoc b/docs/examples/fa42ae3bf6a300420cd0f77ba006458a.asciidoc index a66e5fe3d..e6b2e9301 100644 --- a/docs/examples/fa42ae3bf6a300420cd0f77ba006458a.asciidoc +++ b/docs/examples/fa42ae3bf6a300420cd0f77ba006458a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:11 +// indices/analyze.asciidoc:17 [source, python] ---- diff --git a/docs/examples/fa82d86a046d67366cfe9ce65535e433.asciidoc b/docs/examples/fa82d86a046d67366cfe9ce65535e433.asciidoc index 3dd87952c..18011566d 100644 --- a/docs/examples/fa82d86a046d67366cfe9ce65535e433.asciidoc +++ b/docs/examples/fa82d86a046d67366cfe9ce65535e433.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// graph/explore.asciidoc:396 +// graph/explore.asciidoc:402 [source, python] ---- diff --git a/docs/examples/fa88f6f5a7d728ec4f1d05244228cb09.asciidoc b/docs/examples/fa88f6f5a7d728ec4f1d05244228cb09.asciidoc index 792d64f6f..f123ea93c 100644 --- a/docs/examples/fa88f6f5a7d728ec4f1d05244228cb09.asciidoc +++ b/docs/examples/fa88f6f5a7d728ec4f1d05244228cb09.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// query-dsl/bool-query.asciidoc:107 +// query-dsl/bool-query.asciidoc:110 [source, python] ---- diff --git a/docs/examples/fab702851e90e945c1b62dec0bb6a205.asciidoc b/docs/examples/fab702851e90e945c1b62dec0bb6a205.asciidoc index 59c475fc3..e6c08027b 100644 --- a/docs/examples/fab702851e90e945c1b62dec0bb6a205.asciidoc +++ b/docs/examples/fab702851e90e945c1b62dec0bb6a205.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// behavioral-analytics/apis/delete-analytics-collection.asciidoc:53 +// behavioral-analytics/apis/delete-analytics-collection.asciidoc:59 [source, python] ---- diff --git a/docs/examples/fabe14480624a99e8ee42c7338672058.asciidoc b/docs/examples/fabe14480624a99e8ee42c7338672058.asciidoc index 82b6a2045..798012303 100644 --- a/docs/examples/fabe14480624a99e8ee42c7338672058.asciidoc +++ b/docs/examples/fabe14480624a99e8ee42c7338672058.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/create-index.asciidoc:264 +// indices/create-index.asciidoc:270 [source, python] ---- diff --git a/docs/examples/fad26f4fb5a1bc9c38db33394e877d94.asciidoc b/docs/examples/fad26f4fb5a1bc9c38db33394e877d94.asciidoc index 3abe7941d..3fb4bdc81 100644 --- a/docs/examples/fad26f4fb5a1bc9c38db33394e877d94.asciidoc +++ b/docs/examples/fad26f4fb5a1bc9c38db33394e877d94.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/df-analytics/apis/get-dfanalytics-stats.asciidoc:533 +// ml/df-analytics/apis/get-dfanalytics-stats.asciidoc:539 [source, python] ---- diff --git a/docs/examples/faf7d8b9827cf5c0db5c177f01dc31c4.asciidoc b/docs/examples/faf7d8b9827cf5c0db5c177f01dc31c4.asciidoc index 1015d6895..85bee5676 100644 --- a/docs/examples/faf7d8b9827cf5c0db5c177f01dc31c4.asciidoc +++ b/docs/examples/faf7d8b9827cf5c0db5c177f01dc31c4.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/rank-eval.asciidoc:257 +// search/rank-eval.asciidoc:263 [source, python] ---- diff --git a/docs/examples/633c8a9fc57268979d8735c557705809.asciidoc b/docs/examples/fb0152f6c70f647a8b6709969113486d.asciidoc similarity index 69% rename from docs/examples/633c8a9fc57268979d8735c557705809.asciidoc rename to docs/examples/fb0152f6c70f647a8b6709969113486d.asciidoc index d9a6eaf22..1548e7f1b 100644 --- a/docs/examples/633c8a9fc57268979d8735c557705809.asciidoc +++ b/docs/examples/fb0152f6c70f647a8b6709969113486d.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/keyword.asciidoc:219 +// mapping/types/keyword.asciidoc:222 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "kwd": { "type": "keyword", diff --git a/docs/examples/fb4799d2fe4011bf6084f89d97d9a4a5.asciidoc b/docs/examples/fb4799d2fe4011bf6084f89d97d9a4a5.asciidoc index 4e9fedc99..e3a968c4d 100644 --- a/docs/examples/fb4799d2fe4011bf6084f89d97d9a4a5.asciidoc +++ b/docs/examples/fb4799d2fe4011bf6084f89d97d9a4a5.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// autoscaling/apis/get-autoscaling-policy.asciidoc:40 +// autoscaling/apis/get-autoscaling-policy.asciidoc:47 [source, python] ---- diff --git a/docs/examples/fb56c2ac77d4c308d7702b6b33698382.asciidoc b/docs/examples/fb56c2ac77d4c308d7702b6b33698382.asciidoc new file mode 100644 index 000000000..2d56c218f --- /dev/null +++ b/docs/examples/fb56c2ac77d4c308d7702b6b33698382.asciidoc @@ -0,0 +1,12 @@ +// This file is autogenerated, DO NOT EDIT +// connector/docs/_connectors-create-native-api-key.asciidoc:54 + +[source, python] +---- +resp = client.connector.update_api_key_id( + connector_id="my_connector_id>", + api_key_id="API key_id", + api_key_secret_id="secret_id", +) +print(resp) +---- diff --git a/docs/examples/fbb38243221c8fb311660616e3add9ce.asciidoc b/docs/examples/fbb38243221c8fb311660616e3add9ce.asciidoc index f3511fb9a..25a5cb185 100644 --- a/docs/examples/fbb38243221c8fb311660616e3add9ce.asciidoc +++ b/docs/examples/fbb38243221c8fb311660616e3add9ce.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:418 +// search/search-your-data/sort-search-results.asciidoc:420 [source, python] ---- diff --git a/docs/examples/fc1907515f6a913884a9f86451e90ee8.asciidoc b/docs/examples/fc1907515f6a913884a9f86451e90ee8.asciidoc index 543709c8c..8c60861bf 100644 --- a/docs/examples/fc1907515f6a913884a9f86451e90ee8.asciidoc +++ b/docs/examples/fc1907515f6a913884a9f86451e90ee8.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/semantic-search-elser.asciidoc:304 +// search/search-your-data/semantic-search-elser.asciidoc:316 [source, python] ---- diff --git a/docs/examples/fc190fbbf71949331266dcb3f46a1198.asciidoc b/docs/examples/fc190fbbf71949331266dcb3f46a1198.asciidoc index 0613d1120..75819854f 100644 --- a/docs/examples/fc190fbbf71949331266dcb3f46a1198.asciidoc +++ b/docs/examples/fc190fbbf71949331266dcb3f46a1198.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/data-stream-stats.asciidoc:51 +// indices/data-stream-stats.asciidoc:57 [source, python] ---- diff --git a/docs/examples/fc49437ce2e7916facf58128308c2aa3.asciidoc b/docs/examples/fc49437ce2e7916facf58128308c2aa3.asciidoc index a5b2395ab..dd8923d82 100644 --- a/docs/examples/fc49437ce2e7916facf58128308c2aa3.asciidoc +++ b/docs/examples/fc49437ce2e7916facf58128308c2aa3.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// searchable-snapshots/apis/mount-snapshot.asciidoc:128 +// searchable-snapshots/apis/mount-snapshot.asciidoc:134 [source, python] ---- diff --git a/docs/examples/fccbddfba9f975de7e321732874dfb78.asciidoc b/docs/examples/fccbddfba9f975de7e321732874dfb78.asciidoc index e1106501c..475f1f2d4 100644 --- a/docs/examples/fccbddfba9f975de7e321732874dfb78.asciidoc +++ b/docs/examples/fccbddfba9f975de7e321732874dfb78.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/data-stream-stats.asciidoc:176 +// indices/data-stream-stats.asciidoc:182 [source, python] ---- diff --git a/docs/examples/fce5c03a388c893cb11a6696e068543f.asciidoc b/docs/examples/fce5c03a388c893cb11a6696e068543f.asciidoc index 7417cd3f6..eb279de96 100644 --- a/docs/examples/fce5c03a388c893cb11a6696e068543f.asciidoc +++ b/docs/examples/fce5c03a388c893cb11a6696e068543f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/has-privileges-user-profile.asciidoc:98 +// rest-api/security/has-privileges-user-profile.asciidoc:104 [source, python] ---- diff --git a/docs/examples/fd2d289e6b725fcc3cbe8fe7ffe02ea0.asciidoc b/docs/examples/fd2d289e6b725fcc3cbe8fe7ffe02ea0.asciidoc index 7094e18ab..0c0581876 100644 --- a/docs/examples/fd2d289e6b725fcc3cbe8fe7ffe02ea0.asciidoc +++ b/docs/examples/fd2d289e6b725fcc3cbe8fe7ffe02ea0.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/get-index-template-v1.asciidoc:97 +// indices/get-index-template-v1.asciidoc:103 [source, python] ---- diff --git a/docs/examples/fd352b472d44d197022a46fce90b6ecb.asciidoc b/docs/examples/fd352b472d44d197022a46fce90b6ecb.asciidoc index d52c31f38..5272749ba 100644 --- a/docs/examples/fd352b472d44d197022a46fce90b6ecb.asciidoc +++ b/docs/examples/fd352b472d44d197022a46fce90b6ecb.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/multi-get.asciidoc:178 +// docs/multi-get.asciidoc:184 [source, python] ---- diff --git a/docs/examples/fd60b4092c6552164862cec287359676.asciidoc b/docs/examples/fd60b4092c6552164862cec287359676.asciidoc index b996a6216..d9b530c7b 100644 --- a/docs/examples/fd60b4092c6552164862cec287359676.asciidoc +++ b/docs/examples/fd60b4092c6552164862cec287359676.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/anomaly-detection/apis/stop-datafeed.asciidoc:74 +// ml/anomaly-detection/apis/stop-datafeed.asciidoc:80 [source, python] ---- diff --git a/docs/examples/fd620f09dbce62c6f0f603a366623607.asciidoc b/docs/examples/fd620f09dbce62c6f0f603a366623607.asciidoc index c8d98272a..b03a89667 100644 --- a/docs/examples/fd620f09dbce62c6f0f603a366623607.asciidoc +++ b/docs/examples/fd620f09dbce62c6f0f603a366623607.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// connector/apis/update-connector-filtering-api.asciidoc:149 +// connector/apis/update-connector-filtering-api.asciidoc:156 [source, python] ---- diff --git a/docs/examples/fd7eeadab6251d9113c4380a7fbe2572.asciidoc b/docs/examples/fd7eeadab6251d9113c4380a7fbe2572.asciidoc index e7756bd54..d2ed6b932 100644 --- a/docs/examples/fd7eeadab6251d9113c4380a7fbe2572.asciidoc +++ b/docs/examples/fd7eeadab6251d9113c4380a7fbe2572.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// security/authentication/remote-clusters-privileges-api-key.asciidoc:26 +// security/authentication/remote-clusters-privileges-api-key.asciidoc:27 [source, python] ---- diff --git a/docs/examples/fd9b668eeb1f117950bd4991c7c03fb1.asciidoc b/docs/examples/fd9b668eeb1f117950bd4991c7c03fb1.asciidoc index 8016651a9..9a96ab56c 100644 --- a/docs/examples/fd9b668eeb1f117950bd4991c7c03fb1.asciidoc +++ b/docs/examples/fd9b668eeb1f117950bd4991c7c03fb1.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// indices/analyze.asciidoc:157 +// indices/analyze.asciidoc:163 [source, python] ---- diff --git a/docs/examples/fdada036a875d7995d5d7aba9c06361e.asciidoc b/docs/examples/fdada036a875d7995d5d7aba9c06361e.asciidoc index b2e05b24b..8f9d3b6d5 100644 --- a/docs/examples/fdada036a875d7995d5d7aba9c06361e.asciidoc +++ b/docs/examples/fdada036a875d7995d5d7aba9c06361e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/dense-vector.asciidoc:95 +// mapping/types/dense-vector.asciidoc:94 [source, python] ---- diff --git a/docs/examples/fe208d94ec93eabf3bd06139fa70701e.asciidoc b/docs/examples/fe208d94ec93eabf3bd06139fa70701e.asciidoc index 21882266f..f38b22cb3 100644 --- a/docs/examples/fe208d94ec93eabf3bd06139fa70701e.asciidoc +++ b/docs/examples/fe208d94ec93eabf3bd06139fa70701e.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rollup/migrating-to-downsampling.asciidoc:58 +// rollup/migrating-to-downsampling.asciidoc:59 [source, python] ---- diff --git a/docs/examples/fe3a927d868cbc530e08e05964d5174a.asciidoc b/docs/examples/fe3a927d868cbc530e08e05964d5174a.asciidoc index adad0a7f7..17408d56f 100644 --- a/docs/examples/fe3a927d868cbc530e08e05964d5174a.asciidoc +++ b/docs/examples/fe3a927d868cbc530e08e05964d5174a.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// search/search-your-data/sort-search-results.asciidoc:115 +// search/search-your-data/sort-search-results.asciidoc:117 [source, python] ---- diff --git a/docs/examples/1fcc4a3280be399753dcfd5c489ff682.asciidoc b/docs/examples/fe6429d0d82174aa5acf95e96e237380.asciidoc similarity index 70% rename from docs/examples/1fcc4a3280be399753dcfd5c489ff682.asciidoc rename to docs/examples/fe6429d0d82174aa5acf95e96e237380.asciidoc index 2dac63638..efcf594b4 100644 --- a/docs/examples/1fcc4a3280be399753dcfd5c489ff682.asciidoc +++ b/docs/examples/fe6429d0d82174aa5acf95e96e237380.asciidoc @@ -1,14 +1,20 @@ // This file is autogenerated, DO NOT EDIT -// mapping/types/range.asciidoc:316 +// mapping/types/range.asciidoc:324 [source, python] ---- resp = client.indices.create( index="idx", + settings={ + "index": { + "mapping": { + "source": { + "mode": "synthetic" + } + } + } + }, mappings={ - "_source": { - "mode": "synthetic" - }, "properties": { "my_range": { "type": "ip_range" diff --git a/docs/examples/fe6e35839f7d7381f8ec535c8f21959b.asciidoc b/docs/examples/fe6e35839f7d7381f8ec535c8f21959b.asciidoc index 6eb08b8f0..a3d664e01 100644 --- a/docs/examples/fe6e35839f7d7381f8ec535c8f21959b.asciidoc +++ b/docs/examples/fe6e35839f7d7381f8ec535c8f21959b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// how-to/recipes/scoring.asciidoc:123 +// how-to/recipes/scoring.asciidoc:124 [source, python] ---- diff --git a/docs/examples/febb71d774e0a1fc67454213d7448c53.asciidoc b/docs/examples/febb71d774e0a1fc67454213d7448c53.asciidoc index f7d66a12b..8682a6c83 100644 --- a/docs/examples/febb71d774e0a1fc67454213d7448c53.asciidoc +++ b/docs/examples/febb71d774e0a1fc67454213d7448c53.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// scripting/using.asciidoc:362 +// scripting/using.asciidoc:367 [source, python] ---- diff --git a/docs/examples/ff09e13391cecb2e8b9dd440b37e065f.asciidoc b/docs/examples/ff09e13391cecb2e8b9dd440b37e065f.asciidoc index e6498693e..155f9c05c 100644 --- a/docs/examples/ff09e13391cecb2e8b9dd440b37e065f.asciidoc +++ b/docs/examples/ff09e13391cecb2e8b9dd440b37e065f.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:310 +// docs/reindex.asciidoc:316 [source, python] ---- diff --git a/docs/examples/ff1b96d2fdcf628bd938bff9e939943c.asciidoc b/docs/examples/ff1b96d2fdcf628bd938bff9e939943c.asciidoc index 8bab9f402..6894641fb 100644 --- a/docs/examples/ff1b96d2fdcf628bd938bff9e939943c.asciidoc +++ b/docs/examples/ff1b96d2fdcf628bd938bff9e939943c.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// mapping/runtime.asciidoc:967 +// mapping/runtime.asciidoc:965 [source, python] ---- diff --git a/docs/examples/ff27e5cddd1f58d8a8f84f807fd27eec.asciidoc b/docs/examples/ff27e5cddd1f58d8a8f84f807fd27eec.asciidoc index 9ce7f1ce8..4f9e86fb4 100644 --- a/docs/examples/ff27e5cddd1f58d8a8f84f807fd27eec.asciidoc +++ b/docs/examples/ff27e5cddd1f58d8a8f84f807fd27eec.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ingest/processors/redact.asciidoc:178 +// ingest/processors/redact.asciidoc:179 [source, python] ---- diff --git a/docs/examples/ff56ded50c65998c70f3c5691ddc6f86.asciidoc b/docs/examples/ff56ded50c65998c70f3c5691ddc6f86.asciidoc index b08b694ec..4ea52bc32 100644 --- a/docs/examples/ff56ded50c65998c70f3c5691ddc6f86.asciidoc +++ b/docs/examples/ff56ded50c65998c70f3c5691ddc6f86.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// snapshot-restore/apis/delete-repo-api.asciidoc:27 +// snapshot-restore/apis/delete-repo-api.asciidoc:33 [source, python] ---- diff --git a/docs/examples/ff63ae39c34925dbfa54282ec9989124.asciidoc b/docs/examples/ff63ae39c34925dbfa54282ec9989124.asciidoc index 7381f8418..b7e2bc292 100644 --- a/docs/examples/ff63ae39c34925dbfa54282ec9989124.asciidoc +++ b/docs/examples/ff63ae39c34925dbfa54282ec9989124.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// docs/reindex.asciidoc:1003 +// docs/reindex.asciidoc:1009 [source, python] ---- diff --git a/docs/examples/ff776c0fccf93e1c7050f7cb7efbae0b.asciidoc b/docs/examples/ff776c0fccf93e1c7050f7cb7efbae0b.asciidoc index 5effa743d..3968cc823 100644 --- a/docs/examples/ff776c0fccf93e1c7050f7cb7efbae0b.asciidoc +++ b/docs/examples/ff776c0fccf93e1c7050f7cb7efbae0b.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// ml/trained-models/apis/infer-trained-model.asciidoc:905 +// ml/trained-models/apis/infer-trained-model.asciidoc:1012 [source, python] ---- diff --git a/docs/examples/ff7b81fa96c3b994efa3dee230512291.asciidoc b/docs/examples/ff7b81fa96c3b994efa3dee230512291.asciidoc index 2d64be799..0767e0c5b 100644 --- a/docs/examples/ff7b81fa96c3b994efa3dee230512291.asciidoc +++ b/docs/examples/ff7b81fa96c3b994efa3dee230512291.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// graph/explore.asciidoc:204 +// graph/explore.asciidoc:210 [source, python] ---- diff --git a/docs/examples/ffd63dd186ab81b893faec3b3358fa09.asciidoc b/docs/examples/ffd63dd186ab81b893faec3b3358fa09.asciidoc index 83140cb6e..33e1646ec 100644 --- a/docs/examples/ffd63dd186ab81b893faec3b3358fa09.asciidoc +++ b/docs/examples/ffd63dd186ab81b893faec3b3358fa09.asciidoc @@ -1,5 +1,5 @@ // This file is autogenerated, DO NOT EDIT -// rest-api/security/delete-users.asciidoc:39 +// rest-api/security/delete-users.asciidoc:45 [source, python] ---- diff --git a/docs/examples/ffda10edaa7ce087703193c3cb95a426.asciidoc b/docs/examples/ffda10edaa7ce087703193c3cb95a426.asciidoc new file mode 100644 index 000000000..d88901a8f --- /dev/null +++ b/docs/examples/ffda10edaa7ce087703193c3cb95a426.asciidoc @@ -0,0 +1,146 @@ +// This file is autogenerated, DO NOT EDIT +// search/search-your-data/retrievers-examples.asciidoc:14 + +[source, python] +---- +resp = client.indices.create( + index="retrievers_example", + settings={ + "number_of_shards": 1 + }, + mappings={ + "properties": { + "vector": { + "type": "dense_vector", + "dims": 3, + "similarity": "l2_norm", + "index": True, + "index_options": { + "type": "flat" + } + }, + "text": { + "type": "text" + }, + "year": { + "type": "integer" + }, + "topic": { + "type": "keyword" + }, + "timestamp": { + "type": "date" + } + } + }, +) +print(resp) + +resp1 = client.index( + index="retrievers_example", + id="1", + document={ + "vector": [ + 0.23, + 0.67, + 0.89 + ], + "text": "Large language models are revolutionizing information retrieval by boosting search precision, deepening contextual understanding, and reshaping user experiences in data-rich environments.", + "year": 2024, + "topic": [ + "llm", + "ai", + "information_retrieval" + ], + "timestamp": "2021-01-01T12:10:30" + }, +) +print(resp1) + +resp2 = client.index( + index="retrievers_example", + id="2", + document={ + "vector": [ + 0.12, + 0.56, + 0.78 + ], + "text": "Artificial intelligence is transforming medicine, from advancing diagnostics and tailoring treatment plans to empowering predictive patient care for improved health outcomes.", + "year": 2023, + "topic": [ + "ai", + "medicine" + ], + "timestamp": "2022-01-01T12:10:30" + }, +) +print(resp2) + +resp3 = client.index( + index="retrievers_example", + id="3", + document={ + "vector": [ + 0.45, + 0.32, + 0.91 + ], + "text": "AI is redefining security by enabling advanced threat detection, proactive risk analysis, and dynamic defenses against increasingly sophisticated cyber threats.", + "year": 2024, + "topic": [ + "ai", + "security" + ], + "timestamp": "2023-01-01T12:10:30" + }, +) +print(resp3) + +resp4 = client.index( + index="retrievers_example", + id="4", + document={ + "vector": [ + 0.34, + 0.21, + 0.98 + ], + "text": "Elastic introduces Elastic AI Assistant, the open, generative AI sidekick powered by ESRE to democratize cybersecurity and enable users of every skill level.", + "year": 2023, + "topic": [ + "ai", + "elastic", + "assistant" + ], + "timestamp": "2024-01-01T12:10:30" + }, +) +print(resp4) + +resp5 = client.index( + index="retrievers_example", + id="5", + document={ + "vector": [ + 0.11, + 0.65, + 0.47 + ], + "text": "Learn how to spin up a deployment of our hosted Elasticsearch Service and use Elastic Observability to gain deeper insight into the behavior of your applications and systems.", + "year": 2024, + "topic": [ + "documentation", + "observability", + "elastic" + ], + "timestamp": "2025-01-01T12:10:30" + }, +) +print(resp5) + +resp6 = client.indices.refresh( + index="retrievers_example", +) +print(resp6) +---- diff --git a/docs/examples/fff86117c47f974074284644e8a97a99.asciidoc b/docs/examples/fff86117c47f974074284644e8a97a99.asciidoc new file mode 100644 index 000000000..5624bd74b --- /dev/null +++ b/docs/examples/fff86117c47f974074284644e8a97a99.asciidoc @@ -0,0 +1,18 @@ +// This file is autogenerated, DO NOT EDIT +// inference/service-jinaai.asciidoc:155 + +[source, python] +---- +resp = client.inference.put( + task_type="text_embedding", + inference_id="jinaai-embeddings", + inference_config={ + "service": "jinaai", + "service_settings": { + "model_id": "jina-embeddings-v3", + "api_key": "" + } + }, +) +print(resp) +---- diff --git a/docs/guide/release-notes.asciidoc b/docs/guide/release-notes.asciidoc index 674346865..069cedc39 100644 --- a/docs/guide/release-notes.asciidoc +++ b/docs/guide/release-notes.asciidoc @@ -1,6 +1,10 @@ [[release-notes]] == Release notes +* <> +* <> +* <> +* <> * <> * <> * <> @@ -41,6 +45,94 @@ * <> * <> +[discrete] +[[rn-8-17-2]] +=== 8.17.2 (2025-03-04) + +- Explain how to use sub clients in API docs (https://github.com/elastic/elasticsearch-py/pull/2798[#2798]) +- Render descriptions as Markdown in API docs +- Update APIs + * Add `keep_alive` to Submit async search API + * Add `Run and Delete` an async ES|QL query APIs + * Add Get async ES|QL query results API + * Add `include_ccs_metadata` to ES|QL query API + +[discrete] +[[rn-8-17-1]] +=== 8.17.1 (2025-01-23) + +- Make pyarrow dependency optional for tests (https://github.com/elastic/elasticsearch-py/pull/2733[#2733], contributed by danigm) +- Update APIs: + * Add Simulate ingest API + * Add Get data stream lifecycle stats API + * Add Update inference API + * Add Create or update, Get and Delete IP geolocation database configuration APIs + * Add Bulk update API keys + * Add Get and Update Security index settings APIs + * Add OpenID Connect prepare authentication, OpenID Connect authenticate and OpenID Connect logout APIs + * Add Delegate PKI authentication API + * Add Repository analysis API + * Add Render Search Application Query API + * Add Find field structure and Find messages structure APIs + * Add Get Watcher index settings and Update Watcher index settings APIs + * Add experimental Check in and Claim connector sync job APIs + * Add experimental Set connector sync job errors and Set connector sync job stats APIs + * Add experimental Update connector features APIs + * Add experimental Post Event to an Analytics Collection API + * Add `timeout` and `master_timeout` to Snapshot lifecycle management (SLM) APIs + * Add `allow_partial_search_results` to SQL search API + * Add `throttle_period_in_millis` to Create or update watch API + * Fix query parameters for CAT APIs + +[discrete] +[[rn-8-17-0]] +=== 8.17.0 (2024-12-13) + +- Allow simsimd again on Python 3.13 (https://github.com/elastic/elasticsearch-py/pull/2722[#2722]) +- Update APIs: + * Mark all Inference APIs as stable. + * Add `allow_partial_search_results` to the Open Point in Time API + * Add `keep_alive` to the Get async search status API + * Remove the `keep_alive`, `pre_filter_shard_size` and `scroll` parameters from the Submit async search API. They were never supported. + * Add `master_timeout` and `timeout` to all autoscaling policy APIs + * Add `master_timeout` to the Alias exists and Get alias APIs + * Add `list_executed_pipelines` and `require_data_stream` to Bulk API + * Add `include_model_definition` to Get trained models API + * Add `meta` to Create data frame analytics API + * Add `aggs` to Create datafeeds API + * Add `allow_no_indices`, `expand_wildcards`, `ignore_throttled` and `ignore_unavailable` to Create anomaly detection jobs API + +[discrete] +[[rn-8-16-0]] +=== 8.16.0 (2024-11-12) + +- Support Python 3.13 (https://github.com/elastic/elasticsearch-py/pull/2689[#2689]) +- Emit Python warnings for beta and tech preview APIs (https://github.com/elastic/elasticsearch-py/pull/2685[#2685]) +- Vectorstore: use a retriever query for hybrid search (https://github.com/elastic/elasticsearch-py/pull/2682[#2682]) +- Allow retries for statuses other than 429 in streaming bulk (https://github.com/elastic/elasticsearch-py/pull/2702[#2702]) +- Make `BulkIndexError` and `ScanError` serializable (https://github.com/elastic/elasticsearch-py/pull/2700[#2700]) +- Fix import when `trace` is missing from `opentelemetry` package (https://github.com/elastic/elasticsearch-py/pull/2705[#2705]) +- Update APIs: + * Fix `nodes` parameter in Task management API + * Add Test query rule API + * Add Create Cross-Cluster API key and Update Cross-Cluster API key APIs + * Add Verify snapshot repository API + * Add `data_stream_name` and `settings` to Delete auto-follow pattern API + * Add `max_samples_per_key` to Get async EQL status API + * Add `lifecycle` and remove unused `data_retention` and `downsampling parameters` from Put data stream lifecycle API + * Add `include_remotes` and remove `flat_settings` from Cluster stats API + * Add `remote_indices` to Create or update application privileges and Create or update roles APIs + +Note that the new Python warnings can be disabled as follows: + +[source,python] +---- +import warnings +from elasticsearch.exceptions import GeneralAvailabilityWarning + +warnings.filterwarnings("ignore", category=GeneralAvailabilityWarning) +---- + [discrete] [[rn-8-15-1]] === 8.15.1 (2024-09-08) @@ -51,8 +143,6 @@ - Add `q` parameter to Update by Query API - Add `allow_no_indices` and `ignore_unavailable` parameters to Resolve index API - - [discrete] [[rn-8-15-0]] === 8.15.0 (2024-08-09) diff --git a/docs/sphinx/_static/css/custom.css b/docs/sphinx/_static/css/custom.css new file mode 100644 index 000000000..e6ffd086e --- /dev/null +++ b/docs/sphinx/_static/css/custom.css @@ -0,0 +1,16 @@ +/* Display GitHub Flavored Markdown code blocks correctly */ + +.rst-content pre { + background-color: #f5f5f5; + border-radius: 6px; + padding: 16px; + margin: 16px 0; + overflow-x: auto; +} + +.rst-content pre code { + background-color: #f5f5f5; + white-space: pre; + border: none; + padding: 0; +} diff --git a/docs/sphinx/api.rst b/docs/sphinx/api.rst index 979341034..61d3214e6 100644 --- a/docs/sphinx/api.rst +++ b/docs/sphinx/api.rst @@ -45,6 +45,7 @@ arguments are required for all calls. api/searchable-snapshots api/security api/shutdown + api/simulate api/snapshot-lifecycle-management api/snapshots api/snapshottable-features diff --git a/docs/sphinx/api/elasticsearch.rst b/docs/sphinx/api/elasticsearch.rst index 64df4540b..b8831a407 100644 --- a/docs/sphinx/api/elasticsearch.rst +++ b/docs/sphinx/api/elasticsearch.rst @@ -3,7 +3,7 @@ Elasticsearch ------------- -.. py:module:: elasticsearch.client +.. py:module:: elasticsearch .. autoclass:: Elasticsearch :members: diff --git a/docs/sphinx/api/simulate.rst b/docs/sphinx/api/simulate.rst new file mode 100644 index 000000000..64607bbac --- /dev/null +++ b/docs/sphinx/api/simulate.rst @@ -0,0 +1,9 @@ +.. _simulate: + +Simulate +-------- +.. py:module:: elasticsearch.client + :no-index: + +.. autoclass:: SimulateClient + :members: diff --git a/docs/sphinx/async.rst b/docs/sphinx/async.rst index 22a49b312..58cd53b14 100644 --- a/docs/sphinx/async.rst +++ b/docs/sphinx/async.rst @@ -37,8 +37,7 @@ and are used in the same way as other APIs, just with an extra ``await``: ) print(resp) - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) All APIs that are available under the sync client are also available under the async client. @@ -153,8 +152,7 @@ Bulk and Streaming Bulk async def main(): await async_bulk(client, gendata()) - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) .. autofunction:: async_streaming_bulk @@ -180,8 +178,7 @@ Bulk and Streaming Bulk if not ok: print("failed to %s document %s" % ()) - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) Scan ~~~~ @@ -204,8 +201,7 @@ Scan ): print(doc) - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) Reindex ~~~~~~~ diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py index d7c3f7751..d1537932b 100644 --- a/docs/sphinx/conf.py +++ b/docs/sphinx/conf.py @@ -21,10 +21,42 @@ extensions = ["sphinx.ext.autodoc", "sphinx.ext.doctest", "sphinx.ext.intersphinx"] -autoclass_content = "both" +autoclass_content = "class" +autodoc_class_signature = "separated" autodoc_typehints = "description" + +def client_name(full_name): + # Get the class name, e.g. ['elasticsearch', 'client', 'TextStructureClient'] -> 'TextStructure' + class_name = full_name.split(".")[-1].removesuffix("Client") + # Convert to snake case, e.g. 'TextStructure' -> '_text_structure' + snake_case = "".join(["_" + c.lower() if c.isupper() else c for c in class_name]) + # Remove the leading underscore + return snake_case.lstrip("_") + + +def add_client_usage_example(app, what, name, obj, options, lines): + if what == "class" and "Client" in name: + sub_client_name = client_name(name) + lines.append( + f"To use this client, access ``client.{sub_client_name}`` from an " + " :class:`~elasticsearch.Elasticsearch` client. For example::" + ) + lines.append("") + lines.append(" from elasticsearch import Elasticsearch") + lines.append("") + lines.append(" # Create the client instance") + lines.append(" client = Elasticsearch(...)") + lines.append(f" # Use the {sub_client_name} client") + lines.append(f" client.{sub_client_name}.(...)") + lines.append("") + + +def setup(app): + app.connect("autodoc-process-docstring", add_client_usage_example) + + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -44,6 +76,8 @@ pygments_style = "sphinx" html_theme = "sphinx_rtd_theme" +html_static_path = ["_static"] +html_css_files = ["css/custom.css"] intersphinx_mapping = { "python": ("https://docs.python.org/3", None), diff --git a/elasticsearch/__init__.py b/elasticsearch/__init__.py index 723b3a2b7..c2277228a 100644 --- a/elasticsearch/__init__.py +++ b/elasticsearch/__init__.py @@ -27,7 +27,7 @@ from ._version import __versionstr__ # Ensure that a compatible version of elastic-transport is installed. -_version_groups = tuple(int(x) for x in re.search(r"^(\d+)\.(\d+)\.(\d+)", _elastic_transport_version).groups()) # type: ignore +_version_groups = tuple(int(x) for x in re.search(r"^(\d+)\.(\d+)\.(\d+)", _elastic_transport_version).groups()) # type: ignore[union-attr] if _version_groups < (8, 0, 0) or _version_groups > (9, 0, 0): raise ImportError( "An incompatible version of elastic-transport is installed. Must be between " @@ -35,7 +35,7 @@ "$ python -m pip install 'elastic-transport>=8, <9'" ) -_version_groups = re.search(r"^(\d+)\.(\d+)\.(\d+)", __versionstr__).groups() # type: ignore +_version_groups = re.search(r"^(\d+)\.(\d+)\.(\d+)", __versionstr__).groups() # type: ignore[assignment, union-attr] _major, _minor, _patch = (int(x) for x in _version_groups) VERSION = __version__ = (_major, _minor, _patch) diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index c07e82039..694aca757 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -70,6 +70,7 @@ from .searchable_snapshots import SearchableSnapshotsClient from .security import SecurityClient from .shutdown import ShutdownClient +from .simulate import SimulateClient from .slm import SlmClient from .snapshot import SnapshotClient from .sql import SqlClient @@ -82,8 +83,10 @@ _TYPE_HOSTS, CLIENT_META_SERVICE, SKIP_IN_PATH, + Stability, _quote, _rewrite_parameters, + _stability_warning, client_node_configs, is_requests_http_auth, is_requests_node_class, @@ -463,6 +466,7 @@ def __init__( self.searchable_snapshots = SearchableSnapshotsClient(self) self.security = SecurityClient(self) self.slm = SlmClient(self) + self.simulate = SimulateClient(self) self.shutdown = ShutdownClient(self) self.sql = SqlClient(self) self.ssl = SslClient(self) @@ -624,12 +628,14 @@ async def bulk( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + list_executed_pipelines: t.Optional[bool] = None, pipeline: t.Optional[str] = None, pretty: t.Optional[bool] = None, refresh: t.Optional[ t.Union[bool, str, t.Literal["false", "true", "wait_for"]] ] = None, require_alias: t.Optional[bool] = None, + require_data_stream: t.Optional[bool] = None, routing: t.Optional[str] = None, source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None, source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None, @@ -640,37 +646,131 @@ async def bulk( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk index or delete documents. Performs multiple indexing or delete operations - in a single API call. This reduces overhead and can greatly increase indexing - speed. - - ``_ + .. raw:: html + +

Bulk index or delete documents. + Perform multiple index, create, delete, and update actions in a single request. + This reduces overhead and can greatly increase indexing speed.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:

+
    +
  • To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action.
  • +
  • To use the index action, you must have the create, index, or write index privilege.
  • +
  • To use the delete action, you must have the delete or write index privilege.
  • +
  • To use the update action, you must have the index or write index privilege.
  • +
  • To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
  • To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

The actions are specified in the request body using a newline delimited JSON (NDJSON) structure:

+
action_and_meta_data\\n
+          optional_source\\n
+          action_and_meta_data\\n
+          optional_source\\n
+          ....
+          action_and_meta_data\\n
+          optional_source\\n
+          
+

The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. + A create action fails if a document with the same ID already exists in the target + An index action adds or replaces a document as necessary.

+

NOTE: Data streams support only the create action. + To update or delete a document in a data stream, you must target the backing index containing the document.

+

An update action expects that the partial doc, upsert, and script and its options are specified on the next line.

+

A delete action does not expect a source on the next line and has the same semantics as the standard delete API.

+

NOTE: The final line of data must end with a newline character (\\n). + Each newline character may be preceded by a carriage return (\\r). + When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. + Because this format uses literal newline characters (\\n) as delimiters, make sure that the JSON actions and sources are not pretty printed.

+

If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument.

+

A note on the format: the idea here is to make processing as fast as possible. + As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side.

+

Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible.

+

There is no "correct" number of actions to perform in a single bulk request. + Experiment with different settings to find the optimal size for your particular workload. + Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. + It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. + For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch.

+

Client suppport for bulk requests

+

Some of the officially supported clients provide helpers to assist with bulk requests and reindexing:

+
    +
  • Go: Check out esutil.BulkIndexer
  • +
  • Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll
  • +
  • Python: Check out elasticsearch.helpers.*
  • +
  • JavaScript: Check out client.helpers.*
  • +
  • .NET: Check out BulkAllObservable
  • +
  • PHP: Check out bulk indexing.
  • +
+

Submitting bulk requests with cURL

+

If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. + The latter doesn't preserve newlines. For example:

+
$ cat requests
+          { "index" : { "_index" : "test", "_id" : "1" } }
+          { "field1" : "value1" }
+          $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo
+          {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]}
+          
+

Optimistic concurrency control

+

Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. + The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details.

+

Versioning

+

Each bulk item can include the version value using the version field. + It automatically follows the behavior of the index or delete operation based on the _version mapping. + It also support the version_type.

+

Routing

+

Each bulk item can include the routing value using the routing field. + It automatically follows the behavior of the index or delete operation based on the _routing mapping.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+

Wait for active shards

+

When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request.

+

Refresh

+

Control when the changes made by this request are visible to search.

+

NOTE: Only the shards that receive the bulk request will be affected by refresh. + Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. + The request will only wait for those three shards to refresh. + The other two shards that make up the index do not participate in the _bulk request at all.

+ + + ``_ :param operations: - :param index: Name of the data stream, index, or index alias to perform bulk + :param index: The name of the data stream, index, or index alias to perform bulk actions on. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. - If the index has a default ingest pipeline specified, then setting the value - to `_none` disables the default ingest pipeline for this request. If a final - pipeline is configured it will always run, regardless of the value of this + :param list_executed_pipelines: If `true`, the response will include the ingest + pipelines that were run for each index or create. + :param pipeline: The pipeline identifier to use to preprocess incoming documents. + If the index has a default ingest pipeline specified, setting the value to + `_none` turns off the default ingest pipeline for this request. If a final + pipeline is configured, it will always run regardless of the value of this parameter. :param refresh: If `true`, Elasticsearch refreshes 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` do nothing with refreshes. + this operation visible to search. If `wait_for`, wait for a refresh to make + this operation visible to search. If `false`, do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. - :param require_alias: If `true`, the request’s actions must target an index alias. - :param routing: Custom value used to route operations to a specific shard. - :param source: `true` or `false` to return the `_source` field or not, or a list - of fields to return. + :param require_alias: If `true`, the request's actions must target an index alias. + :param require_data_stream: If `true`, the request's actions must target a data + stream (existing or to be created). + :param routing: A custom value that is used to route operations to a specific + shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or contains a list of fields to return. :param source_excludes: A comma-separated list of source fields to exclude from - the response. + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :param timeout: Period each action waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. + :param timeout: The period each action waits for the following operations: automatic + index creation, dynamic mapping updates, and waiting for active shards. The + default is `1m` (one minute), which guarantees Elasticsearch waits for at + least the timeout before failing. The actual wait time could be longer, particularly + when multiple waits occur. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to all or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. Set to `all` or any positive integer + up to the total number of shards in the index (`number_of_replicas+1`). The + default is `1`, which waits for each primary shard to be active. """ if operations is None and body is None: raise ValueError( @@ -692,6 +792,8 @@ async def bulk( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if list_executed_pipelines is not None: + __query["list_executed_pipelines"] = list_executed_pipelines if pipeline is not None: __query["pipeline"] = pipeline if pretty is not None: @@ -700,6 +802,8 @@ async def bulk( __query["refresh"] = refresh if require_alias is not None: __query["require_alias"] = require_alias + if require_data_stream is not None: + __query["require_data_stream"] = require_data_stream if routing is not None: __query["routing"] = routing if source is not None: @@ -741,11 +845,15 @@ async def clear_scroll( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clears the search context and results for a scrolling search. + .. raw:: html + +

Clear a scrolling search. + Clear the search context and results for a scrolling search.

- ``_ - :param scroll_id: Scroll IDs to clear. To clear all scroll IDs, use `_all`. + ``_ + + :param scroll_id: The scroll IDs to clear. To clear all scroll IDs, use `_all`. """ __path_parts: t.Dict[str, str] = {} __path = "/_search/scroll" @@ -791,9 +899,16 @@ async def close_point_in_time( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Closes a point-in-time. + .. raw:: html + +

Close a point in time. + A point in time must be opened explicitly before being used in search requests. + The keep_alive parameter tells Elasticsearch how long it should persist. + A point in time is automatically closed when the keep_alive period has elapsed. + However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.

- ``_ + + ``_ :param id: The ID of the point-in-time. """ @@ -865,46 +980,65 @@ async def count( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns number of documents matching a query. + .. raw:: html + +

Count search results. + Get the number of documents matching a query.

+

The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. + The query is optional. When no query is provided, the API uses match_all to count all the documents.

+

The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices.

+

The operation is broadcast across all shards. + For each shard ID group, a replica is chosen and the search is run against it. + This means that replicas increase the scalability of the count.

+ - ``_ + ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams and indices, omit this - parameter or use `*` or `_all`. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*` or `_all`. :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. - This behavior applies even if the request targets other open indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - This parameter can only be used when the `q` query string parameter is specified. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the `q` query string parameter is specified. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can only be used when the `q` query string parameter + `OR`. This parameter can be used only when the `q` query string parameter is specified. - :param df: Field to use as default where no field prefix is given in the query - string. This parameter can only be used when the `q` query string parameter + :param df: The field to use as a default when no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter is specified. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. - :param ignore_throttled: If `true`, concrete, expanded or aliased indices are + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. + :param ignore_throttled: If `true`, concrete, expanded, or aliased indices are ignored when frozen. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. - :param min_score: Sets the minimum `_score` value that documents must have to - be included in the result. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. - :param query: Defines the search definition using the Query DSL. - :param routing: Custom value used to route operations to a specific shard. - :param terminate_after: Maximum number of documents to collect for each shard. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. + :param min_score: The minimum `_score` value that documents must have to be included + in the result. + :param preference: The node or shard the operation should be performed on. By + default, it is random. + :param q: The query in Lucene query string syntax. This parameter cannot be used + with a request body. + :param query: Defines the search query using Query DSL. A request body query + cannot be used with the `q` query string parameter. + :param routing: A custom value used to route operations to a specific shard. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - Elasticsearch collects documents before sorting. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this parameter to each shard handling the request. + When possible, let Elasticsearch perform early termination automatically. + Avoid specifying this parameter for requests that target data streams with + backing indices across multiple data tiers. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -998,38 +1132,100 @@ async def create( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Index a document. Adds a JSON document to the specified data stream or index - and makes it searchable. If the target is an index and the document already exists, - the request updates the document and increments its version. - - ``_ - - :param index: Name of the data stream or index to target. If the target doesn’t + .. raw:: html + +

Create a new document in the index.

+

You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs + Using _create guarantees that the document is indexed only if it does not already exist. + It returns a 409 response when a document with a same ID already exists in the index. + To update an existing document, you must use the /<target>/_doc/ API.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:

+
    +
  • To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege.
  • +
  • To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

Automatically create data streams and indices

+

If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream.

+

If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.

+

NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.

+

If no mapping exists, the index operation creates a dynamic mapping. + By default, new fields and objects are automatically added to the mapping if needed.

+

Automatic index creation is controlled by the action.auto_create_index setting. + If it is true, any index can be created automatically. + You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. + Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. + When a list is specified, the default behaviour is to disallow.

+

NOTE: The action.auto_create_index setting affects the automatic creation of indices only. + It does not affect the creation of data streams.

+

Routing

+

By default, shard placement — or routing — is controlled by using a hash of the document's ID value. + For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter.

+

When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. + This does come at the (very minimal) cost of an additional document parsing pass. + If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+

** Distributed**

+

The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. + After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.

+

Active shards

+

To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. + If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. + By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). + This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. + To alter this behavior per operation, use the wait_for_active_shards request parameter.

+

Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). + Specifying a negative value or a number greater than the number of shard copies will throw an error.

+

For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). + If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. + This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. + If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. + This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. + However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. + The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.

+

It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. + After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. + The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed.

+ + + ``_ + + :param index: The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If - the target doesn’t exist and doesn’t match a data stream template, this request + the target doesn't exist and doesn’t match a data stream template, this request creates the index. - :param id: Unique identifier for the document. + :param id: A unique identifier for the document. To automatically generate a + document ID, use the `POST //_doc/` request format. :param document: - :param pipeline: ID of the pipeline to use to preprocess incoming documents. - If the index has a default ingest pipeline specified, then setting the value - to `_none` disables the default ingest pipeline for this request. If a final - pipeline is configured it will always run, regardless of the value of this + :param pipeline: The ID of the pipeline to use to preprocess incoming documents. + If the index has a default ingest pipeline specified, setting the value to + `_none` turns off the default ingest pipeline for this request. If a final + pipeline is configured, it will always run regardless of the value of this parameter. :param refresh: If `true`, Elasticsearch refreshes 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` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period the request waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. + :param routing: A custom value that is used to route operations to a specific + shard. + :param timeout: The period the request waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. Elasticsearch + waits for at least the specified timeout period before failing. The actual + wait time could be longer, particularly when multiple waits occur. This parameter + is useful for situations where the primary shard assigned to perform the + operation might not be available when the operation runs. Some reasons for + this might be that the primary shard is currently recovering from a gateway + or undergoing relocation. By default, the operation will wait on the primary + shard to become available for at least 1 minute before failing and responding + with an error. The actual wait time could be longer, particularly when multiple + waits occur. + :param version: The explicit version number for concurrency control. It must + be a non-negative long number. + :param version_type: The version type. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. You can set it to `all` or any positive + integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1104,29 +1300,60 @@ async def delete( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a document. Removes a JSON document from the specified index. - - ``_ - - :param index: Name of the target index. - :param id: Unique identifier for the document. + .. raw:: html + +

Delete a document.

+

Remove a JSON document from the specified index.

+

NOTE: You cannot send deletion requests directly to a data stream. + To delete a document in a data stream, you must target the backing index containing the document.

+

Optimistic concurrency control

+

Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. + If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409.

+

Versioning

+

Each document indexed is versioned. + When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. + Every write operation run on a document, deletes included, causes its version to be incremented. + The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. + The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting.

+

Routing

+

If routing is used during indexing, the routing value also needs to be specified to delete a document.

+

If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request.

+

For example:

+
DELETE /my-index-000001/_doc/1?routing=shard-1
+          
+

This request deletes the document with ID 1, but it is routed based on the user. + The document is not deleted if the correct routing is not specified.

+

Distributed

+

The delete operation gets hashed into a specific shard ID. + It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.

+ + + ``_ + + :param index: The name of the target index. + :param id: A unique identifier for the document. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param refresh: If `true`, Elasticsearch refreshes 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` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period to wait for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. - :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. + :param routing: A custom value used to route operations to a specific shard. + :param timeout: The period to wait for active shards. This parameter is useful + for situations where the primary shard assigned to perform the delete operation + might not be available when the delete operation runs. Some reasons for this + might be that the primary shard is currently recovering from a store or undergoing + relocation. By default, the delete operation will wait on the primary shard + to become available for up to 1 minute before failing and responding with + an error. + :param version: An explicit version number for concurrency control. It must match + the current version of the document for the request to succeed. + :param version_type: The version type. + :param wait_for_active_shards: The minimum number of shard copies that must be + active before proceeding with the operation. You can set it to `all` or any + positive integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1226,72 +1453,148 @@ async def delete_by_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete documents. Deletes documents that match the specified query. - - ``_ - - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams or indices, omit this - parameter or use `*` or `_all`. + .. raw:: html + +

Delete documents.

+

Deletes documents that match the specified query.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:

+
    +
  • read
  • +
  • delete or write
  • +
+

You can specify the query criteria in the request URI or the request body using the same syntax as the search API. + When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. + If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails.

+

NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number.

+

While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. + A bulk delete request is performed for each batch of matching documents. + If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. + If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. + Any delete requests that completed successfully still stick, they are not rolled back.

+

You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. + Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query.

+

Throttling delete requests

+

To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. + This pads each batch with a wait time to throttle the rate. + Set requests_per_second to -1 to disable throttling.

+

Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. + The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. + By default the batch size is 1000, so if requests_per_second is set to 500:

+
target_time = 1000 / 500 per second = 2 seconds
+          wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
+          
+

Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Delete by query supports sliced scroll to parallelize the delete process. + This can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

Setting slices to auto lets Elasticsearch choose the number of slices to use. + This setting will use one slice per shard, up to a certain limit. + If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. + Adding slices to the delete by query operation creates sub-requests which means it has some quirks:

+
    +
  • You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices.
  • +
  • Fetching the status of the task for the request with slices only contains the status of completed slices.
  • +
  • These sub-requests are individually addressable for things like cancellation and rethrottling.
  • +
  • Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally.
  • +
  • Canceling the request with slices will cancel each sub-request.
  • +
  • Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.
  • +
  • Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted.
  • +
  • Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time.
  • +
+

If you're slicing manually or otherwise tuning automatic slicing, keep in mind that:

+
    +
  • Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.
  • +
  • Delete performance scales linearly across available resources with the number of slices.
  • +
+

Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources.

+

Cancel a delete by query operation

+

Any delete by query can be canceled using the task cancel API. For example:

+
POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel
+          
+

The task ID can be found by using the get tasks API.

+

Cancellation should happen quickly but might take a few seconds. + The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself.

+ + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams or indices, + omit this parameter or use `*` or `_all`. :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: Analyzer to use for the query string. This parameter can be + used only when the `q` query string parameter is specified. :param conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. :param from_: Starting offset (default: 0) :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. :param max_docs: The maximum number of documents to delete. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. - :param query: Specifies the documents to delete using the Query DSL. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: A query in the Lucene query string syntax. + :param query: The documents to delete specified with Query DSL. :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. + delete by query after the request completes. This is different than the delete + API's `refresh` parameter, which causes just the shard that received the + delete request to be refreshed. Unlike the delete API, it does not support + `wait_for`. :param request_cache: If `true`, the request cache is used for this request. Defaults to the index-level setting. :param requests_per_second: The throttle for this request in sub-requests per second. - :param routing: Custom value used to route operations to a specific shard. - :param scroll: Period to retain the search context for scrolling. - :param scroll_size: Size of the scroll request that powers the operation. - :param search_timeout: Explicit timeout for each search request. Defaults to - no timeout. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param routing: A custom value used to route operations to a specific shard. + :param scroll: The period to retain the search context for scrolling. + :param scroll_size: The size of the scroll request that powers the operation. + :param search_timeout: The explicit timeout for each search request. It defaults + to no timeout. + :param search_type: The type of the search operation. Available options include + `query_then_fetch` and `dfs_query_then_fetch`. :param slice: Slice the request manually using the provided slice ID and total number of slices. :param slices: The number of slices this task should be divided into. - :param sort: A comma-separated list of : pairs. - :param stats: Specific `tag` of the request for logging and statistical purposes. - :param terminate_after: Maximum number of documents to collect for each shard. + :param sort: A comma-separated list of `:` pairs. + :param stats: The specific `tag` of the request for logging and statistical purposes. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. - :param timeout: Period each deletion request waits for active shards. + :param timeout: The period each deletion request waits for active shards. :param version: If `true`, returns the document version as part of a hit. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to all or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. Set to `all` or any positive integer + up to the total number of shards in the index (`number_of_replicas+1`). The + `timeout` value controls how long each write request waits for unavailable + shards to become available. :param wait_for_completion: If `true`, the request blocks until the operation - is complete. + is complete. If `false`, Elasticsearch performs some preflight checks, launches + the request, and returns a task you can use to cancel or get the status of + the task. Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. + When you are done with a task, you should delete the task document so Elasticsearch + can reclaim the space. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1404,13 +1707,18 @@ async def delete_by_query_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Changes the number of requests per second for a particular Delete By Query operation. + .. raw:: html + +

Throttle a delete by query operation.

+

Change the number of requests per second for a particular delete by query operation. + Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.

+ - ``_ + ``_ :param task_id: The ID for the task. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. To disable throttling, set it to `-1`. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -1450,16 +1758,22 @@ async def delete_script( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a script or search template. Deletes a stored script or search template. + .. raw:: html - ``_ +

Delete a script or search template. + Deletes a stored script or search template.

- :param id: Identifier for the stored script or search template. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + + ``_ + + :param id: The identifier for the stored script or search template. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. It can also be set to `-1` to indicate that the request + should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. It can + also be set to `-1` to indicate that the request should never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -1518,32 +1832,60 @@ async def exists( ] = None, ) -> HeadApiResponse: """ - Check a document. Checks if a specified document exists. - - ``_ - - :param index: Comma-separated list of data streams, indices, and aliases. Supports - wildcards (`*`). - :param id: Identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + .. raw:: html + +

Check a document.

+

Verify that a document exists. + For example, check to see if a document with the _id 0 exists:

+
HEAD my-index-000001/_doc/0
+          
+

If the document exists, the API returns a status code of 200 - OK. + If the document doesn’t exist, the API returns 404 - Not Found.

+

Versioning support

+

You can use the version parameter to check the document only if its current version is equal to the specified one.

+

Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. + The old version of the document doesn't disappear immediately, although you won't be able to access it. + Elasticsearch cleans up deleted documents in the background as you continue to index more data.

+ + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases. It + supports wildcards (`*`). + :param id: A unique document identifier. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. If it is + set to `_local`, the operation will prefer to be run on a local allocated + shard when possible. If it is set to a custom value, the value is used to + guarantee that the same shards will be used for the same custom value. This + can help with "jumping values" when hitting different shards in different + refresh states. A sample value can be something like the web session ID or + the user name. :param realtime: If `true`, the request is real-time as opposed to near-real-time. - :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. - :param routing: Target the specified primary shard. - :param source: `true` or `false` to return the `_source` field or not, or a list - of fields to return. - :param source_excludes: A comma-separated list of source fields to exclude in - the response. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the `_source` parameter defaults to false. + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. If no fields are specified, no stored fields are included in the + response. If this field is specified, the `_source` parameter defaults to + `false`. :param version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1619,29 +1961,38 @@ async def exists_source( ] = None, ) -> HeadApiResponse: """ - Check for a document source. Checks if a document's `_source` is stored. + .. raw:: html - ``_ +

Check for a document source.

+

Check whether a document source exists in an index. + For example:

+
HEAD my-index-000001/_source/1
+          
+

A document's source is not available if it is disabled in the mapping.

- :param index: Comma-separated list of data streams, indices, and aliases. Supports - wildcards (`*`). - :param id: Identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param realtime: If true, the request is real-time as opposed to near-real-time. - :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. - :param routing: Target the specified primary shard. - :param source: `true` or `false` to return the `_source` field or not, or a list - of fields to return. + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases. It + supports wildcards (`*`). + :param id: A unique identifier for the document. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. + :param realtime: If `true`, the request is real-time as opposed to near-real-time. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. :param source_excludes: A comma-separated list of source fields to exclude in the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1719,34 +2070,47 @@ async def explain( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain a document match result. Returns information about why a specific document - matches, or doesn’t match, a query. + .. raw:: html + +

Explain a document match result. + Get information about why a specific document matches, or doesn't match, a query. + It computes a score explanation for a query and a specific document.

+ - ``_ + ``_ - :param index: Index names used to limit the request. Only a single index name - can be provided to this parameter. - :param id: Defines the document ID. + :param index: Index names that are used to limit the request. Only a single index + name can be provided to this parameter. + :param id: The document identifier. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the `q` query string parameter is specified. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: The query in the Lucene query string syntax. :param query: Defines the search definition using the Query DSL. - :param routing: Custom value used to route operations to a specific shard. - :param source: True or false to return the `_source` field or not, or a list + :param routing: A custom value used to route operations to a specific shard. + :param source: `True` or `false` to return the `_source` field or not or a list of fields to return. :param source_excludes: A comma-separated list of source fields to exclude from - the response. + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. :param stored_fields: A comma-separated list of stored fields to return in the response. """ @@ -1839,14 +2203,18 @@ async def field_caps( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The field capabilities API returns the information about the capabilities of - fields among multiple indices. The field capabilities API returns runtime fields - like any other field. For example, a runtime field with a type of keyword is - returned as any other field that belongs to the `keyword` family. + .. raw:: html - ``_ +

Get the field capabilities.

+

Get information about the capabilities of fields among multiple indices.

+

For data streams, the API returns field capabilities among the stream’s backing indices. + It returns runtime fields like any other field. + For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family.

- :param index: Comma-separated list of data streams, indices, and aliases used + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. :param allow_no_indices: If false, the request returns an error if any wildcard @@ -1854,25 +2222,32 @@ async def field_caps( This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. - :param fields: List of fields to retrieve capabilities for. Wildcard (`*`) expressions - are supported. - :param filters: An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. Supports comma-separated + values, such as `open,hidden`. + :param fields: A list of fields to retrieve capabilities for. Wildcard (`*`) + expressions are supported. + :param filters: A comma-separated list of filters to apply to the response. :param ignore_unavailable: If `true`, missing or closed indices are not included in the response. :param include_empty_fields: If false, empty fields are not included in the response. :param include_unmapped: If true, unmapped fields are included in the response. - :param index_filter: Allows to filter indices if the provided query rewrites - to match_none on every shard. - :param runtime_mappings: Defines ad-hoc runtime fields in the request similar + :param index_filter: Filter indices if the provided query rewrites to `match_none` + on every shard. IMPORTANT: The filtering is done on a best-effort basis, + it uses index statistics and mappings to rewrite queries to `match_none` + instead of fully running the request. For instance a range query over a date + field can rewrite to `match_none` if all documents within a shard (including + deleted documents) are outside of the provided range. However, not all queries + can rewrite to `match_none` so this API may return an index even if the provided + filter matches no document. + :param runtime_mappings: Define ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. - :param types: Only return results for fields that have one of the types in the - list + :param types: A comma-separated list of field types to include. Any fields that + do not match one of these types will be excluded from the results. It defaults + to empty, meaning that all field types are returned. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -1958,36 +2333,87 @@ async def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a document by its ID. Retrieves the document with the specified ID from an - index. - - ``_ - - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. - :param force_synthetic_source: Should this request force synthetic _source? Use - this to test if the mapping supports synthetic _source and to get a sense - of the worst case performance. Fetches with this enabled will be slower the - enabling synthetic source natively in the index. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + .. raw:: html + +

Get a document by its ID.

+

Get a document and its source or stored fields from an index.

+

By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). + In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. + To turn off realtime behavior, set the realtime parameter to false.

+

Source filtering

+

By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. + You can turn off _source retrieval by using the _source parameter:

+
GET my-index-000001/_doc/0?_source=false
+          
+

If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. + This can be helpful with large documents where partial retrieval can save on network overhead + Both parameters take a comma separated list of fields or wildcard expressions. + For example:

+
GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities
+          
+

If you only want to specify includes, you can use a shorter notation:

+
GET my-index-000001/_doc/0?_source=*.id
+          
+

Routing

+

If routing is used during indexing, the routing value also needs to be specified to retrieve a document. + For example:

+
GET my-index-000001/_doc/2?routing=user1
+          
+

This request gets the document with ID 2, but it is routed based on the user. + The document is not fetched if the correct routing is not specified.

+

Distributed

+

The GET operation is hashed into a specific shard ID. + It is then redirected to one of the replicas within that shard ID and returns the result. + The replicas are the primary shard and its replicas within that shard ID group. + This means that the more replicas you have, the better your GET scaling will be.

+

Versioning support

+

You can use the version parameter to retrieve the document only if its current version is equal to the specified one.

+

Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. + The old version of the document doesn't disappear immediately, although you won't be able to access it. + Elasticsearch cleans up deleted documents in the background as you continue to index more data.

+ + + ``_ + + :param index: The name of the index that contains the document. + :param id: A unique document identifier. + :param force_synthetic_source: Indicates whether the request forces synthetic + `_source`. Use this paramater to test if the mapping supports synthetic `_source` + and to get a sense of the worst case performance. Fetches with this parameter + enabled will be slower than enabling synthetic source natively in the index. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. If it is + set to `_local`, the operation will prefer to be run on a local allocated + shard when possible. If it is set to a custom value, the value is used to + guarantee that the same shards will be used for the same custom value. This + can help with "jumping values" when hitting different shards in different + refresh states. A sample value can be something like the web session ID or + the user name. :param realtime: If `true`, the request is real-time as opposed to near-real-time. - :param refresh: If true, Elasticsearch refreshes the affected shards to make - this operation visible to search. If false, do nothing with refreshes. - :param routing: Target the specified primary shard. - :param source: True or false to return the _source field or not, or a list of - fields to return. - :param source_excludes: A comma-separated list of source fields to exclude in - the response. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the `_source` parameter defaults to false. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: internal, external, external_gte. + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. If no fields are specified, no stored fields are included in the + response. If this field is specified, the `_source` parameter defaults to + `false`. Only leaf fields can be retrieved with the `stored_field` option. + Object fields can't be returned;​if specified, the request fails. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2048,12 +2474,19 @@ async def get_script( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a script or search template. Retrieves a stored script or search template. + .. raw:: html + +

Get a script or search template. + Retrieves a stored script or search template.

- ``_ - :param id: Identifier for the stored script or search template. - :param master_timeout: Specify timeout for connection to master + ``_ + + :param id: The identifier for the stored script or search template. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. It can also be set to `-1` to indicate that the request should + never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -2090,9 +2523,13 @@ async def get_script_context( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns all script contexts. + .. raw:: html + +

Get script contexts.

+

Get a list of supported script contexts and their methods.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_context" @@ -2125,9 +2562,13 @@ async def get_script_languages( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns available script types, languages and contexts + .. raw:: html + +

Get script languages.

+

Get a list of available script types, languages, and contexts.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_language" @@ -2180,29 +2621,41 @@ async def get_source( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a document's source. Returns the source of a document. + .. raw:: html - ``_ +

Get a document's source.

+

Get the source of a document. + For example:

+
GET my-index-000001/_source/1
+          
+

You can use the source filtering parameters to control which parts of the _source are returned:

+
GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities
+          
- :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param realtime: Boolean) If true, the request is real-time as opposed to near-real-time. - :param refresh: If true, Elasticsearch refreshes the affected shards to make - this operation visible to search. If false, do nothing with refreshes. - :param routing: Target the specified primary shard. - :param source: True or false to return the _source field or not, or a list of - fields to return. + + ``_ + + :param index: The name of the index that contains the document. + :param id: A unique document identifier. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. + :param realtime: If `true`, the request is real-time as opposed to near-real-time. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. :param source_excludes: A comma-separated list of source fields to exclude in the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param stored_fields: - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: internal, external, external_gte. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2263,9 +2716,24 @@ async def health_report( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the health of the cluster. + .. raw:: html + +

Get the cluster health. + Get a report with the health status of an Elasticsearch cluster. + The report contains a list of indicators that compose Elasticsearch functionality.

+

Each indicator has a health status of: green, unknown, yellow or red. + The indicator will provide an explanation and metadata describing the reason for its current health status.

+

The cluster’s status is controlled by the worst indicator status.

+

In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. + Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system.

+

Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. + The root cause and remediation steps are encapsulated in a diagnosis. + A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem.

+

NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. + When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic.

- ``_ + + ``_ :param feature: A feature of the cluster, as returned by the top-level health report API. @@ -2338,44 +2806,148 @@ async def index( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Index a document. Adds a JSON document to the specified data stream or index - and makes it searchable. If the target is an index and the document already exists, - the request updates the document and increments its version. - - ``_ - - :param index: Name of the data stream or index to target. + .. raw:: html + +

Create or update a document in an index.

+

Add a JSON document to the specified data stream or index and make it searchable. + If the target is an index and the document already exists, the request updates the document and increments its version.

+

NOTE: You cannot use this API to send update requests for existing documents in a data stream.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:

+
    +
  • To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege.
  • +
  • To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege.
  • +
  • To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

NOTE: Replica shards might not all be started when an indexing operation returns successfully. + By default, only the primary is required. Set wait_for_active_shards to change this default behavior.

+

Automatically create data streams and indices

+

If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream.

+

If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.

+

NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.

+

If no mapping exists, the index operation creates a dynamic mapping. + By default, new fields and objects are automatically added to the mapping if needed.

+

Automatic index creation is controlled by the action.auto_create_index setting. + If it is true, any index can be created automatically. + You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. + Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. + When a list is specified, the default behaviour is to disallow.

+

NOTE: The action.auto_create_index setting affects the automatic creation of indices only. + It does not affect the creation of data streams.

+

Optimistic concurrency control

+

Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. + If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409.

+

Routing

+

By default, shard placement — or routing — is controlled by using a hash of the document's ID value. + For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter.

+

When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. + This does come at the (very minimal) cost of an additional document parsing pass. + If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+
    +
  • ** Distributed**
  • +
+

The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. + After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.

+

Active shards

+

To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. + If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. + By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). + This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. + To alter this behavior per operation, use the wait_for_active_shards request parameter.

+

Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). + Specifying a negative value or a number greater than the number of shard copies will throw an error.

+

For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). + If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. + This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. + If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. + This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. + However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. + The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.

+

It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. + After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. + The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed.

+

No operation (noop) updates

+

When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. + If this isn't acceptable use the _update API with detect_noop set to true. + The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source.

+

There isn't a definitive rule for when noop updates aren't acceptable. + It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates.

+

Versioning

+

Each indexed document is given a version number. + By default, internal versioning is used that starts at 1 and increments with each update, deletes included. + Optionally, the version number can be set to an external value (for example, if maintained in a database). + To enable this functionality, version_type should be set to external. + The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18.

+

NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. + If no version is provided, the operation runs without any version checks.

+

When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. + If true, the document will be indexed and the new version number used. + If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example:

+
PUT my-index-000001/_doc/1?version=2&version_type=external
+          {
+            "user": {
+              "id": "elkbee"
+            }
+          }
+
+          In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
+          If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).
+
+          A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
+          Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.
+          
+ + + ``_ + + :param index: The name of the data stream or index to target. If the target doesn't + exist and matches the name or wildcard (`*`) pattern of an index template + with a `data_stream` definition, this request creates the data stream. If + the target doesn't exist and doesn't match a data stream template, this request + creates the index. You can check for existing targets with the resolve index + API. :param document: - :param id: Unique identifier for the document. + :param id: A unique identifier for the document. To automatically generate a + document ID, use the `POST //_doc/` request format and omit this + parameter. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. - :param op_type: Set to create to only index the document if it does not already + :param op_type: Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, - the indexing operation will fail. Same as using the `/_create` endpoint. - Valid values: `index`, `create`. If document id is specified, it defaults - to `index`. Otherwise, it defaults to `create`. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. + the indexing operation will fail. The behavior is the same as using the `/_create` + endpoint. If a document ID is specified, this paramater defaults to `index`. + Otherwise, it defaults to `create`. If the request targets a data stream, + an `op_type` of `create` is required. + :param pipeline: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. :param refresh: If `true`, Elasticsearch refreshes 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` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. :param require_alias: If `true`, the destination must be an index alias. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period the request waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param routing: A custom value that is used to route operations to a specific + shard. + :param timeout: The period the request waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. This + parameter is useful for situations where the primary shard assigned to perform + the operation might not be available when the operation runs. Some reasons + for this might be that the primary shard is currently recovering from a gateway + or undergoing relocation. By default, the operation will wait on the primary + shard to become available for at least 1 minute before failing and responding + with an error. The actual wait time could be longer, particularly when multiple + waits occur. + :param version: An explicit version number for concurrency control. It must be + a non-negative long number. + :param version_type: The version type. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to all or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. You can set it to `all` or any positive + integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2449,9 +3021,13 @@ async def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster info. Returns basic information about the cluster. + .. raw:: html - ``_ +

Get cluster info. + Get basic build, version, and cluster information.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/" @@ -2485,6 +3061,7 @@ async def info( ), parameter_aliases={"_source": "source"}, ) + @_stability_warning(Stability.EXPERIMENTAL) async def knn_search( self, *, @@ -2505,30 +3082,48 @@ async def knn_search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Performs a kNN search. - - ``_ + .. raw:: html + +

Run a knn search.

+

NOTE: The kNN search API has been replaced by the knn option in the search API.

+

Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. + Given a query vector, the API finds the k closest vectors and returns those documents as search hits.

+

Elasticsearch uses the HNSW algorithm to support efficient kNN search. + Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. + This means the results returned are not always the true k closest neighbors.

+

The kNN search API supports restricting the search using a filter. + The search will return the top k documents that also match the filter query.

+

A kNN search response has the exact same structure as a search API response. + However, certain sections have a meaning specific to kNN search:

+
    +
  • The document _score is determined by the similarity between the query and document vector.
  • +
  • The hits.total object contains the total number of nearest neighbor candidates considered, which is num_candidates * num_shards. The hits.total.relation will always be eq, indicating an exact value.
  • +
+ + + ``_ :param index: A comma-separated list of index names to search; use `_all` or - to perform the operation on all indices - :param knn: kNN query to execute + to perform the operation on all indices. + :param knn: The kNN query to run. :param docvalue_fields: The request returns doc values for field names matching - these patterns in the hits.fields property of the response. Accepts wildcard - (*) patterns. + these patterns in the `hits.fields` property of the response. It accepts + wildcard (`*`) patterns. :param fields: The request returns values for field names matching these patterns - in the hits.fields property of the response. Accepts wildcard (*) patterns. - :param filter: Query to filter the documents that can match. The kNN search will - return the top `k` documents that also match this filter. The value can be - a single query or a list of queries. If `filter` isn't provided, all documents - are allowed to match. - :param routing: A comma-separated list of specific routing values + in the `hits.fields` property of the response. It accepts wildcard (`*`) + patterns. + :param filter: A query to filter the documents that can match. The kNN search + will return the top `k` documents that also match this filter. The value + can be a single query or a list of queries. If `filter` isn't provided, all + documents are allowed to match. + :param routing: A comma-separated list of specific routing values. :param source: Indicates which source fields are returned for matching documents. - These fields are returned in the hits._source property of the search response. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the _source parameter defaults to false. You can pass - _source: true to return both source fields and stored fields in the search - response. + These fields are returned in the `hits._source` property of the search response. + :param stored_fields: A list of stored fields to return as part of a hit. If + no fields are specified, no stored fields are included in the response. If + this field is specified, the `_source` parameter defaults to `false`. You + can pass `_source: true` to return both source fields and stored fields in + the search response. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2606,9 +3201,23 @@ async def mget( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows to get multiple documents in one request. + .. raw:: html + +

Get multiple documents.

+

Get multiple JSON documents by ID from one or more indices. + If you specify an index in the request URI, you only need to specify the document IDs in the request body. + To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.

+

Filter source fields

+

By default, the _source field is returned for every document (if stored). + Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. + You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions.

+

Get stored fields

+

Use the stored_fields attribute to specify the set of stored fields you want to retrieve. + Any requested fields that are not stored are ignored. + You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions.

- ``_ + + ``_ :param index: Name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index. @@ -2727,9 +3336,23 @@ async def msearch( typed_keys: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows to execute several search operations in one request. + .. raw:: html + +

Run multiple searches.

+

The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. + The structure is as follows:

+
header\\n
+          body\\n
+          header\\n
+          body\\n
+          
+

This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.

+

IMPORTANT: The final line of data must end with a newline character \\n. + Each newline character may be preceded by a carriage return \\r. + When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson.

+ - ``_ + ``_ :param searches: :param index: Comma-separated list of data streams, indices, and index aliases @@ -2859,22 +3482,35 @@ async def msearch_template( typed_keys: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Runs multiple templated searches with a single request. + .. raw:: html + +

Run multiple templated searches.

+

Run multiple templated searches with a single request. + If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. + For example:

+
$ cat requests
+          { "index": "my-index" }
+          { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }}
+          { "index": "my-other-index" }
+          { "id": "my-other-search-template", "params": { "query_type": "match_all" }}
+
+          $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo
+          
- ``_ + + ``_ :param search_templates: - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams and indices, omit this - parameter or use `*`. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*`. :param ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. - :param max_concurrent_searches: Maximum number of concurrent searches the API - can run. + :param max_concurrent_searches: The maximum number of concurrent searches the + API can run. :param rest_total_hits_as_int: If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param search_type: The type of the search operation. :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ @@ -2954,30 +3590,41 @@ async def mtermvectors( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns multiple termvectors in one request. + .. raw:: html + +

Get multiple term vectors.

+

Get multiple term vectors with a single request. + You can specify existing documents by index and ID or provide artificial documents in the body of the request. + You can specify the index in the request body or request URI. + The response contains a docs array with all the fetched termvectors. + Each element has the structure provided by the termvectors API.

+

Artificial documents

+

You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. + The mapping used is determined by the specified _index.

- ``_ - :param index: Name of the index that contains the documents. - :param docs: Array of existing or artificial documents. + ``_ + + :param index: The name of the index that contains the documents. + :param docs: An array of existing or artificial documents. :param field_statistics: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. - :param fields: Comma-separated list or wildcard expressions of fields to include - in the statistics. Used as the default list unless a specific field list - is provided in the `completion_fields` or `fielddata_fields` parameters. - :param ids: Simplified syntax to specify documents by their ID if they're in + :param fields: A comma-separated list or wildcard expressions of fields to include + in the statistics. It is used as the default list unless a specific field + list is provided in the `completion_fields` or `fielddata_fields` parameters. + :param ids: A simplified syntax to specify documents by their ID if they're in the same index. :param offsets: If `true`, the response includes term offsets. :param payloads: If `true`, the response includes term payloads. :param positions: If `true`, the response includes term positions. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param realtime: If true, the request is real-time as opposed to near-real-time. - :param routing: Custom value used to route operations to a specific shard. + :param routing: A custom value used to route operations to a specific shard. :param term_statistics: If true, the response includes term frequency and document frequency. :param version: If `true`, returns the document version as part of a hit. - :param version_type: Specific version type. + :param version_type: The version type. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -3046,6 +3693,7 @@ async def open_point_in_time( *, index: t.Union[str, t.Sequence[str]], keep_alive: t.Union[str, t.Literal[-1], t.Literal[0]], + allow_partial_search_results: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ t.Union[ @@ -3065,30 +3713,59 @@ async def open_point_in_time( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - A search request by default executes against the most recent visible data of - the target indices, which is called point in time. Elasticsearch pit (point in - time) is a lightweight view into the state of the data as it existed when initiated. - In some cases, it’s preferred to perform multiple search requests using the same - point in time. For example, if refreshes happen between `search_after` requests, - then the results of those requests might not be consistent as changes happening - between searches are only visible to the more recent point in time. - - ``_ + .. raw:: html + +

Open a point in time.

+

A search request by default runs against the most recent visible data of the target indices, + which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the + state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple + search requests using the same point in time. For example, if refreshes happen between + search_after requests, then the results of those requests might not be consistent as changes happening + between searches are only visible to the more recent point in time.

+

A point in time must be opened explicitly before being used in search requests.

+

A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time.

+

Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. + If you want to retrieve more hits, use PIT with search_after.

+

IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request.

+

When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. + To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime.

+

Keeping point in time alive

+

The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. + The value does not need to be long enough to process all data — it just needs to be long enough for the next request.

+

Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. + Once the smaller segments are no longer needed they are deleted. + However, open point-in-times prevent the old segments from being deleted since they are still in use.

+

TIP: Keeping older segments alive means that more disk space and file handles are needed. + Ensure that you have configured your nodes to have ample free file handles.

+

Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. + Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. + Note that a point-in-time doesn't prevent its associated indices from being deleted. + You can check how many point-in-times (that is, search contexts) are open with the nodes stats API.

+ + + ``_ :param index: A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices - :param keep_alive: Extends the time to live of the corresponding point in time. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param keep_alive: Extend the length of time that the point in time persists. + :param allow_partial_search_results: Indicates whether the point in time tolerates + unavailable shards or shard failures when initially creating the PIT. If + `false`, creating a point in time request when a shard is missing or unavailable + will throw an exception. If `true`, the point in time will contain all the + shards that are available at the time of the request. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. - :param index_filter: Allows to filter indices if the provided query rewrites - to `match_none` on every shard. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param routing: Custom value used to route operations to a specific shard. + :param index_filter: Filter indices if the provided query rewrites to `match_none` + on every shard. + :param preference: The node or shard the operation should be performed on. By + default, it is random. + :param routing: A custom value that is used to route operations to a specific + shard. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3100,6 +3777,8 @@ async def open_point_in_time( __body: t.Dict[str, t.Any] = body if body is not None else {} if keep_alive is not None: __query["keep_alive"] = keep_alive + if allow_partial_search_results is not None: + __query["allow_partial_search_results"] = allow_partial_search_results if error_trace is not None: __query["error_trace"] = error_trace if expand_wildcards is not None: @@ -3152,23 +3831,27 @@ async def put_script( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a script or search template. Creates or updates a stored script - or search template. - - ``_ - - :param id: Identifier for the stored script or search template. Must be unique - within the cluster. - :param script: Contains the script or search template, its parameters, and its - language. - :param context: Context in which the script or search template should run. To - prevent errors, the API immediately compiles the script or template in this - context. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + .. raw:: html + +

Create or update a script or search template. + Creates or updates a stored script or search template.

+ + + ``_ + + :param id: The identifier for the stored script or search template. It must be + unique within the cluster. + :param script: The script or search template, its parameters, and its language. + :param context: The context in which the script or search template should run. + To prevent errors, the API immediately compiles the script or template in + this context. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. It can also be set to `-1` to indicate that the request + should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. It can + also be set to `-1` to indicate that the request should never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -3238,14 +3921,17 @@ async def rank_eval( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables you to evaluate the quality of ranked search results over a set of typical - search queries. + .. raw:: html + +

Evaluate ranked search results.

+

Evaluate the quality of ranked search results over a set of typical search queries.

+ - ``_ + ``_ :param requests: A set of typical search requests, together with their provided ratings. - :param index: Comma-separated list of data streams, indices, and index aliases + :param index: A comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`. @@ -3333,33 +4019,187 @@ async def reindex( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reindex documents. Copies documents from a source to a destination. The source - can be any existing index, alias, or data stream. The destination must differ - from the source. For example, you cannot reindex a data stream into itself. - - ``_ + .. raw:: html + +

Reindex documents.

+

Copy documents from a source to a destination. + You can copy all documents to the destination index or reindex a subset of the documents. + The source can be any existing index, alias, or data stream. + The destination must differ from the source. + For example, you cannot reindex a data stream into itself.

+

IMPORTANT: Reindex requires _source to be enabled for all documents in the source. + The destination should be configured as wanted before calling the reindex API. + Reindex does not copy the settings from the source or its associated template. + Mappings, shard counts, and replicas, for example, must be configured ahead of time.

+

If the Elasticsearch security features are enabled, you must have the following security privileges:

+
    +
  • The read index privilege for the source data stream, index, or alias.
  • +
  • The write index privilege for the destination data stream, index, or index alias.
  • +
  • To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias.
  • +
  • If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias.
  • +
+

If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. + Automatic data stream creation requires a matching index template with data stream enabled.

+

The dest element can be configured like the index API to control optimistic concurrency control. + Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID.

+

Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source.

+

Setting op_type to create causes the reindex API to create only missing documents in the destination. + All existing documents will cause a version conflict.

+

IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. + A reindex can only add new documents to a destination data stream. + It cannot update existing documents in a destination data stream.

+

By default, version conflicts abort the reindex process. + To continue reindexing if there are conflicts, set the conflicts request body property to proceed. + In this case, the response includes a count of the version conflicts that were encountered. + Note that the handling of other error types is unaffected by the conflicts property. + Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query.

+

NOTE: The reindex API makes no effort to handle ID collisions. + The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. + Instead, make sure that IDs are unique by using a script.

+

Running reindex asynchronously

+

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. + Elasticsearch creates a record of this task as a document at _tasks/<task_id>.

+

Reindex from multiple sources

+

If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. + That way you can resume the process if there are any errors by removing the partially completed source and starting over. + It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel.

+

For example, you can use a bash script like this:

+
for index in i1 i2 i3 i4 i5; do
+            curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{
+              "source": {
+                "index": "'$index'"
+              },
+              "dest": {
+                "index": "'$index'-reindexed"
+              }
+            }'
+          done
+          
+

** Throttling**

+

Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. + Requests are throttled by padding each batch with a wait time. + To turn off throttling, set requests_per_second to -1.

+

The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. + The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. + By default the batch size is 1000, so if requests_per_second is set to 500:

+
target_time = 1000 / 500 per second = 2 seconds
+          wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
+          
+

Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Reindex supports sliced scroll to parallelize the reindexing process. + This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

NOTE: Reindexing from remote clusters does not support manual or automatic slicing.

+

You can slice a reindex request manually by providing a slice ID and total number of slices to each request. + You can also let reindex automatically parallelize by using sliced scroll to slice on _id. + The slices parameter specifies the number of slices to use.

+

Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks:

+
    +
  • You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices.
  • +
  • Fetching the status of the task for the request with slices only contains the status of completed slices.
  • +
  • These sub-requests are individually addressable for things like cancellation and rethrottling.
  • +
  • Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally.
  • +
  • Canceling the request with slices will cancel each sub-request.
  • +
  • Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.
  • +
  • Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed.
  • +
  • Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time.
  • +
+

If slicing automatically, setting slices to auto will choose a reasonable number for most indices. + If slicing manually or otherwise tuning automatic slicing, use the following guidelines.

+

Query performance is most efficient when the number of slices is equal to the number of shards in the index. + If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. + Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.

+

Indexing performance scales linearly across available resources with the number of slices.

+

Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources.

+

Modify documents during reindexing

+

Like _update_by_query, reindex operations support a script that modifies the document. + Unlike _update_by_query, the script is allowed to modify the document's metadata.

+

Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. + For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. + Set ctx.op to delete if your script decides that the document must be deleted from the destination. + The deletion will be reported in the deleted counter in the response body. + Setting ctx.op to anything else will return an error, as will setting any other field in ctx.

+

Think of the possibilities! Just be careful; you are able to change:

+
    +
  • _id
  • +
  • _index
  • +
  • _version
  • +
  • _routing
  • +
+

Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. + It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API.

+

Reindex from remote

+

Reindex supports reindexing from a remote Elasticsearch cluster. + The host parameter must contain a scheme, host, port, and optional path. + The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. + Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. + There are a range of settings available to configure the behavior of the HTTPS connection.

+

When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. + Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. + It can be set to a comma delimited list of allowed remote host and port combinations. + Scheme is ignored; only the host and port are used. + For example:

+
reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"]
+          
+

The list of allowed hosts must be configured on any nodes that will coordinate the reindex. + This feature should work with remote clusters of any version of Elasticsearch. + This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version.

+

WARNING: Elasticsearch does not support forward compatibility across major versions. + For example, you cannot reindex from a 7.x cluster into a 6.x cluster.

+

To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification.

+

NOTE: Reindexing from remote clusters does not support manual or automatic slicing.

+

Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. + If the remote index includes very large documents you'll need to use a smaller batch size. + It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. + Both default to 30 seconds.

+

Configuring SSL parameters

+

Reindex from remote supports configurable SSL settings. + These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. + It is not possible to configure SSL in the body of the reindex request.

+ + + ``_ :param dest: The destination you are copying to. :param source: The source you are copying from. - :param conflicts: Set to proceed to continue reindexing even if there are conflicts. - :param max_docs: The maximum number of documents to reindex. + :param conflicts: Indicates whether to continue reindexing even when there are + conflicts. + :param max_docs: The maximum number of documents to reindex. By default, all + documents are reindexed. If it is a value less then or equal to `scroll_size`, + a scroll will not be used to retrieve the results for the operation. If `conflicts` + is set to `proceed`, the reindex operation could attempt to reindex more + documents from the source than `max_docs` until it has successfully indexed + `max_docs` documents into the target or it has gone through every document + in the source query. :param refresh: If `true`, the request refreshes affected shards to make this operation visible to search. :param requests_per_second: The throttle for this request in sub-requests per - second. Defaults to no throttle. + second. By default, there is no throttle. :param require_alias: If `true`, the destination must be an index alias. :param script: The script to run to update the document source or metadata when reindexing. - :param scroll: Specifies how long a consistent view of the index should be maintained - for scrolled search. + :param scroll: The period of time that a consistent view of the index should + be maintained for scrolled search. :param size: - :param slices: The number of slices this task should be divided into. Defaults - to 1 slice, meaning the task isn’t sliced into subtasks. - :param timeout: Period each indexing waits for automatic index creation, dynamic - mapping updates, and waiting for active shards. + :param slices: The number of slices this task should be divided into. It defaults + to one slice, which means the task isn't sliced into subtasks. Reindex supports + sliced scroll to parallelize the reindexing process. This parallelization + can improve efficiency and provide a convenient way to break the request + down into smaller parts. NOTE: Reindexing from remote clusters does not support + manual or automatic slicing. If set to `auto`, Elasticsearch chooses the + number of slices to use. This setting will use one slice per shard, up to + a certain limit. If there are multiple sources, it will choose the number + of slices based on the index or backing index with the smallest number of + shards. + :param timeout: The period each indexing waits for automatic index creation, + dynamic mapping updates, and waiting for active shards. By default, Elasticsearch + waits for at least one minute before failing. The actual wait time could + be longer, particularly when multiple waits occur. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. Set it to `all` or any positive integer + up to the total number of shards in the index (`number_of_replicas+1`). The + default value is one, which means it waits for each primary shard to be active. :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ @@ -3431,13 +4271,24 @@ async def reindex_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Copies documents from a source to a destination. + .. raw:: html + +

Throttle a reindex operation.

+

Change the number of requests per second for a particular reindex operation. + For example:

+
POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
+          
+

Rethrottling that speeds up the query takes effect immediately. + Rethrottling that slows down the query will take effect after completing the current batch. + This behavior prevents scroll timeouts.

+ - ``_ + ``_ - :param task_id: Identifier for the task. + :param task_id: The task identifier, which can be found by using the tasks API. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. It can be either `-1` to turn off throttling or any decimal number + like `1.7` or `12` to throttle to that level. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -3482,17 +4333,21 @@ async def render_search_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Renders a search template as a search request body. + .. raw:: html + +

Render a search template.

+

Render a search template as a search request body.

+ - ``_ + ``_ - :param id: ID of the search template to render. If no `source` is specified, + :param id: The ID of the search template to render. If no `source` is specified, this or the `id` request body parameter is required. :param file: :param params: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. - :param source: An inline search template. Supports the same parameters as the - search API's request body. These parameters also support Mustache variables. + :param source: An inline search template. It supports the same parameters as + the search API's request body. These parameters also support Mustache variables. If no `id` or `` is specified, this parameter is required. """ __path_parts: t.Dict[str, str] @@ -3537,6 +4392,7 @@ async def render_search_template( @_rewrite_parameters( body_fields=("context", "context_setup", "script"), ) + @_stability_warning(Stability.EXPERIMENTAL) async def scripts_painless_execute( self, *, @@ -3550,9 +4406,13 @@ async def scripts_painless_execute( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a script. Runs a script and returns a result. + .. raw:: html + +

Run a script. + Runs a script and returns a result.

- ``_ + + ``_ :param context: The context that the script should run in. :param context_setup: Additional parameters for the `context`. @@ -3608,15 +4468,27 @@ async def scroll( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows to retrieve a large numbers of results from a single search request. + .. raw:: html + +

Run a scrolling search.

+

IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the search_after parameter with a point in time (PIT).

+

The scroll API gets large sets of results from a single scrolling search request. + To get the necessary scroll ID, submit a search API request that includes an argument for the scroll query parameter. + The scroll parameter indicates how long Elasticsearch should retain the search context for the request. + The search response returns a scroll ID in the _scroll_id response body parameter. + You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. + If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.

+

You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.

+

IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.

+ - ``_ + ``_ - :param scroll_id: Scroll ID of the search. + :param scroll_id: The scroll ID of the search. :param rest_total_hits_as_int: If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. - :param scroll: Period to retain the search context for scrolling. + :param scroll: The period to retain the search context for scrolling. """ if scroll_id is None and body is None: raise ValueError("Empty value passed for parameter 'scroll_id'") @@ -3798,15 +4670,29 @@ async def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns search hits that match the query defined in the request. You can provide - search queries using the `q` query string parameter or the request body. If both - are specified, only the query parameter is used. - - ``_ - - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams and indices, omit this - parameter or use `*` or `_all`. + .. raw:: html + +

Run a search.

+

Get search hits that match the query defined in the request. + You can provide search queries using the q query string parameter or the request body. + If both are specified, only the query parameter is used.

+

If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. + To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices.

+

Search slicing

+

When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. + By default the splitting is done first on the shards, then locally on each shard. + The local splitting partitions the shard into contiguous ranges based on Lucene document IDs.

+

For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.

+

IMPORTANT: The same point-in-time ID should be used for all slices. + If different PIT IDs are used, slices can overlap and miss documents. + This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.

+ + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*` or `_all`. :param aggregations: Defines the aggregations that are run as part of the search request. :param aggs: Defines the aggregations that are run as part of the search request. @@ -3815,45 +4701,46 @@ async def search( This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. - :param allow_partial_search_results: If true, returns partial results if there - are shard request timeouts or shard failures. If false, returns an error - with no partial results. - :param analyze_wildcard: If true, wildcard and prefix queries are analyzed. This - parameter can only be used when the q query string parameter is specified. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the q query string parameter is specified. + :param allow_partial_search_results: If `true` and there are shard request timeouts + or shard failures, the request returns partial results. If `false`, it returns + an error with no partial results. To override the default behavior, you can + set the `search.default_allow_partial_results` cluster setting to `false`. + :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. :param batched_reduce_size: The number of shard results that should be reduced - at once on the coordinating node. This value should be used as a protection - mechanism to reduce the memory overhead per search request if the potential - number of shards in the request can be large. - :param ccs_minimize_roundtrips: If true, network round-trips between the coordinating - node and the remote clusters are minimized when executing cross-cluster search + at once on the coordinating node. If the potential number of shards in the + request can be large, this value should be used as a protection mechanism + to reduce the memory overhead per search request. + :param ccs_minimize_roundtrips: If `true`, network round-trips between the coordinating + node and the remote clusters are minimized when running cross-cluster search (CCS) requests. :param collapse: Collapses search results the values of the specified field. - :param default_operator: The default operator for query string query: AND or - OR. This parameter can only be used when the `q` query string parameter is - specified. - :param df: Field to use as default where no field prefix is given in the query - string. This parameter can only be used when the q query string parameter + :param default_operator: The default operator for the query string query: `AND` + or `OR`. This parameter can be used only when the `q` query string parameter is specified. - :param docvalue_fields: Array of wildcard (`*`) patterns. The request returns - doc values for field names matching these patterns in the `hits.fields` property - of the response. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. - :param explain: If true, returns detailed information about score computation - as part of a hit. + :param df: The field to use as a default when no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param docvalue_fields: An array of wildcard (`*`) field patterns. The request + returns doc values for field names matching these patterns in the `hits.fields` + property of the response. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values such as `open,hidden`. + :param explain: If `true`, the request returns detailed information about score + computation as part of a hit. :param ext: Configuration of search extensions defined by Elasticsearch plugins. - :param fields: Array of wildcard (`*`) patterns. The request returns values for - field names matching these patterns in the `hits.fields` property of the - response. + :param fields: An array of wildcard (`*`) field patterns. The request returns + values for field names matching these patterns in the `hits.fields` property + of the response. :param force_synthetic_source: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. - :param from_: Starting document offset. Needs to be non-negative. By default, + :param from_: The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. :param highlight: Specifies the highlighter to use for retrieving highlighted @@ -3862,95 +4749,101 @@ async def search( be ignored when frozen. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. - :param include_named_queries_score: Indicates whether hit.matched_queries should - be rendered as a map that includes the name of the matched query associated - with its score (true) or as an array containing the name of the matched queries - (false) This functionality reruns each named query on every hit in a search - response. Typically, this adds a small overhead to a request. However, using - computationally expensive named queries on a large number of hits may add - significant overhead. - :param indices_boost: Boosts the _score of documents from specified indices. - :param knn: Defines the approximate kNN search to run. + :param include_named_queries_score: If `true`, the response includes the score + contribution from any named queries. This functionality reruns each named + query on every hit in a search response. Typically, this adds a small overhead + to a request. However, using computationally expensive named queries on a + large number of hits may add significant overhead. + :param indices_boost: Boost the `_score` of documents from specified indices. + The boost value is the factor by which scores are multiplied. A boost value + greater than `1.0` increases the score. A boost value between `0` and `1.0` + decreases the score. + :param knn: The approximate kNN search to run. :param lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can - only be used when the `q` query string parameter is specified. - :param max_concurrent_shard_requests: Defines the number of concurrent shard - requests per node this search executes concurrently. This value should be - used to limit the impact of the search on the cluster in order to limit the - number of concurrent shard requests. + be used only when the `q` query string parameter is specified. + :param max_concurrent_shard_requests: The number of concurrent shard requests + per node that the search runs concurrently. This value should be used to + limit the impact of the search on the cluster in order to limit the number + of concurrent shard requests. :param min_compatible_shard_node: The minimum version of the node that can handle - the request Any handling node with a lower version will fail the request. - :param min_score: Minimum `_score` for matching documents. Documents with a lower - `_score` are not included in the search results. - :param pit: Limits the search to a point in time (PIT). If you provide a PIT, + the request. Any handling node with a lower version will fail the request. + :param min_score: The minimum `_score` for matching documents. Documents with + a lower `_score` are not included in the search results. + :param pit: Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. :param post_filter: Use the `post_filter` parameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. - :param pre_filter_shard_size: Defines a threshold that enforces a pre-filter - roundtrip to prefilter search shards based on query rewriting if the number - of shards the search request expands to exceeds the threshold. This filter - roundtrip can limit the number of shards significantly if for instance a - shard can not match any documents based on its rewrite method (if date filters - are mandatory to match but the shard bounds and the query are disjoint). - When unspecified, the pre-filter phase is executed if any of these conditions - is met: the request targets more than 128 shards; the request targets one - or more read-only index; the primary sort of the query targets an indexed + :param pre_filter_shard_size: A threshold that enforces a pre-filter roundtrip + to prefilter search shards based on query rewriting if the number of shards + the search request expands to exceeds the threshold. This filter roundtrip + can limit the number of shards significantly if for instance a shard can + not match any documents based on its rewrite method (if date filters are + mandatory to match but the shard bounds and the query are disjoint). When + unspecified, the pre-filter phase is executed if any of these conditions + is met: * The request targets more than 128 shards. * The request targets + one or more read-only index. * The primary sort of the query targets an indexed field. - :param preference: Nodes and shards used for the search. By default, Elasticsearch + :param preference: The nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, - accounting for allocation awareness. Valid values are: `_only_local` to run - the search only on shards on the local node; `_local` to, if possible, run - the search on shards on the local node, or if not, select shards using the - default method; `_only_nodes:,` to run the search on only - the specified nodes IDs, where, if suitable shards exist on more than one - selected node, use shards on those nodes using the default method, or if - none of the specified nodes are available, select shards from any available - node using the default method; `_prefer_nodes:,` to if + accounting for allocation awareness. Valid values are: * `_only_local` to + run the search only on shards on the local node; * `_local` to, if possible, + run the search on shards on the local node, or if not, select shards using + the default method; * `_only_nodes:,` to run the search + on only the specified nodes IDs, where, if suitable shards exist on more + than one selected node, use shards on those nodes using the default method, + or if none of the specified nodes are available, select shards from any available + node using the default method; * `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs, or if not, select shards - using the default method; `_shards:,` to run the search only - on the specified shards; `` (any string that does not start + using the default method; * `_shards:,` to run the search only + on the specified shards; * `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. :param profile: Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. - :param q: Query in the Lucene query string syntax using query parameter search. - Query parameter searches do not support the full Elasticsearch Query DSL - but are handy for testing. - :param query: Defines the search definition using the Query DSL. - :param rank: Defines the Reciprocal Rank Fusion (RRF) to use. + :param q: A query in the Lucene query string syntax. Query parameter searches + do not support the full Elasticsearch Query DSL but are handy for testing. + IMPORTANT: This parameter overrides the query parameter in the request body. + If both parameters are specified, documents matching the query request body + parameter are not returned. + :param query: The search definition using the Query DSL. + :param rank: The Reciprocal Rank Fusion (RRF) to use. :param request_cache: If `true`, the caching of search results is enabled for - requests where `size` is `0`. Defaults to index level settings. + requests where `size` is `0`. It defaults to index level settings. :param rescore: Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases. :param rest_total_hits_as_int: Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. :param retriever: A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that - also return top documents such as query and knn. - :param routing: Custom value used to route operations to a specific shard. - :param runtime_mappings: Defines one or more runtime fields in the search request. - These fields take precedence over mapped fields with the same name. + also return top documents such as `query` and `knn`. + :param routing: A custom value that is used to route operations to a specific + shard. + :param runtime_mappings: One or more runtime fields in the search request. These + fields take precedence over mapped fields with the same name. :param script_fields: Retrieve a script evaluation (based on different fields) for each hit. - :param scroll: Period to retain the search context for scrolling. See Scroll - search results. By default, this value cannot exceed `1d` (24 hours). You - can change this limit using the `search.max_keep_alive` cluster-level setting. + :param scroll: The period to retain the search context for scrolling. By default, + this value cannot exceed `1d` (24 hours). You can change this limit by using + the `search.max_keep_alive` cluster-level setting. :param search_after: Used to retrieve the next page of hits using a set of sort values from the previous page. - :param search_type: How distributed term frequencies are calculated for relevance - scoring. - :param seq_no_primary_term: If `true`, returns sequence number and primary term - of the last modification of each hit. - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param slice: Can be used to split a scrolled search into multiple slices that - can be consumed independently. + :param search_type: Indicates how distributed term frequencies are calculated + for relevance scoring. + :param seq_no_primary_term: If `true`, the request returns sequence number and + primary term of the last modification of each hit. + :param size: The number of hits to return, which must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` property. + :param slice: Split a scrolled search into multiple slices that can be consumed + independently. :param sort: A comma-separated list of : pairs. - :param source: Indicates which source fields are returned for matching documents. - These fields are returned in the hits._source property of the search response. + :param source: The source fields that are returned for matching documents. These + fields are returned in the `hits._source` property of the search response. + If the `stored_fields` property is specified, the `_source` property defaults + to `false`. Otherwise, it defaults to `true`. :param source_excludes: A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` @@ -3960,45 +4853,46 @@ async def search( returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. - :param stats: Stats groups to associate with the search. Each group maintains + :param stats: The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the `_source` parameter defaults to `false`. You can - pass `_source: true` to return both source fields and stored fields in the - search response. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. If no fields are specified, no stored fields are included in the + response. If this field is specified, the `_source` property defaults to + `false`. You can pass `_source: true` to return both source fields and stored + fields in the search response. :param suggest: Defines a suggester that provides similar looking terms based on a provided text. - :param suggest_field: Specifies which field to use for suggestions. - :param suggest_mode: Specifies the suggest mode. This parameter can only be used - when the `suggest_field` and `suggest_text` query string parameters are specified. - :param suggest_size: Number of suggestions to return. This parameter can only - be used when the `suggest_field` and `suggest_text` query string parameters + :param suggest_field: The field to use for suggestions. + :param suggest_mode: The suggest mode. This parameter can be used only when the + `suggest_field` and `suggest_text` query string parameters are specified. + :param suggest_size: The number of suggestions to return. This parameter can + be used only when the `suggest_field` and `suggest_text` query string parameters are specified. :param suggest_text: The source text for which the suggestions should be returned. - This parameter can only be used when the `suggest_field` and `suggest_text` + This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. - :param terminate_after: Maximum number of documents to collect for each shard. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - Elasticsearch collects documents before sorting. Use with caution. Elasticsearch - applies this parameter to each shard handling the request. When possible, - let Elasticsearch perform early termination automatically. Avoid specifying - this parameter for requests that target data streams with backing indices - across multiple data tiers. If set to `0` (default), the query does not terminate - early. - :param timeout: Specifies the period of time to wait for a response from each - shard. If no response is received before the timeout expires, the request - fails and returns an error. Defaults to no timeout. - :param track_scores: If true, calculate and return document scores, even if the - scores are not used for sorting. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this property to each shard handling the request. When + possible, let Elasticsearch perform early termination automatically. Avoid + specifying this property for requests that target data streams with backing + indices across multiple data tiers. If set to `0` (default), the query does + not terminate early. + :param timeout: The period of time to wait for a response from each shard. If + no response is received before the timeout expires, the request fails and + returns an error. Defaults to no timeout. + :param track_scores: If `true`, calculate and return document scores, even if + the scores are not used for sorting. :param track_total_hits: Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. :param typed_keys: If `true`, aggregation and suggester names are be prefixed by their respective types in the response. - :param version: If true, returns document version as part of a hit. + :param version: If `true`, the request returns the document version as part of + a hit. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -4230,52 +5124,376 @@ async def search_mvt( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> BinaryApiResponse: """ - Search a vector tile. Searches a vector tile for geospatial values. - - ``_ + .. raw:: html + +

Search a vector tile.

+

Search a vector tile for geospatial values. + Before using this API, you should be familiar with the Mapbox vector tile specification. + The API returns results as a binary mapbox vector tile.

+

Internally, Elasticsearch translates a vector tile search API request into a search containing:

+
    +
  • A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box.
  • +
  • A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box.
  • +
  • Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true.
  • +
  • If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.
  • +
+

For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search

+
GET my-index/_search
+          {
+            "size": 10000,
+            "query": {
+              "geo_bounding_box": {
+                "my-geo-field": {
+                  "top_left": {
+                    "lat": -40.979898069620134,
+                    "lon": -45
+                  },
+                  "bottom_right": {
+                    "lat": -66.51326044311186,
+                    "lon": 0
+                  }
+                }
+              }
+            },
+            "aggregations": {
+              "grid": {
+                "geotile_grid": {
+                  "field": "my-geo-field",
+                  "precision": 11,
+                  "size": 65536,
+                  "bounds": {
+                    "top_left": {
+                      "lat": -40.979898069620134,
+                      "lon": -45
+                    },
+                    "bottom_right": {
+                      "lat": -66.51326044311186,
+                      "lon": 0
+                    }
+                  }
+                }
+              },
+              "bounds": {
+                "geo_bounds": {
+                  "field": "my-geo-field",
+                  "wrap_longitude": false
+                }
+              }
+            }
+          }
+          
+

The API returns results as a binary Mapbox vector tile. + Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:

+
    +
  • A hits layer containing a feature for each <field> value matching the geo_bounding_box query.
  • +
  • An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data.
  • +
  • A meta layer containing: +
      +
    • A feature containing a bounding box. By default, this is the bounding box of the tile.
    • +
    • Value ranges for any sub-aggregations on the geotile_grid or geohex_grid.
    • +
    • Metadata for the search.
    • +
    +
  • +
+

The API only returns features that can display at its zoom level. + For example, if a polygon feature has no area at its zoom level, the API omits it. + The API returns errors as UTF-8 encoded JSON.

+

IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. + If you specify both parameters, the query parameter takes precedence.

+

Grid precision for geotile

+

For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. + grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. + For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. + The maximum final precision is 29. + The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). + For example, a value of 8 divides the tile into a grid of 256 x 256 cells. + The aggs layer only contains features for cells with matching data.

+

Grid precision for geohex

+

For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision.

+

This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. + The following table maps the H3 resolution for each precision. + For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. + At a precision of 6, hexagonal cells have an H3 resolution of 2. + If <zoom> is 3 and grid_precision is 4, the precision is 7. + At a precision of 7, hexagonal cells have an H3 resolution of 3.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PrecisionUnique tile binsH3 resolutionUnique hex binsRatio
14012230.5
21601227.625
364184213.15625
425618423.2890625
51024258825.744140625
64096258821.436035156
7163843411622.512329102
8655363411620.6280822754
926214442881221.099098206
10104857642881220.2747745514
114194304520168420.4808526039
12167772166141178820.8414913416
13671088646141178820.2103728354
142684354567988251620.3681524172
15107374182486917761220.644266719
16429496729686917761220.1610666797
1717179869184948424328420.2818666889
186871947673610338970298820.4932667053
19274877906944112372792091620.8632167343
201099511627776112372792091620.2158041836
2143980465111041216609544641220.3776573213
221759218604441613116266812488420.6609003122
237036874417766413116266812488420.165225078
2428147497671065614813867687418820.2891438866
251125899906842620155697073811931620.5060018015
264503599627370500155697073811931620.1265004504
2718014398509482000155697073811931620.03162511259
2872057594037927900155697073811931620.007906278149
29288230376151712000155697073811931620.001976569537
+

Hexagonal cells don't align perfectly on a vector tile. + Some cells may intersect more than one vector tile. + To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. + Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density.

+ + + ``_ :param index: Comma-separated list of data streams, indices, or aliases to search :param field: Field containing geospatial data to return :param zoom: Zoom level for the vector tile to search :param x: X coordinate for the vector tile to search :param y: Y coordinate for the vector tile to search - :param aggs: Sub-aggregations for the geotile_grid. Supports the following aggregation - types: - avg - cardinality - max - min - sum - :param buffer: Size, in pixels, of a clipping buffer outside the tile. This allows - renderers to avoid outline artifacts from geometries that extend past the - extent of the tile. - :param exact_bounds: If false, the meta layer’s feature is the bounding box of - the tile. If true, the meta layer’s feature is a bounding box resulting from - a geo_bounds aggregation. The aggregation runs on values that intersect - the // tile with wrap_longitude set to false. The resulting bounding - box may be larger than the vector tile. - :param extent: Size, in pixels, of a side of the tile. Vector tiles are square + :param aggs: Sub-aggregations for the geotile_grid. It supports the following + aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats` + - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank` + - `stats` - `sum` - `value count` The aggregation names can't start with + `_mvt_`. The `_mvt_` prefix is reserved for internal aggregations. + :param buffer: The size, in pixels, of a clipping buffer outside the tile. This + allows renderers to avoid outline artifacts from geometries that extend past + the extent of the tile. + :param exact_bounds: If `false`, the meta layer's feature is the bounding box + of the tile. If `true`, the meta layer's feature is a bounding box resulting + from a `geo_bounds` aggregation. The aggregation runs on values that + intersect the `//` tile with `wrap_longitude` set to `false`. + The resulting bounding box may be larger than the vector tile. + :param extent: The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. - :param fields: Fields to return in the `hits` layer. Supports wildcards (`*`). - This parameter does not support fields with array values. Fields with array - values may return inconsistent results. - :param grid_agg: Aggregation used to create a grid for the `field`. + :param fields: The fields to return in the `hits` layer. It supports wildcards + (`*`). This parameter does not support fields with array values. Fields with + array values may return inconsistent results. + :param grid_agg: The aggregation used to create a grid for the `field`. :param grid_precision: Additional zoom levels available through the aggs layer. - For example, if is 7 and grid_precision is 8, you can zoom in up to - level 15. Accepts 0-8. If 0, results don’t include the aggs layer. + For example, if `` is `7` and `grid_precision` is `8`, you can zoom + in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer. :param grid_type: Determines the geometry type for features in the aggs layer. - In the aggs layer, each feature represents a geotile_grid cell. If 'grid' - each feature is a Polygon of the cells bounding box. If 'point' each feature + In the aggs layer, each feature represents a `geotile_grid` cell. If `grid, + each feature is a polygon of the cells bounding box. If `point`, each feature is a Point that is the centroid of the cell. - :param query: Query DSL used to filter documents for the search. + :param query: The query DSL used to filter documents for the search. :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. - :param size: Maximum number of features to return in the hits layer. Accepts - 0-10000. If 0, results don’t include the hits layer. - :param sort: Sorts features in the hits layer. By default, the API calculates - a bounding box for each feature. It sorts features based on this box’s diagonal + :param size: The maximum number of features to return in the hits layer. Accepts + 0-10000. If 0, results don't include the hits layer. + :param sort: Sort the features in the hits layer. By default, the API calculates + a bounding box for each feature. It sorts features based on this box's diagonal length, from longest to shortest. - :param track_total_hits: Number of hits matching the query to count accurately. + :param track_total_hits: The number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. :param with_labels: If `true`, the hits and aggs layers will contain additional point features representing suggested label positions for the original features. + * `Point` and `MultiPoint` features will have one of the points selected. + * `Polygon` and `MultiPolygon` features will have a single point generated, + either the centroid, if it is within the polygon, or another point within + the polygon selected from the sorted triangle-tree. * `LineString` features + will likewise provide a roughly central point selected from the triangle-tree. + * The aggregation results will provide one central point for each aggregation + bucket. All attributes from the original features will also be copied to + the new label features. In addition, the new features will be distinguishable + using the tag `_mvt_label_position`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4384,13 +5602,20 @@ async def search_shards( routing: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about the indices and shards that a search request would - be executed against. + .. raw:: html + +

Get the search shards.

+

Get the indices and shards that a search request would be run against. + This information can be useful for working out issues or planning optimizations with routing and shard preferences. + When filtered aliases are used, the filter is returned as part of the indices section.

+

If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias.

- ``_ - :param index: Returns the indices and shards that a search request would be executed - against. + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*` or `_all`. :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For @@ -4404,9 +5629,9 @@ async def search_shards( a missing or closed index. :param local: If `true`, the request retrieves information from the local node only. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param routing: Custom value used to route operations to a specific shard. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param routing: A custom value used to route operations to a specific shard. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -4486,12 +5711,15 @@ async def search_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Runs a search with a search template. + .. raw:: html + +

Run a search with a search template.

- ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (*). + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For @@ -4499,32 +5727,34 @@ async def search_template( with `foo` but no index starts with `bar`. :param ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. Supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param explain: If `true`, returns detailed information about score calculation - as part of each hit. - :param id: ID of the search template to use. If no source is specified, this - parameter is required. + as part of each hit. If you specify both this and the `explain` query parameter, + the API uses only the query parameter. + :param id: The ID of the search template to use. If no `source` is specified, + this parameter is required. :param ignore_throttled: If `true`, specified concrete, expanded, or aliased indices are not included in the response when throttled. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param params: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param profile: If `true`, the query execution is profiled. - :param rest_total_hits_as_int: If true, hits.total are rendered as an integer - in the response. - :param routing: Custom value used to route operations to a specific shard. + :param rest_total_hits_as_int: If `true`, `hits.total` is rendered as an integer + in the response. If `false`, it is rendered as an object. + :param routing: A custom value used to route operations to a specific shard. :param scroll: Specifies how long a consistent view of the index should be maintained for scrolled search. :param search_type: The type of the search operation. :param source: An inline search template. Supports the same parameters as the - search API's request body. Also supports Mustache variables. If no id is - specified, this parameter is required. + search API's request body. It also supports Mustache variables. If no `id` + is specified, this parameter is required. :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ @@ -4618,28 +5848,39 @@ async def terms_enum( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The terms enum API can be used to discover terms in the index that begin with - the provided string. It is designed for low-latency look-ups used in auto-complete - scenarios. + .. raw:: html - ``_ +

Get terms in an index.

+

Discover terms that match a partial string in an index. + This API is designed for low-latency look-ups used in auto-complete scenarios.

+
+

info + The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.

+
- :param index: Comma-separated list of data streams, indices, and index aliases - to search. Wildcard (*) expressions are supported. + + ``_ + + :param index: A comma-separated list of data streams, indices, and index aliases + to search. Wildcard (`*`) expressions are supported. To search all data streams + or indices, omit this parameter or use `*` or `_all`. :param field: The string to match at the start of indexed terms. If not provided, all terms in the field are considered. - :param case_insensitive: When true the provided search string is matched against + :param case_insensitive: When `true`, the provided search string is matched against index terms without case sensitivity. - :param index_filter: Allows to filter an index shard if the provided query rewrites - to match_none. - :param search_after: - :param size: How many matching terms to return. - :param string: The string after which terms in the index should be returned. - Allows for a form of pagination if the last result from one request is passed - as the search_after parameter for a subsequent request. - :param timeout: The maximum length of time to spend collecting results. Defaults - to "1s" (one second). If the timeout is exceeded the complete flag set to - false in the response and the results may be partial or empty. + :param index_filter: Filter an index shard if the provided query rewrites to + `match_none`. + :param search_after: The string after which terms in the index should be returned. + It allows for a form of pagination if the last result from one request is + passed as the `search_after` parameter for a subsequent request. + :param size: The number of matching terms to return. + :param string: The string to match at the start of indexed terms. If it is not + provided, all terms in the field are considered. > info > The prefix string + cannot be larger than the largest possible keyword value, which is Lucene's + term byte-length limit of 32766. + :param timeout: The maximum length of time to spend collecting results. If the + timeout is exceeded the `complete` flag set to `false` in the response and + the results may be partial or empty. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4718,33 +5959,77 @@ async def termvectors( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get term vector information. Returns information and statistics about terms in - the fields of a particular document. - - ``_ - - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. + .. raw:: html + +

Get term vector information.

+

Get information and statistics about terms in the fields of a particular document.

+

You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. + You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. + For example:

+
GET /my-index-000001/_termvectors/1?fields=message
+          
+

Fields can be specified using wildcards, similar to the multi match query.

+

Term vectors are real-time by default, not near real-time. + This can be changed by setting realtime parameter to false.

+

You can request three types of values: term information, term statistics, and field statistics. + By default, all term information and field statistics are returned for all fields but term statistics are excluded.

+

Term information

+
    +
  • term frequency in the field (always returned)
  • +
  • term positions (positions: true)
  • +
  • start and end offsets (offsets: true)
  • +
  • term payloads (payloads: true), as base64 encoded bytes
  • +
+

If the requested information wasn't stored in the index, it will be computed on the fly if possible. + Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.

+
+

warn + Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.

+
+

Behaviour

+

The term and field statistics are not accurate. + Deleted documents are not taken into account. + The information is only retrieved for the shard the requested document resides in. + The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. + By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. + Use routing only to hit a particular shard.

+ + + ``_ + + :param index: The name of the index that contains the document. + :param id: A unique identifier for the document. :param doc: An artificial document (a document not present in the index) for which you want to retrieve term vectors. - :param field_statistics: If `true`, the response includes the document count, - sum of document frequencies, and sum of total term frequencies. - :param fields: Comma-separated list or wildcard expressions of fields to include - in the statistics. Used as the default list unless a specific field list - is provided in the `completion_fields` or `fielddata_fields` parameters. - :param filter: Filter terms based on their tf-idf scores. + :param field_statistics: If `true`, the response includes: * The document count + (how many documents contain this field). * The sum of document frequencies + (the sum of document frequencies for all terms in this field). * The sum + of total term frequencies (the sum of total term frequencies of each term + in this field). + :param fields: A comma-separated list or wildcard expressions of fields to include + in the statistics. It is used as the default list unless a specific field + list is provided in the `completion_fields` or `fielddata_fields` parameters. + :param filter: Filter terms based on their tf-idf scores. This could be useful + in order find out a good characteristic vector of a document. This feature + works in a similar manner to the second phase of the More Like This Query. :param offsets: If `true`, the response includes term offsets. :param payloads: If `true`, the response includes term payloads. - :param per_field_analyzer: Overrides the default per-field analyzer. + :param per_field_analyzer: Override the default per-field analyzer. This is useful + in order to generate term vectors in any fashion, especially when using artificial + documents. When providing an analyzer for a field that already stores term + vectors, the term vectors will be regenerated. :param positions: If `true`, the response includes term positions. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param realtime: If true, the request is real-time as opposed to near-real-time. - :param routing: Custom value used to route operations to a specific shard. - :param term_statistics: If `true`, the response includes term frequency and document - frequency. + :param routing: A custom value that is used to route operations to a specific + shard. + :param term_statistics: If `true`, the response includes: * The total term frequency + (how often a term occurs in all documents). * The document frequency (the + number of documents containing the current term). By default these values + are not returned since term statistics can have a serious performance impact. :param version: If `true`, returns the document version as part of a hit. - :param version_type: Specific version type. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4861,46 +6146,65 @@ async def update( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a document. Updates a document by running a script or passing a partial - document. - - ``_ - - :param index: The name of the index - :param id: Document ID - :param detect_noop: Set to false to disable setting 'result' in the response - to 'noop' if no change to the document occurred. - :param doc: A partial update to an existing document. - :param doc_as_upsert: Set to true to use the contents of 'doc' as the value of - 'upsert' + .. raw:: html + +

Update a document.

+

Update a document by running a script or passing a partial document.

+

If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias.

+

The script can update, delete, or skip modifying the document. + The API also supports passing a partial document, which is merged into the existing document. + To fully replace an existing document, use the index API. + This operation:

+
    +
  • Gets the document (collocated with the shard) from the index.
  • +
  • Runs the specified script.
  • +
  • Indexes the result.
  • +
+

The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation.

+

The _source field must be enabled to use this API. + In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp).

+ + + ``_ + + :param index: The name of the target index. By default, the index is created + automatically if it doesn't exist. + :param id: A unique identifier for the document to be updated. + :param detect_noop: If `true`, the `result` in the response is set to `noop` + (no operation) when there are no changes to the document. + :param doc: A partial update to an existing document. If both `doc` and `script` + are specified, `doc` is ignored. + :param doc_as_upsert: If `true`, use the contents of 'doc' as the value of 'upsert'. + NOTE: Using ingest pipelines with `doc_as_upsert` is not supported. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param lang: The script language. :param refresh: If 'true', Elasticsearch refreshes 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' do nothing with refreshes. - :param require_alias: If true, the destination must be an index alias. - :param retry_on_conflict: Specify how many times should the operation be retried + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', it does nothing with refreshes. + :param require_alias: If `true`, the destination must be an index alias. + :param retry_on_conflict: The number of times the operation should be retried when a conflict occurs. - :param routing: Custom value used to route operations to a specific shard. - :param script: Script to execute to update the document. - :param scripted_upsert: Set to true to execute the script whether or not the - document exists. - :param source: Set to false to disable source retrieval. You can also specify - a comma-separated list of the fields you want to retrieve. - :param source_excludes: Specify the source fields you want to exclude. - :param source_includes: Specify the source fields you want to retrieve. - :param timeout: Period to wait for dynamic mapping updates and active shards. - This guarantees Elasticsearch waits for at least the timeout before failing. - The actual wait time could be longer, particularly when multiple waits occur. + :param routing: A custom value used to route operations to a specific shard. + :param script: The script to run to update the document. + :param scripted_upsert: If `true`, run the script whether or not the document + exists. + :param source: If `false`, turn off source retrieval. You can also specify a + comma-separated list of the fields you want to retrieve. + :param source_excludes: The source fields you want to exclude. + :param source_includes: The source fields you want to retrieve. + :param timeout: The period to wait for the following operations: dynamic mapping + updates and waiting for active shards. Elasticsearch waits for at least the + timeout period before failing. The actual wait time could be longer, particularly + when multiple waits occur. :param upsert: If the document does not already exist, the contents of 'upsert' - are inserted as a new document. If the document exists, the 'script' is executed. - :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operations. Set to 'all' or any positive integer - up to the total number of shards in the index (number_of_replicas+1). Defaults - to 1 meaning the primary shard. + are inserted as a new document. If the document exists, the 'script' is run. + :param wait_for_active_shards: The number of copies of each shard that must be + active before proceeding with the operation. Set to 'all' or any positive + integer up to the total number of shards in the index (`number_of_replicas`+1). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5026,82 +6330,166 @@ async def update_by_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update documents. Updates documents that match the specified query. If no query - is specified, performs an update on every document in the data stream or index - without modifying the source, which is useful for picking up mapping changes. - - ``_ - - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams or indices, omit this - parameter or use `*` or `_all`. + .. raw:: html + +

Update documents. + Updates documents that match the specified query. + If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:

+
    +
  • read
  • +
  • index or write
  • +
+

You can specify the query criteria in the request URI or the request body using the same syntax as the search API.

+

When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. + When the versions match, the document is updated and the version number is incremented. + If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. + You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. + Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query.

+

NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number.

+

While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. + A bulk update request is performed for each batch of matching documents. + Any query or update failures cause the update by query request to fail and the failures are shown in the response. + Any update requests that completed successfully still stick, they are not rolled back.

+

Throttling update requests

+

To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. + This pads each batch with a wait time to throttle the rate. + Set requests_per_second to -1 to turn off throttling.

+

Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. + The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. + By default the batch size is 1000, so if requests_per_second is set to 500:

+
target_time = 1000 / 500 per second = 2 seconds
+          wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
+          
+

Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Update by query supports sliced scroll to parallelize the update process. + This can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

Setting slices to auto chooses a reasonable number for most data streams and indices. + This setting will use one slice per shard, up to a certain limit. + If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards.

+

Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks:

+
    +
  • You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices.
  • +
  • Fetching the status of the task for the request with slices only contains the status of completed slices.
  • +
  • These sub-requests are individually addressable for things like cancellation and rethrottling.
  • +
  • Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally.
  • +
  • Canceling the request with slices will cancel each sub-request.
  • +
  • Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.
  • +
  • Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated.
  • +
  • Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time.
  • +
+

If you're slicing manually or otherwise tuning automatic slicing, keep in mind that:

+
    +
  • Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.
  • +
  • Update performance scales linearly across available resources with the number of slices.
  • +
+

Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources.

+

Update the document source

+

Update by query supports scripts to update the document source. + As with the update API, you can set ctx.op to change the operation that is performed.

+

Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. + The update by query operation skips updating the document and increments the noop counter.

+

Set ctx.op = "delete" if your script decides that the document should be deleted. + The update by query operation deletes the document and increments the deleted counter.

+

Update by query supports only index, noop, and delete. + Setting ctx.op to anything else is an error. + Setting any other field in ctx is an error. + This API enables you to only modify the source of matching documents; you cannot move them.

+ + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams or indices, + omit this parameter or use `*` or `_all`. :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. - :param conflicts: What to do if update by query hits version conflicts: `abort` - or `proceed`. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. + :param conflicts: The preferred behavior when update by query hits version conflicts: + `abort` or `proceed`. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param from_: Starting offset (default: 0) :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. :param max_docs: The maximum number of documents to update. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. + :param pipeline: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. - :param query: Specifies the documents to update using the Query DSL. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: A query in the Lucene query string syntax. + :param query: The documents to update using the Query DSL. :param refresh: If `true`, Elasticsearch refreshes affected shards to make the - operation visible to search. + operation visible to search after the request completes. This is different + than the update API's `refresh` parameter, which causes just the shard that + received the request to be refreshed. :param request_cache: If `true`, the request cache is used for this request. + It defaults to the index-level setting. :param requests_per_second: The throttle for this request in sub-requests per second. - :param routing: Custom value used to route operations to a specific shard. + :param routing: A custom value used to route operations to a specific shard. :param script: The script to run to update the document source or metadata when updating. - :param scroll: Period to retain the search context for scrolling. - :param scroll_size: Size of the scroll request that powers the operation. - :param search_timeout: Explicit timeout for each search request. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param scroll: The period to retain the search context for scrolling. + :param scroll_size: The size of the scroll request that powers the operation. + :param search_timeout: An explicit timeout for each search request. By default, + there is no timeout. + :param search_type: The type of the search operation. Available options include + `query_then_fetch` and `dfs_query_then_fetch`. :param slice: Slice the request manually using the provided slice ID and total number of slices. :param slices: The number of slices this task should be divided into. :param sort: A comma-separated list of : pairs. - :param stats: Specific `tag` of the request for logging and statistical purposes. - :param terminate_after: Maximum number of documents to collect for each shard. + :param stats: The specific `tag` of the request for logging and statistical purposes. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - Elasticsearch collects documents before sorting. Use with caution. Elasticsearch - applies this parameter to each shard handling the request. When possible, - let Elasticsearch perform early termination automatically. Avoid specifying - this parameter for requests that target data streams with backing indices - across multiple data tiers. - :param timeout: Period each update request waits for the following operations: - dynamic mapping updates, waiting for active shards. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this parameter to each shard handling the request. + When possible, let Elasticsearch perform early termination automatically. + Avoid specifying this parameter for requests that target data streams with + backing indices across multiple data tiers. + :param timeout: The period each update request waits for the following operations: + dynamic mapping updates, waiting for active shards. By default, it is one + minute. This guarantees Elasticsearch waits for at least the timeout before + failing. The actual wait time could be longer, particularly when multiple + waits occur. :param version: If `true`, returns the document version as part of a hit. :param version_type: Should the document increment the version number (internal) on hit or not (reindex) :param wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + up to the total number of shards in the index (`number_of_replicas+1`). The + `timeout` parameter controls how long each write request waits for unavailable + shards to become available. Both work exactly the way they work in the bulk + API. :param wait_for_completion: If `true`, the request blocks until the operation - is complete. + is complete. If `false`, Elasticsearch performs some preflight checks, launches + the request, and returns a task ID that you can use to cancel or get the + status of the task. Elasticsearch creates a record of this task as a document + at `.tasks/task/${taskId}`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5224,13 +6612,18 @@ async def update_by_query_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Changes the number of requests per second for a particular Update By Query operation. + .. raw:: html + +

Throttle an update by query operation.

+

Change the number of requests per second for a particular update by query operation. + Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.

- ``_ + + ``_ :param task_id: The ID for the task. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. To turn off throttling, set it to `-1`. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") diff --git a/elasticsearch/_async/client/_base.py b/elasticsearch/_async/client/_base.py index dd0b0f44e..cc090671c 100644 --- a/elasticsearch/_async/client/_base.py +++ b/elasticsearch/_async/client/_base.py @@ -298,7 +298,6 @@ async def _perform_request( def mimetype_header_to_compat(header: str) -> None: # Converts all parts of a Accept/Content-Type headers # from application/X -> application/vnd.elasticsearch+X - nonlocal request_headers mimetype = request_headers.get(header, None) if mimetype: request_headers[header] = _COMPAT_MIMETYPE_RE.sub( diff --git a/elasticsearch/_async/client/async_search.py b/elasticsearch/_async/client/async_search.py index 74bfdc0fc..ddd355f3f 100644 --- a/elasticsearch/_async/client/async_search.py +++ b/elasticsearch/_async/client/async_search.py @@ -36,13 +36,15 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an async search by identifier. If the search is still running, the search - request will be cancelled. Otherwise, the saved search results are deleted. If - the Elasticsearch security features are enabled, the deletion of a specific async - search is restricted to: the authenticated user that submitted the original search - request; users that have the `cancel_task` cluster privilege. + .. raw:: html - ``_ +

Delete an async search.

+

If the asynchronous search is still running, it is cancelled. + Otherwise, the saved search results are deleted. + If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege.

+ + + ``_ :param id: A unique identifier for the async search. """ @@ -85,12 +87,14 @@ async def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the results of a previously submitted async search request given its - identifier. If the Elasticsearch security features are enabled, access to the - results of a specific async search is restricted to the user or API key that - submitted it. + .. raw:: html + +

Get async search results.

+

Retrieve the results of a previously submitted asynchronous search request. + If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it.

+ - ``_ + ``_ :param id: A unique identifier for the async search. :param keep_alive: Specifies how long the async search should be available in @@ -145,17 +149,23 @@ async def status( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get async search status Retrieves the status of a previously submitted async - search request given its identifier, without retrieving search results. If the - Elasticsearch security features are enabled, use of this API is restricted to - the `monitoring_user` role. + .. raw:: html + +

Get the async search status.

+

Get the status of a previously submitted async search request given its identifier, without retrieving search results. + If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role.

+ - ``_ + ``_ :param id: A unique identifier for the async search. + :param keep_alive: Specifies how long the async search needs to be available. + Ongoing async searches and any saved search results are deleted after this + period. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -168,6 +178,8 @@ async def status( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if keep_alive is not None: + __query["keep_alive"] = keep_alive if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} @@ -269,7 +281,6 @@ async def submit( min_score: t.Optional[float] = None, pit: t.Optional[t.Mapping[str, t.Any]] = None, post_filter: t.Optional[t.Mapping[str, t.Any]] = None, - pre_filter_shard_size: t.Optional[int] = None, preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, @@ -283,7 +294,6 @@ async def submit( routing: t.Optional[str] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, - scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, search_after: t.Optional[ t.Sequence[t.Union[None, bool, float, int, str, t.Any]] ] = None, @@ -323,17 +333,16 @@ async def submit( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Runs a search request asynchronously. When the primary sort of the results is - an indexed field, shards get sorted based on minimum and maximum value that they - hold for that field, hence partial results become available following the sort - criteria that was requested. Warning: Async search does not support scroll nor - search requests that only include the suggest section. By default, Elasticsearch - doesn’t allow you to store an async search response larger than 10Mb and an attempt - to do this results in an error. The maximum allowed size for a stored async search - response can be set by changing the `search.max_async_search_response_size` cluster - level setting. + .. raw:: html + +

Run an async search.

+

When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested.

+

Warning: Asynchronous search does not support scroll or search requests that include only the suggest section.

+

By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. + The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting.

+ - ``_ + ``_ :param index: A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices @@ -394,10 +403,6 @@ async def submit( :param pit: Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. :param post_filter: - :param pre_filter_shard_size: The default value cannot be changed, which enforces - the execution of a pre-filter roundtrip to retrieve statistics from each - shard so that the ones that surely don’t hold any document matching the query - get skipped. :param preference: Specify the node or shard the operation should be performed on (default: random) :param profile: @@ -406,13 +411,13 @@ async def submit( :param request_cache: Specify if request cache should be used for this request or not, defaults to true :param rescore: - :param rest_total_hits_as_int: + :param rest_total_hits_as_int: Indicates whether hits.total should be rendered + as an integer or an object in the rest search response :param routing: A comma-separated list of specific routing values :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. :param script_fields: Retrieve a script evaluation (based on different fields) for each hit. - :param scroll: :param search_after: :param search_type: Search operation type :param seq_no_primary_term: If true, returns sequence number and primary term @@ -519,8 +524,6 @@ async def submit( __query["max_concurrent_shard_requests"] = max_concurrent_shard_requests if min_compatible_shard_node is not None: __query["min_compatible_shard_node"] = min_compatible_shard_node - if pre_filter_shard_size is not None: - __query["pre_filter_shard_size"] = pre_filter_shard_size if preference is not None: __query["preference"] = preference if pretty is not None: @@ -533,8 +536,6 @@ async def submit( __query["rest_total_hits_as_int"] = rest_total_hits_as_int if routing is not None: __query["routing"] = routing - if scroll is not None: - __query["scroll"] = scroll if search_type is not None: __query["search_type"] = search_type if source_excludes is not None: diff --git a/elasticsearch/_async/client/autoscaling.py b/elasticsearch/_async/client/autoscaling.py index b558e94a5..9999f82e8 100644 --- a/elasticsearch/_async/client/autoscaling.py +++ b/elasticsearch/_async/client/autoscaling.py @@ -33,15 +33,25 @@ async def delete_autoscaling_policy( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. - Direct use is not supported. + .. raw:: html - ``_ +

Delete an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ + + ``_ :param name: the name of the autoscaling policy + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -54,8 +64,12 @@ async def delete_autoscaling_policy( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "DELETE", @@ -73,13 +87,28 @@ async def get_autoscaling_capacity( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets the current autoscaling capacity based on the configured autoscaling policy. - Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. + .. raw:: html + +

Get the autoscaling capacity.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

This API gets the current autoscaling capacity based on the configured autoscaling policy. + It will return information to size the cluster appropriately to the current workload.

+

The required_capacity is calculated as the maximum of the required_capacity result of all individual deciders that are enabled for the policy.

+

The operator should verify that the current_nodes match the operator’s knowledge of the cluster to avoid making autoscaling decisions based on stale or incomplete information.

+

The response contains decider-specific information you can use to diagnose how and why autoscaling determined a certain capacity was required. + This information is provided for diagnosis only. + Do not use this information to make autoscaling decisions.

+ + + ``_ - ``_ + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_autoscaling/capacity" @@ -90,6 +119,8 @@ async def get_autoscaling_capacity( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} @@ -110,15 +141,22 @@ async def get_autoscaling_policy( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. - Direct use is not supported. + .. raw:: html - ``_ +

Get an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ + + ``_ :param name: the name of the autoscaling policy + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -131,6 +169,8 @@ async def get_autoscaling_policy( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} @@ -155,16 +195,26 @@ async def put_autoscaling_policy( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. - Direct use is not supported. + .. raw:: html + +

Create or update an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ - ``_ + ``_ :param name: the name of the autoscaling policy :param policy: + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -183,8 +233,12 @@ async def put_autoscaling_policy( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __body = policy if policy is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] diff --git a/elasticsearch/_async/client/cat.py b/elasticsearch/_async/client/cat.py index 83a393e7a..6ffa36b68 100644 --- a/elasticsearch/_async/client/cat.py +++ b/elasticsearch/_async/client/cat.py @@ -20,7 +20,13 @@ from elastic_transport import ObjectApiResponse, TextApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class CatClient(NamespacedClient): @@ -51,18 +57,22 @@ async def aliases( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get aliases. Retrieves the cluster’s index aliases, including filter and routing - information. The API does not return data stream aliases. CAT APIs are only intended - for human consumption using the command line or the Kibana console. They are - not intended for use by applications. For application consumption, use the aliases - API. + .. raw:: html - ``_ +

Get aliases.

+

Get the cluster's index aliases, including filter and routing information. + This API does not return data stream aliases.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API.

+ + + ``_ :param name: A comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -72,7 +82,10 @@ async def aliases( the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. To indicated that the request should never timeout, + you can set it to `-1`. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -141,13 +154,16 @@ async def allocation( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Provides a snapshot of the number of shards allocated to each data node and their - disk space. IMPORTANT: cat APIs are only intended for human consumption using - the command line or Kibana console. They are not intended for use by applications. + .. raw:: html + +

Get shard allocation information.

+

Get a snapshot of the number of shards allocated to each data node and their disk space.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.

- ``_ - :param node_id: Comma-separated list of node identifiers or names used to limit + ``_ + + :param node_id: A comma-separated list of node identifiers or names used to limit the returned information. :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set @@ -225,17 +241,19 @@ async def component_templates( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get component templates. Returns information about component templates in a cluster. - Component templates are building blocks for constructing index templates that - specify index mappings, settings, and aliases. CAT APIs are only intended for - human consumption using the command line or Kibana console. They are not intended - for use by applications. For application consumption, use the get component template - API. + .. raw:: html + +

Get component templates.

+

Get information about component templates in a cluster. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use the get component template API.

- ``_ - :param name: The name of the component template. Accepts wildcard expressions. - If omitted, all component templates are returned. + ``_ + + :param name: The name of the component template. It accepts wildcard expressions. + If it is omitted, all component templates are returned. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -245,7 +263,7 @@ async def component_templates( the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. + :param master_timeout: The period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -302,35 +320,30 @@ async def count( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get a document count. Provides quick access to a document count for a data stream, - an index, or an entire cluster. The document count only includes live documents, - not deleted documents which have not yet been removed by the merge process. CAT - APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the count API. + .. raw:: html - ``_ +

Get a document count.

+

Get quick access to a document count for a data stream, an index, or an entire cluster. + The document count only includes live documents, not deleted documents which have not yet been removed by the merge process.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use the count API.

- :param index: Comma-separated list of data streams, indices, and aliases used - to limit the request. Supports wildcards (`*`). To target all data streams + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases used + to limit the request. It supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -356,10 +369,6 @@ async def count( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -390,19 +399,20 @@ async def fielddata( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the amount of heap memory currently used by the field data cache on every - data node in the cluster. IMPORTANT: cat APIs are only intended for human consumption - using the command line or Kibana console. They are not intended for use by applications. - For application consumption, use the nodes stats API. + .. raw:: html - ``_ +

Get field data cache information.

+

Get the amount of heap memory currently used by the field data cache on every data node in the cluster.

+

IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use the nodes stats API.

+ + + ``_ :param fields: Comma-separated list of fields used to limit returned information. To retrieve all fields, omit this parameter. @@ -412,11 +422,6 @@ async def fielddata( :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -444,10 +449,6 @@ async def fielddata( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -474,8 +475,6 @@ async def health( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, time: t.Optional[ @@ -485,30 +484,27 @@ async def health( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the health status of a cluster, similar to the cluster health API. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the cluster health API. This API is often used to check malfunctioning clusters. - To help you track cluster health alongside log files and alerting systems, the - API returns timestamps in two formats: `HH:MM:SS`, which is human-readable but - includes no date information; `Unix epoch time`, which is machine-sortable and - includes date information. The latter format is useful for cluster recoveries - that take multiple days. You can use the cat health API to verify cluster health - across multiple nodes. You also can use the API to track the recovery of a large - cluster over a longer period of time. - - ``_ + .. raw:: html + +

Get the cluster health status.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use the cluster health API. + This API is often used to check malfunctioning clusters. + To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: + HH:MM:SS, which is human-readable but includes no date information; + Unix epoch time, which is machine-sortable and includes date information. + The latter format is useful for cluster recoveries that take multiple days. + You can use the cat health API to verify cluster health across multiple nodes. + You also can use the API to track the recovery of a large cluster over a longer period of time.

+ + + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -531,10 +527,6 @@ async def health( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -556,66 +548,19 @@ async def health( ) @_rewrite_parameters() - async def help( - self, - *, - error_trace: t.Optional[bool] = None, - filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, - format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, - help: t.Optional[bool] = None, - human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - pretty: t.Optional[bool] = None, - s: t.Optional[t.Union[str, t.Sequence[str]]] = None, - v: t.Optional[bool] = None, - ) -> TextApiResponse: + async def help(self) -> TextApiResponse: """ - Get CAT help. Returns help for the CAT APIs. + .. raw:: html - ``_ +

Get CAT help.

+

Get help for the CAT APIs.

- :param format: Specifies the format to return the columnar data in, can be set - to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. - :param help: When set to `true` will output available columns. This option can't - be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. - :param s: List of columns that determine how the table should be sorted. Sorting - defaults to ascending and can be changed by setting `:asc` or `:desc` as - a suffix to the column name. - :param v: When set to `true` will enable verbose output. + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_cat" __query: t.Dict[str, t.Any] = {} - if error_trace is not None: - __query["error_trace"] = error_trace - if filter_path is not None: - __query["filter_path"] = filter_path - if format is not None: - __query["format"] = format - if h is not None: - __query["h"] = h - if help is not None: - __query["help"] = help - if human is not None: - __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout - if pretty is not None: - __query["pretty"] = pretty - if s is not None: - __query["s"] = s - if v is not None: - __query["v"] = v __headers = {"accept": "text/plain"} return await self.perform_request( # type: ignore[return-value] "GET", @@ -650,7 +595,6 @@ async def indices( help: t.Optional[bool] = None, human: t.Optional[bool] = None, include_unloaded_segments: t.Optional[bool] = None, - local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, pri: t.Optional[bool] = None, @@ -661,18 +605,25 @@ async def indices( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get index information. Returns high-level information about indices in a cluster, - including backing indices for data streams. Use this request to get the following - information for each index in a cluster: - shard count - document count - deleted - document count - primary store size - total store size of all shards, including - shard replicas These metrics are retrieved directly from Lucene, which Elasticsearch - uses internally to power indexing and search. As a result, all document counts - include hidden nested documents. To get an accurate count of Elasticsearch documents, - use the cat count or count APIs. CAT APIs are only intended for human consumption - using the command line or Kibana console. They are not intended for use by applications. - For application consumption, use an index endpoint. - - ``_ + .. raw:: html + +

Get index information.

+

Get high-level information about indices in a cluster, including backing indices for data streams.

+

Use this request to get the following information for each index in a cluster:

+
    +
  • shard count
  • +
  • document count
  • +
  • deleted document count
  • +
  • primary store size
  • +
  • total store size of all shards, including shard replicas
  • +
+

These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents. + To get an accurate count of Elasticsearch documents, use the cat count or count APIs.

+

CAT APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use an index endpoint.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -688,10 +639,6 @@ async def indices( be combined with any other query string option. :param include_unloaded_segments: If true, the response includes information from segments that are not loaded into memory. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. :param pri: If true, the response only includes information from primary shards. :param s: List of columns that determine how the table should be sorted. Sorting @@ -728,8 +675,6 @@ async def indices( __query["human"] = human if include_unloaded_segments is not None: __query["include_unloaded_segments"] = include_unloaded_segments - if local is not None: - __query["local"] = local if master_timeout is not None: __query["master_timeout"] = master_timeout if pretty is not None: @@ -769,12 +714,14 @@ async def master( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the master node, including the ID, bound IP address, - and name. IMPORTANT: cat APIs are only intended for human consumption using the - command line or Kibana console. They are not intended for use by applications. - For application consumption, use the nodes info API. + .. raw:: html + +

Get master node information.

+

Get information about the master node, including the ID, bound IP address, and name.

+

IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

+ - ``_ + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -888,8 +835,6 @@ async def ml_data_frame_analytics( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -939,17 +884,22 @@ async def ml_data_frame_analytics( ], ] ] = None, - time: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get data frame analytics jobs. Returns configuration and usage information about - data frame analytics jobs. CAT APIs are only intended for human consumption using - the Kibana console or command line. They are not intended for use by applications. - For application consumption, use the get data frame analytics jobs statistics - API. + .. raw:: html + +

Get data frame analytics jobs.

+

Get configuration and usage information about data frame analytics jobs.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get data frame analytics jobs statistics API.

- ``_ + + ``_ :param id: The ID of the data frame analytics to fetch :param allow_no_match: Whether to ignore if a wildcard expression matches no @@ -960,11 +910,6 @@ async def ml_data_frame_analytics( :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. :param time: Unit used to display time values. @@ -994,10 +939,6 @@ async def ml_data_frame_analytics( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -1067,8 +1008,6 @@ async def ml_datafeeds( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -1116,14 +1055,19 @@ async def ml_datafeeds( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get datafeeds. Returns configuration and usage information about datafeeds. This - API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features - are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` - cluster privileges to use this API. CAT APIs are only intended for human consumption - using the Kibana console or command line. They are not intended for use by applications. - For application consumption, use the get datafeed statistics API. + .. raw:: html + +

Get datafeeds.

+

Get configuration and usage information about datafeeds. + This API returns a maximum of 10,000 datafeeds. + If the Elasticsearch security features are enabled, you must have monitor_ml, monitor, manage_ml, or manage + cluster privileges to use this API.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get datafeed statistics API.

+ - ``_ + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. @@ -1139,11 +1083,6 @@ async def ml_datafeeds( :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. :param time: The unit used to display time values. @@ -1171,10 +1110,6 @@ async def ml_datafeeds( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -1343,8 +1278,6 @@ async def ml_jobs( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -1488,15 +1421,19 @@ async def ml_jobs( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get anomaly detection jobs. Returns configuration and usage information for anomaly - detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch - security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, - or `manage` cluster privileges to use this API. CAT APIs are only intended for - human consumption using the Kibana console or command line. They are not intended - for use by applications. For application consumption, use the get anomaly detection - job statistics API. + .. raw:: html + +

Get anomaly detection jobs.

+

Get configuration and usage information for anomaly detection jobs. + This API returns a maximum of 10,000 jobs. + If the Elasticsearch security features are enabled, you must have monitor_ml, + monitor, manage_ml, or manage cluster privileges to use this API.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get anomaly detection job statistics API.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param allow_no_match: Specifies what to do when the request: * Contains wildcard @@ -1512,11 +1449,6 @@ async def ml_jobs( :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. :param time: The unit used to display time values. @@ -1546,10 +1478,6 @@ async def ml_jobs( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -1629,8 +1557,6 @@ async def ml_trained_models( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -1677,15 +1603,22 @@ async def ml_trained_models( ] ] = None, size: t.Optional[int] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get trained models. Returns configuration and usage information about inference - trained models. CAT APIs are only intended for human consumption using the Kibana - console or command line. They are not intended for use by applications. For application - consumption, use the get trained models statistics API. + .. raw:: html - ``_ +

Get trained models.

+

Get configuration and usage information about inference trained models.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get trained models statistics API.

+ + + ``_ :param model_id: A unique identifier for the trained model. :param allow_no_match: Specifies what to do when the request: contains wildcard @@ -1702,14 +1635,10 @@ async def ml_trained_models( :param h: A comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: A comma-separated list of column names or aliases used to sort the response. :param size: The maximum number of transforms to display. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -1738,16 +1667,14 @@ async def ml_trained_models( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s if size is not None: __query["size"] = size + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -1777,12 +1704,14 @@ async def nodeattrs( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about custom node attributes. IMPORTANT: cat APIs are only - intended for human consumption using the command line or Kibana console. They - are not intended for use by applications. For application consumption, use the - nodes info API. + .. raw:: html + +

Get node attribute information.

+

Get information about custom node attributes. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

+ - ``_ + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -1849,19 +1778,23 @@ async def nodes( help: t.Optional[bool] = None, human: t.Optional[bool] = None, include_unloaded_segments: t.Optional[bool] = None, - local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the nodes in a cluster. IMPORTANT: cat APIs are only - intended for human consumption using the command line or Kibana console. They - are not intended for use by applications. For application consumption, use the - nodes info API. + .. raw:: html + +

Get node information.

+

Get information about the nodes in a cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

+ - ``_ + ``_ :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set @@ -1873,14 +1806,11 @@ async def nodes( be combined with any other query string option. :param include_unloaded_segments: If true, the response includes information from segments that are not loaded into memory. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} @@ -1904,14 +1834,14 @@ async def nodes( __query["human"] = human if include_unloaded_segments is not None: __query["include_unloaded_segments"] = include_unloaded_segments - if local is not None: - __query["local"] = local if master_timeout is not None: __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -1938,15 +1868,20 @@ async def pending_tasks( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns cluster-level changes that have not yet been executed. IMPORTANT: cat - APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the pending cluster tasks API. + .. raw:: html + +

Get pending task information.

+

Get information about cluster-level changes that have not yet taken effect. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the pending cluster tasks API.

+ - ``_ + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -1961,6 +1896,7 @@ async def pending_tasks( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} @@ -1986,6 +1922,8 @@ async def pending_tasks( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2008,6 +1946,7 @@ async def plugins( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, + include_bootstrap: t.Optional[bool] = None, local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, @@ -2015,18 +1954,21 @@ async def plugins( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns a list of plugins running on each node of a cluster. IMPORTANT: cat APIs - are only intended for human consumption using the command line or Kibana console. - They are not intended for use by applications. For application consumption, use - the nodes info API. + .. raw:: html + +

Get plugin information.

+

Get a list of plugins running on each node of a cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

- ``_ + + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. + :param include_bootstrap: Include bootstrap plugins in the response :param local: If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating @@ -2052,6 +1994,8 @@ async def plugins( __query["help"] = help if human is not None: __query["human"] = human + if include_bootstrap is not None: + __query["include_bootstrap"] = include_bootstrap if local is not None: __query["local"] = local if master_timeout is not None: @@ -2088,23 +2032,24 @@ async def recovery( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about ongoing and completed shard recoveries. Shard recovery - is the process of initializing a shard copy, such as restoring a primary shard - from a snapshot or syncing a replica shard from a primary shard. When a shard - recovery completes, the recovered shard is available for search and indexing. - For data streams, the API returns information about the stream’s backing indices. - IMPORTANT: cat APIs are only intended for human consumption using the command - line or Kibana console. They are not intended for use by applications. For application - consumption, use the index recovery API. + .. raw:: html + +

Get shard recovery information.

+

Get information about ongoing and completed shard recoveries. + Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. + For data streams, the API returns information about the stream’s backing indices. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index recovery API.

- ``_ + + ``_ :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2118,14 +2063,10 @@ async def recovery( :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2154,14 +2095,12 @@ async def recovery( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2191,12 +2130,14 @@ async def repositories( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the snapshot repositories for a cluster. IMPORTANT: cat APIs are only - intended for human consumption using the command line or Kibana console. They - are not intended for use by applications. For application consumption, use the - get snapshot repository API. + .. raw:: html + +

Get snapshot repository information.

+

Get a list of snapshot repositories for a cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot repository API.

- ``_ + + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -2269,13 +2210,15 @@ async def segments( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns low-level information about the Lucene segments in index shards. For - data streams, the API returns information about the backing indices. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the index segments API. + .. raw:: html + +

Get segment information.

+

Get low-level information about the Lucene segments in index shards. + For data streams, the API returns information about the backing indices. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index segments API.

- ``_ + + ``_ :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2352,19 +2295,24 @@ async def shards( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the shards in a cluster. For data streams, the API - returns information about the backing indices. IMPORTANT: cat APIs are only intended - for human consumption using the command line or Kibana console. They are not - intended for use by applications. + .. raw:: html + +

Get shard information.

+

Get information about the shards in a cluster. + For data streams, the API returns information about the backing indices. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.

+ - ``_ + ``_ :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2375,14 +2323,11 @@ async def shards( :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2407,14 +2352,14 @@ async def shards( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local if master_timeout is not None: __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2439,20 +2384,24 @@ async def snapshots( help: t.Optional[bool] = None, human: t.Optional[bool] = None, ignore_unavailable: t.Optional[bool] = None, - local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the snapshots stored in one or more repositories. A - snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the get snapshot API. + .. raw:: html + +

Get snapshot information.

+

Get information about the snapshots stored in one or more repositories. + A snapshot is a backup of an index or running Elasticsearch cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API.

+ - ``_ + ``_ :param repository: A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. @@ -2464,14 +2413,11 @@ async def snapshots( be combined with any other query string option. :param ignore_unavailable: If `true`, the response does not include information from unavailable snapshots. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2496,14 +2442,14 @@ async def snapshots( __query["human"] = human if ignore_unavailable is not None: __query["ignore_unavailable"] = ignore_unavailable - if local is not None: - __query["local"] = local if master_timeout is not None: __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2517,6 +2463,7 @@ async def snapshots( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def tasks( self, *, @@ -2528,21 +2475,26 @@ async def tasks( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - node_id: t.Optional[t.Sequence[str]] = None, + nodes: t.Optional[t.Sequence[str]] = None, parent_task_id: t.Optional[str] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, v: t.Optional[bool] = None, + wait_for_completion: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about tasks currently executing in the cluster. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the task management API. + .. raw:: html - ``_ +

Get task information.

+

Get information about tasks currently running in the cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API.

+ + + ``_ :param actions: The task action names, which are used to limit the response. :param detailed: If `true`, the response includes detailed information about @@ -2552,18 +2504,18 @@ async def tasks( :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. - :param node_id: Unique node identifiers, which are used to limit the response. + :param nodes: Unique node identifiers, which are used to limit the response. :param parent_task_id: The parent task identifier, which is used to limit the response. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. :param v: When set to `true` will enable verbose output. + :param wait_for_completion: If `true`, the request blocks until the task has + completed. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/tasks" @@ -2584,20 +2536,22 @@ async def tasks( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout - if node_id is not None: - __query["node_id"] = node_id + if nodes is not None: + __query["nodes"] = nodes if parent_task_id is not None: __query["parent_task_id"] = parent_task_id if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time + if timeout is not None: + __query["timeout"] = timeout if v is not None: __query["v"] = v + if wait_for_completion is not None: + __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "text/plain,application/json"} return await self.perform_request( # type: ignore[return-value] "GET", @@ -2626,13 +2580,15 @@ async def templates( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about index templates in a cluster. You can use index templates - to apply index settings and field mappings to new indices at creation. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the get index template API. + .. raw:: html + +

Get index template information.

+

Get information about the index templates in a cluster. + You can use index templates to apply index settings and field mappings to new indices at creation. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API.

+ - ``_ + ``_ :param name: The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. @@ -2712,13 +2668,15 @@ async def thread_pool( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns thread pool statistics for each node in a cluster. Returned information - includes all built-in thread pools and custom thread pools. IMPORTANT: cat APIs - are only intended for human consumption using the command line or Kibana console. - They are not intended for use by applications. For application consumption, use - the nodes info API. + .. raw:: html + +

Get thread pool statistics.

+

Get thread pool statistics for each node in a cluster. + Returned information includes all built-in thread pools and custom thread pools. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

+ - ``_ + ``_ :param thread_pool_patterns: A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions. @@ -2876,8 +2834,6 @@ async def transforms( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -2968,12 +2924,16 @@ async def transforms( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get transforms. Returns configuration and usage information about transforms. - CAT APIs are only intended for human consumption using the Kibana console or - command line. They are not intended for use by applications. For application - consumption, use the get transform statistics API. + .. raw:: html + +

Get transform information.

+

Get configuration and usage information about transforms.

+

CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get transform statistics API.

+ - ``_ + ``_ :param transform_id: A transform identifier or a wildcard expression. If you do not specify one of these options, the API returns information for all @@ -2991,11 +2951,6 @@ async def transforms( :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. :param size: The maximum number of transforms to obtain. @@ -3026,10 +2981,6 @@ async def transforms( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: diff --git a/elasticsearch/_async/client/ccr.py b/elasticsearch/_async/client/ccr.py index c4f7b0c05..9880c32dc 100644 --- a/elasticsearch/_async/client/ccr.py +++ b/elasticsearch/_async/client/ccr.py @@ -36,9 +36,13 @@ async def delete_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes auto-follow patterns. + .. raw:: html - ``_ +

Delete auto-follow patterns. + Delete a collection of cross-cluster replication auto-follow patterns.

+ + + ``_ :param name: The name of the auto follow pattern. """ @@ -107,9 +111,14 @@ async def follow( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a new follower index configured to follow the referenced leader index. + .. raw:: html + +

Create a follower. + Create a cross-cluster replication follower index that follows a specific leader index. + When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index.

+ - ``_ + ``_ :param index: The name of the follower index :param leader_index: @@ -198,10 +207,14 @@ async def follow_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about all follower indices, including parameters and status - for each follower index + .. raw:: html - ``_ +

Get follower information. + Get information about all cross-cluster replication follower indices. + For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused.

+ + + ``_ :param index: A comma-separated list of index patterns; use `_all` to perform the operation on all indices @@ -240,10 +253,14 @@ async def follow_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves follower stats. return shard-level stats about the following tasks - associated with each shard for the specified indices. + .. raw:: html + +

Get follower stats. + Get cross-cluster replication follower stats. + The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices.

- ``_ + + ``_ :param index: A comma-separated list of index patterns; use `_all` to perform the operation on all indices @@ -294,9 +311,21 @@ async def forget_follower( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes the follower retention leases from the leader. + .. raw:: html + +

Forget a follower. + Remove the cross-cluster replication follower retention leases from the leader.

+

A following index takes out retention leases on its leader index. + These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. + When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. + However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. + While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. + This API exists to enable manually removing the leases when the unfollow API is unable to do so.

+

NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. + The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked.

+ - ``_ + ``_ :param index: the name of the leader index for which specified follower retention leases should be removed @@ -350,10 +379,13 @@ async def get_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets configured auto-follow patterns. Returns the specified auto-follow pattern - collection. + .. raw:: html - ``_ +

Get auto-follow patterns. + Get cross-cluster replication auto-follow patterns.

+ + + ``_ :param name: Specifies the auto-follow pattern collection that you want to retrieve. If you do not specify a name, the API returns information for all collections. @@ -395,9 +427,18 @@ async def pause_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Pauses an auto-follow pattern + .. raw:: html + +

Pause an auto-follow pattern. + Pause a cross-cluster replication auto-follow pattern. + When the API returns, the auto-follow pattern is inactive. + New indices that are created on the remote cluster and match the auto-follow patterns are ignored.

+

You can resume auto-following with the resume auto-follow pattern API. + When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. + Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim.

- ``_ + + ``_ :param name: The name of the auto follow pattern that should pause discovering new indices to follow. @@ -436,10 +477,16 @@ async def pause_follow( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Pauses a follower index. The follower index will not fetch any additional operations - from the leader index. + .. raw:: html + +

Pause a follower. + Pause a cross-cluster replication follower index. + The follower index will not fetch any additional operations from the leader index. + You can resume following with the resume follower API. + You can pause and resume a follower index to change the configuration of the following task.

- ``_ + + ``_ :param index: The name of the follower index that should pause following its leader index. @@ -512,11 +559,17 @@ async def put_auto_follow_pattern( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a new named collection of auto-follow patterns against a specified remote - cluster. Newly created indices on the remote cluster matching any of the specified - patterns will be automatically configured as follower indices. + .. raw:: html + +

Create or update auto-follow patterns. + Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. + Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. + Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern.

+

This API can also be used to update auto-follow patterns. + NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns.

- ``_ + + ``_ :param name: The name of the collection of auto-follow patterns. :param remote_cluster: The remote cluster containing the leader indices to match @@ -638,9 +691,15 @@ async def resume_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resumes an auto-follow pattern that has been paused + .. raw:: html + +

Resume an auto-follow pattern. + Resume a cross-cluster replication auto-follow pattern that was paused. + The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. + Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim.

+ - ``_ + ``_ :param name: The name of the auto follow pattern to resume discovering new indices to follow. @@ -703,9 +762,16 @@ async def resume_follow( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Resumes a follower index that has been paused + .. raw:: html - ``_ +

Resume a follower. + Resume a cross-cluster replication follower index that was paused. + The follower index could have been paused with the pause follower API. + Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. + When this API returns, the follower index will resume fetching operations from the leader index.

+ + + ``_ :param index: The name of the follow index to resume following. :param max_outstanding_read_requests: @@ -785,9 +851,13 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets all stats related to cross-cluster replication. + .. raw:: html + +

Get cross-cluster replication stats. + This API returns stats about auto-following and the same shard-level stats as the get follower stats API.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ccr/stats" @@ -821,10 +891,16 @@ async def unfollow( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stops the following task associated with a follower index and removes index metadata - and settings associated with cross-cluster replication. + .. raw:: html + +

Unfollow an index. + Convert a cross-cluster replication follower index to a regular index. + The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. + The follower index must be paused and closed before you call the unfollow API.

+

NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation.

+ - ``_ + ``_ :param index: The name of the follower index that should be turned into a regular index. diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py index dfd44b588..54ee329af 100644 --- a/elasticsearch/_async/client/cluster.py +++ b/elasticsearch/_async/client/cluster.py @@ -44,9 +44,16 @@ async def allocation_explain( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Provides explanations for shard allocations in the cluster. + .. raw:: html - ``_ +

Explain the shard allocations. + Get explanations for shard allocations in the cluster. + For unassigned shards, it provides an explanation for why the shard is unassigned. + For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. + This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.

+ + + ``_ :param current_node: Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. @@ -113,11 +120,13 @@ async def delete_component_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete component templates. Deletes component templates. Component templates - are building blocks for constructing index templates that specify index mappings, - settings, and aliases. + .. raw:: html + +

Delete component templates. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

- ``_ + + ``_ :param name: Comma-separated list or wildcard expression of component template names used to limit the request. @@ -165,9 +174,13 @@ async def delete_voting_config_exclusions( wait_for_removal: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clears cluster voting config exclusions. + .. raw:: html + +

Clear cluster voting config exclusions. + Remove master-eligible nodes from the voting configuration exclusion list.

- ``_ + + ``_ :param wait_for_removal: Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions @@ -212,10 +225,13 @@ async def exists_component_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check component templates. Returns information about whether a particular component - template exists. + .. raw:: html + +

Check component templates. + Returns information about whether a particular component template exists.

+ - ``_ + ``_ :param name: Comma-separated list of component template names used to limit the request. Wildcard (*) expressions are supported. @@ -268,9 +284,13 @@ async def get_component_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get component templates. Retrieves information about component templates. + .. raw:: html + +

Get component templates. + Get information about component templates.

+ - ``_ + ``_ :param name: Comma-separated list of component template names used to limit the request. Wildcard (`*`) expressions are supported. @@ -331,10 +351,13 @@ async def get_settings( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster-wide settings. By default, it returns only settings that have - been explicitly defined. + .. raw:: html - ``_ +

Get cluster-wide settings. + By default, it returns only settings that have been explicitly defined.

+ + + ``_ :param flat_settings: If `true`, returns settings in flat format. :param include_defaults: If `true`, returns default cluster settings from the @@ -414,17 +437,19 @@ async def health( ] = None, ) -> ObjectApiResponse[t.Any]: """ - The cluster health API returns a simple status on the health of the cluster. - You can also use the API to get the health status of only specified data streams - and indices. For data streams, the API retrieves the health status of the stream’s - backing indices. The cluster health status is: green, yellow or red. On the shard - level, a red status indicates that the specific shard is not allocated in the - cluster, yellow means that the primary shard is allocated but replicas are not, - and green means that all shards are allocated. The index level status is controlled - by the worst shard status. The cluster status is controlled by the worst index - status. - - ``_ + .. raw:: html + +

Get the cluster health status. + You can also use the API to get the health status of only specified data streams and indices. + For data streams, the API retrieves the health status of the stream’s backing indices.

+

The cluster health status is: green, yellow or red. + On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. + The index level status is controlled by the worst shard status.

+

One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. + The cluster status is controlled by the worst index status.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (`*`) are supported. To target @@ -526,9 +551,13 @@ async def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster info. Returns basic information about the cluster. + .. raw:: html - ``_ +

Get cluster info. + Returns basic information about the cluster.

+ + + ``_ :param target: Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest. @@ -568,16 +597,16 @@ async def pending_tasks( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster-level changes (such as create index, update mapping, allocate - or fail shard) that have not yet been executed. NOTE: This API returns a list - of any pending updates to the cluster state. These are distinct from the tasks - reported by the Task Management API which include periodic tasks and tasks initiated - by the user, such as node stats, search queries, or create index requests. However, - if a user-initiated task such as a create index command causes a cluster state - update, the activity of this task might be reported by both task api and pending - cluster tasks API. + .. raw:: html + +

Get the pending cluster tasks. + Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect.

+

NOTE: This API returns a list of any pending updates to the cluster state. + These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. + However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.

+ - ``_ + ``_ :param local: If `true`, the request retrieves information from the local node only. If `false`, information is retrieved from the master node. @@ -623,9 +652,26 @@ async def post_voting_config_exclusions( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the cluster voting config exclusions by node ids or node names. + .. raw:: html - ``_ +

Update voting configuration exclusions. + Update the cluster voting config exclusions by node IDs or node names. + By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. + If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. + The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. + It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes.

+

Clusters should have no voting configuration exclusions in normal operation. + Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. + This API waits for the nodes to be fully removed from the cluster before it returns. + If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster.

+

A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. + If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. + In that case, you may safely retry the call.

+

NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. + They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.

+ + + ``_ :param node_ids: A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify @@ -685,22 +731,25 @@ async def put_component_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a component template. Creates or updates a component template. - Component templates are building blocks for constructing index templates that - specify index mappings, settings, and aliases. An index template can be composed - of multiple component templates. To use a component template, specify it in an - index template’s `composed_of` list. Component templates are only applied to - new data streams and indices as part of a matching index template. Settings and - mappings specified directly in the index template or the create index request - override any settings or mappings specified in a component template. Component - templates are only used during index creation. For data streams, this includes - data stream creation and the creation of a stream’s backing indices. Changes - to component templates do not affect existing indices, including a stream’s backing - indices. You can use C-style `/* *\\/` block comments in component templates. - You can include comments anywhere in the request body except before the opening - curly bracket. - - ``_ + .. raw:: html + +

Create or update a component template. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+

An index template can be composed of multiple component templates. + To use a component template, specify it in an index template’s composed_of list. + Component templates are only applied to new data streams and indices as part of a matching index template.

+

Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.

+

Component templates are only used during index creation. + For data streams, this includes data stream creation and the creation of a stream’s backing indices. + Changes to component templates do not affect existing indices, including a stream’s backing indices.

+

You can use C-style /* *\\/ block comments in component templates. + You can include comments anywhere in the request body except before the opening curly bracket.

+

Applying component templates

+

You cannot directly apply a component template to a data stream or index. + To be applied, a component template must be included in an index template's composed_of list.

+ + + ``_ :param name: Name of the component template to create. Elasticsearch includes the following built-in component templates: `logs-mappings`; `logs-settings`; @@ -721,8 +770,8 @@ async def put_component_template( :param master_timeout: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - :param meta: Optional user metadata about the component template. May have any - contents. This map is not automatically generated by Elasticsearch. This + :param meta: Optional user metadata about the component template. It may have + any contents. This map is not automatically generated by Elasticsearch. This information is stored in the cluster state, so keeping it short is preferable. To unset `_meta`, replace the template without specifying this information. :param version: Version number used to manage component templates externally. @@ -787,9 +836,25 @@ async def put_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the cluster settings. + .. raw:: html - ``_ +

Update the cluster settings. + Configure and update dynamic settings on a running cluster. + You can also configure dynamic settings locally on an unstarted or shut down node in elasticsearch.yml.

+

Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. + You can also reset transient or persistent settings by assigning them a null value.

+

If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) elasticsearch.yml setting; 4) Default setting value. + For example, you can apply a transient setting to override a persistent setting or elasticsearch.yml setting. + However, a change to an elasticsearch.yml setting will not override a defined transient or persistent setting.

+

TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster. + If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings. + Only use elasticsearch.yml for static cluster settings and node settings. + The API doesn’t require a restart and ensures a setting’s value is the same on all nodes.

+

WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. + If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration.

+ + + ``_ :param flat_settings: Return settings in flat format (default: false) :param master_timeout: Explicit operation timeout for connection to master node @@ -841,11 +906,14 @@ async def remote_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - The cluster remote info API allows you to retrieve all of the configured remote - cluster information. It returns connection and endpoint information keyed by - the configured remote cluster alias. + .. raw:: html + +

Get remote cluster information. + Get all of the configured remote cluster information. + This API returns connection and endpoint information keyed by the configured remote cluster alias.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_remote/info" @@ -888,15 +956,29 @@ async def reroute( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows to manually change the allocation of individual shards in the cluster. + .. raw:: html + +

Reroute the cluster. + Manually change the allocation of individual shards in the cluster. + For example, a shard can be moved from one node to another explicitly, an allocation can be canceled, and an unassigned shard can be explicitly allocated to a specific node.

+

It is important to note that after processing any reroute commands Elasticsearch will perform rebalancing as normal (respecting the values of settings such as cluster.routing.rebalance.enable) in order to remain in a balanced state. + For example, if the requested allocation includes moving a shard from node1 to node2 then this may cause a shard to be moved from node2 back to node1 to even things out.

+

The cluster can be set to disable allocations using the cluster.routing.allocation.enable setting. + If allocations are disabled then the only allocations that will be performed are explicit ones given using the reroute command, and consequent allocations due to rebalancing.

+

The cluster will attempt to allocate a shard a maximum of index.allocation.max_retries times in a row (defaults to 5), before giving up and leaving the shard unallocated. + This scenario can be caused by structural problems such as having an analyzer which refers to a stopwords file which doesn’t exist on all nodes.

+

Once the problem has been corrected, allocation can be manually retried by calling the reroute API with the ?retry_failed URI query parameter, which will attempt a single retry round for these shards.

- ``_ + + ``_ :param commands: Defines the commands to perform. - :param dry_run: If true, then the request simulates the operation only and returns - the resulting state. + :param dry_run: If true, then the request simulates the operation. It will calculate + the result of applying the commands to the current cluster state and return + the resulting cluster state after the commands (and rebalancing) have been + applied; it will not actually perform the requested changes. :param explain: If true, then the response contains an explanation of why the - commands can or cannot be executed. + commands can or cannot run. :param master_timeout: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. @@ -975,9 +1057,25 @@ async def state( wait_for_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns a comprehensive information about the state of the cluster. + .. raw:: html + +

Get the cluster state. + Get comprehensive information about the state of the cluster.

+

The cluster state is an internal data structure which keeps track of a variety of information needed by every node, including the identity and attributes of the other nodes in the cluster; cluster-wide settings; index metadata, including the mapping and settings for each index; the location and status of every shard copy in the cluster.

+

The elected master node ensures that every node in the cluster has a copy of the same cluster state. + This API lets you retrieve a representation of this internal state for debugging or diagnostic purposes. + You may need to consult the Elasticsearch source code to determine the precise meaning of the response.

+

By default the API will route requests to the elected master node since this node is the authoritative source of cluster states. + You can also retrieve the cluster state held on the node handling the API request by adding the ?local=true query parameter.

+

Elasticsearch may need to expend significant effort to compute a response to this API in larger clusters, and the response may comprise a very large quantity of data. + If you use this API repeatedly, your cluster may become unstable.

+

WARNING: The response is a representation of an internal data structure. + Its format is not subject to the same compatibility guarantees as other more stable APIs and may change from version to version. + Do not query this API using external monitoring tools. + Instead, obtain the information you require using other more stable cluster APIs.

+ - ``_ + ``_ :param metric: Limit the information returned to the specified metrics :param index: A comma-separated list of index names; use `_all` or empty string @@ -1053,21 +1151,23 @@ async def stats( node_id: t.Optional[t.Union[str, t.Sequence[str]]] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, - flat_settings: t.Optional[bool] = None, human: t.Optional[bool] = None, + include_remotes: t.Optional[bool] = None, pretty: t.Optional[bool] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster statistics. It returns basic index metrics (shard numbers, store - size, memory usage) and information about the current nodes that form the cluster - (number, roles, os, jvm versions, memory usage, cpu and installed plugins). + .. raw:: html + +

Get cluster statistics. + Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).

- ``_ + + ``_ :param node_id: Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. - :param flat_settings: If `true`, returns settings in flat format. + :param include_remotes: Include remote cluster data into the response :param timeout: Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, timed out nodes are included in the response’s `_nodes.failed` property. @@ -1085,10 +1185,10 @@ async def stats( __query["error_trace"] = error_trace if filter_path is not None: __query["filter_path"] = filter_path - if flat_settings is not None: - __query["flat_settings"] = flat_settings if human is not None: __query["human"] = human + if include_remotes is not None: + __query["include_remotes"] = include_remotes if pretty is not None: __query["pretty"] = pretty if timeout is not None: diff --git a/elasticsearch/_async/client/connector.py b/elasticsearch/_async/client/connector.py index 8f3fe042d..2f5080821 100644 --- a/elasticsearch/_async/client/connector.py +++ b/elasticsearch/_async/client/connector.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class ConnectorClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def check_in( self, *, @@ -36,9 +43,13 @@ async def check_in( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the last_seen field in the connector, and sets it to current timestamp + .. raw:: html - ``_ +

Check in a connector.

+

Update the last_seen field in the connector and set it to the current timestamp.

+ + + ``_ :param connector_id: The unique identifier of the connector to be checked in """ @@ -66,6 +77,7 @@ async def check_in( ) @_rewrite_parameters() + @_stability_warning(Stability.BETA) async def delete( self, *, @@ -77,9 +89,16 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a connector. + .. raw:: html + +

Delete a connector.

+

Removes a connector and associated sync jobs. + This is a destructive action that is not recoverable. + NOTE: This action doesn’t delete any API keys, ingest pipelines, or data indices associated with the connector. + These need to be removed manually.

- ``_ + + ``_ :param connector_id: The unique identifier of the connector to be deleted :param delete_sync_jobs: A flag indicating if associated sync jobs should be @@ -111,6 +130,7 @@ async def delete( ) @_rewrite_parameters() + @_stability_warning(Stability.BETA) async def get( self, *, @@ -121,9 +141,13 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a connector. + .. raw:: html + +

Get a connector.

+

Get the details about a connector.

- ``_ + + ``_ :param connector_id: The unique identifier of the connector """ @@ -166,6 +190,7 @@ async def get( "sync_cursor", ), ) + @_stability_warning(Stability.EXPERIMENTAL) async def last_sync( self, *, @@ -215,9 +240,14 @@ async def last_sync( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates last sync stats in the connector document + .. raw:: html + +

Update the connector last sync stats.

+

Update the fields related to the last sync of a connector. + This action is used for analytics and monitoring.

- ``_ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param last_access_control_sync_error: @@ -294,6 +324,7 @@ async def last_sync( @_rewrite_parameters( parameter_aliases={"from": "from_"}, ) + @_stability_warning(Stability.BETA) async def list( self, *, @@ -309,9 +340,13 @@ async def list( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns existing connectors. + .. raw:: html + +

Get all connectors.

+

Get information about all connectors.

- ``_ + + ``_ :param connector_name: A comma-separated list of connector names to fetch connector documents for @@ -367,6 +402,7 @@ async def list( "service_type", ), ) + @_stability_warning(Stability.BETA) async def post( self, *, @@ -383,9 +419,15 @@ async def post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a connector. + .. raw:: html + +

Create a connector.

+

Connectors are Elasticsearch integrations that bring content from third-party data sources, which can be deployed on Elastic Cloud or hosted on your own infrastructure. + Elastic managed connectors (Native connectors) are a managed service on Elastic Cloud. + Self-managed connectors (Connector clients) are self-managed on your infrastructure.

- ``_ + + ``_ :param description: :param index_name: @@ -444,6 +486,7 @@ async def post( "service_type", ), ) + @_stability_warning(Stability.BETA) async def put( self, *, @@ -461,9 +504,12 @@ async def put( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a connector. + .. raw:: html + +

Create or update a connector.

- ``_ + + ``_ :param connector_id: The unique identifier of the connector to be created or updated. ID is auto-generated if not provided. @@ -520,6 +566,7 @@ async def put( ) @_rewrite_parameters() + @_stability_warning(Stability.BETA) async def sync_job_cancel( self, *, @@ -530,9 +577,14 @@ async def sync_job_cancel( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancels a connector sync job. + .. raw:: html + +

Cancel a connector sync job.

+

Cancel a connector sync job, which sets the status to cancelling and updates cancellation_requested_at to the current time. + The connector service is then responsible for setting the status of connector sync jobs to cancelled.

- ``_ + + ``_ :param connector_sync_job_id: The unique identifier of the connector sync job """ @@ -564,6 +616,130 @@ async def sync_job_cancel( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def sync_job_check_in( + self, + *, + connector_sync_job_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Check in a connector sync job. + Check in a connector sync job and set the last_seen field to the current time before updating it in the internal index.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_sync_job_id: The unique identifier of the connector sync job + to be checked in. + """ + if connector_sync_job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_sync_job_id'") + __path_parts: t.Dict[str, str] = { + "connector_sync_job_id": _quote(connector_sync_job_id) + } + __path = ( + f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_check_in' + ) + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="connector.sync_job_check_in", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("worker_hostname", "sync_cursor"), + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def sync_job_claim( + self, + *, + connector_sync_job_id: str, + worker_hostname: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + sync_cursor: t.Optional[t.Any] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Claim a connector sync job. + This action updates the job status to in_progress and sets the last_seen and started_at timestamps to the current time. + Additionally, it can set the sync_cursor property for the sync job.

+

This API is not intended for direct connector management by users. + It supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_sync_job_id: The unique identifier of the connector sync job. + :param worker_hostname: The host name of the current system that will run the + job. + :param sync_cursor: The cursor object from the last incremental sync job. This + should reference the `sync_cursor` field in the connector state for which + the job runs. + """ + if connector_sync_job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_sync_job_id'") + if worker_hostname is None and body is None: + raise ValueError("Empty value passed for parameter 'worker_hostname'") + __path_parts: t.Dict[str, str] = { + "connector_sync_job_id": _quote(connector_sync_job_id) + } + __path = f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_claim' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if worker_hostname is not None: + __body["worker_hostname"] = worker_hostname + if sync_cursor is not None: + __body["sync_cursor"] = sync_cursor + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.sync_job_claim", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.BETA) async def sync_job_delete( self, *, @@ -574,9 +750,14 @@ async def sync_job_delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a connector sync job. + .. raw:: html + +

Delete a connector sync job.

+

Remove a connector sync job and its associated data. + This is a destructive action that is not recoverable.

+ - ``_ + ``_ :param connector_sync_job_id: The unique identifier of the connector sync job to be deleted @@ -606,7 +787,69 @@ async def sync_job_delete( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("error",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def sync_job_error( + self, + *, + connector_sync_job_id: str, + error: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Set a connector sync job error. + Set the error field for a connector sync job and set its status to error.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_sync_job_id: The unique identifier for the connector sync job. + :param error: The error for the connector sync job error field. + """ + if connector_sync_job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_sync_job_id'") + if error is None and body is None: + raise ValueError("Empty value passed for parameter 'error'") + __path_parts: t.Dict[str, str] = { + "connector_sync_job_id": _quote(connector_sync_job_id) + } + __path = f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_error' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if error is not None: + __body["error"] = error + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.sync_job_error", + path_parts=__path_parts, + ) + @_rewrite_parameters() + @_stability_warning(Stability.BETA) async def sync_job_get( self, *, @@ -617,9 +860,12 @@ async def sync_job_get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a connector sync job. + .. raw:: html + +

Get a connector sync job.

+ - ``_ + ``_ :param connector_sync_job_id: The unique identifier of the connector sync job """ @@ -651,6 +897,7 @@ async def sync_job_get( @_rewrite_parameters( parameter_aliases={"from": "from_"}, ) + @_stability_warning(Stability.BETA) async def sync_job_list( self, *, @@ -685,9 +932,13 @@ async def sync_job_list( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Lists connector sync jobs. + .. raw:: html - ``_ +

Get all connector sync jobs.

+

Get information about all stored connector sync jobs listed by their creation date in ascending order.

+ + + ``_ :param connector_id: A connector id to fetch connector sync jobs for :param from_: Starting offset (default: 0) @@ -729,6 +980,7 @@ async def sync_job_list( @_rewrite_parameters( body_fields=("id", "job_type", "trigger_method"), ) + @_stability_warning(Stability.BETA) async def sync_job_post( self, *, @@ -746,9 +998,13 @@ async def sync_job_post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a connector sync job. + .. raw:: html + +

Create a connector sync job.

+

Create a connector sync job document in the internal index and initialize its counters and timestamps with default values.

+ - ``_ + ``_ :param id: The id of the associated connector :param job_type: @@ -786,7 +1042,111 @@ async def sync_job_post( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=( + "deleted_document_count", + "indexed_document_count", + "indexed_document_volume", + "last_seen", + "metadata", + "total_document_count", + ), + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def sync_job_update_stats( + self, + *, + connector_sync_job_id: str, + deleted_document_count: t.Optional[int] = None, + indexed_document_count: t.Optional[int] = None, + indexed_document_volume: t.Optional[int] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + last_seen: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + metadata: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + total_document_count: t.Optional[int] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Set the connector sync job stats. + Stats include: deleted_document_count, indexed_document_count, indexed_document_volume, and total_document_count. + You can also update last_seen. + This API is mainly used by the connector service for updating sync job information.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_sync_job_id: The unique identifier of the connector sync job. + :param deleted_document_count: The number of documents the sync job deleted. + :param indexed_document_count: The number of documents the sync job indexed. + :param indexed_document_volume: The total size of the data (in MiB) the sync + job indexed. + :param last_seen: The timestamp to use in the `last_seen` property for the connector + sync job. + :param metadata: The connector-specific metadata. + :param total_document_count: The total number of documents in the target index + after the sync job finished. + """ + if connector_sync_job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_sync_job_id'") + if deleted_document_count is None and body is None: + raise ValueError( + "Empty value passed for parameter 'deleted_document_count'" + ) + if indexed_document_count is None and body is None: + raise ValueError( + "Empty value passed for parameter 'indexed_document_count'" + ) + if indexed_document_volume is None and body is None: + raise ValueError( + "Empty value passed for parameter 'indexed_document_volume'" + ) + __path_parts: t.Dict[str, str] = { + "connector_sync_job_id": _quote(connector_sync_job_id) + } + __path = f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_stats' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if deleted_document_count is not None: + __body["deleted_document_count"] = deleted_document_count + if indexed_document_count is not None: + __body["indexed_document_count"] = indexed_document_count + if indexed_document_volume is not None: + __body["indexed_document_volume"] = indexed_document_volume + if last_seen is not None: + __body["last_seen"] = last_seen + if metadata is not None: + __body["metadata"] = metadata + if total_document_count is not None: + __body["total_document_count"] = total_document_count + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.sync_job_update_stats", + path_parts=__path_parts, + ) + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def update_active_filtering( self, *, @@ -797,9 +1157,13 @@ async def update_active_filtering( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Activates the valid draft filtering for a connector. + .. raw:: html + +

Activate the connector draft filter.

+

Activates the valid draft filtering for a connector.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated """ @@ -829,6 +1193,7 @@ async def update_active_filtering( @_rewrite_parameters( body_fields=("api_key_id", "api_key_secret_id"), ) + @_stability_warning(Stability.BETA) async def update_api_key_id( self, *, @@ -842,9 +1207,16 @@ async def update_api_key_id( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the API key id in the connector document + .. raw:: html - ``_ +

Update the connector API key ID.

+

Update the api_key_id and api_key_secret_id fields of a connector. + You can specify the ID of the API key used for authorization and the ID of the connector secret where the API key is stored. + The connector secret ID is required only for Elastic managed (native) connectors. + Self-managed connectors (connector clients) do not use this field.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param api_key_id: @@ -883,6 +1255,7 @@ async def update_api_key_id( @_rewrite_parameters( body_fields=("configuration", "values"), ) + @_stability_warning(Stability.BETA) async def update_configuration( self, *, @@ -896,9 +1269,13 @@ async def update_configuration( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the configuration field in the connector document + .. raw:: html + +

Update the connector configuration.

+

Update the configuration field in the connector document.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param configuration: @@ -937,6 +1314,7 @@ async def update_configuration( @_rewrite_parameters( body_fields=("error",), ) + @_stability_warning(Stability.EXPERIMENTAL) async def update_error( self, *, @@ -949,9 +1327,15 @@ async def update_error( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the filtering field in the connector document + .. raw:: html - ``_ +

Update the connector error field.

+

Set the error field for the connector. + If the error provided in the request body is non-null, the connector’s status is updated to error. + Otherwise, if the error is reset to null, the connector status is updated to connected.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param error: @@ -986,9 +1370,78 @@ async def update_error( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("features",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def update_features( + self, + *, + connector_id: str, + features: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update the connector features. + Update the connector features in the connector document. + This API can be used to control the following aspects of a connector:

+
    +
  • document-level security
  • +
  • incremental syncs
  • +
  • advanced sync rules
  • +
  • basic sync rules
  • +
+

Normally, the running connector service automatically manages these features. + However, you can use this API to override the default behavior.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_id: The unique identifier of the connector to be updated. + :param features: + """ + if connector_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_id'") + if features is None and body is None: + raise ValueError("Empty value passed for parameter 'features'") + __path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)} + __path = f'/_connector/{__path_parts["connector_id"]}/_features' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if features is not None: + __body["features"] = features + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.update_features", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("advanced_snippet", "filtering", "rules"), ) + @_stability_warning(Stability.BETA) async def update_filtering( self, *, @@ -1003,9 +1456,15 @@ async def update_filtering( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the filtering field in the connector document + .. raw:: html + +

Update the connector filtering.

+

Update the draft filtering configuration of a connector and marks the draft validation state as edited. + The filtering draft is activated once validated by the running Elastic connector service. + The filtering property is used to configure sync rules (both basic and advanced) for a connector.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param advanced_snippet: @@ -1047,6 +1506,7 @@ async def update_filtering( @_rewrite_parameters( body_fields=("validation",), ) + @_stability_warning(Stability.EXPERIMENTAL) async def update_filtering_validation( self, *, @@ -1059,9 +1519,13 @@ async def update_filtering_validation( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the draft filtering validation info for a connector. + .. raw:: html - ``_ +

Update the connector draft filtering validation.

+

Update the draft filtering validation info for a connector.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param validation: @@ -1099,6 +1563,7 @@ async def update_filtering_validation( @_rewrite_parameters( body_fields=("index_name",), ) + @_stability_warning(Stability.BETA) async def update_index_name( self, *, @@ -1111,9 +1576,13 @@ async def update_index_name( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the index_name in the connector document + .. raw:: html + +

Update the connector index name.

+

Update the index_name field of a connector, specifying the index where the data ingested by the connector is stored.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param index_name: @@ -1151,6 +1620,7 @@ async def update_index_name( @_rewrite_parameters( body_fields=("description", "name"), ) + @_stability_warning(Stability.BETA) async def update_name( self, *, @@ -1164,9 +1634,12 @@ async def update_name( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the name and description fields in the connector document + .. raw:: html - ``_ +

Update the connector name and description.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param description: @@ -1205,6 +1678,7 @@ async def update_name( @_rewrite_parameters( body_fields=("is_native",), ) + @_stability_warning(Stability.BETA) async def update_native( self, *, @@ -1217,9 +1691,12 @@ async def update_native( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the is_native flag in the connector document + .. raw:: html + +

Update the connector is_native flag.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param is_native: @@ -1257,6 +1734,7 @@ async def update_native( @_rewrite_parameters( body_fields=("pipeline",), ) + @_stability_warning(Stability.BETA) async def update_pipeline( self, *, @@ -1269,9 +1747,13 @@ async def update_pipeline( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the pipeline field in the connector document + .. raw:: html - ``_ +

Update the connector pipeline.

+

When you create a new connector, the configuration of an ingest pipeline is populated with default settings.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param pipeline: @@ -1309,6 +1791,7 @@ async def update_pipeline( @_rewrite_parameters( body_fields=("scheduling",), ) + @_stability_warning(Stability.BETA) async def update_scheduling( self, *, @@ -1321,9 +1804,12 @@ async def update_scheduling( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the scheduling field in the connector document + .. raw:: html + +

Update the connector scheduling.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param scheduling: @@ -1361,6 +1847,7 @@ async def update_scheduling( @_rewrite_parameters( body_fields=("service_type",), ) + @_stability_warning(Stability.BETA) async def update_service_type( self, *, @@ -1373,9 +1860,12 @@ async def update_service_type( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the service type of the connector + .. raw:: html - ``_ +

Update the connector service type.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param service_type: @@ -1413,6 +1903,7 @@ async def update_service_type( @_rewrite_parameters( body_fields=("status",), ) + @_stability_warning(Stability.EXPERIMENTAL) async def update_status( self, *, @@ -1432,9 +1923,12 @@ async def update_status( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the status of the connector + .. raw:: html + +

Update the connector status.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param status: diff --git a/elasticsearch/_async/client/dangling_indices.py b/elasticsearch/_async/client/dangling_indices.py index b65002f44..d7b5d5597 100644 --- a/elasticsearch/_async/client/dangling_indices.py +++ b/elasticsearch/_async/client/dangling_indices.py @@ -39,13 +39,19 @@ async def delete_dangling_index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes the specified dangling index + .. raw:: html - ``_ +

Delete a dangling index. + If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

- :param index_uuid: The UUID of the dangling index - :param accept_data_loss: Must be set to true in order to delete the dangling - index + + ``_ + + :param index_uuid: The UUID of the index to delete. Use the get dangling indices + API to find the UUID. + :param accept_data_loss: This parameter must be set to true to acknowledge that + it will no longer be possible to recove data from the dangling index. :param master_timeout: Specify timeout for connection to master :param timeout: Explicit operation timeout """ @@ -94,13 +100,22 @@ async def import_dangling_index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Imports the specified dangling index + .. raw:: html + +

Import a dangling index.

+

If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

- ``_ - :param index_uuid: The UUID of the dangling index - :param accept_data_loss: Must be set to true in order to import the dangling - index + ``_ + + :param index_uuid: The UUID of the index to import. Use the get dangling indices + API to locate the UUID. + :param accept_data_loss: This parameter must be set to true to import a dangling + index. Because Elasticsearch cannot know where the dangling index data came + from or determine which shard copies are fresh and which are stale, it cannot + guarantee that the imported data represents the latest state of the index + when it was last in the cluster. :param master_timeout: Specify timeout for connection to master :param timeout: Explicit operation timeout """ @@ -145,9 +160,15 @@ async def list_dangling_indices( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns all dangling indices. + .. raw:: html + +

Get the dangling indices.

+

If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

+

Use this API to list dangling indices, which you can then import or delete.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_dangling" diff --git a/elasticsearch/_async/client/enrich.py b/elasticsearch/_async/client/enrich.py index 6663826b9..1eb44df8a 100644 --- a/elasticsearch/_async/client/enrich.py +++ b/elasticsearch/_async/client/enrich.py @@ -36,9 +36,13 @@ async def delete_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an enrich policy. Deletes an existing enrich policy and its enrich index. + .. raw:: html - ``_ +

Delete an enrich policy. + Deletes an existing enrich policy and its enrich index.

+ + + ``_ :param name: Enrich policy to delete. """ @@ -77,9 +81,13 @@ async def execute_policy( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates the enrich index for an existing enrich policy. + .. raw:: html + +

Run an enrich policy. + Create the enrich index for an existing enrich policy.

- ``_ + + ``_ :param name: Enrich policy to execute. :param wait_for_completion: If `true`, the request blocks other enrich policy @@ -121,9 +129,13 @@ async def get_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an enrich policy. Returns information about an enrich policy. + .. raw:: html + +

Get an enrich policy. + Returns information about an enrich policy.

- ``_ + + ``_ :param name: Comma-separated list of enrich policy names used to limit the request. To return information for all enrich policies, omit this parameter. @@ -171,9 +183,13 @@ async def put_policy( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an enrich policy. Creates an enrich policy. + .. raw:: html + +

Create an enrich policy. + Creates an enrich policy.

+ - ``_ + ``_ :param name: Name of the enrich policy to create or update. :param geo_match: Matches enrich data to incoming documents based on a `geo_shape` @@ -224,10 +240,13 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get enrich stats. Returns enrich coordinator statistics and information about - enrich policies that are currently executing. + .. raw:: html + +

Get enrich stats. + Returns enrich coordinator statistics and information about enrich policies that are currently executing.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_enrich/_stats" diff --git a/elasticsearch/_async/client/eql.py b/elasticsearch/_async/client/eql.py index 3944130a1..3908aadd7 100644 --- a/elasticsearch/_async/client/eql.py +++ b/elasticsearch/_async/client/eql.py @@ -36,10 +36,14 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an async EQL search or a stored synchronous EQL search. The API also - deletes results for the search. + .. raw:: html - ``_ +

Delete an async EQL search. + Delete an async EQL search or a stored synchronous EQL search. + The API also deletes results for the search.

+ + + ``_ :param id: Identifier for the search to delete. A search ID is provided in the EQL search API's response for an async search. A search ID is also provided @@ -83,10 +87,13 @@ async def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current status and available results for an async EQL search or a - stored synchronous EQL search. + .. raw:: html + +

Get async EQL search results. + Get the current status and available results for an async EQL search or a stored synchronous EQL search.

+ - ``_ + ``_ :param id: Identifier for the search. :param keep_alive: Period for which the search and its results are stored on @@ -134,10 +141,13 @@ async def get_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current status for an async EQL search or a stored synchronous EQL - search without returning results. + .. raw:: html - ``_ +

Get the async EQL status. + Get the current status for an async EQL search or a stored synchronous EQL search without returning results.

+ + + ``_ :param id: Identifier for the search. """ @@ -223,9 +233,14 @@ async def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns results matching a query expressed in Event Query Language (EQL) + .. raw:: html + +

Get EQL search results. + Returns search results for an Event Query Language (EQL) query. + EQL assumes each document in a data stream or index corresponds to an event.

+ - ``_ + ``_ :param index: The name of the index to scope the operation :param query: EQL query you wish to run. diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py index d0849643e..8e375e90c 100644 --- a/elasticsearch/_async/client/esql.py +++ b/elasticsearch/_async/client/esql.py @@ -20,7 +20,7 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import _rewrite_parameters +from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters class EsqlClient(NamespacedClient): @@ -30,6 +30,288 @@ class EsqlClient(NamespacedClient): "query", "columnar", "filter", + "include_ccs_metadata", + "locale", + "params", + "profile", + "tables", + ), + ignore_deprecated_options={"params"}, + ) + async def async_query( + self, + *, + query: t.Optional[str] = None, + columnar: t.Optional[bool] = None, + delimiter: t.Optional[str] = None, + drop_null_columns: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter: t.Optional[t.Mapping[str, t.Any]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + format: t.Optional[ + t.Union[ + str, + t.Literal[ + "arrow", "cbor", "csv", "json", "smile", "tsv", "txt", "yaml" + ], + ] + ] = None, + human: t.Optional[bool] = None, + include_ccs_metadata: t.Optional[bool] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + keep_on_completion: t.Optional[bool] = None, + locale: t.Optional[str] = None, + params: t.Optional[ + t.Sequence[t.Union[None, bool, float, int, str, t.Any]] + ] = None, + pretty: t.Optional[bool] = None, + profile: t.Optional[bool] = None, + tables: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Mapping[str, t.Any]]] + ] = None, + wait_for_completion_timeout: t.Optional[ + t.Union[str, t.Literal[-1], t.Literal[0]] + ] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Run an async ES|QL query. + Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available.

+

The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties.

+ + + ``_ + + :param query: The ES|QL query API accepts an ES|QL query string in the query + parameter, runs it, and returns the results. + :param columnar: By default, ES|QL returns results as rows. For example, FROM + returns each individual document as one row. For the JSON, YAML, CBOR and + smile formats, ES|QL can return the results in a columnar fashion where one + row represents all the values of a certain column in the results. + :param delimiter: The character to use between values within a CSV row. It is + valid only for the CSV format. + :param drop_null_columns: Indicates whether columns that are entirely `null` + will be removed from the `columns` and `values` portion of the results. If + `true`, the response will include an extra section under the name `all_columns` + which has the name of all the columns. + :param filter: Specify a Query DSL query in the filter parameter to filter the + set of documents that an ES|QL query runs on. + :param format: A short version of the Accept header, for example `json` or `yaml`. + :param include_ccs_metadata: When set to `true` and performing a cross-cluster + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. + :param keep_alive: The period for which the query and its results are stored + in the cluster. The default period is five days. When this period expires, + the query and its results are deleted, even if the query is still ongoing. + If the `keep_on_completion` parameter is false, Elasticsearch only stores + async queries that do not complete within the period set by the `wait_for_completion_timeout` + parameter, regardless of this value. + :param keep_on_completion: Indicates whether the query and its results are stored + in the cluster. If false, the query and its results are stored in the cluster + only if the request does not complete during the period set by the `wait_for_completion_timeout` + parameter. + :param locale: + :param params: To avoid any attempts of hacking or code injection, extract the + values in a separate list of parameters. Use question mark placeholders (?) + in the query string for each of the parameters. + :param profile: If provided and `true` the response will include an extra `profile` + object with information on how the query was executed. This information is + for human debugging and its format can change at any time but it can give + some insight into the performance of each part of the query. + :param tables: Tables to use with the LOOKUP operation. The top level key is + the table name and the next level key is the column name. + :param wait_for_completion_timeout: The period to wait for the request to finish. + By default, the request waits for 1 second for the query results. If the + query completes during this period, results are returned Otherwise, a query + ID is returned that can later be used to retrieve the results. + """ + if query is None and body is None: + raise ValueError("Empty value passed for parameter 'query'") + __path_parts: t.Dict[str, str] = {} + __path = "/_query/async" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if delimiter is not None: + __query["delimiter"] = delimiter + if drop_null_columns is not None: + __query["drop_null_columns"] = drop_null_columns + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if format is not None: + __query["format"] = format + if human is not None: + __query["human"] = human + if keep_alive is not None: + __query["keep_alive"] = keep_alive + if keep_on_completion is not None: + __query["keep_on_completion"] = keep_on_completion + if pretty is not None: + __query["pretty"] = pretty + if wait_for_completion_timeout is not None: + __query["wait_for_completion_timeout"] = wait_for_completion_timeout + if not __body: + if query is not None: + __body["query"] = query + if columnar is not None: + __body["columnar"] = columnar + if filter is not None: + __body["filter"] = filter + if include_ccs_metadata is not None: + __body["include_ccs_metadata"] = include_ccs_metadata + if locale is not None: + __body["locale"] = locale + if params is not None: + __body["params"] = params + if profile is not None: + __body["profile"] = profile + if tables is not None: + __body["tables"] = tables + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="esql.async_query", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + async def async_query_delete( + self, + *, + id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Delete an async ES|QL query. + If the query is still running, it is cancelled. + Otherwise, the stored results are deleted.

+

If the Elasticsearch security features are enabled, only the following users can use this API to delete a query:

+
    +
  • The authenticated user that submitted the original query request
  • +
  • Users with the cancel_task cluster privilege
  • +
+ + + ``_ + + :param id: The unique identifier of the query. A query ID is provided in the + ES|QL async query API response for a query that does not complete in the + designated time. A query ID is also provided when the request was submitted + with the `keep_on_completion` parameter set to `true`. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_query/async/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_delete", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + async def async_query_get( + self, + *, + id: str, + drop_null_columns: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + wait_for_completion_timeout: t.Optional[ + t.Union[str, t.Literal[-1], t.Literal[0]] + ] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get async ES|QL query results. + Get the current status and available results or stored results for an ES|QL asynchronous query. + If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API.

+ + + ``_ + + :param id: The unique identifier of the query. A query ID is provided in the + ES|QL async query API response for a query that does not complete in the + designated time. A query ID is also provided when the request was submitted + with the `keep_on_completion` parameter set to `true`. + :param drop_null_columns: Indicates whether columns that are entirely `null` + will be removed from the `columns` and `values` portion of the results. If + `true`, the response will include an extra section under the name `all_columns` + which has the name of all the columns. + :param keep_alive: The period for which the query and its results are stored + in the cluster. When this period expires, the query and its results are deleted, + even if the query is still ongoing. + :param wait_for_completion_timeout: The period to wait for the request to finish. + By default, the request waits for complete query results. If the request + completes during the period specified in this parameter, complete query results + are returned. Otherwise, the response returns an `is_running` value of `true` + and no results. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_query/async/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + if drop_null_columns is not None: + __query["drop_null_columns"] = drop_null_columns + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if keep_alive is not None: + __query["keep_alive"] = keep_alive + if pretty is not None: + __query["pretty"] = pretty + if wait_for_completion_timeout is not None: + __query["wait_for_completion_timeout"] = wait_for_completion_timeout + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_get", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=( + "query", + "columnar", + "filter", + "include_ccs_metadata", "locale", "params", "profile", @@ -47,8 +329,16 @@ async def query( error_trace: t.Optional[bool] = None, filter: t.Optional[t.Mapping[str, t.Any]] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, - format: t.Optional[str] = None, + format: t.Optional[ + t.Union[ + str, + t.Literal[ + "arrow", "cbor", "csv", "json", "smile", "tsv", "txt", "yaml" + ], + ] + ] = None, human: t.Optional[bool] = None, + include_ccs_metadata: t.Optional[bool] = None, locale: t.Optional[str] = None, params: t.Optional[ t.Sequence[t.Union[None, bool, float, int, str, t.Any]] @@ -61,9 +351,13 @@ async def query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes an ES|QL request + .. raw:: html + +

Run an ES|QL query. + Get search results for an ES|QL (Elasticsearch query language) query.

+ - ``_ + ``_ :param query: The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. @@ -80,6 +374,10 @@ async def query( :param filter: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. :param format: A short version of the Accept header, e.g. json, yaml. + :param include_ccs_metadata: When set to `true` and performing a cross-cluster + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. :param locale: :param params: To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) @@ -118,6 +416,8 @@ async def query( __body["columnar"] = columnar if filter is not None: __body["filter"] = filter + if include_ccs_metadata is not None: + __body["include_ccs_metadata"] = include_ccs_metadata if locale is not None: __body["locale"] = locale if params is not None: diff --git a/elasticsearch/_async/client/features.py b/elasticsearch/_async/client/features.py index a6fbf4d14..c432e7dfc 100644 --- a/elasticsearch/_async/client/features.py +++ b/elasticsearch/_async/client/features.py @@ -20,7 +20,7 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import _rewrite_parameters +from .utils import Stability, _rewrite_parameters, _stability_warning class FeaturesClient(NamespacedClient): @@ -35,10 +35,19 @@ async def get_features( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets a list of features which can be included in snapshots using the feature_states - field when creating a snapshot + .. raw:: html - ``_ +

Get the features. + Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. + You can use this API to determine which feature states to include when taking a snapshot. + By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not.

+

A feature state includes one or more system indices necessary for a given feature to function. + In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together.

+

The features listed by this API are a combination of built-in features and features defined by plugins. + In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_features" @@ -62,6 +71,7 @@ async def get_features( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def reset_features( self, *, @@ -71,9 +81,22 @@ async def reset_features( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resets the internal state of features, usually by deleting system indices + .. raw:: html + +

Reset the features. + Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices.

+

WARNING: Intended for development and testing use only. Do not reset features on a production cluster.

+

Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. + This deletes all state information stored in system indices.

+

The response code is HTTP 200 if the state is successfully reset for all features. + It is HTTP 500 if the reset operation failed for any feature.

+

Note that select features might provide a way to reset particular system indices. + Using this API resets all features, both those that are built-in and implemented as plugins.

+

To list the features that will be affected, use the get features API.

+

IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_features/_reset" diff --git a/elasticsearch/_async/client/fleet.py b/elasticsearch/_async/client/fleet.py index e34aa0fd9..acdb046de 100644 --- a/elasticsearch/_async/client/fleet.py +++ b/elasticsearch/_async/client/fleet.py @@ -20,7 +20,13 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class FleetClient(NamespacedClient): @@ -40,10 +46,12 @@ async def global_checkpoints( wait_for_index: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current global checkpoints for an index. This API is design for internal - use by the fleet server project. + .. raw:: html - ``_ +

Returns the current global checkpoints for an index. This API is design for internal use by the fleet server project.

+ + + ``_ :param index: A single index or index alias that resolves to a single index. :param checkpoints: A comma separated list of previous global checkpoints. When @@ -91,6 +99,7 @@ async def global_checkpoints( @_rewrite_parameters( body_name="searches", ) + @_stability_warning(Stability.EXPERIMENTAL) async def msearch( self, *, @@ -125,10 +134,12 @@ async def msearch( wait_for_checkpoints: t.Optional[t.Sequence[int]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) - with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) - API. However, similar to the fleet search API, it supports the wait_for_checkpoints - parameter. + .. raw:: html + +

Executes several fleet searches with a single API request. + The API follows the same structure as the multi search API. However, similar to the fleet search API, it + supports the wait_for_checkpoints parameter.

+ :param searches: :param index: A single target to search. If the target is an index alias, it @@ -277,6 +288,7 @@ async def msearch( "from": "from_", }, ) + @_stability_warning(Stability.EXPERIMENTAL) async def search( self, *, @@ -370,9 +382,11 @@ async def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The purpose of the fleet search api is to provide a search api where the search - will only be executed after provided checkpoint has been processed and is visible - for searches inside of Elasticsearch. + .. raw:: html + +

The purpose of the fleet search api is to provide a search api where the search will only be executed + after provided checkpoint has been processed and is visible for searches inside of Elasticsearch.

+ :param index: A single target to search. If the target is an index alias, it must resolve to a single index. diff --git a/elasticsearch/_async/client/graph.py b/elasticsearch/_async/client/graph.py index 963428a45..5b86970b1 100644 --- a/elasticsearch/_async/client/graph.py +++ b/elasticsearch/_async/client/graph.py @@ -45,10 +45,17 @@ async def explore( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Extracts and summarizes information about the documents and terms in an Elasticsearch - data stream or index. + .. raw:: html - ``_ +

Explore graph analytics. + Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. + The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. + An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. + Subsequent requests enable you to spider out from one more vertices of interest. + You can exclude vertices that have already been returned.

+ + + ``_ :param index: Name of the index. :param connections: Specifies or more fields from which you want to extract terms diff --git a/elasticsearch/_async/client/ilm.py b/elasticsearch/_async/client/ilm.py index 9a644f797..d43ad52c4 100644 --- a/elasticsearch/_async/client/ilm.py +++ b/elasticsearch/_async/client/ilm.py @@ -38,11 +38,13 @@ async def delete_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes the specified lifecycle policy definition. You cannot delete policies - that are currently in use. If the policy is being used to manage any indices, - the request fails and returns an error. + .. raw:: html - ``_ +

Delete a lifecycle policy. + You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error.

+ + + ``_ :param name: Identifier for the policy. :param master_timeout: Period to wait for a connection to the master node. If @@ -93,11 +95,15 @@ async def explain_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the index’s current lifecycle state, such as the - currently executing phase, action, and step. Shows when the index entered each - one, the definition of the running phase, and information about any failures. + .. raw:: html + +

Explain the lifecycle state. + Get the current lifecycle status for one or more indices. + For data streams, the API retrieves the current lifecycle status for the stream's backing indices.

+

The response indicates when the index entered each lifecycle state, provides the definition of the running phase, and information about any failures.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases to target. Supports wildcards (`*`). To target all data streams and indices, use `*` @@ -157,9 +163,12 @@ async def get_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a lifecycle policy. + .. raw:: html + +

Get lifecycle policies.

+ - ``_ + ``_ :param name: Identifier for the policy. :param master_timeout: Period to wait for a connection to the master node. If @@ -208,9 +217,13 @@ async def get_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the current index lifecycle management (ILM) status. + .. raw:: html - ``_ +

Get the ILM status. + Get the current index lifecycle management status.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ilm/status" @@ -249,12 +262,24 @@ async def migrate_to_data_tiers( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Switches the indices, ILM policies, and legacy, composable and component templates - from using custom node attributes and attribute-based allocation filters to using - data tiers, and optionally deletes one legacy index template.+ Using node roles - enables ILM to automatically move the indices between data tiers. + .. raw:: html + +

Migrate to data tiers routing. + Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. + Optionally, delete one legacy index template. + Using node roles enables ILM to automatically move the indices between data tiers.

+

Migrating away from custom node attributes routing can be manually performed. + This API provides an automated way of performing three out of the four manual steps listed in the migration guide:

+
    +
  1. Stop setting the custom hot attribute on new indices.
  2. +
  3. Remove custom allocation settings from existing ILM policies.
  4. +
  5. Replace custom allocation settings from existing indices with the corresponding tier preference.
  6. +
+

ILM must be stopped before performing the migration. + Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED.

- ``_ + + ``_ :param dry_run: If true, simulates the migration from node attributes based allocation filters to data tiers, but does not perform the migration. This provides @@ -304,24 +329,41 @@ async def move_to_step( *, index: str, current_step: t.Optional[t.Mapping[str, t.Any]] = None, + next_step: t.Optional[t.Mapping[str, t.Any]] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, - next_step: t.Optional[t.Mapping[str, t.Any]] = None, pretty: t.Optional[bool] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Manually moves an index into the specified step and executes that step. + .. raw:: html - ``_ +

Move to a lifecycle step. + Manually move an index into a specific step in the lifecycle policy and run that step.

+

WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API.

+

You must specify both the current step and the step to be executed in the body of the request. + The request will fail if the current step does not match the step currently running for the index + This is to prevent the index from being moved from an unexpected step into the next step.

+

When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. + If only the phase is specified, the index will move to the first step of the first action in the target phase. + If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. + Only actions specified in the ILM policy are considered valid. + An index cannot move to a step that is not part of its policy.

+ + + ``_ :param index: The name of the index whose lifecycle step is to change - :param current_step: - :param next_step: + :param current_step: The step that the index is expected to be in. + :param next_step: The step that you want to run. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") + if current_step is None and body is None: + raise ValueError("Empty value passed for parameter 'current_step'") + if next_step is None and body is None: + raise ValueError("Empty value passed for parameter 'next_step'") __path_parts: t.Dict[str, str] = {"index": _quote(index)} __path = f'/_ilm/move/{__path_parts["index"]}' __query: t.Dict[str, t.Any] = {} @@ -371,10 +413,14 @@ async def put_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a lifecycle policy. If the specified policy exists, the policy is replaced - and the policy version is incremented. + .. raw:: html + +

Create or update a lifecycle policy. + If the specified policy exists, it is replaced and the policy version is incremented.

+

NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions.

- ``_ + + ``_ :param name: Identifier for the policy. :param master_timeout: Period to wait for a connection to the master node. If @@ -431,9 +477,14 @@ async def remove_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes the assigned lifecycle policy and stops managing the specified index + .. raw:: html + +

Remove policies from an index. + Remove the assigned lifecycle policies from an index or a data stream's backing indices. + It also stops managing the indices.

+ - ``_ + ``_ :param index: The name of the index to remove policy on """ @@ -471,9 +522,15 @@ async def retry( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retries executing the policy for an index that is in the ERROR step. + .. raw:: html - ``_ +

Retry a policy. + Retry running the lifecycle policy for an index that is in the ERROR step. + The API sets the policy back to the step where the error occurred and runs the step. + Use the explain lifecycle state API to determine whether an index is in the ERROR step.

+ + + ``_ :param index: The name of the indices (comma-separated) whose failed lifecycle step is to be retry @@ -513,12 +570,18 @@ async def start( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start the index lifecycle management (ILM) plugin. + .. raw:: html + +

Start the ILM plugin. + Start the index lifecycle management plugin if it is currently stopped. + ILM is started automatically when the cluster is formed. + Restarting ILM is necessary only when it has been stopped using the stop ILM API.

- ``_ - :param master_timeout: - :param timeout: + ``_ + + :param master_timeout: Explicit operation timeout for connection to master node + :param timeout: Explicit operation timeout """ __path_parts: t.Dict[str, str] = {} __path = "/_ilm/start" @@ -557,13 +620,19 @@ async def stop( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Halts all lifecycle management operations and stops the index lifecycle management - (ILM) plugin + .. raw:: html + +

Stop the ILM plugin. + Halt all lifecycle management operations and stop the index lifecycle management plugin. + This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices.

+

The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. + Use the get ILM status API to check whether ILM is running.

+ - ``_ + ``_ - :param master_timeout: - :param timeout: + :param master_timeout: Explicit operation timeout for connection to master node + :param timeout: Explicit operation timeout """ __path_parts: t.Dict[str, str] = {} __path = "/_ilm/stop" diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index f60e358c9..3ba69b273 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -20,7 +20,13 @@ from elastic_transport import HeadApiResponse, ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class IndicesClient(NamespacedClient): @@ -49,10 +55,13 @@ async def add_block( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Add an index block. Limits the operations allowed on an index by blocking specific - operation types. + .. raw:: html - ``_ +

Add an index block. + Limits the operations allowed on an index by blocking specific operation types.

+ + + ``_ :param index: A comma separated list of indices to add a block to :param block: The block to add (one of read, write, read_only or metadata) @@ -137,9 +146,17 @@ async def analyze( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Performs analysis on a text string and returns the resulting tokens. + .. raw:: html + +

Get tokens from text analysis. + The analyze API performs analysis on a text string and returns the resulting tokens.

+

Generating excessive amount of tokens may cause a node to run out of memory. + The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. + If more than this limit of tokens gets generated, an error occurs. + The _analyze endpoint without a specified index will always use 10000 as its limit.

- ``_ + + ``_ :param index: Index used to derive the analyzer. If specified, the `analyzer` or field parameter overrides this value. If no index is specified or the @@ -238,10 +255,17 @@ async def clear_cache( request: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clears the caches of one or more indices. For data streams, the API clears the - caches of the stream’s backing indices. + .. raw:: html + +

Clear the cache. + Clear the cache of one or more indices. + For data streams, the API clears the caches of the stream's backing indices.

+

By default, the clear cache API clears all caches. + To clear only specific caches, use the fielddata, query, or request parameters. + To clear the cache only of specific fields, use the fields parameter.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -324,9 +348,46 @@ async def clone( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clones an existing index. - - ``_ + .. raw:: html + +

Clone an index. + Clone an existing index into a new index. + Each original primary shard is cloned into a new primary shard in the new index.

+

IMPORTANT: Elasticsearch does not apply index templates to the resulting index. + The API also does not copy index metadata from the original index. + Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. + For example, if you clone a CCR follower index, the resulting clone will not be a follower index.

+

The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. + To set the number of replicas in the resulting index, configure these settings in the clone request.

+

Cloning works as follows:

+
    +
  • First, it creates a new target index with the same definition as the source index.
  • +
  • Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process.
  • +
  • Finally, it recovers the target index as though it were a closed index which had just been re-opened.
  • +
+

IMPORTANT: Indices can only be cloned if they meet the following requirements:

+
    +
  • The index must be marked as read-only and have a cluster health status of green.
  • +
  • The target index must not exist.
  • +
  • The source index must have the same number of primary shards as the target index.
  • +
  • The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+

The current write index on a data stream cannot be cloned. + In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned.

+

NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index.

+

Monitor the cloning process

+

The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow.

+

The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. + At this point, all shards are in the state unassigned. + If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node.

+

Once the primary shard is allocated, it moves to state initializing, and the clone process begins. + When the clone operation completes, the shard will become active. + At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node.

+

Wait for active shards

+

Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well.

+ + + ``_ :param index: Name of the source index to clone. :param target: Name of the target index to create. @@ -412,9 +473,25 @@ async def close( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Closes an index. - - ``_ + .. raw:: html + +

Close an index. + A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. + It is not possible to index documents or to search for documents in a closed index. + Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster.

+

When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. + The shards will then go through the normal recovery process. + The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.

+

You can open and close multiple indices. + An error is thrown if the request explicitly refers to a missing index. + This behaviour can be turned off using the ignore_unavailable=true parameter.

+

By default, you must explicitly name the indices you are opening or closing. + To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API.

+

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. + Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false.

+ + + ``_ :param index: Comma-separated list or wildcard expression of index names used to limit the request. @@ -493,9 +570,29 @@ async def create( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an index. Creates a new index. - - ``_ + .. raw:: html + +

Create an index. + You can use the create index API to add a new index to an Elasticsearch cluster. + When creating an index, you can specify the following:

+
    +
  • Settings for the index.
  • +
  • Mappings for fields in the index.
  • +
  • Index aliases
  • +
+

Wait for active shards

+

By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. + The index creation response will indicate what happened. + For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. + Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. + These values simply indicate whether the operation completed before the timeout. + If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. + If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true).

+

You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. + Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations.

+ + + ``_ :param index: Name of the index you wish to create. :param aliases: Aliases for the index. @@ -566,10 +663,14 @@ async def create_data_stream( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a data stream. Creates a data stream. You must have a matching index template - with data stream enabled. + .. raw:: html - ``_ +

Create a data stream. + Creates a data stream. + You must have a matching index template with data stream enabled.

+ + + ``_ :param name: Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include `\\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, @@ -628,9 +729,13 @@ async def data_streams_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream stats. Retrieves statistics for one or more data streams. + .. raw:: html + +

Get data stream stats. + Retrieves statistics for one or more data streams.

- ``_ + + ``_ :param name: Comma-separated list of data streams used to limit the request. Wildcard expressions (`*`) are supported. To target all data streams in a @@ -689,9 +794,17 @@ async def delete( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete indices. Deletes one or more indices. + .. raw:: html + +

Delete indices. + Deleting an index deletes its documents, shards, and metadata. + It does not delete related Kibana components, such as data views, visualizations, or dashboards.

+

You cannot delete the current write index of a data stream. + To delete the index, you must roll over the data stream so a new write index is created. + You can then use the delete index API to delete the previous write index.

- ``_ + + ``_ :param index: Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not support wildcards (`*`) or `_all`. @@ -759,9 +872,13 @@ async def delete_alias( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an alias. Removes a data stream or index from an alias. + .. raw:: html + +

Delete an alias. + Removes a data stream or index from an alias.

- ``_ + + ``_ :param index: Comma-separated list of data streams or indices used to limit the request. Supports wildcards (`*`). @@ -823,10 +940,13 @@ async def delete_data_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete data stream lifecycles. Removes the data stream lifecycle from a data - stream, rendering it not managed by the data stream lifecycle. + .. raw:: html + +

Delete data stream lifecycles. + Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle.

- ``_ + + ``_ :param name: A comma-separated list of data streams of which the data stream lifecycle will be deleted; use `*` to get all data streams @@ -884,9 +1004,13 @@ async def delete_data_stream( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete data streams. Deletes one or more data streams and their backing indices. + .. raw:: html + +

Delete data streams. + Deletes one or more data streams and their backing indices.

+ - ``_ + ``_ :param name: Comma-separated list of data streams to delete. Wildcard (`*`) expressions are supported. @@ -936,12 +1060,15 @@ async def delete_index_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an index template. The provided may contain multiple - template names separated by a comma. If multiple template names are specified - then there is no wildcard support and the provided names should match completely - with existing templates. + .. raw:: html + +

Delete an index template. + The provided may contain multiple template names separated by a comma. If multiple template + names are specified then there is no wildcard support and the provided names should match completely with + existing templates.

+ - ``_ + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. @@ -991,9 +1118,13 @@ async def delete_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a legacy index template. + .. raw:: html - ``_ +

Delete a legacy index template. + IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+ + + ``_ :param name: The name of the legacy index template to delete. Wildcard (`*`) expressions are supported. @@ -1031,6 +1162,7 @@ async def delete_template( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def disk_usage( self, *, @@ -1053,9 +1185,18 @@ async def disk_usage( run_expensive_tasks: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Analyzes the disk usage of each field of an index or data stream. + .. raw:: html + +

Analyze the index disk usage. + Analyze the disk usage of each field of an index or data stream. + This API might not support indices created in previous Elasticsearch versions. + The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API.

+

NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. + Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. + The stored size of the _id field is likely underestimated while the _source field is overestimated.

+ - ``_ + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. It’s recommended to execute this API with a single @@ -1113,6 +1254,7 @@ async def disk_usage( @_rewrite_parameters( body_name="config", ) + @_stability_warning(Stability.EXPERIMENTAL) async def downsample( self, *, @@ -1126,11 +1268,18 @@ async def downsample( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Aggregates a time series (TSDS) index and stores pre-computed statistical summaries - (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped - by a configured time interval. + .. raw:: html - ``_ +

Downsample an index. + Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. + For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. + All documents within an hour interval are summarized and stored as a single document in the downsample index.

+

NOTE: Only indices in a time series data stream are supported. + Neither field nor document level security can be defined on the source index. + The source index must be read only (index.blocks.write: true).

+ + + ``_ :param index: Name of the time series index to downsample. :param target_index: Name of the index to create. @@ -1196,10 +1345,13 @@ async def exists( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check indices. Checks if one or more indices, index aliases, or data streams - exist. + .. raw:: html + +

Check indices. + Check if one or more indices, index aliases, or data streams exist.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases. Supports wildcards (`*`). @@ -1275,9 +1427,13 @@ async def exists_alias( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check aliases. Checks if one or more data stream or index aliases exist. + .. raw:: html + +

Check aliases. + Checks if one or more data stream or index aliases exist.

- ``_ + + ``_ :param name: Comma-separated list of aliases to check. Supports wildcards (`*`). :param index: Comma-separated list of data streams or indices used to limit the @@ -1345,9 +1501,13 @@ async def exists_index_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Returns information about whether a particular index template exists. + .. raw:: html + +

Check index templates. + Check whether index templates exist.

- ``_ + + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. @@ -1394,16 +1554,23 @@ async def exists_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check existence of index templates. Returns information about whether a particular - index template exists. + .. raw:: html + +

Check existence of index templates. + Get information about whether index templates exist. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

- ``_ - :param name: The comma separated names of the index templates - :param flat_settings: Return settings in flat format (default: false) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Explicit operation timeout for connection to master node + ``_ + + :param name: A comma-separated list of index template names used to limit the + request. Wildcard (`*`) expressions are supported. + :param flat_settings: Indicates whether to use a flat format for the response. + :param local: Indicates whether to get information from the local node only. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. To indicate that the request should never timeout, set it to `-1`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -1447,12 +1614,13 @@ async def explain_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the status for a data stream lifecycle. Retrieves information about an index - or data stream’s current data stream lifecycle status, such as time since index - creation, time since rollover, the lifecycle configuration managing the index, - or any errors encountered during lifecycle execution. + .. raw:: html + +

Get the status for a data stream lifecycle. + Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.

+ - ``_ + ``_ :param index: The name of the index to explain :param include_defaults: indicates if the API should return the default values @@ -1487,6 +1655,7 @@ async def explain_data_lifecycle( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def field_usage_stats( self, *, @@ -1513,9 +1682,17 @@ async def field_usage_stats( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns field usage information for each shard and field of an index. + .. raw:: html + +

Get field usage stats. + Get field usage information for each shard and field of an index. + Field usage statistics are automatically captured when queries are running on a cluster. + A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use.

+

The response body reports the per-shard usage count of the data structures that back the fields in the index. + A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times.

+ - ``_ + ``_ :param index: Comma-separated list or wildcard expression of index names used to limit the request. @@ -1601,9 +1778,20 @@ async def flush( wait_if_ongoing: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Flushes one or more data streams or indices. + .. raw:: html - ``_ +

Flush data streams or indices. + Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. + When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. + Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush.

+

After each operation has been flushed it is permanently stored in the Lucene index. + This may mean that there is no need to maintain an additional copy of it in the transaction log. + The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space.

+

It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. + If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases to flush. Supports wildcards (`*`). To flush all data streams and indices, omit this @@ -1684,9 +1872,51 @@ async def forcemerge( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Performs the force merge operation on one or more indices. - - ``_ + .. raw:: html + +

Force a merge. + Perform the force merge operation on the shards of one or more indices. + For data streams, the API forces a merge on the shards of the stream's backing indices.

+

Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. + Merging normally happens automatically, but sometimes it is useful to trigger a merge manually.

+

WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). + When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". + These soft-deleted documents are automatically cleaned up during regular segment merges. + But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. + So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. + If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally.

+

Blocks during a force merge

+

Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). + If the client connection is lost before completion then the force merge process will continue in the background. + Any new requests to force merge the same indices will also block until the ongoing force merge is complete.

+

Running force merge asynchronously

+

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. + However, you can not cancel this task as the force merge task is not cancelable. + Elasticsearch creates a record of this task as a document at _tasks/<task_id>. + When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.

+

Force merging multiple indices

+

You can force merge multiple indices with a single request by targeting:

+
    +
  • One or more data streams that contain multiple backing indices
  • +
  • Multiple indices
  • +
  • One or more aliases
  • +
  • All data streams and indices in a cluster
  • +
+

Each targeted shard is force-merged separately using the force_merge threadpool. + By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. + If you expand the force_merge threadpool on a node then it will force merge its shards in parallel

+

Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one.

+

Data streams and time-based indices

+

Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. + In these cases, each index only receives indexing traffic for a certain period of time. + Once an index receive no more writes, its shards can be force-merged to a single segment. + This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. + For example:

+
POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1
+          
+ + + ``_ :param index: A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices @@ -1777,10 +2007,14 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index information. Returns information about one or more indices. For data - streams, the API returns information about the stream’s backing indices. + .. raw:: html + +

Get index information. + Get information about one or more indices. For data streams, the API returns information about the + stream’s backing indices.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported. @@ -1867,9 +2101,13 @@ async def get_alias( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get aliases. Retrieves information for one or more data stream or index aliases. + .. raw:: html + +

Get aliases. + Retrieves information for one or more data stream or index aliases.

+ - ``_ + ``_ :param index: Comma-separated list of data streams or indices used to limit the request. Supports wildcards (`*`). To target all data streams and indices, @@ -1949,10 +2187,13 @@ async def get_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream lifecycles. Retrieves the data stream lifecycle configuration - of one or more data streams. + .. raw:: html + +

Get data stream lifecycles. + Retrieves the data stream lifecycle configuration of one or more data streams.

+ - ``_ + ``_ :param name: Comma-separated list of data streams to limit the request. Supports wildcards (`*`). To target all data streams, omit this parameter or use `*` @@ -1994,6 +2235,45 @@ async def get_data_lifecycle( path_parts=__path_parts, ) + @_rewrite_parameters() + async def get_data_lifecycle_stats( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get data stream lifecycle stats. + Get statistics about the data streams that are managed by a data stream lifecycle.

+ + + ``_ + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_lifecycle/stats" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_data_lifecycle_stats", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def get_data_stream( self, @@ -2016,9 +2296,13 @@ async def get_data_stream( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data streams. Retrieves information about one or more data streams. + .. raw:: html + +

Get data streams. + Retrieves information about one or more data streams.

+ - ``_ + ``_ :param name: Comma-separated list of data stream names used to limit the request. Wildcard (`*`) expressions are supported. If omitted, all data streams are @@ -2091,13 +2375,18 @@ async def get_field_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get mapping definitions. Retrieves mapping definitions for one or more fields. - For data streams, the API retrieves field mappings for the stream’s backing indices. + .. raw:: html + +

Get mapping definitions. + Retrieves mapping definitions for one or more fields. + For data streams, the API retrieves field mappings for the stream’s backing indices.

+

This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields.

+ - ``_ + ``_ :param fields: Comma-separated list or wildcard expression of fields used to - limit returned information. + limit returned information. Supports wildcards (`*`). :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. @@ -2169,9 +2458,13 @@ async def get_index_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index templates. Returns information about one or more index templates. + .. raw:: html - ``_ +

Get index templates. + Get information about one or more index templates.

+ + + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. @@ -2242,10 +2535,13 @@ async def get_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get mapping definitions. Retrieves mapping definitions for one or more indices. - For data streams, the API retrieves mappings for the stream’s backing indices. + .. raw:: html + +

Get mapping definitions. + For data streams, the API retrieves mappings for the stream’s backing indices.

+ - ``_ + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2327,10 +2623,14 @@ async def get_settings( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index settings. Returns setting information for one or more indices. For - data streams, returns setting information for the stream’s backing indices. + .. raw:: html - ``_ +

Get index settings. + Get setting information for one or more indices. + For data streams, it returns setting information for the stream's backing indices.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2415,9 +2715,14 @@ async def get_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index templates. Retrieves information about one or more index templates. + .. raw:: html + +

Get legacy index templates. + Get information about one or more index templates.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

- ``_ + + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (`*`) expressions are supported. To return all index templates, @@ -2474,16 +2779,22 @@ async def migrate_to_data_stream( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Convert an index alias to a data stream. Converts an index alias to a data stream. - You must have a matching index template that is data stream enabled. The alias - must meet the following criteria: The alias must have a write index; All indices - for the alias must have a `@timestamp` field mapping of a `date` or `date_nanos` - field type; The alias must not have any filters; The alias must not use custom - routing. If successful, the request removes the alias and creates a data stream - with the same name. The indices for the alias become hidden backing indices for - the stream. The write index for the alias becomes the write index for the stream. + .. raw:: html + +

Convert an index alias to a data stream. + Converts an index alias to a data stream. + You must have a matching index template that is data stream enabled. + The alias must meet the following criteria: + The alias must have a write index; + All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; + The alias must not have any filters; + The alias must not use custom routing. + If successful, the request removes the alias and creates a data stream with the same name. + The indices for the alias become hidden backing indices for the stream. + The write index for the alias becomes the write index for the stream.

- ``_ + + ``_ :param name: Name of the index alias to convert to a data stream. :param master_timeout: Period to wait for a connection to the master node. If @@ -2533,10 +2844,13 @@ async def modify_data_stream( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update data streams. Performs one or more data stream modification actions in - a single atomic operation. + .. raw:: html + +

Update data streams. + Performs one or more data stream modification actions in a single atomic operation.

- ``_ + + ``_ :param actions: Actions to perform. """ @@ -2594,9 +2908,28 @@ async def open( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Opens a closed index. For data streams, the API opens any closed backing indices. - - ``_ + .. raw:: html + +

Open a closed index. + For data streams, the API opens any closed backing indices.

+

A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. + It is not possible to index documents or to search for documents in a closed index. + This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster.

+

When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. + The shards will then go through the normal recovery process. + The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.

+

You can open and close multiple indices. + An error is thrown if the request explicitly refers to a missing index. + This behavior can be turned off by using the ignore_unavailable=true parameter.

+

By default, you must explicitly name the indices you are opening or closing. + To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. + This setting can also be changed with the cluster update settings API.

+

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. + Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false.

+

Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). By default, you must explicitly @@ -2669,10 +3002,20 @@ async def promote_data_stream( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Promotes a data stream from a replicated data stream managed by CCR to a regular - data stream + .. raw:: html - ``_ +

Promote a data stream. + Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream.

+

With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. + These data streams can't be rolled over in the local cluster. + These replicated data streams roll over only if the upstream data stream rolls over. + In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster.

+

NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. + If this is missing, the data stream will not be able to roll over until a matching index template is created. + This will affect the lifecycle management of the data stream and interfere with the data stream size and retention.

+ + + ``_ :param name: The name of the data stream :param master_timeout: Period to wait for a connection to the master node. If @@ -2732,9 +3075,13 @@ async def put_alias( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an alias. Adds a data stream or index to an alias. + .. raw:: html + +

Create or update an alias. + Adds a data stream or index to an alias.

- ``_ + + ``_ :param index: Comma-separated list of data streams or indices to add. Supports wildcards (`*`). Wildcard patterns that match both data streams and indices @@ -2834,10 +3181,13 @@ async def put_data_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update data stream lifecycles. Update the data stream lifecycle of the specified - data streams. + .. raw:: html + +

Update data stream lifecycles. + Update the data stream lifecycle of the specified data streams.

- ``_ + + ``_ :param name: Comma-separated list of data streams used to limit the request. Supports wildcards (`*`). To target all data streams use `*` or `_all`. @@ -2936,10 +3286,32 @@ async def put_index_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an index template. Index templates define settings, mappings, - and aliases that can be applied automatically to new indices. - - ``_ + .. raw:: html + +

Create or update an index template. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

+

Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. + Index templates are applied during data stream or index creation. + For data streams, these settings and mappings are applied when the stream's backing indices are created. + Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. + Changes to index templates do not affect existing indices, including the existing backing indices of a data stream.

+

You can use C-style /* *\\/ block comments in index templates. + You can include comments anywhere in the request body, except before the opening curly bracket.

+

Multiple matching templates

+

If multiple index templates match the name of a new index or data stream, the template with the highest priority is used.

+

Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities.

+

Composing aliases, mappings, and settings

+

When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. + Any mappings, settings, or aliases from the parent index template are merged in next. + Finally, any configuration on the index request itself is merged. + Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. + If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. + This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. + If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. + If an entry already exists with the same key, then it is overwritten by the new definition.

+ + + ``_ :param name: Index or template name :param allow_auto_create: This setting overrides the value of the `action.auto_create_index` @@ -2967,8 +3339,11 @@ async def put_index_template( :param master_timeout: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - :param meta: Optional user metadata about the index template. May have any contents. - This map is not automatically generated by Elasticsearch. + :param meta: Optional user metadata about the index template. It may have any + contents. It is not automatically generated or used by Elasticsearch. This + user-defined object is stored in the cluster state, so keeping it short is + preferable To unset the metadata, replace the template without specifying + it. :param priority: Priority to determine index template precedence when a new data stream or index is created. The index template with the highest priority is chosen. If no priority is specified the template is treated as though @@ -2977,7 +3352,9 @@ async def put_index_template( :param template: Template to be applied. It may optionally include an `aliases`, `mappings`, or `settings` configuration. :param version: Version number used to manage index templates externally. This - number is not automatically generated by Elasticsearch. + number is not automatically generated by Elasticsearch. External systems + can use these version numbers to simplify template management. To unset a + version, replace the template without specifying one. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3065,10 +3442,7 @@ async def put_mapping( ] = None, dynamic_date_formats: t.Optional[t.Sequence[str]] = None, dynamic_templates: t.Optional[ - t.Union[ - t.Mapping[str, t.Mapping[str, t.Any]], - t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]], - ] + t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]] ] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ @@ -3096,11 +3470,31 @@ async def put_mapping( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update field mappings. Adds new fields to an existing data stream or index. You - can also use this API to change the search settings of existing fields. For data - streams, these changes are applied to all backing indices by default. - - ``_ + .. raw:: html + +

Update field mappings. + Add new fields to an existing data stream or index. + You can also use this API to change the search settings of existing fields and add new properties to existing object fields. + For data streams, these changes are applied to all backing indices by default.

+

Add multi-fields to an existing field

+

Multi-fields let you index the same field in different ways. + You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. + WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. + You can populate the new multi-field with the update by query API.

+

Change supported mapping parameters for an existing field

+

The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. + For example, you can use the update mapping API to update the ignore_above parameter.

+

Change the mapping of an existing field

+

Except for supported mapping parameters, you can't change the mapping or field type of an existing field. + Changing an existing field could invalidate data that's already indexed.

+

If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. + If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.

+

Rename a field

+

Renaming a field would invalidate data already indexed under the old field name. + Instead, add an alias field to create an alternate field name.

+ + + ``_ :param index: A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. @@ -3227,10 +3621,25 @@ async def put_settings( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update index settings. Changes dynamic index settings in real time. For data - streams, index setting changes are applied to all backing indices by default. - - ``_ + .. raw:: html + +

Update index settings. + Changes dynamic index settings in real time. + For data streams, index setting changes are applied to all backing indices by default.

+

To revert a setting to the default value, use a null value. + The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. + To preserve existing settings from being updated, set the preserve_existing parameter to true.

+

NOTE: You can only define new analyzers on closed indices. + To add an analyzer, you must close the index, define the analyzer, and reopen the index. + You cannot close the write index of a data stream. + To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. + Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. + This affects searches and any new data added to the stream after the rollover. + However, it does not affect the data stream's backing indices or their existing data. + To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it.

+ + + ``_ :param settings: :param index: Comma-separated list of data streams, indices, and aliases used @@ -3332,14 +3741,30 @@ async def put_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an index template. Index templates define settings, mappings, - and aliases that can be applied automatically to new indices. - - ``_ + .. raw:: html + +

Create or update a legacy index template. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices. + Elasticsearch applies templates to new indices based on an index pattern that matches the index name.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+

Composable templates always take precedence over legacy templates. + If no composable template matches a new index, matching legacy templates are applied according to their order.

+

Index templates are only applied during index creation. + Changes to index templates do not affect existing indices. + Settings and mappings specified in create index API requests override any settings or mappings specified in an index template.

+

You can use C-style /* *\\/ block comments in index templates. + You can include comments anywhere in the request body, except before the opening curly bracket.

+

Indices matching multiple templates

+

Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. + The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. + NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.

+ + + ``_ :param name: The name of the template :param aliases: Aliases for the index. - :param cause: + :param cause: User defined reason for creating/updating the index template :param create: If true, this request cannot replace or update existing index templates. :param index_patterns: Array of wildcard expressions used to match the names @@ -3354,7 +3779,8 @@ async def put_template( with lower values. :param settings: Configuration options for the index. :param version: Version number used to manage index templates externally. This - number is not automatically generated by Elasticsearch. + number is not automatically generated by Elasticsearch. To unset a version, + replace the template without specifying one. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3413,11 +3839,30 @@ async def recovery( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about ongoing and completed shard recoveries for one or more - indices. For data streams, the API returns information for the stream’s backing - indices. - - ``_ + .. raw:: html + +

Get index recovery information. + Get information about ongoing and completed shard recoveries for one or more indices. + For data streams, the API returns information for the stream's backing indices.

+

All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time.

+

Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. + When a shard recovery completes, the recovered shard is available for search and indexing.

+

Recovery automatically occurs during the following processes:

+
    +
  • When creating an index for the first time.
  • +
  • When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path.
  • +
  • Creation of new replica shard copies from the primary.
  • +
  • Relocation of a shard copy to a different node in the same cluster.
  • +
  • A snapshot restore operation.
  • +
  • A clone, shrink, or split operation.
  • +
+

You can determine the cause of a shard recovery using the recovery or cat recovery APIs.

+

The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. + It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. + This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -3477,11 +3922,21 @@ async def refresh( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Refresh an index. A refresh makes recent operations performed on one or more - indices available for search. For data streams, the API runs the refresh operation - on the stream’s backing indices. + .. raw:: html - ``_ +

Refresh an index. + A refresh makes recent operations performed on one or more indices available for search. + For data streams, the API runs the refresh operation on the stream’s backing indices.

+

By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. + You can change this default interval with the index.refresh_interval setting.

+

Refresh requests are synchronous and do not return a response until the refresh operation completes.

+

Refreshes are resource-intensive. + To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.

+

If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. + This option ensures the indexing operation waits for a periodic refresh before running the search.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -3549,9 +4004,22 @@ async def reload_search_analyzers( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reloads an index's search analyzers and their resources. + .. raw:: html + +

Reload search analyzers. + Reload an index's search analyzers and their resources. + For data streams, the API reloads search analyzers and resources for the stream's backing indices.

+

IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer.

+

You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. + To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers.

+

NOTE: This API does not perform a reload for each shard of an index. + Instead, it performs a reload for each node containing index shards. + As a result, the total shard count returned by the API can differ from the number of index shards. + Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. + This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future.

- ``_ + + ``_ :param index: A comma-separated list of index names to reload analyzers for :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves @@ -3613,11 +4081,35 @@ async def resolve_cluster( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resolves the specified index expressions to return information about each cluster, - including the local cluster, if included. Multiple patterns and remote clusters - are supported. - - ``_ + .. raw:: html + +

Resolve the cluster. + Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. + Multiple patterns and remote clusters are supported.

+

This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search.

+

You use the same index expression with this endpoint as you would for cross-cluster search. + Index and cluster exclusions are also supported with this endpoint.

+

For each cluster in the index expression, information is returned about:

+
    +
  • Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope.
  • +
  • Whether each remote cluster is configured with skip_unavailable as true or false.
  • +
  • Whether there are any indices, aliases, or data streams on that cluster that match the index expression.
  • +
  • Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index).
  • +
  • Cluster version information, including the Elasticsearch server version.
  • +
+

For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. + Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*.

+

Advantages of using this endpoint before a cross-cluster search

+

You may want to exclude a cluster or index from a search when:

+
    +
  • A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail.
  • +
  • A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search.
  • +
  • The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.)
  • +
  • A remote cluster is an older version that does not support the feature you want to use in your search.
  • +
+ + + ``_ :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified @@ -3688,10 +4180,14 @@ async def resolve_index( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resolves the specified name(s) and/or index patterns for indices, aliases, and - data streams. Multiple patterns and remote clusters are supported. + .. raw:: html - ``_ +

Resolve indices. + Resolve the names and/or index patterns for indices, aliases, and data streams. + Multiple patterns and remote clusters are supported.

+ + + ``_ :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified @@ -3762,9 +4258,37 @@ async def rollover( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Roll over to a new index. Creates a new index for a data stream or index alias. - - ``_ + .. raw:: html + +

Roll over to a new index. + TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.

+

The rollover API creates a new index for a data stream or index alias. + The API behavior depends on the rollover target.

+

Roll over a data stream

+

If you roll over a data stream, the API creates a new write index for the stream. + The stream's previous write index becomes a regular backing index. + A rollover also increments the data stream's generation.

+

Roll over an index alias with a write index

+

TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. + Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers.

+

If an index alias points to multiple indices, one of the indices must be a write index. + The rollover API creates a new write index for the alias with is_write_index set to true. + The API also sets is_write_index to false for the previous write index.

+

Roll over an index alias with one index

+

If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias.

+

NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting.

+

Increment index names for an alias

+

When you roll over an index alias, you can specify a name for the new index. + If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. + For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. + This number is always six characters and zero-padded, regardless of the previous index's name.

+

If you use an index alias for time series data, you can use date math in the index name to track the rollover date. + For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. + If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. + If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002.

+ + + ``_ :param alias: Name of the data stream or index alias to roll over. :param new_index: Name of the index to create. Supports date math. Data streams @@ -3867,10 +4391,14 @@ async def segments( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns low-level information about the Lucene segments in index shards. For - data streams, the API returns information about the stream’s backing indices. + .. raw:: html + +

Get index segments. + Get low-level information about the Lucene segments in index shards. + For data streams, the API returns information about the stream's backing indices.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -3947,10 +4475,22 @@ async def shard_stores( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves store information about replica shards in one or more indices. For - data streams, the API retrieves store information for the stream’s backing indices. + .. raw:: html + +

Get index shard stores. + Get store information about replica shards in one or more indices. + For data streams, the API retrieves store information for the stream's backing indices.

+

The index shard stores API returns the following information:

+
    +
  • The node on which each replica shard exists.
  • +
  • The allocation ID for each replica shard.
  • +
  • A unique ID for each replica shard.
  • +
  • Any errors encountered while opening the shard index or from an earlier failure.
  • +
+

By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards.

+ - ``_ + ``_ :param index: List of data streams, indices, and aliases used to limit the request. :param allow_no_indices: If false, the request returns an error if any wildcard @@ -4019,9 +4559,40 @@ async def shrink( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Shrinks an existing index into a new index with fewer primary shards. - - ``_ + .. raw:: html + +

Shrink an index. + Shrink an index into a new index with fewer primary shards.

+

Before you can shrink an index:

+
    +
  • The index must be read-only.
  • +
  • A copy of every shard in the index must reside on the same node.
  • +
  • The index must have a green health status.
  • +
+

To make shard allocation easier, we recommend you also remove the index's replica shards. + You can later re-add replica shards as part of the shrink operation.

+

The requested number of primary shards in the target index must be a factor of the number of shards in the source index. + For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. + If the number of shards in the index is a prime number it can only be shrunk into a single primary shard + Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node.

+

The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk.

+

A shrink operation:

+
    +
  • Creates a new target index with the same definition as the source index, but with a smaller number of primary shards.
  • +
  • Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks.
  • +
  • Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting.
  • +
+

IMPORTANT: Indices can only be shrunk if they satisfy the following requirements:

+
    +
  • The target index must not exist.
  • +
  • The source index must have more primary shards than the target index.
  • +
  • The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index.
  • +
  • The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard.
  • +
  • The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+ + + ``_ :param index: Name of the source index to shrink. :param target: Name of the target index to create. @@ -4094,10 +4665,13 @@ async def simulate_index_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate an index. Returns the index configuration that would be applied to the - specified index from an existing index template. + .. raw:: html + +

Simulate an index. + Get the index configuration that would be applied to the specified index from an existing index template.

- ``_ + + ``_ :param name: Name of the index to simulate :param include_defaults: If true, returns all relevant default configurations @@ -4172,10 +4746,13 @@ async def simulate_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate an index template. Returns the index configuration that would be applied - by a particular index template. + .. raw:: html + +

Simulate an index template. + Get the index configuration that would be applied by a particular index template.

- ``_ + + ``_ :param name: Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter and specify the template @@ -4304,9 +4881,46 @@ async def split( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Splits an existing index into a new index with more primary shards. - - ``_ + .. raw:: html + +

Split an index. + Split an index into a new index with more primary shards.

+
    +
  • +

    Before you can split an index:

    +
  • +
  • +

    The index must be read-only.

    +
  • +
  • +

    The cluster health status must be green.

    +
  • +
+

You can do make an index read-only with the following request using the add index block API:

+
PUT /my_source_index/_block/write
+          
+

The current write index on a data stream cannot be split. + In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split.

+

The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. + The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. + For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3.

+

A split operation:

+
    +
  • Creates a new target index with the same definition as the source index, but with a larger number of primary shards.
  • +
  • Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process.
  • +
  • Hashes all documents again, after low level files are created, to delete documents that belong to a different shard.
  • +
  • Recovers the target index as though it were a closed index which had just been re-opened.
  • +
+

IMPORTANT: Indices can only be split if they satisfy the following requirements:

+
    +
  • The target index must not exist.
  • +
  • The source index must have fewer primary shards than the target index.
  • +
  • The number of primary shards in the target index must be a multiple of the number of primary shards in the source index.
  • +
  • The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+ + + ``_ :param index: Name of the source index to split. :param target: Name of the target index to create. @@ -4396,10 +5010,19 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns statistics for one or more indices. For data streams, the API retrieves - statistics for the stream’s backing indices. + .. raw:: html - ``_ +

Get index statistics. + For data streams, the API retrieves statistics for the stream's backing indices.

+

By default, the returned statistics are index-level with primaries and total aggregations. + primaries are the values for only the primary shards. + total are the accumulated values for both primary and replica shards.

+

To get shard-level statistics, set the level parameter to shards.

+

NOTE: When moving to another node, the shard-level statistics for a shard are cleared. + Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed.

+ + + ``_ :param index: A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices @@ -4500,9 +5123,13 @@ async def unfreeze( wait_for_active_shards: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Unfreezes an index. + .. raw:: html + +

Unfreeze an index. + When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.

+ - ``_ + ``_ :param index: Identifier for the index. :param allow_no_indices: If `false`, the request returns an error if any wildcard @@ -4574,9 +5201,13 @@ async def update_aliases( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an alias. Adds a data stream or index to an alias. + .. raw:: html - ``_ +

Create or update an alias. + Adds a data stream or index to an alias.

+ + + ``_ :param actions: Actions to perform. :param master_timeout: Period to wait for a connection to the master node. If @@ -4649,9 +5280,13 @@ async def validate_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Validate a query. Validates a query without running it. + .. raw:: html + +

Validate a query. + Validates a query without running it.

+ - ``_ + ``_ :param index: Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (`*`). To search all data streams or indices, omit this diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py index b7fd1b7a3..f85857b8b 100644 --- a/elasticsearch/_async/client/inference.py +++ b/elasticsearch/_async/client/inference.py @@ -44,9 +44,12 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an inference endpoint + .. raw:: html - ``_ +

Delete an inference endpoint

+ + + ``_ :param inference_id: The inference Id :param task_type: The task type @@ -109,9 +112,12 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an inference endpoint + .. raw:: html + +

Get an inference endpoint

- ``_ + + ``_ :param task_type: The task type :param inference_id: The inference Id @@ -172,9 +178,12 @@ async def inference( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Perform inference on the service + .. raw:: html + +

Perform inference on the service

- ``_ + + ``_ :param inference_id: The inference Id :param input: Inference input. Either a string or an array of strings. @@ -255,9 +264,20 @@ async def put( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an inference endpoint + .. raw:: html + +

Create an inference endpoint. + When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. + After creating the endpoint, wait for the model deployment to complete before using it. + To verify the deployment status, use the get trained model statistics API. + Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". + Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.

+

IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. + For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. + However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.

- ``_ + + ``_ :param inference_id: The inference Id :param inference_config: @@ -303,3 +323,80 @@ async def put( endpoint_id="inference.put", path_parts=__path_parts, ) + + @_rewrite_parameters( + body_name="inference_config", + ) + async def update( + self, + *, + inference_id: str, + inference_config: t.Optional[t.Mapping[str, t.Any]] = None, + body: t.Optional[t.Mapping[str, t.Any]] = None, + task_type: t.Optional[ + t.Union[ + str, + t.Literal["completion", "rerank", "sparse_embedding", "text_embedding"], + ] + ] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update an inference endpoint.

+

Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type.

+

IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. + For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. + However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.

+ + + ``_ + + :param inference_id: The unique identifier of the inference endpoint. + :param inference_config: + :param task_type: The type of inference task that the model performs. + """ + if inference_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'inference_id'") + if inference_config is None and body is None: + raise ValueError( + "Empty value passed for parameters 'inference_config' and 'body', one of them should be set." + ) + elif inference_config is not None and body is not None: + raise ValueError("Cannot set both 'inference_config' and 'body'") + __path_parts: t.Dict[str, str] + if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH: + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}/_update' + elif inference_id not in SKIP_IN_PATH: + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}/_update' + else: + raise ValueError("Couldn't find a path for the given parameters") + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __body = inference_config if inference_config is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="inference.update", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_async/client/ingest.py b/elasticsearch/_async/client/ingest.py index c98e11b2a..be1369846 100644 --- a/elasticsearch/_async/client/ingest.py +++ b/elasticsearch/_async/client/ingest.py @@ -38,9 +38,13 @@ async def delete_geoip_database( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a geoip database configuration. + .. raw:: html - ``_ +

Delete GeoIP database configurations. + Delete one or more IP geolocation database configurations.

+ + + ``_ :param id: A comma-separated list of geoip database configurations to delete :param master_timeout: Period to wait for a connection to the master node. If @@ -76,6 +80,62 @@ async def delete_geoip_database( path_parts=__path_parts, ) + @_rewrite_parameters() + async def delete_ip_location_database( + self, + *, + id: t.Union[str, t.Sequence[str]], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Delete IP geolocation database configurations.

+ + + ``_ + + :param id: A comma-separated list of IP location database configurations. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. A value of `-1` indicates that the request should never + time out. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. A value + of `-1` indicates that the request should never time out. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/ip_location/database/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.delete_ip_location_database", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def delete_pipeline( self, @@ -89,9 +149,13 @@ async def delete_pipeline( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes one or more existing ingest pipeline. + .. raw:: html + +

Delete pipelines. + Delete one or more ingest pipelines.

- ``_ + + ``_ :param id: Pipeline ID or wildcard expression of pipeline IDs used to limit the request. To delete all ingest pipelines in a cluster, use a value of `*`. @@ -138,9 +202,13 @@ async def geo_ip_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets download statistics for GeoIP2 databases used with the geoip processor. + .. raw:: html + +

Get GeoIP statistics. + Get download statistics for GeoIP2 databases that are used with the GeoIP processor.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ingest/geoip/stats" @@ -175,9 +243,13 @@ async def get_geoip_database( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about one or more geoip database configurations. + .. raw:: html + +

Get GeoIP database configurations. + Get information about one or more IP geolocation database configurations.

+ - ``_ + ``_ :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard (`*`) expressions are supported. To get all database configurations, omit @@ -214,6 +286,61 @@ async def get_geoip_database( path_parts=__path_parts, ) + @_rewrite_parameters() + async def get_ip_location_database( + self, + *, + id: t.Optional[t.Union[str, t.Sequence[str]]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get IP geolocation database configurations.

+ + + ``_ + + :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard + (`*`) expressions are supported. To get all database configurations, omit + this parameter or use `*`. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. A value of `-1` indicates that the request should never + time out. + """ + __path_parts: t.Dict[str, str] + if id not in SKIP_IN_PATH: + __path_parts = {"id": _quote(id)} + __path = f'/_ingest/ip_location/database/{__path_parts["id"]}' + else: + __path_parts = {} + __path = "/_ingest/ip_location/database" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.get_ip_location_database", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def get_pipeline( self, @@ -227,10 +354,14 @@ async def get_pipeline( summary: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about one or more ingest pipelines. This API returns a local - reference of the pipeline. + .. raw:: html + +

Get pipelines. + Get information about one or more ingest pipelines. + This API returns a local reference of the pipeline.

+ - ``_ + ``_ :param id: Comma-separated list of pipeline IDs to retrieve. Wildcard (`*`) expressions are supported. To get all ingest pipelines, omit this parameter or use `*`. @@ -279,12 +410,15 @@ async def processor_grok( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Extracts structured fields out of a single text field within a document. You - choose which field to extract matched fields from, as well as the grok pattern - you expect will match. A grok pattern is like a regular expression that supports - aliased expressions that can be reused. + .. raw:: html + +

Run a grok processor. + Extract structured fields out of a single text field within a document. + You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. + A grok pattern is like a regular expression that supports aliased expressions that can be reused.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ingest/processor/grok" @@ -325,9 +459,13 @@ async def put_geoip_database( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about one or more geoip database configurations. + .. raw:: html - ``_ +

Create or update a GeoIP database configuration. + Refer to the create or update IP geolocation database configuration API.

+ + + ``_ :param id: ID of the database configuration to create or update. :param maxmind: The configuration necessary to identify which IP geolocation @@ -380,6 +518,77 @@ async def put_geoip_database( path_parts=__path_parts, ) + @_rewrite_parameters( + body_name="configuration", + ) + async def put_ip_location_database( + self, + *, + id: str, + configuration: t.Optional[t.Mapping[str, t.Any]] = None, + body: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Create or update an IP geolocation database configuration.

+ + + ``_ + + :param id: The database configuration identifier. + :param configuration: + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. A value of `-1` indicates that the request should never + time out. + :param timeout: The period to wait for a response from all relevant nodes in + the cluster after updating the cluster metadata. If no response is received + before the timeout expires, the cluster metadata update still applies but + the response indicates that it was not completely acknowledged. A value of + `-1` indicates that the request should never time out. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if configuration is None and body is None: + raise ValueError( + "Empty value passed for parameters 'configuration' and 'body', one of them should be set." + ) + elif configuration is not None and body is not None: + raise ValueError("Cannot set both 'configuration' and 'body'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/ip_location/database/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __body = configuration if configuration is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ingest.put_ip_location_database", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "deprecated", @@ -411,10 +620,13 @@ async def put_pipeline( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates an ingest pipeline. Changes made using this API take effect - immediately. + .. raw:: html - ``_ +

Create or update a pipeline. + Changes made using this API take effect immediately.

+ + + ``_ :param id: ID of the ingest pipeline to create or update. :param deprecated: Marks this ingest pipeline as deprecated. When a deprecated @@ -504,9 +716,14 @@ async def simulate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes an ingest pipeline against a set of provided documents. + .. raw:: html + +

Simulate a pipeline. + Run an ingest pipeline against a set of provided documents. + You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request.

+ - ``_ + ``_ :param docs: Sample documents to test in the pipeline. :param id: Pipeline to test. If you don’t specify a `pipeline` in the request diff --git a/elasticsearch/_async/client/license.py b/elasticsearch/_async/client/license.py index a43d7064d..1dba3a6d0 100644 --- a/elasticsearch/_async/client/license.py +++ b/elasticsearch/_async/client/license.py @@ -35,9 +35,14 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes licensing information for the cluster + .. raw:: html - ``_ +

Delete the license. + When the license expires, your subscription level reverts to Basic.

+

If the operator privileges feature is enabled, only operator users can use this API.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_license" @@ -72,11 +77,15 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get license information. Returns information about your Elastic license, including - its type, its status, when it was issued, and when it expires. For more information - about the different types of licenses, refer to [Elastic Stack subscriptions](https://www.elastic.co/subscriptions). + .. raw:: html + +

Get license information. + Get information about your Elastic license including its type, its status, when it was issued, and when it expires.

+

NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. + If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request.

+ - ``_ + ``_ :param accept_enterprise: If `true`, this parameter returns enterprise for Enterprise license types. If `false`, this parameter returns platinum for both platinum @@ -120,9 +129,12 @@ async def get_basic_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the status of the basic license. + .. raw:: html - ``_ +

Get the basic license status.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_license/basic_status" @@ -155,9 +167,12 @@ async def get_trial_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the status of the trial license. + .. raw:: html + +

Get the trial status.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_license/trial_status" @@ -196,9 +211,18 @@ async def post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the license for the cluster. + .. raw:: html + +

Update the license. + You can update your license at runtime without shutting down your nodes. + License updates take effect immediately. + If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. + You must then re-submit the API request with the acknowledge parameter set to true.

+

NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. + If the operator privileges feature is enabled, only operator users can use this API.

- ``_ + + ``_ :param acknowledge: Specifies whether you acknowledge the license changes. :param license: @@ -250,14 +274,17 @@ async def post_start_basic( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - The start basic API enables you to initiate an indefinite basic license, which - gives access to all the basic features. If the basic license does not support - all of the features that are available with your current license, however, you - are notified in the response. You must then re-submit the API request with the - acknowledge parameter set to true. To check the status of your basic license, - use the following API: [Get basic status](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-basic-status.html). + .. raw:: html + +

Start a basic license. + Start an indefinite basic license, which gives access to all the basic features.

+

NOTE: In order to start a basic license, you must not currently have a basic license.

+

If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. + You must then re-submit the API request with the acknowledge parameter set to true.

+

To check the status of your basic license, use the get basic license API.

- ``_ + + ``_ :param acknowledge: whether the user has acknowledged acknowledge messages (default: false) @@ -297,10 +324,16 @@ async def post_start_trial( type_query_string: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - The start trial API enables you to start a 30-day trial, which gives access to - all subscription features. + .. raw:: html + +

Start a trial. + Start a 30-day trial, which gives access to all subscription features.

+

NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. + For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension.

+

To check the status of your trial, use the get trial status API.

+ - ``_ + ``_ :param acknowledge: whether the user has acknowledged acknowledge messages (default: false) diff --git a/elasticsearch/_async/client/logstash.py b/elasticsearch/_async/client/logstash.py index 882a1f633..9e8e6c639 100644 --- a/elasticsearch/_async/client/logstash.py +++ b/elasticsearch/_async/client/logstash.py @@ -36,11 +36,16 @@ async def delete_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a pipeline used for Logstash Central Management. + .. raw:: html - ``_ +

Delete a Logstash pipeline. + Delete a pipeline that is used for Logstash Central Management. + If the request succeeds, you receive an empty response with an appropriate status code.

- :param id: Identifier for the pipeline. + + ``_ + + :param id: An identifier for the pipeline. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -76,11 +81,15 @@ async def get_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves pipelines used for Logstash Central Management. + .. raw:: html + +

Get Logstash pipelines. + Get pipelines that are used for Logstash Central Management.

- ``_ - :param id: Comma-separated list of pipeline identifiers. + ``_ + + :param id: A comma-separated list of pipeline identifiers. """ __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: @@ -123,11 +132,16 @@ async def put_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a pipeline used for Logstash Central Management. + .. raw:: html + +

Create or update a Logstash pipeline.

+

Create a pipeline that is used for Logstash Central Management. + If the specified pipeline exists, it is replaced.

+ - ``_ + ``_ - :param id: Identifier for the pipeline. + :param id: An identifier for the pipeline. :param pipeline: """ if id in SKIP_IN_PATH: diff --git a/elasticsearch/_async/client/migration.py b/elasticsearch/_async/client/migration.py index cbfc2c7d2..6cbc5283e 100644 --- a/elasticsearch/_async/client/migration.py +++ b/elasticsearch/_async/client/migration.py @@ -36,11 +36,15 @@ async def deprecations( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about different cluster, node, and index level settings - that use deprecated features that will be removed or changed in the next major - version. + .. raw:: html - ``_ +

Get deprecation information. + Get information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version.

+

TIP: This APIs is designed for indirect use by the Upgrade Assistant. + You are strongly recommended to use the Upgrade Assistant.

+ + + ``_ :param index: Comma-separate list of data streams or indices to check. Wildcard (*) expressions are supported. @@ -81,9 +85,16 @@ async def get_feature_upgrade_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Find out whether system features need to be upgraded or not + .. raw:: html + +

Get feature migration information. + Version upgrades sometimes require changes to how features store configuration information and data in system indices. + Check which features need to be migrated and the status of any migrations that are in progress.

+

TIP: This API is designed for indirect use by the Upgrade Assistant. + You are strongly recommended to use the Upgrade Assistant.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_migration/system_features" @@ -116,9 +127,16 @@ async def post_feature_upgrade( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Begin upgrades for system features + .. raw:: html + +

Start the feature migration. + Version upgrades sometimes require changes to how features store configuration information and data in system indices. + This API starts the automatic migration process.

+

Some functionality might be temporarily unavailable during the migration process.

+

TIP: The API is designed for indirect use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_migration/system_features" diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index cf86f37a6..4f6dfd095 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -36,13 +36,16 @@ async def clear_trained_model_deployment_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear trained model deployment cache. Cache will be cleared on all nodes where - the trained model is assigned. A trained model deployment may have an inference - cache enabled. As requests are handled by each allocated node, their responses - may be cached on that individual node. Calling this API clears the caches without - restarting the deployment. + .. raw:: html - ``_ +

Clear trained model deployment cache. + Cache will be cleared on all nodes where the trained model is assigned. + A trained model deployment may have an inference cache enabled. + As requests are handled by each allocated node, their responses may be cached on that individual node. + Calling this API clears the caches without restarting the deployment.

+ + + ``_ :param model_id: The unique identifier of the trained model. """ @@ -88,21 +91,16 @@ async def close_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Close anomaly detection jobs. A job can be opened and closed multiple times throughout - its lifecycle. A closed job cannot receive data or perform analysis operations, - but you can still explore and navigate results. When you close a job, it runs - housekeeping tasks such as pruning the model history, flushing buffers, calculating - final results and persisting the model snapshots. Depending upon the size of - the job, it could take several minutes to close and the equivalent time to re-open. - After it is closed, the job has a minimal overhead on the cluster except for - maintaining its meta data. Therefore it is a best practice to close jobs that - are no longer required to process data. If you close an anomaly detection job - whose datafeed is running, the request first tries to stop the datafeed. This - behavior is equivalent to calling stop datafeed API with the same timeout and - force parameters as the close job request. When a datafeed that has a specified - end date stops, it automatically closes its associated job. - - ``_ + .. raw:: html + +

Close anomaly detection jobs. + A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. + When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. + If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. + When a datafeed that has a specified end date stops, it automatically closes its associated job.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. You can close multiple anomaly detection @@ -161,10 +159,13 @@ async def delete_calendar( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a calendar. Removes all scheduled events from a calendar, then deletes - it. + .. raw:: html + +

Delete a calendar. + Removes all scheduled events from a calendar, then deletes it.

- ``_ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. """ @@ -203,9 +204,12 @@ async def delete_calendar_event( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete events from a calendar. + .. raw:: html + +

Delete events from a calendar.

+ - ``_ + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param event_id: Identifier for the scheduled event. You can obtain this identifier @@ -251,9 +255,12 @@ async def delete_calendar_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete anomaly jobs from a calendar. + .. raw:: html - ``_ +

Delete anomaly jobs from a calendar.

+ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param job_id: An identifier for the anomaly detection jobs. It can be a job @@ -300,9 +307,12 @@ async def delete_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a data frame analytics job. + .. raw:: html + +

Delete a data frame analytics job.

- ``_ + + ``_ :param id: Identifier for the data frame analytics job. :param force: If `true`, it deletes a job that is not stopped; this method is @@ -348,9 +358,12 @@ async def delete_datafeed( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a datafeed. + .. raw:: html + +

Delete a datafeed.

+ - ``_ + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -400,15 +413,20 @@ async def delete_expired_data( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete expired ML data. Deletes all job results, model snapshots and forecast - data that have exceeded their retention days period. Machine learning state documents - that are not associated with any job are also deleted. You can limit the request - to a single or set of anomaly detection jobs by using a job identifier, a group - name, a comma-separated list of jobs, or a wildcard expression. You can delete - expired data for all anomaly detection jobs by using _all, by specifying * as - the , or by omitting the . + .. raw:: html - ``_ +

Delete expired ML data. + Deletes all job results, model snapshots and forecast data that have exceeded + their retention days period. Machine learning state documents that are not + associated with any job are also deleted. + You can limit the request to a single or set of anomaly detection jobs by + using a job identifier, a group name, a comma-separated list of jobs, or a + wildcard expression. You can delete expired data for all anomaly detection + jobs by using _all, by specifying * as the <job_id>, or by omitting the + <job_id>.

+ + + ``_ :param job_id: Identifier for an anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. @@ -465,11 +483,14 @@ async def delete_filter( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a filter. If an anomaly detection job references the filter, you cannot - delete the filter. You must update or delete the job before you can delete the - filter. + .. raw:: html + +

Delete a filter. + If an anomaly detection job references the filter, you cannot delete the + filter. You must update or delete the job before you can delete the filter.

- ``_ + + ``_ :param filter_id: A string that uniquely identifies a filter. """ @@ -510,12 +531,16 @@ async def delete_forecast( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete forecasts from a job. By default, forecasts are retained for 14 days. - You can specify a different retention period with the `expires_in` parameter - in the forecast jobs API. The delete forecast API enables you to delete one or - more forecasts before they expire. + .. raw:: html + +

Delete forecasts from a job. + By default, forecasts are retained for 14 days. You can specify a + different retention period with the expires_in parameter in the forecast + jobs API. The delete forecast API enables you to delete one or more + forecasts before they expire.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param forecast_id: A comma-separated list of forecast identifiers. If you do @@ -580,14 +605,18 @@ async def delete_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an anomaly detection job. All job configuration, model state and results - are deleted. It is not currently possible to delete multiple jobs using wildcards - or a comma separated list. If you delete a job that has a datafeed, the request - first tries to delete the datafeed. This behavior is equivalent to calling the - delete datafeed API with the same timeout and force parameters as the delete - job request. + .. raw:: html + +

Delete an anomaly detection job. + All job configuration, model state and results are deleted. + It is not currently possible to delete multiple jobs using wildcards or a + comma separated list. If you delete a job that has a datafeed, the request + first tries to delete the datafeed. This behavior is equivalent to calling + the delete datafeed API with the same timeout and force parameters as the + delete job request.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param delete_user_annotations: Specifies whether annotations that have been @@ -639,11 +668,15 @@ async def delete_model_snapshot( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a model snapshot. You cannot delete the active model snapshot. To delete - that snapshot, first revert to a different one. To identify the active model - snapshot, refer to the `model_snapshot_id` in the results from the get jobs API. + .. raw:: html - ``_ +

Delete a model snapshot. + You cannot delete the active model snapshot. To delete that snapshot, first + revert to a different one. To identify the active model snapshot, refer to + the model_snapshot_id in the results from the get jobs API.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: Identifier for the model snapshot. @@ -688,10 +721,13 @@ async def delete_trained_model( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an unreferenced trained model. The request deletes a trained inference - model that is not referenced by an ingest pipeline. + .. raw:: html + +

Delete an unreferenced trained model. + The request deletes a trained inference model that is not referenced by an ingest pipeline.

- ``_ + + ``_ :param model_id: The unique identifier of the trained model. :param force: Forcefully deletes a trained model that is referenced by ingest @@ -734,11 +770,15 @@ async def delete_trained_model_alias( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a trained model alias. This API deletes an existing model alias that refers - to a trained model. If the model alias is missing or refers to a model other - than the one identified by the `model_id`, this API returns an error. + .. raw:: html + +

Delete a trained model alias. + This API deletes an existing model alias that refers to a trained model. If + the model alias is missing or refers to a model other than the one identified + by the model_id, this API returns an error.

+ - ``_ + ``_ :param model_id: The trained model ID to which the model alias refers. :param model_alias: The model alias to delete. @@ -791,11 +831,15 @@ async def estimate_model_memory( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Estimate job model memory usage. Makes an estimation of the memory usage for - an anomaly detection job model. It is based on analysis configuration details - for the job and cardinality estimates for the fields it references. + .. raw:: html - ``_ +

Estimate job model memory usage. + Makes an estimation of the memory usage for an anomaly detection job model. + It is based on analysis configuration details for the job and cardinality + estimates for the fields it references.

+ + + ``_ :param analysis_config: For a list of the properties that you can specify in the `analysis_config` component of the body of this API. @@ -858,12 +902,16 @@ async def evaluate_data_frame( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evaluate data frame analytics. The API packages together commonly used evaluation - metrics for various types of machine learning features. This has been designed - for use on indexes created by data frame analytics. Evaluation requires both - a ground truth field and an analytics result field to be present. + .. raw:: html + +

Evaluate data frame analytics. + The API packages together commonly used evaluation metrics for various types + of machine learning features. This has been designed for use on indexes + created by data frame analytics. Evaluation requires both a ground truth + field and an analytics result field to be present.

- ``_ + + ``_ :param evaluation: Defines the type of evaluation you want to perform. :param index: Defines the `index` in which the evaluation will be performed. @@ -935,15 +983,20 @@ async def explain_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain data frame analytics config. This API provides explanations for a data - frame analytics config that either exists already or one that has not been created - yet. The following explanations are provided: * which fields are included or - not in the analysis and why, * how much memory is estimated to be required. The - estimate can be used when deciding the appropriate value for model_memory_limit - setting later on. If you have object fields or fields that are excluded via source - filtering, they are not included in the explanation. + .. raw:: html + +

Explain data frame analytics config. + This API provides explanations for a data frame analytics config that either + exists already or one that has not been created yet. The following + explanations are provided:

+
    +
  • which fields are included or not in the analysis and why,
  • +
  • how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. + If you have object fields or fields that are excluded via source filtering, they are not included in the explanation.
  • +
+ - ``_ + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -1041,16 +1094,20 @@ async def flush_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Force buffered data to be processed. The flush jobs API is only applicable when - sending data for analysis using the post data API. Depending on the content of - the buffer, then it might additionally calculate new results. Both flush and - close operations are similar, however the flush is more efficient if you are - expecting to send more data for analysis. When flushing, the job remains open - and is available to continue analyzing data. A close operation additionally prunes - and persists the model state to disk and the job must be opened again before - analyzing further data. + .. raw:: html - ``_ +

Force buffered data to be processed. + The flush jobs API is only applicable when sending data for analysis using + the post data API. Depending on the content of the buffer, then it might + additionally calculate new results. Both flush and close operations are + similar, however the flush is more efficient if you are expecting to send + more data for analysis. When flushing, the job remains open and is available + to continue analyzing data. A close operation additionally prunes and + persists the model state to disk and the job must be opened again before + analyzing further data.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. :param advance_time: Refer to the description for the `advance_time` query parameter. @@ -1116,12 +1173,16 @@ async def forecast( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Predict future behavior of a time series. Forecasts are not supported for jobs - that perform population analysis; an error occurs if you try to create a forecast - for a job that has an `over_field_name` in its configuration. Forcasts predict - future behavior based on historical data. + .. raw:: html + +

Predict future behavior of a time series.

+

Forecasts are not supported for jobs that perform population analysis; an + error occurs if you try to create a forecast for a job that has an + over_field_name in its configuration. Forcasts predict future behavior + based on historical data.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. The job must be open when you create a forecast; otherwise, an error occurs. @@ -1201,10 +1262,13 @@ async def get_buckets( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for buckets. The API presents a chronological - view of the records, grouped by bucket. + .. raw:: html + +

Get anomaly detection job results for buckets. + The API presents a chronological view of the records, grouped by bucket.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param timestamp: The timestamp of a single bucket result. If you do not specify @@ -1297,9 +1361,12 @@ async def get_calendar_events( start: t.Optional[t.Union[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get info about events in calendars. + .. raw:: html - ``_ +

Get info about events in calendars.

+ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids @@ -1363,9 +1430,12 @@ async def get_calendars( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get calendar configuration info. + .. raw:: html + +

Get calendar configuration info.

- ``_ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids @@ -1436,9 +1506,12 @@ async def get_categories( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for categories. + .. raw:: html + +

Get anomaly detection job results for categories.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param category_id: Identifier for the category, which is unique in the job. @@ -1518,11 +1591,15 @@ async def get_data_frame_analytics( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data frame analytics job configuration info. You can get information for - multiple data frame analytics jobs in a single API request by using a comma-separated - list of data frame analytics jobs or a wildcard expression. + .. raw:: html + +

Get data frame analytics job configuration info. + You can get information for multiple data frame analytics jobs in a single + API request by using a comma-separated list of data frame analytics jobs or a + wildcard expression.

+ - ``_ + ``_ :param id: Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame @@ -1592,9 +1669,12 @@ async def get_data_frame_analytics_stats( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data frame analytics jobs usage info. + .. raw:: html - ``_ +

Get data frame analytics job stats.

+ + + ``_ :param id: Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame @@ -1657,14 +1737,18 @@ async def get_datafeed_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get datafeeds usage info. You can get statistics for multiple datafeeds in a - single API request by using a comma-separated list of datafeeds or a wildcard - expression. You can get statistics for all datafeeds by using `_all`, by specifying - `*` as the ``, or by omitting the ``. If the datafeed is stopped, - the only information you receive is the `datafeed_id` and the `state`. This API - returns a maximum of 10,000 datafeeds. + .. raw:: html + +

Get datafeeds stats. + You can get statistics for multiple datafeeds in a single API request by + using a comma-separated list of datafeeds or a wildcard expression. You can + get statistics for all datafeeds by using _all, by specifying * as the + <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the + only information you receive is the datafeed_id and the state. + This API returns a maximum of 10,000 datafeeds.

- ``_ + + ``_ :param datafeed_id: Identifier for the datafeed. It can be a datafeed identifier or a wildcard expression. If you do not specify one of these options, the @@ -1718,13 +1802,17 @@ async def get_datafeeds( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get datafeeds configuration info. You can get information for multiple datafeeds - in a single API request by using a comma-separated list of datafeeds or a wildcard - expression. You can get information for all datafeeds by using `_all`, by specifying - `*` as the ``, or by omitting the ``. This API returns a maximum - of 10,000 datafeeds. + .. raw:: html + +

Get datafeeds configuration info. + You can get information for multiple datafeeds in a single API request by + using a comma-separated list of datafeeds or a wildcard expression. You can + get information for all datafeeds by using _all, by specifying * as the + <feed_id>, or by omitting the <feed_id>. + This API returns a maximum of 10,000 datafeeds.

+ - ``_ + ``_ :param datafeed_id: Identifier for the datafeed. It can be a datafeed identifier or a wildcard expression. If you do not specify one of these options, the @@ -1785,9 +1873,13 @@ async def get_filters( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get filters. You can get a single filter or all filters. + .. raw:: html - ``_ +

Get filters. + You can get a single filter or all filters.

+ + + ``_ :param filter_id: A string that uniquely identifies a filter. :param from_: Skips the specified number of filters. @@ -1847,11 +1939,15 @@ async def get_influencers( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for influencers. Influencers are the entities - that have contributed to, or are to blame for, the anomalies. Influencer results - are available only if an `influencer_field_name` is specified in the job configuration. + .. raw:: html + +

Get anomaly detection job results for influencers. + Influencers are the entities that have contributed to, or are to blame for, + the anomalies. Influencer results are available only if an + influencer_field_name is specified in the job configuration.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param desc: If true, the results are sorted in descending order. @@ -1930,9 +2026,12 @@ async def get_job_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection jobs usage info. + .. raw:: html + +

Get anomaly detection job stats.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. It can be a job identifier, a group name, a comma-separated list of jobs, or a wildcard expression. If @@ -1987,13 +2086,16 @@ async def get_jobs( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection jobs configuration info. You can get information for multiple - anomaly detection jobs in a single API request by using a group name, a comma-separated - list of jobs, or a wildcard expression. You can get information for all anomaly - detection jobs by using `_all`, by specifying `*` as the ``, or by omitting - the ``. + .. raw:: html - ``_ +

Get anomaly detection jobs configuration info. + You can get information for multiple anomaly detection jobs in a single API + request by using a group name, a comma-separated list of jobs, or a wildcard + expression. You can get information for all anomaly detection jobs by using + _all, by specifying * as the <job_id>, or by omitting the <job_id>.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. If you do not specify one of these @@ -2052,11 +2154,14 @@ async def get_memory_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get machine learning memory usage info. Get information about how machine learning - jobs and trained models are using memory, on each node, both within the JVM heap, - and natively, outside of the JVM. + .. raw:: html + +

Get machine learning memory usage info. + Get information about how machine learning jobs and trained models are using memory, + on each node, both within the JVM heap, and natively, outside of the JVM.

- ``_ + + ``_ :param node_id: The names of particular nodes in the cluster to target. For example, `nodeId1,nodeId2` or `ml:true` @@ -2109,9 +2214,12 @@ async def get_model_snapshot_upgrade_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job model snapshot upgrade usage info. + .. raw:: html + +

Get anomaly detection job model snapshot upgrade usage info.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: A numerical character string that uniquely identifies the @@ -2180,9 +2288,12 @@ async def get_model_snapshots( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get model snapshots info. + .. raw:: html + +

Get model snapshots info.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: A numerical character string that uniquely identifies the @@ -2281,21 +2392,28 @@ async def get_overall_buckets( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get overall bucket results. Retrievs overall bucket results that summarize the - bucket results of multiple anomaly detection jobs. The `overall_score` is calculated - by combining the scores of all the buckets within the overall bucket span. First, - the maximum `anomaly_score` per anomaly detection job in the overall bucket is - calculated. Then the `top_n` of those scores are averaged to result in the `overall_score`. - This means that you can fine-tune the `overall_score` so that it is more or less - sensitive to the number of jobs that detect an anomaly at the same time. For - example, if you set `top_n` to `1`, the `overall_score` is the maximum bucket - score in the overall bucket. Alternatively, if you set `top_n` to the number - of jobs, the `overall_score` is high only when all jobs detect anomalies in that - overall bucket. If you set the `bucket_span` parameter (to a value greater than - its default), the `overall_score` is the maximum `overall_score` of the overall - buckets that have a span equal to the jobs' largest bucket span. - - ``_ + .. raw:: html + +

Get overall bucket results.

+

Retrievs overall bucket results that summarize the bucket results of + multiple anomaly detection jobs.

+

The overall_score is calculated by combining the scores of all the + buckets within the overall bucket span. First, the maximum + anomaly_score per anomaly detection job in the overall bucket is + calculated. Then the top_n of those scores are averaged to result in + the overall_score. This means that you can fine-tune the + overall_score so that it is more or less sensitive to the number of + jobs that detect an anomaly at the same time. For example, if you set + top_n to 1, the overall_score is the maximum bucket score in the + overall bucket. Alternatively, if you set top_n to the number of jobs, + the overall_score is high only when all jobs detect anomalies in that + overall bucket. If you set the bucket_span parameter (to a value + greater than its default), the overall_score is the maximum + overall_score of the overall buckets that have a span equal to the + jobs' largest bucket span.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. It can be a job identifier, a group name, a comma-separated list of jobs or groups, or a wildcard expression. @@ -2390,17 +2508,22 @@ async def get_records( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly records for an anomaly detection job. Records contain the detailed - analytical results. They describe the anomalous activity that has been identified - in the input data based on the detector configuration. There can be many anomaly - records depending on the characteristics and size of the input data. In practice, - there are often too many to be able to manually process them. The machine learning - features therefore perform a sophisticated aggregation of the anomaly records - into buckets. The number of record results depends on the number of anomalies - found in each bucket, which relates to the number of time series being modeled - and the number of detectors. + .. raw:: html - ``_ +

Get anomaly records for an anomaly detection job. + Records contain the detailed analytical results. They describe the anomalous + activity that has been identified in the input data based on the detector + configuration. + There can be many anomaly records depending on the characteristics and size + of the input data. In practice, there are often too many to be able to + manually process them. The machine learning features therefore perform a + sophisticated aggregation of the anomaly records into buckets. + The number of record results depends on the number of anomalies found in each + bucket, which relates to the number of time series being modeled and the + number of detectors.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. :param desc: Refer to the description for the `desc` query parameter. @@ -2488,14 +2611,18 @@ async def get_trained_models( ], ] ] = None, + include_model_definition: t.Optional[bool] = None, pretty: t.Optional[bool] = None, size: t.Optional[int] = None, tags: t.Optional[t.Union[str, t.Sequence[str]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get trained model configuration info. + .. raw:: html + +

Get trained model configuration info.

- ``_ + + ``_ :param model_id: The unique identifier of the trained model or a model alias. You can get information for multiple trained models in a single API request @@ -2514,6 +2641,8 @@ async def get_trained_models( :param from_: Skips the specified number of models. :param include: A comma delimited string of optional fields to include in the response body. + :param include_model_definition: parameter is deprecated! Use [include=definition] + instead :param size: Specifies the maximum number of models to obtain. :param tags: A comma delimited string of tags. A trained model can have many tags, or none. When supplied, only trained models that contain all the supplied @@ -2543,6 +2672,8 @@ async def get_trained_models( __query["human"] = human if include is not None: __query["include"] = include + if include_model_definition is not None: + __query["include_model_definition"] = include_model_definition if pretty is not None: __query["pretty"] = pretty if size is not None: @@ -2575,11 +2706,14 @@ async def get_trained_models_stats( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get trained models usage info. You can get usage information for multiple trained - models in a single API request by using a comma-separated list of model IDs or - a wildcard expression. + .. raw:: html + +

Get trained models usage info. + You can get usage information for multiple trained + models in a single API request by using a comma-separated list of model IDs or a wildcard expression.

+ - ``_ + ``_ :param model_id: The unique identifier of the trained model or a model alias. It can be a comma-separated list or a wildcard expression. @@ -2640,9 +2774,12 @@ async def infer_trained_model( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evaluate a trained model. + .. raw:: html - ``_ +

Evaluate a trained model.

+ + + ``_ :param model_id: The unique identifier of the trained model. :param docs: An array of objects to pass to the model for inference. The objects @@ -2697,14 +2834,19 @@ async def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Return ML defaults and limits. Returns defaults and limits used by machine learning. - This endpoint is designed to be used by a user interface that needs to fully - understand machine learning configurations where some options are not specified, - meaning that the defaults should be used. This endpoint may be used to find out - what those defaults are. It also provides information about the maximum size - of machine learning jobs that could run in the current cluster configuration. + .. raw:: html + +

Get machine learning information. + Get defaults and limits used by machine learning. + This endpoint is designed to be used by a user interface that needs to fully + understand machine learning configurations where some options are not + specified, meaning that the defaults should be used. This endpoint may be + used to find out what those defaults are. It also provides information about + the maximum size of machine learning jobs that could run in the current + cluster configuration.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ml/info" @@ -2742,14 +2884,18 @@ async def open_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Open anomaly detection jobs. An anomaly detection job must be opened to be ready - to receive and analyze data. It can be opened and closed multiple times throughout - its lifecycle. When you open a new job, it starts with an empty model. When you - open an existing job, the most recent model state is automatically loaded. The - job is ready to resume its analysis from where it left off, once new data is - received. + .. raw:: html + +

Open anomaly detection jobs. + An anomaly detection job must be opened to be ready to receive and analyze + data. It can be opened and closed multiple times throughout its lifecycle. + When you open a new job, it starts with an empty model. + When you open an existing job, the most recent model state is automatically + loaded. The job is ready to resume its analysis from where it left off, once + new data is received.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param timeout: Refer to the description for the `timeout` query parameter. @@ -2801,9 +2947,12 @@ async def post_calendar_events( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Add scheduled events to the calendar. + .. raw:: html + +

Add scheduled events to the calendar.

+ - ``_ + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param events: A list of one of more scheduled events. The event’s start and @@ -2857,11 +3006,14 @@ async def post_data( reset_start: t.Optional[t.Union[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Send data to an anomaly detection job for analysis. IMPORTANT: For each job, - data can be accepted from only a single connection at a time. It is not currently - possible to post data to multiple jobs using wildcards or a comma-separated list. + .. raw:: html - ``_ +

Send data to an anomaly detection job for analysis.

+

IMPORTANT: For each job, data can be accepted from only a single connection at a time. + It is not currently possible to post data to multiple jobs using wildcards or a comma-separated list.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. The job must have a state of open to receive and process the data. @@ -2922,10 +3074,13 @@ async def preview_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview features used by data frame analytics. Previews the extracted features - used by a data frame analytics config. + .. raw:: html + +

Preview features used by data frame analytics. + Previews the extracted features used by a data frame analytics config.

- ``_ + + ``_ :param id: Identifier for the data frame analytics job. :param config: A data frame analytics config as described in create data frame @@ -2985,17 +3140,20 @@ async def preview_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview a datafeed. This API returns the first "page" of search results from - a datafeed. You can preview an existing datafeed or provide configuration details - for a datafeed and anomaly detection job in the API. The preview shows the structure - of the data that will be passed to the anomaly detection engine. IMPORTANT: When - Elasticsearch security features are enabled, the preview uses the credentials - of the user that called the API. However, when the datafeed starts it uses the - roles of the last user that created or updated the datafeed. To get a preview - that accurately reflects the behavior of the datafeed, use the appropriate credentials. - You can also use secondary authorization headers to supply the credentials. + .. raw:: html + +

Preview a datafeed. + This API returns the first "page" of search results from a datafeed. + You can preview an existing datafeed or provide configuration details for a datafeed + and anomaly detection job in the API. The preview shows the structure of the data + that will be passed to the anomaly detection engine. + IMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that + called the API. However, when the datafeed starts it uses the roles of the last user that created or updated the + datafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials. + You can also use secondary authorization headers to supply the credentials.

+ - ``_ + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -3069,9 +3227,12 @@ async def put_calendar( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a calendar. + .. raw:: html + +

Create a calendar.

+ - ``_ + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param description: A description of the calendar. @@ -3123,9 +3284,12 @@ async def put_calendar_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Add anomaly detection job to calendar. + .. raw:: html - ``_ +

Add anomaly detection job to calendar.

+ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param job_id: An identifier for the anomaly detection jobs. It can be a job @@ -3169,9 +3333,11 @@ async def put_calendar_job( "description", "headers", "max_num_threads", + "meta", "model_memory_limit", "version", ), + parameter_aliases={"_meta": "meta"}, ignore_deprecated_options={"headers"}, ) async def put_data_frame_analytics( @@ -3189,17 +3355,24 @@ async def put_data_frame_analytics( headers: t.Optional[t.Mapping[str, t.Union[str, t.Sequence[str]]]] = None, human: t.Optional[bool] = None, max_num_threads: t.Optional[int] = None, + meta: t.Optional[t.Mapping[str, t.Any]] = None, model_memory_limit: t.Optional[str] = None, pretty: t.Optional[bool] = None, version: t.Optional[str] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a data frame analytics job. This API creates a data frame analytics job - that performs an analysis on the source indices and stores the outcome in a destination - index. + .. raw:: html + +

Create a data frame analytics job. + This API creates a data frame analytics job that performs an analysis on the + source indices and stores the outcome in a destination index. + By default, the query used in the source configuration is {"match_all": {}}.

+

If the destination index does not exist, it is created automatically when you start the job.

+

If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters.

- ``_ + + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -3249,6 +3422,7 @@ async def put_data_frame_analytics( Using more threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself. + :param meta: :param model_memory_limit: The approximate maximum amount of memory resources that are permitted for analytical processing. If your `elasticsearch.yml` file contains an `xpack.ml.max_model_memory_limit` setting, an error occurs @@ -3293,6 +3467,8 @@ async def put_data_frame_analytics( __body["headers"] = headers if max_num_threads is not None: __body["max_num_threads"] = max_num_threads + if meta is not None: + __body["_meta"] = meta if model_memory_limit is not None: __body["model_memory_limit"] = model_memory_limit if version is not None: @@ -3311,6 +3487,7 @@ async def put_data_frame_analytics( @_rewrite_parameters( body_fields=( "aggregations", + "aggs", "chunking_config", "delayed_data_check_config", "frequency", @@ -3333,6 +3510,7 @@ async def put_datafeed( *, datafeed_id: str, aggregations: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, + aggs: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, allow_no_indices: t.Optional[bool] = None, chunking_config: t.Optional[t.Mapping[str, t.Any]] = None, delayed_data_check_config: t.Optional[t.Mapping[str, t.Any]] = None, @@ -3365,19 +3543,21 @@ async def put_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a datafeed. Datafeeds retrieve data from Elasticsearch for analysis by - an anomaly detection job. You can associate only one datafeed with each anomaly - detection job. The datafeed contains a query that runs at a defined interval - (`frequency`). If you are concerned about delayed data, you can add a delay (`query_delay') - at each interval. When Elasticsearch security features are enabled, your datafeed - remembers which roles the user who created it had at the time of creation and - runs the query using those same roles. If you provide secondary authorization - headers, those credentials are used instead. You must use Kibana, this API, or - the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - directly to the `.ml-config` index. Do not give users `write` privileges on the - `.ml-config` index. + .. raw:: html + +

Create a datafeed. + Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. + You can associate only one datafeed with each anomaly detection job. + The datafeed contains a query that runs at a defined interval (frequency). + If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`.

+

When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had + at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, + those credentials are used instead. + You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed + directly to the .ml-config index. Do not give users write privileges on the .ml-config index.

+ - ``_ + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -3386,6 +3566,8 @@ async def put_datafeed( :param aggregations: If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. + :param aggs: If set, the datafeed performs aggregation searches. Support for + aggregations is limited and should be used only with low cardinality data. :param allow_no_indices: If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the `_all` string or when no indices are specified. @@ -3417,11 +3599,11 @@ async def put_datafeed( :param ignore_unavailable: If true, unavailable indices (missing or closed) are ignored. :param indexes: An array of index names. Wildcards are supported. If any of the - indices are in remote clusters, the machine learning nodes must have the - `remote_cluster_client` role. + indices are in remote clusters, the master nodes and the machine learning + nodes must have the `remote_cluster_client` role. :param indices: An array of index names. Wildcards are supported. If any of the - indices are in remote clusters, the machine learning nodes must have the - `remote_cluster_client` role. + indices are in remote clusters, the master nodes and the machine learning + nodes must have the `remote_cluster_client` role. :param indices_options: Specifies index expansion options that are used during search :param job_id: Identifier for the anomaly detection job. @@ -3473,6 +3655,8 @@ async def put_datafeed( if not __body: if aggregations is not None: __body["aggregations"] = aggregations + if aggs is not None: + __body["aggs"] = aggs if chunking_config is not None: __body["chunking_config"] = chunking_config if delayed_data_check_config is not None: @@ -3528,11 +3712,14 @@ async def put_filter( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a filter. A filter contains a list of strings. It can be used by one or - more anomaly detection jobs. Specifically, filters are referenced in the `custom_rules` - property of detector configuration objects. + .. raw:: html + +

Create a filter. + A filter contains a list of strings. It can be used by one or more anomaly detection jobs. + Specifically, filters are referenced in the custom_rules property of detector configuration objects.

+ - ``_ + ``_ :param filter_id: A string that uniquely identifies a filter. :param description: A description of the filter. @@ -3595,6 +3782,7 @@ async def put_job( analysis_config: t.Optional[t.Mapping[str, t.Any]] = None, data_description: t.Optional[t.Mapping[str, t.Any]] = None, allow_lazy_open: t.Optional[bool] = None, + allow_no_indices: t.Optional[bool] = None, analysis_limits: t.Optional[t.Mapping[str, t.Any]] = None, background_persist_interval: t.Optional[ t.Union[str, t.Literal[-1], t.Literal[0]] @@ -3604,9 +3792,19 @@ async def put_job( datafeed_config: t.Optional[t.Mapping[str, t.Any]] = None, description: t.Optional[str] = None, error_trace: t.Optional[bool] = None, + expand_wildcards: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]] + ], + t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]], + ] + ] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, groups: t.Optional[t.Sequence[str]] = None, human: t.Optional[bool] = None, + ignore_throttled: t.Optional[bool] = None, + ignore_unavailable: t.Optional[bool] = None, model_plot_config: t.Optional[t.Mapping[str, t.Any]] = None, model_snapshot_retention_days: t.Optional[int] = None, pretty: t.Optional[bool] = None, @@ -3616,10 +3814,14 @@ async def put_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an anomaly detection job. If you include a `datafeed_config`, you must - have read index privileges on the source index. + .. raw:: html - ``_ +

Create an anomaly detection job. + If you include a datafeed_config, you must have read index privileges on the source index. + If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}.

+ + + ``_ :param job_id: The identifier for the anomaly detection job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and @@ -3641,6 +3843,9 @@ async def put_job( to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. + :param allow_no_indices: If `true`, wildcard indices expressions that resolve + into no concrete indices are ignored. This includes the `_all` string or + when no indices are specified. :param analysis_limits: Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for @@ -3664,7 +3869,20 @@ async def put_job( using those same roles. If you provide secondary authorization headers, those credentials are used instead. :param description: A description of the job. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values. Valid + values are: * `all`: Match any data stream or index, including hidden ones. + * `closed`: Match closed, non-hidden indices. Also matches any non-hidden + data stream. Data streams cannot be closed. * `hidden`: Match hidden data + streams and hidden indices. Must be combined with `open`, `closed`, or both. + * `none`: Wildcard patterns are not accepted. * `open`: Match open, non-hidden + indices. Also matches any non-hidden data stream. :param groups: A list of job groups. A job can belong to no groups or many. + :param ignore_throttled: If `true`, concrete, expanded or aliased indices are + ignored when frozen. + :param ignore_unavailable: If `true`, unavailable indices (missing or closed) + are ignored. :param model_plot_config: This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance @@ -3704,12 +3922,20 @@ async def put_job( __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} + if allow_no_indices is not None: + __query["allow_no_indices"] = allow_no_indices if error_trace is not None: __query["error_trace"] = error_trace + if expand_wildcards is not None: + __query["expand_wildcards"] = expand_wildcards if filter_path is not None: __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if ignore_throttled is not None: + __query["ignore_throttled"] = ignore_throttled + if ignore_unavailable is not None: + __query["ignore_unavailable"] = ignore_unavailable if pretty is not None: __query["pretty"] = pretty if not __body: @@ -3797,10 +4023,13 @@ async def put_trained_model( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a trained model. Enable you to supply a trained model that is not created - by data frame analytics. + .. raw:: html - ``_ +

Create a trained model. + Enable you to supply a trained model that is not created by data frame analytics.

+ + + ``_ :param model_id: The unique identifier of the trained model. :param compressed_definition: The compressed (GZipped and Base64 encoded) inference @@ -3900,21 +4129,28 @@ async def put_trained_model_alias( reassign: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a trained model alias. A trained model alias is a logical name - used to reference a single trained model. You can use aliases instead of trained - model identifiers to make it easier to reference your models. For example, you - can use aliases in inference aggregations and processors. An alias must be unique - and refer to only a single trained model. However, you can have multiple aliases - for each trained model. If you use this API to update an alias such that it references - a different trained model ID and the model uses a different type of data frame - analytics, an error occurs. For example, this situation occurs if you have a - trained model for regression analysis and a trained model for classification - analysis; you cannot reassign an alias from one type of trained model to another. - If you use this API to update an alias and there are very few input fields in - common between the old and new trained models for the model alias, the API returns - a warning. - - ``_ + .. raw:: html + +

Create or update a trained model alias. + A trained model alias is a logical name used to reference a single trained + model. + You can use aliases instead of trained model identifiers to make it easier to + reference your models. For example, you can use aliases in inference + aggregations and processors. + An alias must be unique and refer to only a single trained model. However, + you can have multiple aliases for each trained model. + If you use this API to update an alias such that it references a different + trained model ID and the model uses a different type of data frame analytics, + an error occurs. For example, this situation occurs if you have a trained + model for regression analysis and a trained model for classification + analysis; you cannot reassign an alias from one type of trained model to + another. + If you use this API to update an alias and there are very few input fields in + common between the old and new trained models for the model alias, the API + returns a warning.

+ + + ``_ :param model_id: The identifier for the trained model that the alias refers to. :param model_alias: The alias to create or update. This value cannot end in numbers. @@ -3970,9 +4206,12 @@ async def put_trained_model_definition_part( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create part of a trained model definition. + .. raw:: html + +

Create part of a trained model definition.

- ``_ + + ``_ :param model_id: The unique identifier of the trained model. :param part: The definition part number. When the definition is loaded for inference @@ -4047,11 +4286,14 @@ async def put_trained_model_vocabulary( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a trained model vocabulary. This API is supported only for natural language - processing (NLP) models. The vocabulary is stored in the index as described in - `inference_config.*.vocabulary` of the trained model definition. + .. raw:: html + +

Create a trained model vocabulary. + This API is supported only for natural language processing (NLP) models. + The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition.

+ - ``_ + ``_ :param model_id: The unique identifier of the trained model. :param vocabulary: The model vocabulary, which must not be empty. @@ -4105,11 +4347,16 @@ async def reset_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset an anomaly detection job. All model state and results are deleted. The - job is ready to start over as if it had just been created. It is not currently - possible to reset multiple jobs using wildcards or a comma separated list. + .. raw:: html - ``_ +

Reset an anomaly detection job. + All model state and results are deleted. The job is ready to start over as if + it had just been created. + It is not currently possible to reset multiple jobs using wildcards or a + comma separated list.

+ + + ``_ :param job_id: The ID of the job to reset. :param delete_user_annotations: Specifies whether annotations that have been @@ -4161,15 +4408,19 @@ async def revert_model_snapshot( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Revert to a snapshot. The machine learning features react quickly to anomalous - input, learning new behaviors in data. Highly anomalous input increases the variance - in the models whilst the system learns whether this is a new step-change in behavior - or a one-off event. In the case where this anomalous input is known to be a one-off, - then it might be appropriate to reset the model state to a time before this event. - For example, you might consider reverting to a saved snapshot after Black Friday - or a critical system failure. + .. raw:: html + +

Revert to a snapshot. + The machine learning features react quickly to anomalous input, learning new + behaviors in data. Highly anomalous input increases the variance in the + models whilst the system learns whether this is a new step-change in behavior + or a one-off event. In the case where this anomalous input is known to be a + one-off, then it might be appropriate to reset the model state to a time + before this event. For example, you might consider reverting to a saved + snapshot after Black Friday or a critical system failure.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: You can specify `empty` as the . Reverting to @@ -4227,19 +4478,24 @@ async def set_upgrade_mode( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Set upgrade_mode for ML indices. Sets a cluster wide upgrade_mode setting that - prepares machine learning indices for an upgrade. When upgrading your cluster, - in some circumstances you must restart your nodes and reindex your machine learning - indices. In those circumstances, there must be no machine learning jobs running. - You can close the machine learning jobs, do the upgrade, then open all the jobs - again. Alternatively, you can use this API to temporarily halt tasks associated - with the jobs and datafeeds and prevent new jobs from opening. You can also use - this API during upgrades that do not require you to reindex your machine learning - indices, though stopping jobs is not a requirement in that case. You can see - the current value for the upgrade_mode setting by using the get machine learning - info API. + .. raw:: html + +

Set upgrade_mode for ML indices. + Sets a cluster wide upgrade_mode setting that prepares machine learning + indices for an upgrade. + When upgrading your cluster, in some circumstances you must restart your + nodes and reindex your machine learning indices. In those circumstances, + there must be no machine learning jobs running. You can close the machine + learning jobs, do the upgrade, then open all the jobs again. Alternatively, + you can use this API to temporarily halt tasks associated with the jobs and + datafeeds and prevent new jobs from opening. You can also use this API + during upgrades that do not require you to reindex your machine learning + indices, though stopping jobs is not a requirement in that case. + You can see the current value for the upgrade_mode setting by using the get + machine learning info API.

+ - ``_ + ``_ :param enabled: When `true`, it enables `upgrade_mode` which temporarily halts all job and datafeed tasks and prohibits new job and datafeed tasks from @@ -4283,18 +4539,23 @@ async def start_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a data frame analytics job. A data frame analytics job can be started and - stopped multiple times throughout its lifecycle. If the destination index does - not exist, it is created automatically the first time you start the data frame - analytics job. The `index.number_of_shards` and `index.number_of_replicas` settings - for the destination index are copied from the source index. If there are multiple - source indices, the destination index copies the highest setting values. The - mappings for the destination index are also copied from the source indices. If - there are any mapping conflicts, the job fails to start. If the destination index - exists, it is used as is. You can therefore set up the destination index in advance - with custom settings and mappings. + .. raw:: html - ``_ +

Start a data frame analytics job. + A data frame analytics job can be started and stopped multiple times + throughout its lifecycle. + If the destination index does not exist, it is created automatically the + first time you start the data frame analytics job. The + index.number_of_shards and index.number_of_replicas settings for the + destination index are copied from the source index. If there are multiple + source indices, the destination index copies the highest setting values. The + mappings for the destination index are also copied from the source indices. + If there are any mapping conflicts, the job fails to start. + If the destination index exists, it is used as is. You can therefore set up + the destination index in advance with custom settings and mappings.

+ + + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -4344,19 +4605,20 @@ async def start_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start datafeeds. A datafeed must be started in order to retrieve data from Elasticsearch. - A datafeed can be started and stopped multiple times throughout its lifecycle. - Before you can start a datafeed, the anomaly detection job must be open. Otherwise, - an error occurs. If you restart a stopped datafeed, it continues processing input - data from the next millisecond after it was stopped. If new data was indexed - for that exact millisecond between stopping and starting, it will be ignored. - When Elasticsearch security features are enabled, your datafeed remembers which - roles the last user to create or update it had at the time of creation or update - and runs the query using those same roles. If you provided secondary authorization - headers when you created or updated the datafeed, those credentials are used - instead. + .. raw:: html + +

Start datafeeds.

+

A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped + multiple times throughout its lifecycle.

+

Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs.

+

If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. + If new data was indexed for that exact millisecond between stopping and starting, it will be ignored.

+

When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or + update it had at the time of creation or update and runs the query using those same roles. If you provided secondary + authorization headers when you created or updated the datafeed, those credentials are used instead.

- ``_ + + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -4423,10 +4685,13 @@ async def start_trained_model_deployment( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a trained model deployment. It allocates the model to every machine learning - node. + .. raw:: html + +

Start a trained model deployment. + It allocates the model to every machine learning node.

+ - ``_ + ``_ :param model_id: The unique identifier of the trained model. Currently, only PyTorch models are supported. @@ -4507,10 +4772,14 @@ async def stop_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop data frame analytics jobs. A data frame analytics job can be started and - stopped multiple times throughout its lifecycle. + .. raw:: html + +

Stop data frame analytics jobs. + A data frame analytics job can be started and stopped multiple times + throughout its lifecycle.

+ - ``_ + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -4573,10 +4842,14 @@ async def stop_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop datafeeds. A datafeed that is stopped ceases to retrieve data from Elasticsearch. - A datafeed can be started and stopped multiple times throughout its lifecycle. + .. raw:: html - ``_ +

Stop datafeeds. + A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped + multiple times throughout its lifecycle.

+ + + ``_ :param datafeed_id: Identifier for the datafeed. You can stop multiple datafeeds in a single API request by using a comma-separated list of datafeeds or a @@ -4636,9 +4909,12 @@ async def stop_trained_model_deployment( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop a trained model deployment. + .. raw:: html + +

Stop a trained model deployment.

- ``_ + + ``_ :param model_id: The unique identifier of the trained model. :param allow_no_match: Specifies what to do when the request: contains wildcard @@ -4701,9 +4977,12 @@ async def update_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a data frame analytics job. + .. raw:: html + +

Update a data frame analytics job.

+ - ``_ + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -4809,13 +5088,16 @@ async def update_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a datafeed. You must stop and start the datafeed for the changes to be - applied. When Elasticsearch security features are enabled, your datafeed remembers - which roles the user who updated it had at the time of the update and runs the - query using those same roles. If you provide secondary authorization headers, - those credentials are used instead. + .. raw:: html - ``_ +

Update a datafeed. + You must stop and start the datafeed for the changes to be applied. + When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at + the time of the update and runs the query using those same roles. If you provide secondary authorization headers, + those credentials are used instead.

+ + + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -4976,10 +5258,13 @@ async def update_filter( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a filter. Updates the description of a filter, adds items, or removes - items from the list. + .. raw:: html + +

Update a filter. + Updates the description of a filter, adds items, or removes items from the list.

- ``_ + + ``_ :param filter_id: A string that uniquely identifies a filter. :param add_items: The items to add to the filter. @@ -5067,10 +5352,13 @@ async def update_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an anomaly detection job. Updates certain properties of an anomaly detection - job. + .. raw:: html + +

Update an anomaly detection job. + Updates certain properties of an anomaly detection job.

- ``_ + + ``_ :param job_id: Identifier for the job. :param allow_lazy_open: Advanced configuration option. Specifies whether this @@ -5196,9 +5484,13 @@ async def update_model_snapshot( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a snapshot. Updates certain properties of a snapshot. + .. raw:: html + +

Update a snapshot. + Updates certain properties of a snapshot.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: Identifier for the model snapshot. @@ -5257,9 +5549,12 @@ async def update_trained_model_deployment( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a trained model deployment. + .. raw:: html - ``_ +

Update a trained model deployment.

+ + + ``_ :param model_id: The unique identifier of the trained model. Currently, only PyTorch models are supported. @@ -5316,16 +5611,21 @@ async def upgrade_job_snapshot( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Upgrade a snapshot. Upgrades an anomaly detection model snapshot to the latest - major version. Over time, older snapshot formats are deprecated and removed. - Anomaly detection jobs support only snapshots that are from the current or previous - major version. This API provides a means to upgrade a snapshot to the current - major version. This aids in preparing the cluster for an upgrade to the next - major version. Only one snapshot per anomaly detection job can be upgraded at - a time and the upgraded snapshot cannot be the current snapshot of the anomaly - detection job. + .. raw:: html + +

Upgrade a snapshot. + Upgrades an anomaly detection model snapshot to the latest major version. + Over time, older snapshot formats are deprecated and removed. Anomaly + detection jobs support only snapshots that are from the current or previous + major version. + This API provides a means to upgrade a snapshot to the current major version. + This aids in preparing the cluster for an upgrade to the next major version. + Only one snapshot per anomaly detection job can be upgraded at a time and the + upgraded snapshot cannot be the current snapshot of the anomaly detection + job.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: A numerical character string that uniquely identifies the @@ -5399,9 +5699,12 @@ async def validate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Validates an anomaly detection job. + .. raw:: html + +

Validate an anomaly detection job.

+ - ``_ + ``_ :param analysis_config: :param analysis_limits: @@ -5469,9 +5772,12 @@ async def validate_detector( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Validates an anomaly detection detector. + .. raw:: html + +

Validate an anomaly detection job.

+ - ``_ + ``_ :param detector: """ diff --git a/elasticsearch/_async/client/monitoring.py b/elasticsearch/_async/client/monitoring.py index aa8dc41fc..d5e5b5252 100644 --- a/elasticsearch/_async/client/monitoring.py +++ b/elasticsearch/_async/client/monitoring.py @@ -42,9 +42,13 @@ async def bulk( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Used by the monitoring features to send monitoring data. + .. raw:: html - ``_ +

Send monitoring data. + This API is used by the monitoring features to send monitoring data.

+ + + ``_ :param interval: Collection interval (e.g., '10s' or '10000ms') of the payload :param operations: diff --git a/elasticsearch/_async/client/nodes.py b/elasticsearch/_async/client/nodes.py index 3056354c4..49a3086c7 100644 --- a/elasticsearch/_async/client/nodes.py +++ b/elasticsearch/_async/client/nodes.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse, TextApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class NodesClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def clear_repositories_metering_archive( self, *, @@ -37,15 +44,18 @@ async def clear_repositories_metering_archive( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - You can use this API to clear the archived repositories metering information - in the cluster. + .. raw:: html - ``_ +

Clear the archived repositories metering. + Clear the archived repositories metering information in the cluster.

+ + + ``_ :param node_id: Comma-separated list of node IDs or names used to limit returned - information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes). - :param max_archive_version: Specifies the maximum [archive_version](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-repositories-metering-api.html#get-repositories-metering-api-response-body) - to be cleared from the archive. + information. + :param max_archive_version: Specifies the maximum `archive_version` to be cleared + from the archive. """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'node_id'") @@ -76,6 +86,7 @@ async def clear_repositories_metering_archive( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def get_repositories_metering_info( self, *, @@ -86,13 +97,15 @@ async def get_repositories_metering_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - You can use the cluster repositories metering API to retrieve repositories metering - information in a cluster. This API exposes monotonically non-decreasing counters - and it’s expected that clients would durably store the information needed to - compute aggregations over a period of time. Additionally, the information exposed - by this API is volatile, meaning that it won’t be present after node restarts. + .. raw:: html - ``_ +

Get cluster repositories metering. + Get repositories metering information for a cluster. + This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. + Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts.

+ + + ``_ :param node_id: Comma-separated list of node IDs or names used to limit returned information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes). @@ -143,10 +156,14 @@ async def hot_threads( ] = None, ) -> TextApiResponse: """ - This API yields a breakdown of the hot threads on each selected node in the cluster. - The output is plain text with a breakdown of each node’s top hot threads. + .. raw:: html + +

Get the hot threads for nodes. + Get a breakdown of the hot threads on each selected node in the cluster. + The output is plain text with a breakdown of the top hot threads for each node.

+ - ``_ + ``_ :param node_id: List of node IDs or names used to limit returned information. :param ignore_idle_threads: If true, known idle threads (e.g. waiting in a socket @@ -219,9 +236,13 @@ async def info( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster nodes information. + .. raw:: html - ``_ +

Get node information. + By default, the API returns all attributes and core settings for cluster nodes.

+ + + ``_ :param node_id: Comma-separated list of node IDs or names used to limit returned information. @@ -288,9 +309,18 @@ async def reload_secure_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reloads the keystore on nodes in the cluster. + .. raw:: html + +

Reload the keystore on nodes in the cluster.

+

Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. + That is, you can change them on disk and reload them without restarting any nodes in the cluster. + When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node.

+

When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. + Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. + Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.

+ - ``_ + ``_ :param node_id: The names of particular nodes in the cluster to target. :param secure_settings_password: The password for the Elasticsearch keystore. @@ -359,9 +389,14 @@ async def stats( types: t.Optional[t.Sequence[str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster nodes statistics. + .. raw:: html - ``_ +

Get node statistics. + Get statistics for nodes in a cluster. + By default, all stats are returned. You can limit the returned information by using metrics.

+ + + ``_ :param node_id: Comma-separated list of node IDs or names used to limit returned information. @@ -476,9 +511,12 @@ async def usage( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information on the usage of features. + .. raw:: html + +

Get feature usage information.

+ - ``_ + ``_ :param 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 diff --git a/elasticsearch/_async/client/query_rules.py b/elasticsearch/_async/client/query_rules.py index 5f9a931ee..9e7f38b4b 100644 --- a/elasticsearch/_async/client/query_rules.py +++ b/elasticsearch/_async/client/query_rules.py @@ -37,9 +37,14 @@ async def delete_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a query rule within a query ruleset. + .. raw:: html - ``_ +

Delete a query rule. + Delete a query rule within a query ruleset. + This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API.

+ + + ``_ :param ruleset_id: The unique identifier of the query ruleset containing the rule to delete @@ -85,9 +90,14 @@ async def delete_ruleset( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a query ruleset. + .. raw:: html + +

Delete a query ruleset. + Remove a query ruleset and its associated data. + This is a destructive action that is not recoverable.

+ - ``_ + ``_ :param ruleset_id: The unique identifier of the query ruleset to delete """ @@ -126,9 +136,13 @@ async def get_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the details about a query rule within a query ruleset + .. raw:: html - ``_ +

Get a query rule. + Get details about a query rule within a query ruleset.

+ + + ``_ :param ruleset_id: The unique identifier of the query ruleset containing the rule to retrieve @@ -174,9 +188,13 @@ async def get_ruleset( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the details about a query ruleset + .. raw:: html + +

Get a query ruleset. + Get details about a query ruleset.

+ - ``_ + ``_ :param ruleset_id: The unique identifier of the query ruleset """ @@ -217,12 +235,16 @@ async def list_rulesets( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns summarized information about existing query rulesets. + .. raw:: html - ``_ +

Get all query rulesets. + Get summarized information about the query rulesets.

- :param from_: Starting offset (default: 0) - :param size: specifies a max number of results to get + + ``_ + + :param from_: The offset from the first result to fetch. + :param size: The maximum number of results to retrieve. """ __path_parts: t.Dict[str, str] = {} __path = "/_query_rules" @@ -270,17 +292,28 @@ async def put_rule( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a query rule within a query ruleset. + .. raw:: html + +

Create or update a query rule. + Create or update a query rule within a query ruleset.

+

IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. + It is advised to use one or the other in query rulesets, to avoid errors. + Additionally, pinned queries have a maximum limit of 100 pinned hits. + If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.

+ - ``_ + ``_ :param ruleset_id: The unique identifier of the query ruleset containing the - rule to be created or updated + rule to be created or updated. :param rule_id: The unique identifier of the query rule within the specified - ruleset to be created or updated - :param actions: - :param criteria: - :param type: + ruleset to be created or updated. + :param actions: The actions to take when the rule is matched. The format of this + action depends on the rule type. + :param criteria: The criteria that must be met for the rule to be applied. If + multiple criteria are specified for a rule, all criteria must be met for + the rule to be applied. + :param type: The type of rule. :param priority: """ if ruleset_id in SKIP_IN_PATH: @@ -345,12 +378,21 @@ async def put_ruleset( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a query ruleset. + .. raw:: html - ``_ +

Create or update a query ruleset. + There is a limit of 100 rules per ruleset. + This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting.

+

IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. + It is advised to use one or the other in query rulesets, to avoid errors. + Additionally, pinned queries have a maximum limit of 100 pinned hits. + If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.

+ + + ``_ :param ruleset_id: The unique identifier of the query ruleset to be created or - updated + updated. :param rules: """ if ruleset_id in SKIP_IN_PATH: @@ -382,3 +424,62 @@ async def put_ruleset( endpoint_id="query_rules.put_ruleset", path_parts=__path_parts, ) + + @_rewrite_parameters( + body_fields=("match_criteria",), + ) + async def test( + self, + *, + ruleset_id: str, + match_criteria: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Test a query ruleset. + Evaluate match criteria against a query ruleset to identify the rules that would match that criteria.

+ + + ``_ + + :param ruleset_id: The unique identifier of the query ruleset to be created or + updated + :param match_criteria: The match criteria to apply to rules in the given query + ruleset. Match criteria should match the keys defined in the `criteria.metadata` + field of the rule. + """ + if ruleset_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'ruleset_id'") + if match_criteria is None and body is None: + raise ValueError("Empty value passed for parameter 'match_criteria'") + __path_parts: t.Dict[str, str] = {"ruleset_id": _quote(ruleset_id)} + __path = f'/_query_rules/{__path_parts["ruleset_id"]}/_test' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if match_criteria is not None: + __body["match_criteria"] = match_criteria + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="query_rules.test", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_async/client/rollup.py b/elasticsearch/_async/client/rollup.py index 5c6c157f0..94dc52ae3 100644 --- a/elasticsearch/_async/client/rollup.py +++ b/elasticsearch/_async/client/rollup.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class RollupClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def delete_job( self, *, @@ -36,9 +43,31 @@ async def delete_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an existing rollup job. + .. raw:: html - ``_ +

Delete a rollup job.

+

A job must be stopped before it can be deleted. + If you attempt to delete a started job, an error occurs. + Similarly, if you attempt to delete a nonexistent job, an exception occurs.

+

IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. + The API does not delete any previously rolled up data. + This is by design; a user may wish to roll up a static data set. + Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). + Thus the job can be deleted, leaving behind the rolled up data for analysis. + If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. + If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example:

+
POST my_rollup_index/_delete_by_query
+          {
+            "query": {
+              "term": {
+                "_rollup.id": "the_rollup_job_id"
+              }
+            }
+          }
+          
+ + + ``_ :param id: Identifier for the job. """ @@ -66,6 +95,7 @@ async def delete_job( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def get_jobs( self, *, @@ -76,9 +106,16 @@ async def get_jobs( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the configuration, stats, and status of rollup jobs. + .. raw:: html + +

Get rollup job information. + Get the configuration, stats, and status of rollup jobs.

+

NOTE: This API returns only active (both STARTED and STOPPED) jobs. + If a job was created, ran for a while, then was deleted, the API does not return any details about it. + For details about a historical rollup job, the rollup capabilities API may be more useful.

+ - ``_ + ``_ :param id: Identifier for the rollup job. If it is `_all` or omitted, the API returns all rollup jobs. @@ -110,6 +147,7 @@ async def get_jobs( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def get_rollup_caps( self, *, @@ -120,10 +158,20 @@ async def get_rollup_caps( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the capabilities of any rollup jobs that have been configured for a specific - index or index pattern. + .. raw:: html - ``_ +

Get the rollup job capabilities. + Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern.

+

This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. + Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. + This API enables you to inspect an index and determine:

+
    +
  1. Does this index have associated rollup data somewhere in the cluster?
  2. +
  3. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live?
  4. +
+ + + ``_ :param id: Index, indices or index-pattern to return rollup capabilities for. `_all` may be used to fetch rollup capabilities from all jobs. @@ -155,6 +203,7 @@ async def get_rollup_caps( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def get_rollup_index_caps( self, *, @@ -165,10 +214,18 @@ async def get_rollup_index_caps( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the rollup capabilities of all jobs inside of a rollup index (for example, - the index where rollup data is stored). + .. raw:: html + +

Get the rollup index capabilities. + Get the rollup capabilities of all jobs inside of a rollup index. + A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine:

+
    +
  • What jobs are stored in an index (or indices specified via a pattern)?
  • +
  • What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job?
  • +
+ - ``_ + ``_ :param index: Data stream or index to check for rollup capabilities. Wildcard (`*`) expressions are supported. @@ -209,6 +266,7 @@ async def get_rollup_index_caps( ), ignore_deprecated_options={"headers"}, ) + @_stability_warning(Stability.EXPERIMENTAL) async def put_job( self, *, @@ -228,9 +286,16 @@ async def put_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a rollup job. + .. raw:: html - ``_ +

Create a rollup job.

+

WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run.

+

The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index.

+

There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group.

+

Jobs are created in a STOPPED state. You can start them with the start rollup jobs API.

+ + + ``_ :param id: Identifier for the rollup job. This can be any alphanumeric string and uniquely identifies the data that is associated with the rollup job. @@ -327,6 +392,7 @@ async def put_job( @_rewrite_parameters( body_fields=("aggregations", "aggs", "query", "size"), ) + @_stability_warning(Stability.EXPERIMENTAL) async def rollup_search( self, *, @@ -344,14 +410,54 @@ async def rollup_search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables searching rolled-up data using the standard Query DSL. + .. raw:: html + +

Search rolled-up data. + The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. + It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query.

+

The request body supports a subset of features from the regular search API. + The following functionality is not available:

+

size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. + highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed.

+

Searching both historical rollup and non-rollup data

+

The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. + This is done by simply adding the live indices to the URI. For example:

+
GET sensor-1,sensor_rollup/_rollup_search
+          {
+            "size": 0,
+            "aggregations": {
+               "max_temperature": {
+                "max": {
+                  "field": "temperature"
+                }
+              }
+            }
+          }
+          
+

The rollup search endpoint does two things when the search runs:

+
    +
  • The original request is sent to the non-rollup index unaltered.
  • +
  • A rewritten version of the original request is sent to the rollup index.
  • +
+

When the two responses are received, the endpoint rewrites the rollup response and merges the two together. + During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used.

+ - ``_ + ``_ - :param index: Enables searching rolled-up data using the standard Query DSL. + :param index: A comma-separated list of data streams and indices used to limit + the request. This parameter has the following rules: * At least one data + stream, index, or wildcard expression must be specified. This target can + include a rollup or non-rollup index. For data streams, the stream's backing + indices can only serve as non-rollup indices. Omitting the parameter or using + `_all` are not permitted. * Multiple non-rollup indices may be specified. + * Only one rollup index may be specified. If more than one are supplied, + an exception occurs. * Wildcard expressions (`*`) may be used. If they match + more than one rollup index, an exception occurs. However, you can use an + expression to match multiple non-rollup indices or data streams. :param aggregations: Specifies aggregations. :param aggs: Specifies aggregations. - :param query: Specifies a DSL query. + :param query: Specifies a DSL query that is subject to some limitations. :param rest_total_hits_as_int: Indicates whether hits.total should be rendered as an integer or an object in the rest search response :param size: Must be zero if set, as rollups work on pre-aggregated data. @@ -397,6 +503,7 @@ async def rollup_search( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def start_job( self, *, @@ -407,9 +514,14 @@ async def start_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Starts an existing, stopped rollup job. + .. raw:: html - ``_ +

Start rollup jobs. + If you try to start a job that does not exist, an exception occurs. + If you try to start a job that is already started, nothing happens.

+ + + ``_ :param id: Identifier for the rollup job. """ @@ -437,6 +549,7 @@ async def start_job( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def stop_job( self, *, @@ -449,14 +562,28 @@ async def stop_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stops an existing, started rollup job. + .. raw:: html + +

Stop rollup jobs. + If you try to stop a job that does not exist, an exception occurs. + If you try to stop a job that is already stopped, nothing happens.

+

Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. + This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example:

+
POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s
+          
+

The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. + If the specified time elapses without the job moving to STOPPED, a timeout exception occurs.

+ - ``_ + ``_ :param id: Identifier for the rollup job. :param timeout: If `wait_for_completion` is `true`, the API blocks for (at maximum) the specified duration while waiting for the job to stop. If more than `timeout` - time has passed, the API throws a timeout exception. + time has passed, the API throws a timeout exception. NOTE: Even if a timeout + occurs, the stop request is still processing and eventually moves the job + to STOPPED. The timeout simply means the API call itself timed out while + waiting for the status change. :param wait_for_completion: If set to `true`, causes the API to block until the indexer state completely stops. If set to `false`, the API returns immediately and the indexer is stopped asynchronously in the background. diff --git a/elasticsearch/_async/client/search_application.py b/elasticsearch/_async/client/search_application.py index 73fc36897..724ccdcff 100644 --- a/elasticsearch/_async/client/search_application.py +++ b/elasticsearch/_async/client/search_application.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class SearchApplicationClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.BETA) async def delete( self, *, @@ -36,9 +43,13 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a search application. + .. raw:: html - ``_ +

Delete a search application. + Remove a search application and its associated alias. Indices attached to the search application are not removed.

+ + + ``_ :param name: The name of the search application to delete """ @@ -66,6 +77,7 @@ async def delete( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def delete_behavioral_analytics( self, *, @@ -76,9 +88,13 @@ async def delete_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a behavioral analytics collection. + .. raw:: html + +

Delete a behavioral analytics collection. + The associated data stream is also deleted.

+ - ``_ + ``_ :param name: The name of the analytics collection to be deleted """ @@ -106,6 +122,7 @@ async def delete_behavioral_analytics( ) @_rewrite_parameters() + @_stability_warning(Stability.BETA) async def get( self, *, @@ -116,9 +133,12 @@ async def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the details about a search application + .. raw:: html - ``_ +

Get search application details.

+ + + ``_ :param name: The name of the search application """ @@ -146,6 +166,7 @@ async def get( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def get_behavioral_analytics( self, *, @@ -156,9 +177,12 @@ async def get_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the existing behavioral analytics collections. + .. raw:: html + +

Get behavioral analytics collections.

- ``_ + + ``_ :param name: A list of analytics collections to limit the returned information """ @@ -191,6 +215,7 @@ async def get_behavioral_analytics( @_rewrite_parameters( parameter_aliases={"from": "from_"}, ) + @_stability_warning(Stability.BETA) async def list( self, *, @@ -203,9 +228,13 @@ async def list( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the existing search applications. + .. raw:: html + +

Get search applications. + Get information about search applications.

+ - ``_ + ``_ :param from_: Starting offset. :param q: Query in the Lucene query string syntax. @@ -238,9 +267,78 @@ async def list( path_parts=__path_parts, ) + @_rewrite_parameters( + body_name="payload", + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def post_behavioral_analytics_event( + self, + *, + collection_name: str, + event_type: t.Union[str, t.Literal["page_view", "search", "search_click"]], + payload: t.Optional[t.Any] = None, + body: t.Optional[t.Any] = None, + debug: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Create a behavioral analytics collection event.

+ + + ``_ + + :param collection_name: The name of the behavioral analytics collection. + :param event_type: The analytics event type. + :param payload: + :param debug: Whether the response type has to include more details + """ + if collection_name in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'collection_name'") + if event_type in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'event_type'") + if payload is None and body is None: + raise ValueError( + "Empty value passed for parameters 'payload' and 'body', one of them should be set." + ) + elif payload is not None and body is not None: + raise ValueError("Cannot set both 'payload' and 'body'") + __path_parts: t.Dict[str, str] = { + "collection_name": _quote(collection_name), + "event_type": _quote(event_type), + } + __path = f'/_application/analytics/{__path_parts["collection_name"]}/event/{__path_parts["event_type"]}' + __query: t.Dict[str, t.Any] = {} + if debug is not None: + __query["debug"] = debug + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __body = payload if payload is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_application.post_behavioral_analytics_event", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_name="search_application", ) + @_stability_warning(Stability.BETA) async def put( self, *, @@ -254,9 +352,12 @@ async def put( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a search application. + .. raw:: html - ``_ +

Create or update a search application.

+ + + ``_ :param name: The name of the search application to be created or updated. :param search_application: @@ -297,6 +398,7 @@ async def put( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def put_behavioral_analytics( self, *, @@ -307,9 +409,12 @@ async def put_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a behavioral analytics collection. + .. raw:: html + +

Create a behavioral analytics collection.

- ``_ + + ``_ :param name: The name of the analytics collection to be created or updated. """ @@ -340,6 +445,72 @@ async def put_behavioral_analytics( body_fields=("params",), ignore_deprecated_options={"params"}, ) + @_stability_warning(Stability.EXPERIMENTAL) + async def render_query( + self, + *, + name: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + params: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Render a search application query. + Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. + If a parameter used in the search template is not specified in params, the parameter's default value will be used. + The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.

+

You must have read privileges on the backing alias of the search application.

+ + + ``_ + + :param name: The name of the search application to render teh query for. + :param params: + """ + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = ( + f'/_application/search_application/{__path_parts["name"]}/_render_query' + ) + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if params is not None: + __body["params"] = params + if not __body: + __body = None # type: ignore[assignment] + __headers = {"accept": "application/json"} + if __body is not None: + __headers["content-type"] = "application/json" + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_application.render_query", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("params",), + ignore_deprecated_options={"params"}, + ) + @_stability_warning(Stability.BETA) async def search( self, *, @@ -353,9 +524,14 @@ async def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Perform a search against a search application. + .. raw:: html + +

Run a search application search. + Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. + Unspecified template parameters are assigned their default values if applicable.

+ - ``_ + ``_ :param name: The name of the search application to be searched. :param params: Query parameters specific to this request, which will override diff --git a/elasticsearch/_async/client/searchable_snapshots.py b/elasticsearch/_async/client/searchable_snapshots.py index b6a405991..6d9ef50cc 100644 --- a/elasticsearch/_async/client/searchable_snapshots.py +++ b/elasticsearch/_async/client/searchable_snapshots.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class SearchableSnapshotsClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def cache_stats( self, *, @@ -37,13 +44,15 @@ async def cache_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieve node-level cache statistics about searchable snapshots. + .. raw:: html - ``_ +

Get cache statistics. + Get statistics about the shared cache for partially mounted indices.

- :param 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 node_id: The names of the nodes in the cluster to target. :param master_timeout: """ __path_parts: t.Dict[str, str] @@ -75,6 +84,7 @@ async def cache_stats( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def clear_cache( self, *, @@ -95,11 +105,16 @@ async def clear_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the cache of searchable snapshots. + .. raw:: html + +

Clear the cache. + Clear indices and data streams from the shared cache for partially mounted indices.

+ - ``_ + ``_ - :param index: A comma-separated list of index names + :param index: A comma-separated list of data streams, indices, and aliases to + clear from the cache. It supports wildcards (`*`). :param 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) @@ -167,22 +182,33 @@ async def mount( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Mount a snapshot as a searchable index. + .. raw:: html - ``_ +

Mount a snapshot. + Mount a snapshot as a searchable snapshot index. + Do not use this API for snapshots managed by index lifecycle management (ILM). + Manually mounting ILM-managed snapshots can interfere with ILM processes.

+ + + ``_ :param repository: The name of the repository containing the snapshot of the - index to mount - :param snapshot: The name of the snapshot of the index to mount - :param index: - :param ignore_index_settings: - :param index_settings: - :param master_timeout: Explicit operation timeout for connection to master node - :param renamed_index: - :param storage: Selects the kind of local storage used to accelerate searches. - Experimental, and defaults to `full_copy` - :param wait_for_completion: Should this request wait until the operation has - completed before returning + index to mount. + :param snapshot: The name of the snapshot of the index to mount. + :param index: The name of the index contained in the snapshot whose data is to + be mounted. If no `renamed_index` is specified, this name will also be used + to create the new index. + :param ignore_index_settings: The names of settings that should be removed from + the index when it is mounted. + :param index_settings: The settings that should be added to the index when it + is mounted. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. To indicate that the request should never timeout, set it to `-1`. + :param renamed_index: The name of the index that will be created. + :param storage: The mount option for the searchable snapshot index. + :param wait_for_completion: If true, the request blocks until the operation is + complete. """ if repository in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'repository'") @@ -247,11 +273,15 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieve shard-level statistics about searchable snapshots. + .. raw:: html + +

Get searchable snapshot statistics.

+ - ``_ + ``_ - :param index: A comma-separated list of index names + :param index: A comma-separated list of data streams and indices to retrieve + statistics for. :param level: Return stats aggregated at cluster, index or shard level """ __path_parts: t.Dict[str, str] diff --git a/elasticsearch/_async/client/security.py b/elasticsearch/_async/client/security.py index e8edd8f44..2fb66dddb 100644 --- a/elasticsearch/_async/client/security.py +++ b/elasticsearch/_async/client/security.py @@ -44,14 +44,32 @@ async def activate_user_profile( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a user profile on behalf of another user. - - ``_ - - :param grant_type: - :param access_token: - :param password: - :param username: + .. raw:: html + +

Activate a user profile.

+

Create or update a user profile on behalf of another user.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. + For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token.

+

When updating a profile document, the API enables the document if it was disabled. + Any updates do not change existing content for either the labels or data fields.

+ + + ``_ + + :param grant_type: The type of grant. + :param access_token: The user's Elasticsearch access token or JWT. Both `access` + and `id` JWT token types are supported and they depend on the underlying + JWT realm configuration. If you specify the `access_token` grant type, this + parameter is required. It is not valid with other grant types. + :param password: The user's password. If you specify the `password` grant type, + this parameter is required. It is not valid with other grant types. + :param username: The username that identifies the user. If you specify the `password` + grant type, this parameter is required. It is not valid with other grant + types. """ if grant_type is None and body is None: raise ValueError("Empty value passed for parameter 'grant_type'") @@ -97,14 +115,16 @@ async def authenticate( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Authenticate a user. Authenticates a user and returns information about the authenticated - user. Include the user information in a [basic auth header](https://en.wikipedia.org/wiki/Basic_access_authentication). - A successful call returns a JSON structure that shows user information such as - their username, the roles that are assigned to the user, any assigned metadata, - and information about the realms that authenticated and authorized the user. - If the user cannot be authenticated, this API returns a 401 status code. + .. raw:: html + +

Authenticate a user.

+

Authenticates a user and returns information about the authenticated user. + Include the user information in a basic auth header. + A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + If the user cannot be authenticated, this API returns a 401 status code.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_authenticate" @@ -144,11 +164,14 @@ async def bulk_delete_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The role management APIs are generally the preferred way to manage roles, rather - than using file-based role management. The bulk delete roles API cannot delete - roles that are defined in roles files. + .. raw:: html - ``_ +

Bulk delete roles.

+

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The bulk delete roles API cannot delete roles that are defined in roles files.

+ + + ``_ :param names: An array of role names to delete :param refresh: If `true` (the default) then refresh the affected shards to make @@ -202,11 +225,14 @@ async def bulk_put_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The role management APIs are generally the preferred way to manage roles, rather - than using file-based role management. The bulk create or update roles API cannot - update roles that are defined in roles files. + .. raw:: html + +

Bulk create or update roles.

+

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The bulk create or update roles API cannot update roles that are defined in roles files.

+ - ``_ + ``_ :param roles: A dictionary of role name to RoleDescriptor objects to add or update :param refresh: If `true` (the default) then refresh the affected shards to make @@ -243,6 +269,90 @@ async def bulk_put_role( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("ids", "expiration", "metadata", "role_descriptors"), + ) + async def bulk_update_api_keys( + self, + *, + ids: t.Optional[t.Union[str, t.Sequence[str]]] = None, + error_trace: t.Optional[bool] = None, + expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + metadata: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + role_descriptors: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Bulk update API keys. + Update the attributes for multiple API keys.

+

IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required.

+

This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates.

+

It is not possible to update expired or invalidated API keys.

+

This API supports updates to API key access scope, metadata and expiration. + The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. + The snapshot of the owner's permissions is updated automatically on every call.

+

IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified.

+

A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update.

+ + + ``_ + + :param ids: The API key identifiers. + :param expiration: Expiration time for the API keys. By default, API keys never + expire. This property can be omitted to leave the value unchanged. + :param metadata: Arbitrary nested metadata to associate with the API keys. Within + the `metadata` object, top-level keys beginning with an underscore (`_`) + are reserved for system usage. Any information specified with this parameter + fully replaces metadata previously associated with the API key. + :param role_descriptors: The role descriptors to assign to the API keys. An API + key's effective permissions are an intersection of its assigned privileges + and the point-in-time snapshot of permissions of the owner user. You can + assign new privileges by specifying them in this parameter. To remove assigned + privileges, supply the `role_descriptors` parameter as an empty object `{}`. + If an API key has no assigned privileges, it inherits the owner user's full + permissions. The snapshot of the owner's permissions is always updated, whether + you supply the `role_descriptors` parameter. The structure of a role descriptor + is the same as the request for the create API keys API. + """ + if ids is None and body is None: + raise ValueError("Empty value passed for parameter 'ids'") + __path_parts: t.Dict[str, str] = {} + __path = "/_security/api_key/_bulk_update" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if ids is not None: + __body["ids"] = ids + if expiration is not None: + __body["expiration"] = expiration + if metadata is not None: + __body["metadata"] = metadata + if role_descriptors is not None: + __body["role_descriptors"] = role_descriptors + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.bulk_update_api_keys", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("password", "password_hash"), ) @@ -262,9 +372,13 @@ async def change_password( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Changes the passwords of users in the native realm and built-in users. + .. raw:: html - ``_ +

Change passwords.

+

Change the passwords of users in the native realm and built-in users.

+ + + ``_ :param username: The user whose password you want to change. If you do not specify this parameter, the password is changed for the current user. @@ -324,10 +438,14 @@ async def clear_api_key_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts a subset of all entries from the API key cache. The cache is also automatically - cleared on state changes of the security index. + .. raw:: html + +

Clear the API key cache.

+

Evict a subset of all entries from the API key cache. + The cache is also automatically cleared on state changes of the security index.

- ``_ + + ``_ :param ids: Comma-separated list of API key IDs to evict from the API key cache. To evict all API keys, use `*`. Does not support other wildcard patterns. @@ -366,11 +484,17 @@ async def clear_cached_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts application privileges from the native application privileges cache. + .. raw:: html + +

Clear the privileges cache.

+

Evict privileges from the native application privilege cache. + The cache is also automatically cleared for applications that have their privileges updated.

- ``_ - :param application: A comma-separated list of application names + ``_ + + :param application: A comma-separated list of applications. To clear all applications, + use an asterism (`*`). It does not support other wildcard patterns. """ if application in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'application'") @@ -407,13 +531,23 @@ async def clear_cached_realms( usernames: t.Optional[t.Sequence[str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts users from the user cache. Can completely clear the cache or evict specific - users. + .. raw:: html + +

Clear the user cache.

+

Evict users from the user cache. + You can completely clear the cache or evict specific users.

+

User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. + There are realm settings that you can use to configure the user cache. + For more information, refer to the documentation about controlling the user cache.

- ``_ - :param realms: Comma-separated list of realms to clear - :param usernames: Comma-separated list of usernames to clear from the cache + ``_ + + :param realms: A comma-separated list of realms. To clear all realms, use an + asterisk (`*`). It does not support other wildcard patterns. + :param usernames: A comma-separated list of the users to clear from the cache. + If you do not specify this parameter, the API evicts all users from the user + cache. """ if realms in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'realms'") @@ -451,11 +585,17 @@ async def clear_cached_roles( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts roles from the native role cache. + .. raw:: html + +

Clear the roles cache.

+

Evict roles from the native role cache.

- ``_ - :param name: Role name + ``_ + + :param name: A comma-separated list of roles to evict from the role cache. To + evict all roles, use an asterisk (`*`). It does not support other wildcard + patterns. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -493,13 +633,23 @@ async def clear_cached_service_tokens( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts tokens from the service account token caches. + .. raw:: html + +

Clear service account token caches.

+

Evict a subset of all entries from the service account token caches. + Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. + This API clears matching entries from both caches.

+

The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. + The cache for tokens backed by the service_tokens file is cleared automatically on file changes.

- ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: A comma-separated list of service token names + ``_ + + :param namespace: The namespace, which is a top-level grouping of service accounts. + :param service: The name of the service, which must be unique within its namespace. + :param name: A comma-separated list of token names to evict from the service + account token caches. Use a wildcard (`*`) to evict all tokens that belong + to a service account. It does not support other wildcard patterns. """ if namespace in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'namespace'") @@ -552,31 +702,43 @@ async def create_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an API key. Creates an API key for access without requiring basic authentication. - A successful request returns a JSON structure that contains the API key, its - unique id, and its name. If applicable, it also returns expiration information - for the API key in milliseconds. NOTE: By default, API keys never expire. You - can specify expiration information when you create the API keys. + .. raw:: html - ``_ +

Create an API key.

+

Create an API key for access without requiring basic authentication.

+

IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. + If you specify privileges, the API returns an error.

+

A successful request returns a JSON structure that contains the API key, its unique id, and its name. + If applicable, it also returns expiration information for the API key in milliseconds.

+

NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys.

+

The API keys are created by the Elasticsearch API key service, which is automatically enabled. + To configure or turn off the API key service, refer to API key service setting documentation.

- :param expiration: Expiration time for the API key. By default, API keys never - expire. + + ``_ + + :param expiration: The expiration time for the API key. By default, API keys + never expire. :param metadata: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. - :param name: Specifies the name for this API key. + :param name: A name for the API key. :param refresh: If `true` (the default) 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` then do nothing with refreshes. - :param role_descriptors: An array of role descriptors for this API key. This - parameter is optional. When it is not specified or is an empty array, then - the API key will have a point in time snapshot of permissions of the authenticated - user. If you supply role descriptors then the resultant permissions would - be an intersection of API keys permissions and authenticated user’s permissions - thereby limiting the access scope for API keys. The structure of role descriptor - is the same as the request for create role API. For more details, see create - or update roles API. + :param role_descriptors: An array of role descriptors for this API key. When + it is not specified or it is an empty array, the API key will have a point + in time snapshot of permissions of the authenticated user. If you supply + role descriptors, the resultant permissions are an intersection of API keys + permissions and the authenticated user's permissions thereby limiting the + access scope for API keys. The structure of role descriptor is the same as + the request for the create role API. For more details, refer to the create + or update roles API. NOTE: Due to the way in which this permission intersection + is calculated, it is not possible to create an API key that is a child of + another API key, unless the derived key is created without any privileges. + In this case, you must explicitly specify a role descriptor with no privileges. + The derived API key can be used for authentication; it will not have authority + to call Elasticsearch APIs. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" @@ -612,6 +774,88 @@ async def create_api_key( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("access", "name", "expiration", "metadata"), + ) + async def create_cross_cluster_api_key( + self, + *, + access: t.Optional[t.Mapping[str, t.Any]] = None, + name: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + metadata: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Create a cross-cluster API key.

+

Create an API key of the cross_cluster type for the API key based remote cluster access. + A cross_cluster API key cannot be used to authenticate through the REST interface.

+

IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.

+

Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.

+

NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property.

+

A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.

+

By default, API keys never expire. You can specify expiration information when you create the API keys.

+

Cross-cluster API keys can only be updated with the update cross-cluster API key API. + Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.

+ + + ``_ + + :param access: The access to be granted to this API key. The access is composed + of permissions for cross-cluster search and cross-cluster replication. At + least one of them must be specified. NOTE: No explicit privileges should + be specified for either search or replication access. The creation process + automatically converts the access specification to a role descriptor which + has relevant privileges assigned accordingly. + :param name: Specifies the name for this API key. + :param expiration: Expiration time for the API key. By default, API keys never + expire. + :param metadata: Arbitrary metadata that you want to associate with the API key. + It supports nested data structure. Within the metadata object, keys beginning + with `_` are reserved for system usage. + """ + if access is None and body is None: + raise ValueError("Empty value passed for parameter 'access'") + if name is None and body is None: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {} + __path = "/_security/cross_cluster/api_key" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if access is not None: + __body["access"] = access + if name is not None: + __body["name"] = name + if expiration is not None: + __body["expiration"] = expiration + if metadata is not None: + __body["metadata"] = metadata + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.create_cross_cluster_api_key", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def create_service_token( self, @@ -628,13 +872,26 @@ async def create_service_token( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a service accounts token for access without requiring basic authentication. - - ``_ - - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: An identifier for the token name + .. raw:: html + +

Create a service account token.

+

Create a service accounts token for access without requiring basic authentication.

+

NOTE: Service account tokens never expire. + You must actively delete them if they are no longer needed.

+ + + ``_ + + :param namespace: The name of the namespace, which is a top-level grouping of + service accounts. + :param service: The name of the service. + :param name: The name for the service account token. If omitted, a random name + will be generated. Token names must be at least one and no more than 256 + characters. They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes + (`-`), and underscores (`_`), but cannot begin with an underscore. NOTE: + Token names must be unique in the context of the associated service account. + They must also be globally unique with their fully qualified names, which + are comprised of the service account principal and token name, such as `//`. :param refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -683,6 +940,71 @@ async def create_service_token( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("x509_certificate_chain",), + ) + async def delegate_pki( + self, + *, + x509_certificate_chain: t.Optional[t.Sequence[str]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Delegate PKI authentication.

+

This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. + The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. + A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm.

+

This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch.

+

IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. + This is part of the TLS authentication process and it is delegated to the proxy that calls this API. + The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token.

+ + + ``_ + + :param x509_certificate_chain: The X509Certificate chain, which is represented + as an ordered string array. Each string in the array is a base64-encoded + (Section 4 of RFC4648 - not base64url-encoded) of the certificate's DER encoding. + The first element is the target certificate that contains the subject distinguished + name that is requesting access. This may be followed by additional certificates; + each subsequent certificate is used to certify the previous one. + """ + if x509_certificate_chain is None and body is None: + raise ValueError( + "Empty value passed for parameter 'x509_certificate_chain'" + ) + __path_parts: t.Dict[str, str] = {} + __path = "/_security/delegate_pki" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if x509_certificate_chain is not None: + __body["x509_certificate_chain"] = x509_certificate_chain + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.delegate_pki", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def delete_privileges( self, @@ -698,12 +1020,21 @@ async def delete_privileges( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes application privileges. + .. raw:: html + +

Delete application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_security cluster privilege (or a greater privilege such as all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
- ``_ - :param application: Application name - :param name: Privilege name + ``_ + + :param application: The name of the application. Application privileges are always + associated with exactly one application. + :param name: The name of the privilege. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -754,11 +1085,17 @@ async def delete_role( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes roles in the native realm. + .. raw:: html + +

Delete roles.

+

Delete roles in the native realm. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The delete roles API cannot remove roles that are defined in roles files.

+ - ``_ + ``_ - :param name: Role name + :param name: The name of the role. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -802,11 +1139,19 @@ async def delete_role_mapping( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes role mappings. + .. raw:: html + +

Delete role mappings.

+

Role mappings define which roles are assigned to each user. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. + The delete role mappings API cannot remove role mappings that are defined in role mapping files.

- ``_ - :param name: Role-mapping name + ``_ + + :param name: The distinct name that identifies the role mapping. The name is + used solely as an identifier to facilitate interaction via the API; it does + not affect the behavior of the mapping in any way. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -852,13 +1197,17 @@ async def delete_service_token( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a service account token. + .. raw:: html + +

Delete service account tokens.

+

Delete service account tokens for a service in a specified namespace.

- ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: An identifier for the token name + ``_ + + :param namespace: The namespace, which is a top-level grouping of service accounts. + :param service: The service name. + :param name: The name of the service account token. :param refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -910,11 +1259,15 @@ async def delete_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes users from the native realm. + .. raw:: html + +

Delete users.

+

Delete users from the native realm.

- ``_ - :param username: username + ``_ + + :param username: An identifier for the user. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -958,11 +1311,17 @@ async def disable_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Disables users in the native realm. + .. raw:: html + +

Disable users.

+

Disable users in the native realm. + By default, when you create users, they are enabled. + You can use this API to revoke a user's access to Elasticsearch.

- ``_ - :param username: The username of the user to disable + ``_ + + :param username: An identifier for the user. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -1006,14 +1365,23 @@ async def disable_user_profile( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Disables a user profile so it's not visible in user profile searches. + .. raw:: html + +

Disable a user profile.

+

Disable user profiles so that they are not visible in user profile searches.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. + To re-enable a disabled user profile, use the enable user profile API .

- ``_ + + ``_ :param uid: Unique identifier for the user profile. :param refresh: If 'true', Elasticsearch refreshes 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' do nothing with refreshes. + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', it does nothing with refreshes. """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") @@ -1054,11 +1422,16 @@ async def enable_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables users in the native realm. + .. raw:: html + +

Enable users.

+

Enable users in the native realm. + By default, when you create users, they are enabled.

- ``_ - :param username: The username of the user to enable + ``_ + + :param username: An identifier for the user. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -1102,14 +1475,23 @@ async def enable_user_profile( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables a user profile so it's visible in user profile searches. + .. raw:: html - ``_ +

Enable a user profile.

+

Enable user profiles to make them visible in user profile searches.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

When you activate a user profile, it's automatically enabled and visible in user profile searches. + If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again.

- :param uid: Unique identifier for the user profile. + + ``_ + + :param uid: A unique identifier for the user profile. :param refresh: If 'true', Elasticsearch refreshes 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' do nothing with refreshes. + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', nothing is done with refreshes. """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") @@ -1146,10 +1528,15 @@ async def enroll_kibana( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables a Kibana instance to configure itself for communication with a secured - Elasticsearch cluster. + .. raw:: html - ``_ +

Enroll Kibana.

+

Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster.

+

NOTE: This API is currently intended for internal use only by Kibana. + Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_security/enroll/kibana" @@ -1182,9 +1569,15 @@ async def enroll_node( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows a new node to join an existing cluster with security features enabled. + .. raw:: html + +

Enroll a node.

+

Enroll a new node to allow it to join an existing cluster with security features enabled.

+

The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. + The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_security/enroll/node" @@ -1225,13 +1618,15 @@ async def get_api_key( with_profile_uid: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get API key information. Retrieves information for one or more API keys. NOTE: - If you have only the `manage_own_api_key` privilege, this API returns only the - API keys that you own. If you have `read_security`, `manage_api_key` or greater - privileges (including `manage_security`), this API returns all API keys regardless - of ownership. + .. raw:: html - ``_ +

Get API key information.

+

Retrieves information for one or more API keys. + NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership.

+ + + ``_ :param active_only: A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, @@ -1303,10 +1698,13 @@ async def get_builtin_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the list of cluster privileges and index privileges that are available - in this version of Elasticsearch. + .. raw:: html + +

Get builtin privileges.

+

Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_security/privilege/_builtin" @@ -1341,12 +1739,23 @@ async def get_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves application privileges. + .. raw:: html - ``_ +

Get application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The read_security cluster privilege (or a greater privilege such as manage_security or all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
- :param application: Application name - :param name: Privilege name + + ``_ + + :param application: The name of the application. Application privileges are always + associated with exactly one application. If you do not specify this parameter, + the API returns information about all privileges for all applications. + :param name: The name of the privilege. If you do not specify this parameter, + the API returns information about all privileges for the requested application. """ __path_parts: t.Dict[str, str] if application not in SKIP_IN_PATH and name not in SKIP_IN_PATH: @@ -1388,11 +1797,15 @@ async def get_role( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - The role management APIs are generally the preferred way to manage roles, rather - than using file-based role management. The get roles API cannot retrieve roles - that are defined in roles files. + .. raw:: html + +

Get roles.

+

Get roles in the native realm. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The get roles API cannot retrieve roles that are defined in roles files.

+ - ``_ + ``_ :param name: The name of the role. You can specify multiple roles as a comma-separated list. If you do not specify this parameter, the API returns information about @@ -1435,9 +1848,15 @@ async def get_role_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves role mappings. + .. raw:: html - ``_ +

Get role mappings.

+

Role mappings define which roles are assigned to each user. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. + The get role mappings API cannot retrieve role mappings that are defined in role mapping files.

+ + + ``_ :param name: The distinct name that identifies the role mapping. The name is used solely as an identifier to facilitate interaction via the API; it does @@ -1483,14 +1902,19 @@ async def get_service_accounts( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - This API returns a list of service accounts that match the provided path parameter(s). + .. raw:: html + +

Get service accounts.

+

Get a list of service accounts that match the provided path parameters.

+

NOTE: Currently, only the elastic/fleet-server service account is available.

+ - ``_ + ``_ - :param namespace: Name of the namespace. Omit this parameter to retrieve information - about all service accounts. If you omit this parameter, you must also omit - the `service` parameter. - :param service: Name of the service name. Omit this parameter to retrieve information + :param namespace: The name of the namespace. Omit this parameter to retrieve + information about all service accounts. If you omit this parameter, you must + also omit the `service` parameter. + :param service: The service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. """ __path_parts: t.Dict[str, str] @@ -1534,12 +1958,19 @@ async def get_service_credentials( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information of all service credentials for a service account. + .. raw:: html - ``_ +

Get service account credentials.

+

To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security).

+

The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster.

+

NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. + Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens.

- :param namespace: Name of the namespace. - :param service: Name of the service name. + + ``_ + + :param namespace: The name of the namespace. + :param service: The service name. """ if namespace in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'namespace'") @@ -1569,6 +2000,58 @@ async def get_service_credentials( path_parts=__path_parts, ) + @_rewrite_parameters() + async def get_settings( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get security index settings.

+

Get the user-configurable settings for the security internal index (.security and associated indices). + Only a subset of the index settings — those that are user-configurable—will be shown. + This includes:

+
    +
  • index.auto_expand_replicas
  • +
  • index.number_of_replicas
  • +
+ + + ``_ + + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_security/settings" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_settings", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "grant_type", @@ -1602,16 +2085,39 @@ async def get_token( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a bearer token for access without requiring basic authentication. - - ``_ - - :param grant_type: - :param kerberos_ticket: - :param password: - :param refresh_token: - :param scope: - :param username: + .. raw:: html + +

Get a token.

+

Create a bearer token for access without requiring basic authentication. + The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. + Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. + When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface.

+

The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body.

+

A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available.

+

The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. + That time period is defined by the xpack.security.authc.token.timeout setting. + If you want to invalidate a token immediately, you can do so by using the invalidate token API.

+ + + ``_ + + :param grant_type: The type of grant. Supported grant types are: `password`, + `_kerberos`, `client_credentials`, and `refresh_token`. + :param kerberos_ticket: The base64 encoded kerberos ticket. If you specify the + `_kerberos` grant type, this parameter is required. This parameter is not + valid with any other supported grant type. + :param password: The user's password. If you specify the `password` grant type, + this parameter is required. This parameter is not valid with any other supported + grant type. + :param refresh_token: The string that was returned when you created the token, + which enables you to extend its life. If you specify the `refresh_token` + grant type, this parameter is required. This parameter is not valid with + any other supported grant type. + :param scope: The scope of the token. Currently tokens are only issued for a + scope of FULL regardless of the value sent with the request. + :param username: The username that identifies the user. If you specify the `password` + grant type, this parameter is required. This parameter is not valid with + any other supported grant type. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" @@ -1661,15 +2167,19 @@ async def get_user( with_profile_uid: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about users in the native realm and built-in users. + .. raw:: html + +

Get users.

+

Get information about users in the native realm and built-in users.

- ``_ + + ``_ :param username: An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users. - :param with_profile_uid: If true will return the User Profile ID for a user, - if any. + :param with_profile_uid: Determines whether to retrieve the user profile UID, + if it exists, for the users. """ __path_parts: t.Dict[str, str] if username not in SKIP_IN_PATH: @@ -1712,9 +2222,16 @@ async def get_user_privileges( username: t.Optional[t.Union[None, str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves security privileges for the logged in user. + .. raw:: html + +

Get user privileges.

+

Get the security privileges for the logged in user. + All users can use this API, but only to determine their own privileges. + To check the privileges of other users, you must use the run as feature. + To check whether a user has a specific list of privileges, use the has privileges API.

+ - ``_ + ``_ :param application: The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, @@ -1762,15 +2279,22 @@ async def get_user_profile( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a user's profile using the unique profile ID. + .. raw:: html - ``_ +

Get a user profile.

+

Get a user's profile using the unique profile ID.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ + + ``_ :param uid: A unique identifier for the user profile. - :param data: List of filters for the `data` field of the profile document. To - return all content use `data=*`. To return a subset of content use `data=` - to retrieve content nested under the specified ``. By default returns - no `data` content. + :param data: A comma-separated list of filters for the `data` field of the profile + document. To return all content use `data=*`. To return a subset of content + use `data=` to retrieve content nested under the specified ``. + By default returns no `data` content. """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") @@ -1826,31 +2350,37 @@ async def grant_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates an API key on behalf of another user. This API is similar to Create API - keys, however it creates the API key for a user that is different than the user - that runs the API. The caller must have authentication credentials (either an - access token, or a username and password) for the user on whose behalf the API - key will be created. It is not possible to use this API to create an API key - without that user’s credentials. The user, for whom the authentication credentials - is provided, can optionally "run as" (impersonate) another user. In this case, - the API key will be created on behalf of the impersonated user. This API is intended - be used by applications that need to create and manage API keys for end users, - but cannot guarantee that those users have permission to create API keys on their - own behalf. A successful grant API key API call returns a JSON structure that - contains the API key, its unique id, and its name. If applicable, it also returns - expiration information for the API key in milliseconds. By default, API keys - never expire. You can specify expiration information when you create the API - keys. - - ``_ - - :param api_key: Defines the API key. + .. raw:: html + +

Grant an API key.

+

Create an API key on behalf of another user. + This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. + The caller must have authentication credentials for the user on whose behalf the API key will be created. + It is not possible to use this API to create an API key without that user's credentials. + The supported user authentication credential types are:

+
    +
  • username and password
  • +
  • Elasticsearch access tokens
  • +
  • JWTs
  • +
+

The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + In this case, the API key will be created on behalf of the impersonated user.

+

This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + The API keys are created by the Elasticsearch API key service, which is automatically enabled.

+

A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + If applicable, it also returns expiration information for the API key in milliseconds.

+

By default, API keys never expire. You can specify expiration information when you create the API keys.

+ + + ``_ + + :param api_key: The API key. :param grant_type: The type of grant. Supported grant types are: `access_token`, `password`. - :param access_token: The user’s access token. If you specify the `access_token` + :param access_token: The user's access token. If you specify the `access_token` grant type, this parameter is required. It is not valid with other grant types. - :param password: The user’s password. If you specify the `password` grant type, + :param password: The user's password. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. :param run_as: The name of the user to be impersonated. :param username: The user name that identifies the user. If you specify the `password` @@ -1954,6 +2484,7 @@ async def has_privileges( "monitor_ml", "monitor_rollup", "monitor_snapshot", + "monitor_stats", "monitor_text_structure", "monitor_transform", "monitor_watcher", @@ -1980,10 +2511,15 @@ async def has_privileges( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Check user privileges. Determines whether the specified user has a specified - list of privileges. + .. raw:: html + +

Check user privileges.

+

Determine whether the specified user has a specified list of privileges. + All users can use this API, but only to determine their own privileges. + To check the privileges of other users, you must use the run as feature.

+ - ``_ + ``_ :param user: Username :param application: @@ -2040,12 +2576,17 @@ async def has_privileges_user_profile( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Determines whether the users associated with the specified profile IDs have all - the requested privileges. + .. raw:: html - ``_ +

Check user profile privileges.

+

Determine whether the users associated with the specified user profile IDs have all the requested privileges.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

- :param privileges: + + ``_ + + :param privileges: An object containing all the privileges to be checked. :param uids: A list of profile IDs. The privileges are checked for associated users of the profiles. """ @@ -2100,29 +2641,39 @@ async def invalidate_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidate API keys. Invalidates one or more API keys. The `manage_api_key` privilege - allows deleting any API keys. The `manage_own_api_key` only allows deleting API - keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, - an invalidation request must be issued in one of the three formats: - Set the - parameter `owner=true`. - Or, set both `username` and `realm_name` to match the - user’s identity. - Or, if the request is issued by an API key, i.e. an API key - invalidates itself, specify its ID in the `ids` field. + .. raw:: html + +

Invalidate API keys.

+

This API invalidates API keys created by the create API key or grant API key APIs. + Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted.

+

To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. + The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. + The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. + The manage_own_api_key only allows deleting REST API keys that are owned by the user. + In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats:

+
    +
  • Set the parameter owner=true.
  • +
  • Or, set both username and realm_name to match the user's identity.
  • +
  • Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field.
  • +
- ``_ + + ``_ :param id: :param ids: A list of API key ids. This parameter cannot be used with any of `name`, `realm_name`, or `username`. :param name: An API key name. This parameter cannot be used with any of `ids`, `realm_name` or `username`. - :param owner: Can be used to query API keys owned by the currently authenticated - user. The `realm_name` or `username` parameters cannot be specified when - this parameter is set to `true` as they are assumed to be the currently authenticated - ones. + :param owner: Query API keys owned by the currently authenticated user. The `realm_name` + or `username` parameters cannot be specified when this parameter is set to + `true` as they are assumed to be the currently authenticated ones. NOTE: + At least one of `ids`, `name`, `username`, and `realm_name` must be specified + if `owner` is `false`. :param realm_name: The name of an authentication realm. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. :param username: The username of a user. This parameter cannot be used with either - `ids` or `name`, or when `owner` flag is set to `true`. + `ids` or `name` or when `owner` flag is set to `true`. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" @@ -2177,14 +2728,30 @@ async def invalidate_token( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidates one or more access tokens or refresh tokens. + .. raw:: html - ``_ +

Invalidate a token.

+

The access tokens returned by the get token API have a finite period of time for which they are valid. + After that time period, they can no longer be used. + The time period is defined by the xpack.security.authc.token.timeout setting.

+

The refresh tokens returned by the get token API are only valid for 24 hours. + They can also be used exactly once. + If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API.

+

NOTE: While all parameters are optional, at least one of them is required. + More specifically, either one of token or refresh_token parameters is required. + If none of these two are specified, then realm_name and/or username need to be specified.

- :param realm_name: - :param refresh_token: - :param token: - :param username: + + ``_ + + :param realm_name: The name of an authentication realm. This parameter cannot + be used with either `refresh_token` or `token`. + :param refresh_token: A refresh token. This parameter cannot be used if any of + `refresh_token`, `realm_name`, or `username` are used. + :param token: An access token. This parameter cannot be used if any of `refresh_token`, + `realm_name`, or `username` are used. + :param username: The username of a user. This parameter cannot be used with either + `refresh_token` or `token`. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" @@ -2218,6 +2785,229 @@ async def invalidate_token( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("nonce", "redirect_uri", "state", "realm"), + ) + async def oidc_authenticate( + self, + *, + nonce: t.Optional[str] = None, + redirect_uri: t.Optional[str] = None, + state: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + realm: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Authenticate OpenID Connect.

+

Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ + + ``_ + + :param nonce: Associate a client session with an ID token and mitigate replay + attacks. This value needs to be the same as the one that was provided to + the `/_security/oidc/prepare` API or the one that was generated by Elasticsearch + and included in the response to that call. + :param redirect_uri: The URL to which the OpenID Connect Provider redirected + the User Agent in response to an authentication request after a successful + authentication. This URL must be provided as-is (URL encoded), taken from + the body of the response or as the value of a location header in the response + from the OpenID Connect Provider. + :param state: Maintain state between the authentication request and the response. + This value needs to be the same as the one that was provided to the `/_security/oidc/prepare` + API or the one that was generated by Elasticsearch and included in the response + to that call. + :param realm: The name of the OpenID Connect realm. This property is useful in + cases where multiple realms are defined. + """ + if nonce is None and body is None: + raise ValueError("Empty value passed for parameter 'nonce'") + if redirect_uri is None and body is None: + raise ValueError("Empty value passed for parameter 'redirect_uri'") + if state is None and body is None: + raise ValueError("Empty value passed for parameter 'state'") + __path_parts: t.Dict[str, str] = {} + __path = "/_security/oidc/authenticate" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if nonce is not None: + __body["nonce"] = nonce + if redirect_uri is not None: + __body["redirect_uri"] = redirect_uri + if state is not None: + __body["state"] = state + if realm is not None: + __body["realm"] = realm + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.oidc_authenticate", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("access_token", "refresh_token"), + ) + async def oidc_logout( + self, + *, + access_token: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + refresh_token: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Logout of OpenID Connect.

+

Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API.

+

If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ + + ``_ + + :param access_token: The access token to be invalidated. + :param refresh_token: The refresh token to be invalidated. + """ + if access_token is None and body is None: + raise ValueError("Empty value passed for parameter 'access_token'") + __path_parts: t.Dict[str, str] = {} + __path = "/_security/oidc/logout" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if access_token is not None: + __body["access_token"] = access_token + if refresh_token is not None: + __body["refresh_token"] = refresh_token + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.oidc_logout", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("iss", "login_hint", "nonce", "realm", "state"), + ) + async def oidc_prepare_authentication( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + iss: t.Optional[str] = None, + login_hint: t.Optional[str] = None, + nonce: t.Optional[str] = None, + pretty: t.Optional[bool] = None, + realm: t.Optional[str] = None, + state: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Prepare OpenID connect authentication.

+

Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch.

+

The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ + + ``_ + + :param iss: In the case of a third party initiated single sign on, this is the + issuer identifier for the OP that the RP is to send the authentication request + to. It cannot be specified when *realm* is specified. One of *realm* or *iss* + is required. + :param login_hint: In the case of a third party initiated single sign on, it + is a string value that is included in the authentication request as the *login_hint* + parameter. This parameter is not valid when *realm* is specified. + :param nonce: The value used to associate a client session with an ID token and + to mitigate replay attacks. If the caller of the API does not provide a value, + Elasticsearch will generate one with sufficient entropy and return it in + the response. + :param realm: The name of the OpenID Connect realm in Elasticsearch the configuration + of which should be used in order to generate the authentication request. + It cannot be specified when *iss* is specified. One of *realm* or *iss* is + required. + :param state: The value used to maintain state between the authentication request + and the response, typically used as a Cross-Site Request Forgery mitigation. + If the caller of the API does not provide a value, Elasticsearch will generate + one with sufficient entropy and return it in the response. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_security/oidc/prepare" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if iss is not None: + __body["iss"] = iss + if login_hint is not None: + __body["login_hint"] = login_hint + if nonce is not None: + __body["nonce"] = nonce + if realm is not None: + __body["realm"] = realm + if state is not None: + __body["state"] = state + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.oidc_prepare_authentication", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_name="privileges", ) @@ -2237,9 +3027,28 @@ async def put_privileges( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Adds or updates application privileges. - - ``_ + .. raw:: html + +

Create or update application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_security cluster privilege (or a greater privilege such as all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
+

Application names are formed from a prefix, with an optional suffix that conform to the following rules:

+
    +
  • The prefix must begin with a lowercase ASCII letter.
  • +
  • The prefix must contain only ASCII letters or digits.
  • +
  • The prefix must be at least 3 characters long.
  • +
  • If the suffix exists, it must begin with either a dash - or _.
  • +
  • The suffix cannot contain any of the following characters: \\, /, *, ?, ", <, >, |, ,, *.
  • +
  • No part of the name can contain whitespace.
  • +
+

Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and ..

+

Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :.

+ + + ``_ :param privileges: :param refresh: If `true` (the default) then refresh the affected shards to make @@ -2285,6 +3094,8 @@ async def put_privileges( "global_", "indices", "metadata", + "remote_cluster", + "remote_indices", "run_as", "transient_metadata", ), @@ -2344,6 +3155,7 @@ async def put_role( "monitor_ml", "monitor_rollup", "monitor_snapshot", + "monitor_stats", "monitor_text_structure", "monitor_transform", "monitor_watcher", @@ -2373,16 +3185,22 @@ async def put_role( refresh: t.Optional[ t.Union[bool, str, t.Literal["false", "true", "wait_for"]] ] = None, + remote_cluster: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, + remote_indices: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, run_as: t.Optional[t.Sequence[str]] = None, transient_metadata: t.Optional[t.Mapping[str, t.Any]] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The role management APIs are generally the preferred way to manage roles, rather - than using file-based role management. The create or update roles API cannot - update roles that are defined in roles files. + .. raw:: html + +

Create or update roles.

+

The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. + The create or update roles API cannot update roles that are defined in roles files. + File-based role management is not available in Elastic Serverless.

- ``_ + + ``_ :param name: The name of the role. :param applications: A list of application privilege entries. @@ -2398,6 +3216,11 @@ async def put_role( :param refresh: If `true` (the default) 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` then do nothing with refreshes. + :param remote_cluster: A list of remote cluster permissions entries. + :param remote_indices: A list of remote indices permissions entries. NOTE: Remote + indices are effective for remote clusters configured with the API key based + model. They have no effect for remote clusters configured with the certificate + based model. :param run_as: A list of users that the owners of this role can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will @@ -2438,6 +3261,10 @@ async def put_role( __body["indices"] = indices if metadata is not None: __body["metadata"] = metadata + if remote_cluster is not None: + __body["remote_cluster"] = remote_cluster + if remote_indices is not None: + __body["remote_indices"] = remote_indices if run_as is not None: __body["run_as"] = run_as if transient_metadata is not None: @@ -2483,19 +3310,48 @@ async def put_role_mapping( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates and updates role mappings. - - ``_ + .. raw:: html + +

Create or update role mappings.

+

Role mappings define which roles are assigned to each user. + Each mapping has rules that identify users and a list of roles that are granted to those users. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files.

+

NOTE: This API does not create roles. Rather, it maps users to existing roles. + Roles can be created by using the create or update roles API or roles files.

+

Role templates

+

The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. + For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. + The roles field is used for this purpose.

+

For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. + The role_templates field is used for this purpose.

+

NOTE: To use role templates successfully, the relevant scripting feature must be enabled. + Otherwise, all attempts to create a role mapping with role templates fail.

+

All of the user fields that are available in the role mapping rules are also available in the role templates. + Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated.

+

By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. + If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names.

+ + + ``_ - :param name: Role-mapping name - :param enabled: - :param metadata: + :param name: The distinct name that identifies the role mapping. The name is + used solely as an identifier to facilitate interaction via the API; it does + not affect the behavior of the mapping in any way. + :param enabled: Mappings that have `enabled` set to `false` are ignored when + role mapping is performed. + :param metadata: Additional metadata that helps define which roles are assigned + to each user. Within the metadata object, keys beginning with `_` are reserved + for system usage. :param refresh: If `true` (the default) 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` then do nothing with refreshes. - :param role_templates: - :param roles: - :param rules: + :param role_templates: A list of Mustache templates that will be evaluated to + determine the roles names that should granted to the users that match the + role mapping rules. Exactly one of `roles` or `role_templates` must be specified. + :param roles: A list of role names that are granted to the users that match the + role mapping rules. Exactly one of `roles` or `role_templates` must be specified. + :param rules: The rules that determine which users should be matched by the mapping. + A rule is a logical condition that is expressed by using a JSON DSL. :param run_as: """ if name in SKIP_IN_PATH: @@ -2570,22 +3426,41 @@ async def put_user( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Adds and updates users in the native realm. These users are commonly referred - to as native users. - - ``_ - - :param username: The username of the User - :param email: - :param enabled: - :param full_name: - :param metadata: - :param password: - :param password_hash: - :param refresh: If `true` (the default) 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` then do nothing with refreshes. - :param roles: + .. raw:: html + +

Create or update users.

+

Add and update users in the native realm. + A password is required for adding a new user but is optional when updating an existing user. + To change a user's password without updating any other fields, use the change password API.

+ + + ``_ + + :param username: An identifier for the user. NOTE: Usernames must be at least + 1 and no more than 507 characters. They can contain alphanumeric characters + (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic + Latin (ASCII) block. Leading or trailing whitespace is not allowed. + :param email: The email of the user. + :param enabled: Specifies whether the user is enabled. + :param full_name: The full name of the user. + :param metadata: Arbitrary metadata that you want to associate with the user. + :param password: The user's password. Passwords must be at least 6 characters + long. When adding a user, one of `password` or `password_hash` is required. + When updating an existing user, the password is optional, so that other fields + on the user (such as their roles) may be updated without modifying the user's + password + :param password_hash: A hash of the user's password. This must be produced using + the same hashing algorithm as has been configured for password storage. For + more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm` + setting in the user cache and password hash algorithm documentation. Using + this parameter allows the client to pre-hash the password for performance + and/or confidentiality reasons. The `password` parameter and the `password_hash` + parameter cannot be used in the same request. + :param refresh: Valid values are `true`, `false`, and `wait_for`. These values + have the same meaning as in the index API, but the default value for this + API is true. + :param roles: A set of roles the user has. The roles determine the user's access + permissions. To create a user without any roles, specify an empty list (`[]`). """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") @@ -2668,10 +3543,17 @@ async def query_api_keys( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Query API keys. Retrieves a paginated list of API keys and their information. - You can optionally filter the results with a query. + .. raw:: html + +

Find API keys with a query.

+

Get a paginated list of API keys and their information. + You can optionally filter the results with a query.

+

To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. + If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership.

- ``_ + + ``_ :param aggregations: Any aggregations to run over the corpus of returned API keys. Aggregations and queries work together. Aggregations are computed only @@ -2685,30 +3567,39 @@ async def query_api_keys( `terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`, `composite`, `filter`, and `filters`. Additionally, aggregations only run over the same subset of fields that query works with. - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which API keys to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following public information associated with an API key: `id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`, - `username`, `realm`, and `metadata`. - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: Other than `id`, all public fields of an API key are eligible for - sorting. In addition, sort can also be applied to the `_doc` field to sort - by index order. + `username`, `realm`, and `metadata`. NOTE: The queryable string values associated + with API keys are internally mapped as keywords. Consequently, if no `analyzer` + parameter is specified for a `match` query, then the provided match query + string is interpreted as a single keyword value. Such a match query is hence + equivalent to a `term` query. + :param search_after: The search after definition. + :param size: The number of hits to return. It must not be negative. The `size` + parameter can be set to `0`, in which case no API key matches are returned, + only the aggregation results. By default, you cannot page through more than + 10,000 hits using the `from` and `size` parameters. To page through more + hits, use the `search_after` parameter. + :param sort: The sort definition. Other than `id`, all public fields of an API + key are eligible for sorting. In addition, sort can also be applied to the + `_doc` field to sort by index order. :param typed_keys: Determines whether aggregation names are prefixed by their respective types in the response. :param with_limited_by: Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection - of its assigned role descriptors and the owner user's role descriptors. - :param with_profile_uid: Determines whether to also retrieve the profile uid, - for the API key owner principal, if it exists. + of its assigned role descriptors and the owner user's role descriptors (effectively + limited by it). An API key cannot retrieve any API key’s limited-by role + descriptors (including itself) unless it has `manage_api_key` or higher privileges. + :param with_profile_uid: Determines whether to also retrieve the profile UID + for the API key owner principal. If it exists, the profile UID is returned + under the `profile_uid` response field for each API key. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/api_key" @@ -2795,26 +3686,34 @@ async def query_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves roles in a paginated manner. You can optionally filter the results - with a query. + .. raw:: html - ``_ +

Find roles with a query.

+

Get roles in a paginated manner. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. + You can optionally filter the results with a query. + Also, the results can be paginated and sorted.

- :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + + ``_ + + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which roles to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with roles: `name`, `description`, - `metadata`, `applications.application`, `applications.privileges`, `applications.resources`. - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: All public fields of a role are eligible for sorting. In addition, - sort can also be applied to the `_doc` field to sort by index order. + `metadata`, `applications.application`, `applications.privileges`, and `applications.resources`. + :param search_after: The search after definition. + :param size: The number of hits to return. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param sort: The sort definition. You can sort on `username`, `roles`, or `enabled`. + In addition, sort can also be applied to the `_doc` field to sort by index + order. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/role" @@ -2881,28 +3780,35 @@ async def query_user( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information for Users in a paginated manner. You can optionally filter - the results with a query. + .. raw:: html - ``_ +

Find users with a query.

+

Get information for users in a paginated manner. + You can optionally filter the results with a query.

+

NOTE: As opposed to the get user API, built-in users are excluded from the result. + This API is only for native users.

- :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + + ``_ + + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which users to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with user: `username`, - `roles`, `enabled` - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: Fields eligible for sorting are: username, roles, enabled In addition, - sort can also be applied to the `_doc` field to sort by index order. - :param with_profile_uid: If true will return the User Profile ID for the users - in the query result, if any. + `roles`, `enabled`, `full_name`, and `email`. + :param search_after: The search after definition + :param size: The number of hits to return. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param sort: The sort definition. Fields eligible for sorting are: `username`, + `roles`, `enabled`. In addition, sort can also be applied to the `_doc` field + to sort by index order. + :param with_profile_uid: Determines whether to retrieve the user profile UID, + if it exists, for the users. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/user" @@ -2960,13 +3866,27 @@ async def saml_authenticate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Submits a SAML Response message to Elasticsearch for consumption. + .. raw:: html + +

Authenticate SAML.

+

Submit a SAML response message to Elasticsearch for consumption.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The SAML message that is submitted can be:

+
    +
  • A response to a SAML authentication request that was previously created using the SAML prepare authentication API.
  • +
  • An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow.
  • +
+

In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>.

+

After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. + This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch.

+ - ``_ + ``_ - :param content: The SAML response as it was sent by the user’s browser, usually + :param content: The SAML response as it was sent by the user's browser, usually a Base64 encoded XML document. - :param ids: A json array with all the valid SAML Request Ids that the caller + :param ids: A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. :param realm: The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. @@ -3022,11 +3942,22 @@ async def saml_complete_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Verifies the logout response sent from the SAML IdP. + .. raw:: html - ``_ +

Logout of SAML completely.

+

Verifies the logout response sent from the SAML IdP.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. + This API verifies the response by ensuring the content is relevant and validating its signature. + An empty response is returned if the verification process is successful. + The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. + The caller of this API must prepare the request accordingly so that this API can handle either of them.

- :param ids: A json array with all the valid SAML Request Ids that the caller + + ``_ + + :param ids: A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. :param realm: The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. @@ -3088,25 +4019,35 @@ async def saml_invalidate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Submits a SAML LogoutRequest message to Elasticsearch for consumption. + .. raw:: html + +

Invalidate SAML.

+

Submit a SAML LogoutRequest message to Elasticsearch for consumption.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The logout request comes from the SAML IdP during an IdP initiated Single Logout. + The custom web application can use this API to have Elasticsearch process the LogoutRequest. + After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. + Thus the user can be redirected back to their IdP.

+ - ``_ + ``_ :param query_string: The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. This query should include - a single parameter named SAMLRequest that contains a SAML logout request + a single parameter named `SAMLRequest` that contains a SAML logout request that is deflated and Base64 encoded. If the SAML IdP has signed the logout - request, the URL should include two extra parameters named SigAlg and Signature + request, the URL should include two extra parameters named `SigAlg` and `Signature` that contain the algorithm used for the signature and the signature value - itself. In order for Elasticsearch to be able to verify the IdP’s signature, - the value of the query_string field must be an exact match to the string + itself. In order for Elasticsearch to be able to verify the IdP's signature, + the value of the `query_string` field must be an exact match to the string provided by the browser. The client application must not attempt to parse or process the string in any way. :param acs: The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this - parameter or the realm parameter. + parameter or the `realm` parameter. :param realm: The name of the SAML realm in Elasticsearch the configuration. - You must specify either this parameter or the acs parameter. + You must specify either this parameter or the `acs` parameter. """ if query_string is None and body is None: raise ValueError("Empty value passed for parameter 'query_string'") @@ -3155,13 +4096,21 @@ async def saml_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Submits a request to invalidate an access token and refresh token. + .. raw:: html - ``_ +

Logout of SAML.

+

Submits a request to invalidate an access token and refresh token.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

This API invalidates the tokens that were generated for a user by the SAML authenticate API. + If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout).

+ + + ``_ :param token: The access token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent token that was received - after refreshing the original one by using a refresh_token. + after refreshing the original one by using a `refresh_token`. :param refresh_token: The refresh token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent refresh token that was received after refreshing the original access token. @@ -3212,19 +4161,31 @@ async def saml_prepare_authentication( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a SAML authentication request () as a URL string, based - on the configuration of the respective SAML realm in Elasticsearch. + .. raw:: html + +

Prepare SAML authentication.

+

Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

This API returns a URL pointing to the SAML Identity Provider. + You can use the URL to redirect the browser of the user in order to continue the authentication process. + The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. + If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. + These parameters contain the algorithm used for the signature and the signature value itself. + It also returns a random string that uniquely identifies this SAML Authentication request. + The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process.

+ - ``_ + ``_ :param acs: The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. The realm is used to generate the authentication - request. You must specify either this parameter or the realm parameter. + request. You must specify either this parameter or the `realm` parameter. :param realm: The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. You must specify either this - parameter or the acs parameter. + parameter or the `acs` parameter. :param relay_state: A string that will be included in the redirect URL that this - API returns as the RelayState query parameter. If the Authentication Request + API returns as the `RelayState` query parameter. If the Authentication Request is signed, this value is used as part of the signature computation. """ __path_parts: t.Dict[str, str] = {} @@ -3268,9 +4229,15 @@ async def saml_service_provider_metadata( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Generate SAML metadata for a SAML 2.0 Service Provider. + .. raw:: html - ``_ +

Create SAML service provider metadata.

+

Generate SAML metadata for a SAML 2.0 Service Provider.

+

The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. + This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch.

+ + + ``_ :param realm_name: The name of the SAML realm in Elasticsearch. """ @@ -3314,21 +4281,30 @@ async def suggest_user_profiles( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get suggestions for user profiles that match specified search criteria. + .. raw:: html + +

Suggest a user profile.

+

Get suggestions for user profiles that match specified search criteria.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ - ``_ + ``_ - :param data: List of filters for the `data` field of the profile document. To - return all content use `data=*`. To return a subset of content use `data=` - to retrieve content nested under the specified ``. By default returns - no `data` content. + :param data: A comma-separated list of filters for the `data` field of the profile + document. To return all content use `data=*`. To return a subset of content, + use `data=` to retrieve content nested under the specified ``. + By default, the API returns no `data` content. It is an error to specify + `data` as both the query parameter and the request body field. :param hint: Extra search criteria to improve relevance of the suggestion result. Profiles matching the spcified hint are ranked higher in the response. Profiles - not matching the hint don't exclude the profile from the response as long - as the profile matches the `name` field query. - :param name: Query string used to match name-related fields in user profile documents. - Name-related fields are the user's `username`, `full_name`, and `email`. - :param size: Number of profiles to return. + not matching the hint aren't excluded from the response as long as the profile + matches the `name` field query. + :param name: A query string used to match name-related fields in user profile + documents. Name-related fields are the user's `username`, `full_name`, and + `email`. + :param size: The number of profiles to return. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/profile/_suggest" @@ -3383,38 +4359,43 @@ async def update_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an API key. Updates attributes of an existing API key. Users can only - update API keys that they created or that were granted to them. Use this API - to update API keys created by the create API Key or grant API Key APIs. If you - need to apply the same update to many API keys, you can use bulk update API Keys - to reduce overhead. It’s not possible to update expired API keys, or API keys - that have been invalidated by invalidate API Key. This API supports updates to - an API key’s access scope and metadata. The access scope of an API key is derived - from the `role_descriptors` you specify in the request, and a snapshot of the - owner user’s permissions at the time of the request. The snapshot of the owner’s - permissions is updated automatically on every call. If you don’t specify `role_descriptors` - in the request, a call to this API might still change the API key’s access scope. - This change can occur if the owner user’s permissions have changed since the - API key was created or last modified. To update another user’s API key, use the - `run_as` feature to submit a request on behalf of another user. IMPORTANT: It’s - not possible to use an API key as the authentication credential for this API. - To update an API key, the owner user’s credentials are required. - - ``_ + .. raw:: html + +

Update an API key.

+

Update attributes of an existing API key. + This API supports updates to an API key's access scope, expiration, and metadata.

+

To use this API, you must have at least the manage_own_api_key cluster privilege. + Users can only update API keys that they created or that were granted to them. + To update another user’s API key, use the run_as feature to submit a request on behalf of another user.

+

IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required.

+

Use this API to update API keys created by the create API key or grant API Key APIs. + If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. + It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API.

+

The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. + The snapshot of the owner's permissions is updated automatically on every call.

+

IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. + This change can occur if the owner user's permissions have changed since the API key was created or last modified.

+ + + ``_ :param id: The ID of the API key to update. - :param expiration: Expiration time for the API key. + :param expiration: The expiration time for the API key. By default, API keys + never expire. This property can be omitted to leave the expiration unchanged. :param metadata: Arbitrary metadata that you want to associate with the API key. - It supports nested data structure. Within the metadata object, keys beginning - with _ are reserved for system usage. - :param role_descriptors: An array of role descriptors for this API key. This - parameter is optional. When it is not specified or is an empty array, then - the API key will have a point in time snapshot of permissions of the authenticated - user. If you supply role descriptors then the resultant permissions would - be an intersection of API keys permissions and authenticated user’s permissions - thereby limiting the access scope for API keys. The structure of role descriptor - is the same as the request for create role API. For more details, see create - or update roles API. + It supports a nested data structure. Within the metadata object, keys beginning + with `_` are reserved for system usage. When specified, this value fully + replaces the metadata previously associated with the API key. + :param role_descriptors: The role descriptors to assign to this API key. The + API key's effective permissions are an intersection of its assigned privileges + and the point in time snapshot of permissions of the owner user. You can + assign new privileges by specifying them in this parameter. To remove assigned + privileges, you can supply an empty `role_descriptors` parameter, that is + to say, an empty object `{}`. If an API key has no assigned privileges, it + inherits the owner user's full permissions. The snapshot of the owner's permissions + is always updated, whether you supply the `role_descriptors` parameter or + not. The structure of a role descriptor is the same as the request for the + create API keys API. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -3452,6 +4433,163 @@ async def update_api_key( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("access", "expiration", "metadata"), + ) + async def update_cross_cluster_api_key( + self, + *, + id: str, + access: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + metadata: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update a cross-cluster API key.

+

Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access.

+

To use this API, you must have at least the manage_security cluster privilege. + Users can only update API keys that they created. + To update another user's API key, use the run_as feature to submit a request on behalf of another user.

+

IMPORTANT: It's not possible to use an API key as the authentication credential for this API. + To update an API key, the owner user's credentials are required.

+

It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API.

+

This API supports updates to an API key's access scope, metadata, and expiration. + The owner user's information, such as the username and realm, is also updated automatically on every call.

+

NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API.

+ + + ``_ + + :param id: The ID of the cross-cluster API key to update. + :param access: The access to be granted to this API key. The access is composed + of permissions for cross cluster search and cross cluster replication. At + least one of them must be specified. When specified, the new access assignment + fully replaces the previously assigned access. + :param expiration: The expiration time for the API key. By default, API keys + never expire. This property can be omitted to leave the value unchanged. + :param metadata: Arbitrary metadata that you want to associate with the API key. + It supports nested data structure. Within the metadata object, keys beginning + with `_` are reserved for system usage. When specified, this information + fully replaces metadata previously associated with the API key. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if access is None and body is None: + raise ValueError("Empty value passed for parameter 'access'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_security/cross_cluster/api_key/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if access is not None: + __body["access"] = access + if expiration is not None: + __body["expiration"] = expiration + if metadata is not None: + __body["metadata"] = metadata + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.update_cross_cluster_api_key", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("security", "security_profile", "security_tokens"), + parameter_aliases={ + "security-profile": "security_profile", + "security-tokens": "security_tokens", + }, + ) + async def update_settings( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + security: t.Optional[t.Mapping[str, t.Any]] = None, + security_profile: t.Optional[t.Mapping[str, t.Any]] = None, + security_tokens: t.Optional[t.Mapping[str, t.Any]] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update security index settings.

+

Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas.

+

NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates.

+

If a specific index is not in use on the system and settings are provided for it, the request will be rejected. + This API does not yet support configuring the settings for indices before they are in use.

+ + + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param security: Settings for the index used for most security configuration, + including native realm users and roles configured with the API. + :param security_profile: Settings for the index used to store profile information. + :param security_tokens: Settings for the index used to store tokens. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_security/settings" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if not __body: + if security is not None: + __body["security"] = security + if security_profile is not None: + __body["security-profile"] = security_profile + if security_tokens is not None: + __body["security-tokens"] = security_tokens + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.update_settings", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("data", "labels"), ) @@ -3473,23 +4611,42 @@ async def update_user_profile_data( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates specific data for the user profile that's associated with the specified - unique ID. - - ``_ + .. raw:: html + +

Update user profile data.

+

Update specific data for the user profile that is associated with a unique ID.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_user_profile cluster privilege.
  • +
  • The update_profile_data global privilege for the namespaces that are referenced in the request.
  • +
+

This API updates the labels and data fields of an existing user profile document with JSON objects. + New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request.

+

For both labels and data, content is namespaced by the top-level fields. + The update_profile_data global privilege grants privileges for updating only the allowed namespaces.

+ + + ``_ :param uid: A unique identifier for the user profile. :param data: Non-searchable data that you want to associate with the user profile. - This field supports a nested data structure. + This field supports a nested data structure. Within the `data` object, top-level + keys cannot begin with an underscore (`_`) or contain a period (`.`). The + data object is not searchable, but can be retrieved with the get user profile + API. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param labels: Searchable data that you want to associate with the user profile. - This field supports a nested data structure. + This field supports a nested data structure. Within the labels object, top-level + keys cannot begin with an underscore (`_`) or contain a period (`.`). :param refresh: If 'true', Elasticsearch refreshes 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' do nothing with refreshes. + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', nothing is done with refreshes. """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") diff --git a/elasticsearch/_async/client/shutdown.py b/elasticsearch/_async/client/shutdown.py index 0301435c9..54e2beed1 100644 --- a/elasticsearch/_async/client/shutdown.py +++ b/elasticsearch/_async/client/shutdown.py @@ -42,10 +42,18 @@ async def delete_node( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and - ECK. Direct use is not supported. + .. raw:: html - ``_ +

Cancel node shutdown preparations. + Remove a node from the shutdown list so it can resume normal operations. + You must explicitly clear the shutdown request when a node rejoins the cluster or when a node has permanently left the cluster. + Shutdown requests are never removed automatically by Elasticsearch.

+

NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. + Direct use is not supported.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+ + + ``_ :param node_id: The node id of node to be removed from the shutdown state :param master_timeout: Period to wait for a connection to the master node. If @@ -98,10 +106,16 @@ async def get_node( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieve status of a node or nodes that are currently marked as shutting down. - Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. + .. raw:: html + +

Get the shutdown status.

+

Get information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled. + The API returns status information for each part of the shut down process.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

- ``_ + + ``_ :param node_id: Which node for which to retrieve the shutdown status :param master_timeout: Period to wait for a connection to the master node. If @@ -166,12 +180,26 @@ async def put_node( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct - use is not supported. + .. raw:: html + +

Prepare a node to be shut down.

+

NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

If you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+

The API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster. + This ensures that Elasticsearch can be stopped safely with minimal disruption to the cluster.

+

You must specify the type of shutdown: restart, remove, or replace. + If a node is already being prepared for shutdown, you can use this API to change the shutdown type.

+

IMPORTANT: This API does NOT terminate the Elasticsearch process. + Monitor the node shutdown status to determine when it is safe to stop Elasticsearch.

+ - ``_ + ``_ - :param node_id: The node id of node to be shut down + :param node_id: The node identifier. This parameter is not validated against + the cluster's active nodes. This enables you to register a node for shut + down while it is offline. No error is thrown if you specify an invalid node + ID. :param reason: A human-readable reason that the node is being shut down. This field provides information for other cluster operators; it does not affect the shut down process. @@ -192,17 +220,17 @@ async def put_node( the index.unassigned.node_left.delayed_timeout setting. If you specify both a restart allocation delay and an index-level allocation delay, the longer of the two is used. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. :param target_node_name: Only valid if type is replace. Specifies the name of the node that is replacing the node being shut down. Shards from the shut down node are only allowed to be allocated to the target node, and no other data will be allocated to the target node. During relocation of data certain allocation rules are ignored, such as disk watermarks or user attribute filtering rules. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'node_id'") diff --git a/elasticsearch/_async/client/simulate.py b/elasticsearch/_async/client/simulate.py new file mode 100644 index 000000000..5b2f11b2e --- /dev/null +++ b/elasticsearch/_async/client/simulate.py @@ -0,0 +1,145 @@ +# 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. + +import typing as t + +from elastic_transport import ObjectApiResponse + +from ._base import NamespacedClient +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) + + +class SimulateClient(NamespacedClient): + + @_rewrite_parameters( + body_fields=( + "docs", + "component_template_substitutions", + "index_template_substitutions", + "mapping_addition", + "pipeline_substitutions", + ), + ) + @_stability_warning(Stability.EXPERIMENTAL) + async def ingest( + self, + *, + docs: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, + index: t.Optional[str] = None, + component_template_substitutions: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Any]] + ] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + index_template_substitutions: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Any]] + ] = None, + mapping_addition: t.Optional[t.Mapping[str, t.Any]] = None, + pipeline: t.Optional[str] = None, + pipeline_substitutions: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Any]] + ] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Simulate data ingestion. + Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index.

+

This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch.

+

The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. + If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. + No data is indexed into Elasticsearch. + Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. + The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result.

+

This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. + The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index.

+

By default, the pipeline definitions that are currently in the system are used. + However, you can supply substitute pipeline definitions in the body of the request. + These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request.

+ + + ``_ + + :param docs: Sample documents to test in the pipeline. + :param index: The index to simulate ingesting into. This value can be overridden + by specifying an index on each document. If you specify this parameter in + the request path, it is used for any documents that do not explicitly specify + an index argument. + :param component_template_substitutions: A map of component template names to + substitute component template definition objects. + :param index_template_substitutions: A map of index template names to substitute + index template definition objects. + :param mapping_addition: + :param pipeline: The pipeline to use as the default pipeline. This value can + be used to override the default pipeline of the index. + :param pipeline_substitutions: Pipelines to test. If you don’t specify the `pipeline` + request path parameter, this parameter is required. If you specify both this + and the request path parameter, the API only uses the request path parameter. + """ + if docs is None and body is None: + raise ValueError("Empty value passed for parameter 'docs'") + __path_parts: t.Dict[str, str] + if index not in SKIP_IN_PATH: + __path_parts = {"index": _quote(index)} + __path = f'/_ingest/{__path_parts["index"]}/_simulate' + else: + __path_parts = {} + __path = "/_ingest/_simulate" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pipeline is not None: + __query["pipeline"] = pipeline + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if docs is not None: + __body["docs"] = docs + if component_template_substitutions is not None: + __body["component_template_substitutions"] = ( + component_template_substitutions + ) + if index_template_substitutions is not None: + __body["index_template_substitutions"] = index_template_substitutions + if mapping_addition is not None: + __body["mapping_addition"] = mapping_addition + if pipeline_substitutions is not None: + __body["pipeline_substitutions"] = pipeline_substitutions + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="simulate.ingest", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_async/client/slm.py b/elasticsearch/_async/client/slm.py index 831774cc2..62ef2aa53 100644 --- a/elasticsearch/_async/client/slm.py +++ b/elasticsearch/_async/client/slm.py @@ -33,14 +33,26 @@ async def delete_lifecycle( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an existing snapshot lifecycle policy. + .. raw:: html + +

Delete a policy. + Delete a snapshot lifecycle policy definition. + This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots.

- ``_ + + ``_ :param policy_id: The id of the snapshot lifecycle policy to remove + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") @@ -53,8 +65,12 @@ async def delete_lifecycle( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "DELETE", @@ -73,15 +89,26 @@ async def execute_lifecycle( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Immediately creates a snapshot according to the lifecycle policy, without waiting - for the scheduled time. + .. raw:: html + +

Run a policy. + Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. + The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance.

- ``_ + + ``_ :param policy_id: The id of the snapshot lifecycle policy to be executed + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") @@ -94,8 +121,12 @@ async def execute_lifecycle( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", @@ -113,12 +144,25 @@ async def execute_retention( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes any snapshots that are expired according to the policy's retention rules. + .. raw:: html + +

Run a retention policy. + Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. + The retention policy is normally applied according to its schedule.

+ + + ``_ - ``_ + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/_execute_retention" @@ -129,8 +173,12 @@ async def execute_retention( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", @@ -149,15 +197,25 @@ async def get_lifecycle( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves one or more snapshot lifecycle policy definitions and information about - the latest snapshot attempts. + .. raw:: html + +

Get policy information. + Get snapshot lifecycle policy definitions and information about the latest snapshot attempts.

+ - ``_ + ``_ :param policy_id: Comma-separated list of snapshot lifecycle policies to retrieve + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] if policy_id not in SKIP_IN_PATH: @@ -173,8 +231,12 @@ async def get_lifecycle( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "GET", @@ -192,13 +254,24 @@ async def get_stats( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns global and policy-level statistics about actions taken by snapshot lifecycle - management. + .. raw:: html + +

Get snapshot lifecycle management statistics. + Get global and policy-level statistics about actions taken by snapshot lifecycle management.

- ``_ + + ``_ + + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/stats" @@ -209,8 +282,12 @@ async def get_stats( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "GET", @@ -228,12 +305,25 @@ async def get_status( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the status of snapshot lifecycle management (SLM). + .. raw:: html + +

Get the snapshot lifecycle management status.

+ - ``_ + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. To indicate + that the request should never timeout, set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/status" @@ -244,8 +334,12 @@ async def get_status( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "GET", @@ -277,16 +371,23 @@ async def put_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a snapshot lifecycle policy. + .. raw:: html - ``_ +

Create or update a policy. + Create or update a snapshot lifecycle policy. + If the policy already exists, this request increments the policy version. + Only the latest version of a policy is stored.

- :param policy_id: ID for the snapshot lifecycle policy you want to create or - update. + + ``_ + + :param policy_id: The identifier for the snapshot lifecycle policy you want to + create or update. :param config: Configuration for each snapshot created by the policy. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. :param name: Name automatically assigned to each snapshot created by the policy. Date math is supported. To prevent conflicting snapshot names, a UUID is automatically appended to each snapshot name. @@ -297,8 +398,9 @@ async def put_lifecycle( by the policy. :param schedule: Periodic or absolute schedule at which the policy creates snapshots. SLM applies schedule changes immediately. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. To indicate + that the request should never timeout, set it to `-1`. """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") @@ -351,12 +453,27 @@ async def start( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Turns on snapshot lifecycle management (SLM). + .. raw:: html + +

Start snapshot lifecycle management. + Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. + Manually starting SLM is necessary only if it has been stopped using the stop SLM API.

- ``_ + + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. To indicate + that the request should never timeout, set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/start" @@ -367,8 +484,12 @@ async def start( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", @@ -386,12 +507,31 @@ async def stop( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Turns off snapshot lifecycle management (SLM). + .. raw:: html + +

Stop snapshot lifecycle management. + Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. + This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. + Stopping SLM does not stop any snapshots that are in progress. + You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped.

+

The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. + Use the get snapshot lifecycle management status API to see if SLM is running.

+ - ``_ + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. To indicate + that the request should never timeout, set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/stop" @@ -402,8 +542,12 @@ async def stop( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", diff --git a/elasticsearch/_async/client/snapshot.py b/elasticsearch/_async/client/snapshot.py index 6f2d6bcbf..df8d6920c 100644 --- a/elasticsearch/_async/client/snapshot.py +++ b/elasticsearch/_async/client/snapshot.py @@ -20,7 +20,13 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class SnapshotClient(NamespacedClient): @@ -38,10 +44,13 @@ async def cleanup_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Triggers the review of a snapshot repository’s contents and deletes any stale - data not referenced by existing snapshots. + .. raw:: html - ``_ +

Clean up the snapshot repository. + Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots.

+ + + ``_ :param name: Snapshot repository to clean up. :param master_timeout: Period to wait for a connection to the master node. @@ -93,9 +102,13 @@ async def clone( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clones indices from one snapshot into another snapshot in the same repository. + .. raw:: html + +

Clone a snapshot. + Clone part of all of a snapshot into another snapshot in the same repository.

+ - ``_ + ``_ :param repository: A repository name :param snapshot: The name of the snapshot to clone from @@ -176,9 +189,13 @@ async def create( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a snapshot in a repository. + .. raw:: html - ``_ +

Create a snapshot. + Take a snapshot of a cluster or of data streams and indices.

+ + + ``_ :param repository: Repository for the snapshot. :param snapshot: Name of the snapshot. Must be unique in the repository. @@ -280,9 +297,15 @@ async def create_repository( verify: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a repository. + .. raw:: html + +

Create or update a snapshot repository. + IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. + To register a snapshot repository, the cluster's global metadata must be writeable. + Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access.

- ``_ + + ``_ :param name: A repository name :param repository: @@ -340,9 +363,12 @@ async def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes one or more snapshots. + .. raw:: html + +

Delete snapshots.

+ - ``_ + ``_ :param repository: A repository name :param snapshot: A comma-separated list of snapshot names @@ -391,9 +417,14 @@ async def delete_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a repository. + .. raw:: html - ``_ +

Delete snapshot repositories. + When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. + The snapshots themselves are left untouched and in place.

+ + + ``_ :param name: Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. @@ -465,9 +496,12 @@ async def get( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about a snapshot. + .. raw:: html + +

Get snapshot information.

- ``_ + + ``_ :param repository: Comma-separated list of snapshot repository names used to limit the request. Wildcard (*) expressions are supported. @@ -577,9 +611,12 @@ async def get_repository( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about a repository. + .. raw:: html + +

Get snapshot repository information.

+ - ``_ + ``_ :param name: A comma-separated list of repository names :param local: Return local information, do not retrieve the state from master @@ -616,6 +653,291 @@ async def get_repository( path_parts=__path_parts, ) + @_rewrite_parameters() + async def repository_analyze( + self, + *, + name: str, + blob_count: t.Optional[int] = None, + concurrency: t.Optional[int] = None, + detailed: t.Optional[bool] = None, + early_read_node_count: t.Optional[int] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + max_blob_size: t.Optional[t.Union[int, str]] = None, + max_total_data_size: t.Optional[t.Union[int, str]] = None, + pretty: t.Optional[bool] = None, + rare_action_probability: t.Optional[float] = None, + rarely_abort_writes: t.Optional[bool] = None, + read_node_count: t.Optional[int] = None, + register_operation_count: t.Optional[int] = None, + seed: t.Optional[int] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Analyze a snapshot repository. + Analyze the performance characteristics and any incorrect behaviour found in a repository.

+

The response exposes implementation details of the analysis which may change from version to version. + The response body format is therefore not considered stable and may be different in newer versions.

+

There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. + Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system.

+

The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. + Run your first analysis with the default parameter values to check for simple problems. + If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. + Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. + Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once.

+

If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. + This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. + If so, this storage system is not suitable for use as a snapshot repository. + You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects.

+

If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. + You can use this information to determine the performance of your storage system. + If any operation fails or returns an incorrect result, the API returns an error. + If the API returns an error, it may not have removed all the data it wrote to the repository. + The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. + You should verify that this location has been cleaned up correctly. + If there is still leftover data at the specified location, you should manually remove it.

+

If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. + Some clients are configured to close their connection if no response is received within a certain timeout. + An analysis takes a long time to complete so you might need to relax any such client-side timeouts. + On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. + The path to the leftover data is recorded in the Elasticsearch logs. + You should verify that this location has been cleaned up correctly. + If there is still leftover data at the specified location, you should manually remove it.

+

If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. + The analysis attempts to detect common bugs but it does not offer 100% coverage. + Additionally, it does not test the following:

+
    +
  • Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster.
  • +
  • Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted.
  • +
  • Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results.
  • +
+

IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. + This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. + You must ensure this load does not affect other users of these systems. + Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume.

+

NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.

+

NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. + A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. + This indicates it behaves incorrectly in ways that the former version did not detect. + You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch.

+

NOTE: This API may not work correctly in a mixed-version cluster.

+

Implementation details

+

NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions.

+

The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. + These tasks are distributed over the data and master-eligible nodes in the cluster for execution.

+

For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. + The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. + If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires.

+

For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. + These reads are permitted to fail, but must not return partial data. + If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires.

+

For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. + In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. + If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites.

+

The executing node will use a variety of different methods to write the blob. + For instance, where applicable, it will use both single-part and multi-part uploads. + Similarly, the reading nodes will use a variety of different methods to read the data back again. + For instance they may read the entire blob from start to end or may read only a subset of the data.

+

For some blob-level tasks, the executing node will cancel the write before it is complete. + In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob.

+

Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. + This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. + The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. + Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. + Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. + If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. + Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. + Some operations also verify the behavior on small blobs with sizes other than 8 bytes.

+ + + ``_ + + :param name: The name of the repository. + :param blob_count: The total number of blobs to write to the repository during + the test. For realistic experiments, you should set it to at least `2000`. + :param concurrency: The number of operations to run concurrently during the test. + :param detailed: Indicates whether to return detailed results, including timing + information for every operation performed during the analysis. If false, + it returns only a summary of the analysis. + :param early_read_node_count: The number of nodes on which to perform an early + read operation while writing each blob. Early read operations are only rarely + performed. + :param max_blob_size: The maximum size of a blob to be written during the test. + For realistic experiments, you should set it to at least `2gb`. + :param max_total_data_size: An upper limit on the total size of all the blobs + written during the test. For realistic experiments, you should set it to + at least `1tb`. + :param rare_action_probability: The probability of performing a rare action such + as an early read, an overwrite, or an aborted write on each blob. + :param rarely_abort_writes: Indicates whether to rarely cancel writes before + they complete. + :param read_node_count: The number of nodes on which to read a blob after writing. + :param register_operation_count: The minimum number of linearizable register + operations to perform in total. For realistic experiments, you should set + it to at least `100`. + :param seed: The seed for the pseudo-random number generator used to generate + the list of operations performed during the test. To repeat the same set + of operations in multiple experiments, use the same seed in each experiment. + Note that the operations are performed concurrently so might not always happen + in the same order on each run. + :param timeout: The period of time to wait for the test to complete. If no response + is received before the timeout expires, the test is cancelled and returns + an error. + """ + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}/_analyze' + __query: t.Dict[str, t.Any] = {} + if blob_count is not None: + __query["blob_count"] = blob_count + if concurrency is not None: + __query["concurrency"] = concurrency + if detailed is not None: + __query["detailed"] = detailed + if early_read_node_count is not None: + __query["early_read_node_count"] = early_read_node_count + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if max_blob_size is not None: + __query["max_blob_size"] = max_blob_size + if max_total_data_size is not None: + __query["max_total_data_size"] = max_total_data_size + if pretty is not None: + __query["pretty"] = pretty + if rare_action_probability is not None: + __query["rare_action_probability"] = rare_action_probability + if rarely_abort_writes is not None: + __query["rarely_abort_writes"] = rarely_abort_writes + if read_node_count is not None: + __query["read_node_count"] = read_node_count + if register_operation_count is not None: + __query["register_operation_count"] = register_operation_count + if seed is not None: + __query["seed"] = seed + if timeout is not None: + __query["timeout"] = timeout + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.repository_analyze", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + async def repository_verify_integrity( + self, + *, + name: t.Union[str, t.Sequence[str]], + blob_thread_pool_concurrency: t.Optional[int] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + index_snapshot_verification_concurrency: t.Optional[int] = None, + index_verification_concurrency: t.Optional[int] = None, + max_bytes_per_sec: t.Optional[str] = None, + max_failed_shard_snapshots: t.Optional[int] = None, + meta_thread_pool_concurrency: t.Optional[int] = None, + pretty: t.Optional[bool] = None, + snapshot_verification_concurrency: t.Optional[int] = None, + verify_blob_contents: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Verify the repository integrity. + Verify the integrity of the contents of a snapshot repository.

+

This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail.

+

If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. + Until you do so:

+
    +
  • It may not be possible to restore some snapshots from this repository.
  • +
  • Searchable snapshots may report errors when searched or may have unassigned shards.
  • +
  • Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored.
  • +
  • Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk.
  • +
  • Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents.
  • +
+

If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. + The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. + You must also identify what caused the damage and take action to prevent it from happening again.

+

If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. + In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository.

+

Avoid all operations which write to the repository while the verify repository integrity API is running. + If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. + It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting.

+

NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.

+

NOTE: This API may not work correctly in a mixed-version cluster.

+ + + ``_ + + :param name: A repository name + :param blob_thread_pool_concurrency: Number of threads to use for reading blob + contents + :param index_snapshot_verification_concurrency: Number of snapshots to verify + concurrently within each index + :param index_verification_concurrency: Number of indices to verify concurrently + :param max_bytes_per_sec: Rate limit for individual blob verification + :param max_failed_shard_snapshots: Maximum permitted number of failed shard snapshots + :param meta_thread_pool_concurrency: Number of threads to use for reading metadata + :param snapshot_verification_concurrency: Number of snapshots to verify concurrently + :param verify_blob_contents: Whether to verify the contents of individual blobs + """ + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}/_verify_integrity' + __query: t.Dict[str, t.Any] = {} + if blob_thread_pool_concurrency is not None: + __query["blob_thread_pool_concurrency"] = blob_thread_pool_concurrency + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if index_snapshot_verification_concurrency is not None: + __query["index_snapshot_verification_concurrency"] = ( + index_snapshot_verification_concurrency + ) + if index_verification_concurrency is not None: + __query["index_verification_concurrency"] = index_verification_concurrency + if max_bytes_per_sec is not None: + __query["max_bytes_per_sec"] = max_bytes_per_sec + if max_failed_shard_snapshots is not None: + __query["max_failed_shard_snapshots"] = max_failed_shard_snapshots + if meta_thread_pool_concurrency is not None: + __query["meta_thread_pool_concurrency"] = meta_thread_pool_concurrency + if pretty is not None: + __query["pretty"] = pretty + if snapshot_verification_concurrency is not None: + __query["snapshot_verification_concurrency"] = ( + snapshot_verification_concurrency + ) + if verify_blob_contents is not None: + __query["verify_blob_contents"] = verify_blob_contents + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.repository_verify_integrity", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "feature_states", @@ -654,9 +976,22 @@ async def restore( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Restores a snapshot. + .. raw:: html - ``_ +

Restore a snapshot. + Restore a snapshot of a cluster or data streams and indices.

+

You can restore a snapshot only to a running cluster with an elected master node. + The snapshot repository must be registered and available to the cluster. + The snapshot and cluster versions must be compatible.

+

To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks.

+

Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API:

+
GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream
+          
+

If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices.

+

If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot.

+ + + ``_ :param repository: A repository name :param snapshot: A snapshot name @@ -747,9 +1082,20 @@ async def status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about the status of a snapshot. + .. raw:: html + +

Get the snapshot status. + Get a detailed description of the current state for each shard participating in the snapshot. + Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. + If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API.

+

WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. + The API requires a read from the repository for each shard in each snapshot. + For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards).

+

Depending on the latency of your storage, such requests can take an extremely long time to return results. + These requests can also tax machine resources and, when using cloud storage, incur high processing costs.

- ``_ + + ``_ :param repository: A repository name :param snapshot: A comma-separated list of snapshot names @@ -806,9 +1152,13 @@ async def verify_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Verifies a repository. + .. raw:: html + +

Verify a snapshot repository. + Check for common misconfigurations in a snapshot repository.

+ - ``_ + ``_ :param name: A repository name :param master_timeout: Explicit operation timeout for connection to master node diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py index c089ed495..39ac7c5b9 100644 --- a/elasticsearch/_async/client/sql.py +++ b/elasticsearch/_async/client/sql.py @@ -39,9 +39,12 @@ async def clear_cursor( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clears the SQL cursor + .. raw:: html - ``_ +

Clear an SQL search cursor.

+ + + ``_ :param cursor: Cursor to clear. """ @@ -84,12 +87,21 @@ async def delete_async( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an async SQL search or a stored synchronous SQL search. If the search - is still running, the API cancels it. + .. raw:: html + +

Delete an async SQL search. + Delete an async SQL search or a stored synchronous SQL search. + If the search is still running, the API cancels it.

+

If the Elasticsearch security features are enabled, only the following users can use this API to delete a search:

+
    +
  • Users with the cancel_task cluster privilege.
  • +
  • The user who first submitted the search.
  • +
- ``_ - :param id: Identifier for the search. + ``_ + + :param id: The identifier for the search. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -131,21 +143,26 @@ async def get_async( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current status and available results for an async SQL search or stored - synchronous SQL search - - ``_ - - :param id: Identifier for the search. - :param delimiter: Separator for CSV results. The API only supports this parameter - for CSV responses. - :param format: Format for the response. You must specify a format using this - parameter or the Accept HTTP header. If you specify both, the API uses this - parameter. - :param keep_alive: Retention period for the search and its results. Defaults + .. raw:: html + +

Get async SQL search results. + Get the current status and available results for an async SQL search or stored synchronous SQL search.

+

If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API.

+ + + ``_ + + :param id: The identifier for the search. + :param delimiter: The separator for CSV results. The API supports this parameter + only for CSV responses. + :param format: The format for the response. You must specify a format using this + parameter or the `Accept` HTTP header. If you specify both, the API uses + this parameter. + :param keep_alive: The retention period for the search and its results. It defaults to the `keep_alive` period for the original SQL search. - :param wait_for_completion_timeout: Period to wait for complete results. Defaults - to no timeout, meaning the request waits for complete search results. + :param wait_for_completion_timeout: The period to wait for complete results. + It defaults to no timeout, meaning the request waits for complete search + results. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -189,12 +206,15 @@ async def get_async_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current status of an async SQL search or a stored synchronous SQL - search + .. raw:: html + +

Get the async SQL search status. + Get the current status of an async SQL search or a stored synchronous SQL search.

+ - ``_ + ``_ - :param id: Identifier for the search. + :param id: The identifier for the search. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -221,6 +241,7 @@ async def get_async_status( @_rewrite_parameters( body_fields=( + "allow_partial_search_results", "catalog", "columnar", "cursor", @@ -243,6 +264,7 @@ async def get_async_status( async def query( self, *, + allow_partial_search_results: t.Optional[bool] = None, catalog: t.Optional[str] = None, columnar: t.Optional[bool] = None, cursor: t.Optional[str] = None, @@ -251,7 +273,11 @@ async def query( field_multi_value_leniency: t.Optional[bool] = None, filter: t.Optional[t.Mapping[str, t.Any]] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, - format: t.Optional[str] = None, + format: t.Optional[ + t.Union[ + str, t.Literal["cbor", "csv", "json", "smile", "tsv", "txt", "yaml"] + ] + ] = None, human: t.Optional[bool] = None, index_using_frozen: t.Optional[bool] = None, keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, @@ -269,40 +295,53 @@ async def query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes a SQL request - - ``_ - - :param catalog: Default catalog (cluster) for queries. If unspecified, the queries - execute on the data in the local cluster only. - :param columnar: If true, the results in a columnar fashion: one row represents - all the values of a certain column from the current page of results. - :param cursor: Cursor used to retrieve a set of paginated results. If you specify - a cursor, the API only uses the `columnar` and `time_zone` request body parameters. - It ignores other request body parameters. - :param fetch_size: The maximum number of rows (or entries) to return in one response - :param field_multi_value_leniency: Throw an exception when encountering multiple - values for a field (default) or be lenient and return the first value from - the list (without any guarantees of what that will be - typically the first - in natural ascending order). - :param filter: Elasticsearch query DSL for additional filtering. - :param format: Format for the response. - :param index_using_frozen: If true, the search can run on frozen indices. Defaults - to false. - :param keep_alive: Retention period for an async or saved synchronous search. - :param keep_on_completion: If true, Elasticsearch stores synchronous searches - if you also specify the wait_for_completion_timeout parameter. If false, - Elasticsearch only stores async searches that don’t finish before the wait_for_completion_timeout. - :param page_timeout: The timeout before a pagination request fails. - :param params: Values for parameters in the query. - :param query: SQL query to run. + .. raw:: html + +

Get SQL search results. + Run an SQL request.

+ + + ``_ + + :param allow_partial_search_results: If `true`, the response has partial results + when there are shard request timeouts or shard failures. If `false`, the + API returns an error with no partial results. + :param catalog: The default catalog (cluster) for queries. If unspecified, the + queries execute on the data in the local cluster only. + :param columnar: If `true`, the results are in a columnar fashion: one row represents + all the values of a certain column from the current page of results. The + API supports this parameter only for CBOR, JSON, SMILE, and YAML responses. + :param cursor: The cursor used to retrieve a set of paginated results. If you + specify a cursor, the API only uses the `columnar` and `time_zone` request + body parameters. It ignores other request body parameters. + :param fetch_size: The maximum number of rows (or entries) to return in one response. + :param field_multi_value_leniency: If `false`, the API returns an exception when + encountering multiple values for a field. If `true`, the API is lenient and + returns the first value from the array with no guarantee of consistent results. + :param filter: The Elasticsearch query DSL for additional filtering. + :param format: The format for the response. You can also specify a format using + the `Accept` HTTP header. If you specify both this parameter and the `Accept` + HTTP header, this parameter takes precedence. + :param index_using_frozen: If `true`, the search can run on frozen indices. + :param keep_alive: The retention period for an async or saved synchronous search. + :param keep_on_completion: If `true`, Elasticsearch stores synchronous searches + if you also specify the `wait_for_completion_timeout` parameter. If `false`, + Elasticsearch only stores async searches that don't finish before the `wait_for_completion_timeout`. + :param page_timeout: The minimum retention period for the scroll cursor. After + this time period, a pagination request might fail because the scroll cursor + is no longer available. Subsequent scroll requests prolong the lifetime of + the scroll cursor by the duration of `page_timeout` in the scroll request. + :param params: The values for parameters in the query. + :param query: The SQL query to run. :param request_timeout: The timeout before the request fails. - :param runtime_mappings: Defines one or more runtime fields in the search request. - These fields take precedence over mapped fields with the same name. - :param time_zone: ISO-8601 time zone ID for the search. - :param wait_for_completion_timeout: Period to wait for complete results. Defaults - to no timeout, meaning the request waits for complete search results. If - the search doesn’t finish within this period, the search becomes async. + :param runtime_mappings: One or more runtime fields for the search request. These + fields take precedence over mapped fields with the same name. + :param time_zone: The ISO-8601 time zone ID for the search. + :param wait_for_completion_timeout: The period to wait for complete results. + It defaults to no timeout, meaning the request waits for complete search + results. If the search doesn't finish within this period, the search becomes + async. To save a synchronous search, you must specify this parameter and + the `keep_on_completion` parameter. """ __path_parts: t.Dict[str, str] = {} __path = "/_sql" @@ -319,6 +358,8 @@ async def query( if pretty is not None: __query["pretty"] = pretty if not __body: + if allow_partial_search_results is not None: + __body["allow_partial_search_results"] = allow_partial_search_results if catalog is not None: __body["catalog"] = catalog if columnar is not None: @@ -379,14 +420,19 @@ async def translate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Translates SQL into Elasticsearch queries + .. raw:: html + +

Translate SQL into Elasticsearch queries. + Translate an SQL search into a search API request containing Query DSL. + It accepts the same request body parameters as the SQL search API, excluding cursor.

+ - ``_ + ``_ - :param query: SQL query to run. + :param query: The SQL query to run. :param fetch_size: The maximum number of rows (or entries) to return in one response. - :param filter: Elasticsearch query DSL for additional filtering. - :param time_zone: ISO-8601 time zone ID for the search. + :param filter: The Elasticsearch query DSL for additional filtering. + :param time_zone: The ISO-8601 time zone ID for the search. """ if query is None and body is None: raise ValueError("Empty value passed for parameter 'query'") diff --git a/elasticsearch/_async/client/ssl.py b/elasticsearch/_async/client/ssl.py index 5b9397893..9fc313614 100644 --- a/elasticsearch/_async/client/ssl.py +++ b/elasticsearch/_async/client/ssl.py @@ -35,10 +35,24 @@ async def certificates( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the X.509 certificates used to encrypt communications - in the cluster. + .. raw:: html - ``_ +

Get SSL certificates.

+

Get information about the X.509 certificates that are used to encrypt communications in the cluster. + The API returns a list that includes certificates from all TLS contexts including:

+
    +
  • Settings for transport and HTTP interfaces
  • +
  • TLS settings that are used within authentication realms
  • +
  • TLS settings for remote monitoring exporters
  • +
+

The list includes certificates that are used for configuring trust, such as those configured in the xpack.security.transport.ssl.truststore and xpack.security.transport.ssl.certificate_authorities settings. + It also includes certificates that are used for configuring server identity, such as xpack.security.http.ssl.keystore and xpack.security.http.ssl.certificate settings.

+

The list does not include certificates that are sourced from the default SSL context of the Java Runtime Environment (JRE), even if those certificates are in use within Elasticsearch.

+

NOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API returns all the certificates that are included in the PKCS#11 token irrespective of whether these are used in the Elasticsearch TLS configuration.

+

If Elasticsearch is configured to use a keystore or truststore, the API output includes all certificates in that store, even though some of the certificates might not be in active use within the cluster.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ssl/certificates" diff --git a/elasticsearch/_async/client/synonyms.py b/elasticsearch/_async/client/synonyms.py index 153c552af..21cbd8084 100644 --- a/elasticsearch/_async/client/synonyms.py +++ b/elasticsearch/_async/client/synonyms.py @@ -36,11 +36,26 @@ async def delete_synonym( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a synonym set + .. raw:: html - ``_ +

Delete a synonym set.

+

You can only delete a synonyms set that is not in use by any index analyzer.

+

Synonyms sets can be used in synonym graph token filters and synonym token filters. + These synonym filters can be used as part of search analyzers.

+

Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). + Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase.

+

If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. + To prevent that, synonyms sets that are used in analyzers can't be deleted. + A delete request in this case will return a 400 response code.

+

To remove a synonyms set, you must first remove all indices that contain analyzers using it. + You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. + Once finished, you can delete the index. + When the synonyms set is not used in analyzers, you will be able to delete it.

- :param id: The id of the synonyms set to be deleted + + ``_ + + :param id: The synonyms set identifier to delete. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -77,12 +92,16 @@ async def delete_synonym_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a synonym rule in a synonym set + .. raw:: html + +

Delete a synonym rule. + Delete a synonym rule from a synonym set.

+ - ``_ + ``_ - :param set_id: The id of the synonym set to be updated - :param rule_id: The id of the synonym rule to be deleted + :param set_id: The ID of the synonym set to update. + :param rule_id: The ID of the synonym rule to delete. """ if set_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'set_id'") @@ -127,13 +146,16 @@ async def get_synonym( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a synonym set + .. raw:: html - ``_ +

Get a synonym set.

- :param id: "The id of the synonyms set to be retrieved - :param from_: Starting offset for query rules to be retrieved - :param size: specifies a max number of query rules to retrieve + + ``_ + + :param id: The synonyms set identifier to retrieve. + :param from_: The starting offset for query rules to retrieve. + :param size: The max number of query rules to retrieve. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -174,12 +196,16 @@ async def get_synonym_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a synonym rule from a synonym set + .. raw:: html + +

Get a synonym rule. + Get a synonym rule from a synonym set.

- ``_ - :param set_id: The id of the synonym set to retrieve the synonym rule from - :param rule_id: The id of the synonym rule to retrieve + ``_ + + :param set_id: The ID of the synonym set to retrieve the synonym rule from. + :param rule_id: The ID of the synonym rule to retrieve. """ if set_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'set_id'") @@ -223,12 +249,16 @@ async def get_synonyms_sets( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a summary of all defined synonym sets + .. raw:: html + +

Get all synonym sets. + Get a summary of all defined synonym sets.

- ``_ - :param from_: Starting offset - :param size: specifies a max number of results to get + ``_ + + :param from_: The starting offset for synonyms sets to retrieve. + :param size: The maximum number of synonyms sets to retrieve. """ __path_parts: t.Dict[str, str] = {} __path = "/_synonyms" @@ -272,12 +302,19 @@ async def put_synonym( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a synonym set. + .. raw:: html + +

Create or update a synonym set. + Synonyms sets are limited to a maximum of 10,000 synonym rules per set. + If you need to manage more synonym rules, you can create multiple synonym sets.

+

When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. + This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set.

- ``_ - :param id: The id of the synonyms set to be created or updated - :param synonyms_set: The synonym set information to update + ``_ + + :param id: The ID of the synonyms set to be created or updated. + :param synonyms_set: The synonym rules definitions for the synonyms set. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -325,13 +362,20 @@ async def put_synonym_rule( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a synonym rule in a synonym set + .. raw:: html + +

Create or update a synonym rule. + Create or update a synonym rule in a synonym set.

+

If any of the synonym rules included is invalid, the API returns an error.

+

When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule.

+ - ``_ + ``_ - :param set_id: The id of the synonym set to be updated with the synonym rule - :param rule_id: The id of the synonym rule to be updated or created - :param synonyms: + :param set_id: The ID of the synonym set. + :param rule_id: The ID of the synonym rule to be updated or created. + :param synonyms: The synonym rule information definition, which must be in Solr + format. """ if set_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'set_id'") diff --git a/elasticsearch/_async/client/tasks.py b/elasticsearch/_async/client/tasks.py index 0acbfef31..c3ad38970 100644 --- a/elasticsearch/_async/client/tasks.py +++ b/elasticsearch/_async/client/tasks.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class TasksClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def cancel( self, *, @@ -40,17 +47,29 @@ async def cancel( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancels a task, if it can be cancelled through an API. + .. raw:: html - ``_ +

Cancel a task.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. + It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. + The get task information API will continue to list these cancelled tasks until they complete. + The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible.

+

To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. + You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task.

- :param task_id: ID of the task. - :param actions: Comma-separated list or wildcard expression of actions used to - limit the request. - :param nodes: Comma-separated list of node IDs or names used to limit the request. - :param parent_task_id: Parent task ID used to limit the tasks. - :param wait_for_completion: Should the request block until the cancellation of - the task and its descendant tasks is completed. Defaults to false + + ``_ + + :param task_id: The task identifier. + :param actions: A comma-separated list or wildcard expression of actions that + is used to limit the request. + :param nodes: A comma-separated list of node IDs or names that is used to limit + the request. + :param parent_task_id: A parent task ID that is used to limit the tasks. + :param wait_for_completion: If true, the request blocks until all found tasks + are complete. """ __path_parts: t.Dict[str, str] if task_id not in SKIP_IN_PATH: @@ -87,6 +106,7 @@ async def cancel( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def get( self, *, @@ -99,14 +119,20 @@ async def get( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get task information. Returns information about the tasks currently executing - in the cluster. + .. raw:: html + +

Get task information. + Get information about a task currently running in the cluster.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

If the task identifier is not found, a 404 response code indicates that there are no resources that match the request.

- ``_ - :param task_id: ID of the task. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + ``_ + + :param task_id: The task identifier. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. :param wait_for_completion: If `true`, the request blocks until the task has completed. """ @@ -138,6 +164,7 @@ async def get( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) async def list( self, *, @@ -150,32 +177,89 @@ async def list( ] = None, human: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - node_id: t.Optional[t.Sequence[str]] = None, + nodes: t.Optional[t.Union[str, t.Sequence[str]]] = None, parent_task_id: t.Optional[str] = None, pretty: t.Optional[bool] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - The task management API returns information about tasks currently executing on - one or more nodes in the cluster. + .. raw:: html + +

Get all tasks. + Get information about the tasks currently running on one or more nodes in the cluster.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

Identifying running tasks

+

The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. + This enables you to track certain calls or associate certain tasks with the client that started them. + For example:

+
curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents"
+          
+

The API returns the following result:

+
HTTP/1.1 200 OK
+          X-Opaque-Id: 123456
+          content-type: application/json; charset=UTF-8
+          content-length: 831
 
-        ``_
+          {
+            "tasks" : {
+              "u5lcZHqcQhu-rUoFaqDphA:45" : {
+                "node" : "u5lcZHqcQhu-rUoFaqDphA",
+                "id" : 45,
+                "type" : "transport",
+                "action" : "cluster:monitor/tasks/lists",
+                "start_time_in_millis" : 1513823752749,
+                "running_time_in_nanos" : 293139,
+                "cancellable" : false,
+                "headers" : {
+                  "X-Opaque-Id" : "123456"
+                },
+                "children" : [
+                  {
+                    "node" : "u5lcZHqcQhu-rUoFaqDphA",
+                    "id" : 46,
+                    "type" : "direct",
+                    "action" : "cluster:monitor/tasks/lists[n]",
+                    "start_time_in_millis" : 1513823752750,
+                    "running_time_in_nanos" : 92133,
+                    "cancellable" : false,
+                    "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45",
+                    "headers" : {
+                      "X-Opaque-Id" : "123456"
+                    }
+                  }
+                ]
+              }
+            }
+           }
+          
+

In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. + The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. + The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request.

- :param actions: Comma-separated list or wildcard expression of actions used to - limit the request. + + ``_ + + :param actions: A comma-separated list or wildcard expression of actions used + to limit the request. For example, you can use `cluser:*` to retrieve all + cluster-related tasks. :param detailed: If `true`, the response includes detailed information about - shard recoveries. - :param group_by: Key used to group tasks in the response. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param node_id: Comma-separated list of node IDs or names used to limit returned - information. - :param parent_task_id: Parent task ID used to limit returned information. To - return all tasks, omit this parameter or use a value of `-1`. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + the running tasks. This information is useful to distinguish tasks from each + other but is more costly to run. + :param group_by: A key that is used to group tasks in the response. The task + lists can be grouped either by nodes or by parent tasks. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param nodes: A comma-separated list of node IDs or names that is used to limit + the returned information. + :param parent_task_id: A parent task identifier that is used to limit returned + information. To return all tasks, omit this parameter or use a value of `-1`. + If the parent task is not found, the API does not return a 404 response code. + :param timeout: The period to wait for each node to respond. If a node does not + respond before its timeout expires, the response does not include its information. + However, timed out nodes are included in the `node_failures` property. :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ @@ -196,8 +280,8 @@ async def list( __query["human"] = human if master_timeout is not None: __query["master_timeout"] = master_timeout - if node_id is not None: - __query["node_id"] = node_id + if nodes is not None: + __query["nodes"] = nodes if parent_task_id is not None: __query["parent_task_id"] = parent_task_id if pretty is not None: diff --git a/elasticsearch/_async/client/text_structure.py b/elasticsearch/_async/client/text_structure.py index 8da71dafb..e5d7b1e12 100644 --- a/elasticsearch/_async/client/text_structure.py +++ b/elasticsearch/_async/client/text_structure.py @@ -25,6 +25,370 @@ class TextStructureClient(NamespacedClient): + @_rewrite_parameters() + async def find_field_structure( + self, + *, + field: str, + index: str, + column_names: t.Optional[str] = None, + delimiter: t.Optional[str] = None, + documents_to_sample: t.Optional[int] = None, + ecs_compatibility: t.Optional[t.Union[str, t.Literal["disabled", "v1"]]] = None, + error_trace: t.Optional[bool] = None, + explain: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + format: t.Optional[ + t.Union[ + str, t.Literal["delimited", "ndjson", "semi_structured_text", "xml"] + ] + ] = None, + grok_pattern: t.Optional[str] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + quote: t.Optional[str] = None, + should_trim_fields: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + timestamp_field: t.Optional[str] = None, + timestamp_format: t.Optional[str] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Find the structure of a text field. + Find the structure of a text field in an Elasticsearch index.

+

This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. + For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field.

+

The response from the API contains:

+
    +
  • Sample messages.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.
  • +
  • Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+

If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. + It helps determine why the returned structure was chosen.

+ + + ``_ + + :param field: The field that should be analyzed. + :param index: The name of the index that contains the analyzed field. + :param column_names: If `format` is set to `delimited`, you can specify the column + names in a comma-separated list. If this parameter is not specified, the + structure finder uses the column names from the header row of the text. If + the text does not have a header row, columns are named "column1", "column2", + "column3", for example. + :param delimiter: If you have set `format` to `delimited`, you can specify the + character used to delimit the values in each row. Only a single character + is supported; the delimiter cannot have multiple characters. By default, + the API considers the following possibilities: comma, tab, semi-colon, and + pipe (`|`). In this default scenario, all rows must have the same number + of fields for the delimited format to be detected. If you specify a delimiter, + up to 10% of the rows can have a different number of columns than the first + row. + :param documents_to_sample: The number of documents to include in the structural + analysis. The minimum value is 2. + :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns. + Use this parameter to specify whether to use ECS Grok patterns instead of + legacy ones when the structure finder creates a Grok pattern. This setting + primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` + matches the input. If the structure finder identifies a common structure + but has no idea of the meaning then generic field names such as `path`, `ipaddress`, + `field1`, and `field2` are used in the `grok_pattern` output. The intention + in that situation is that a user who knows the meanings will rename the fields + before using them. + :param explain: If `true`, the response includes a field named `explanation`, + which is an array of strings that indicate how the structure finder produced + its result. + :param format: The high level structure of the text. By default, the API chooses + the format. In this default scenario, all rows must have the same number + of fields for a delimited format to be detected. If the format is set to + delimited and the delimiter is not set, however, the API tolerates up to + 5% of rows that have a different number of columns than the first row. + :param grok_pattern: If the format is `semi_structured_text`, you can specify + a Grok pattern that is used to extract fields from every message in the text. + The name of the timestamp field in the Grok pattern must match what is specified + in the `timestamp_field` parameter. If that parameter is not specified, the + name of the timestamp field in the Grok pattern must match "timestamp". If + `grok_pattern` is not specified, the structure finder creates a Grok pattern. + :param quote: If the format is `delimited`, you can specify the character used + to quote the values in each row if they contain newlines or the delimiter + character. Only a single character is supported. If this parameter is not + specified, the default value is a double quote (`"`). If your delimited text + format does not use quoting, a workaround is to set this argument to a character + that does not appear anywhere in the sample. + :param should_trim_fields: If the format is `delimited`, you can specify whether + values between delimiters should have whitespace trimmed from them. If this + parameter is not specified and the delimiter is pipe (`|`), the default value + is true. Otherwise, the default value is `false`. + :param timeout: The maximum amount of time that the structure analysis can take. + If the analysis is still running when the timeout expires, it will be stopped. + :param timestamp_field: The name of the field that contains the primary timestamp + of each record in the text. In particular, if the text was ingested into + an index, this is the field that would be used to populate the `@timestamp` + field. If the format is `semi_structured_text`, this field must match the + name of the appropriate extraction in the `grok_pattern`. Therefore, for + semi-structured text, it is best not to specify this parameter unless `grok_pattern` + is also specified. For structured text, if you specify this parameter, the + field must exist within the text. If this parameter is not specified, the + structure finder makes a decision about which field (if any) is the primary + timestamp field. For structured text, it is not compulsory to have a timestamp + in the text. + :param timestamp_format: The Java time format of the timestamp field in the text. + Only a subset of Java time format letter groups are supported: * `a` * `d` + * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` + * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter + groups (fractional seconds) of length one to nine are supported providing + they occur after `ss` and are separated from the `ss` by a period (`.`), + comma (`,`), or colon (`:`). Spacing and punctuation is also permitted with + the exception a question mark (`?`), newline, and carriage return, together + with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS + 'in' yyyy` is a valid override format. One valuable use case for this parameter + is when the format is semi-structured text, there are multiple timestamp + formats in the text, and you know which format corresponds to the primary + timestamp, but you do not want to specify the full `grok_pattern`. Another + is when the timestamp format is one that the structure finder does not consider + by default. If this parameter is not specified, the structure finder chooses + the best format from a built-in set. If the special value `null` is specified, + the structure finder will not look for a primary timestamp in the text. When + the format is semi-structured text, this will result in the structure finder + treating the text as single-line messages. + """ + if field is None: + raise ValueError("Empty value passed for parameter 'field'") + if index is None: + raise ValueError("Empty value passed for parameter 'index'") + __path_parts: t.Dict[str, str] = {} + __path = "/_text_structure/find_field_structure" + __query: t.Dict[str, t.Any] = {} + if field is not None: + __query["field"] = field + if index is not None: + __query["index"] = index + if column_names is not None: + __query["column_names"] = column_names + if delimiter is not None: + __query["delimiter"] = delimiter + if documents_to_sample is not None: + __query["documents_to_sample"] = documents_to_sample + if ecs_compatibility is not None: + __query["ecs_compatibility"] = ecs_compatibility + if error_trace is not None: + __query["error_trace"] = error_trace + if explain is not None: + __query["explain"] = explain + if filter_path is not None: + __query["filter_path"] = filter_path + if format is not None: + __query["format"] = format + if grok_pattern is not None: + __query["grok_pattern"] = grok_pattern + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if quote is not None: + __query["quote"] = quote + if should_trim_fields is not None: + __query["should_trim_fields"] = should_trim_fields + if timeout is not None: + __query["timeout"] = timeout + if timestamp_field is not None: + __query["timestamp_field"] = timestamp_field + if timestamp_format is not None: + __query["timestamp_format"] = timestamp_format + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="text_structure.find_field_structure", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("messages",), + ) + async def find_message_structure( + self, + *, + messages: t.Optional[t.Sequence[str]] = None, + column_names: t.Optional[str] = None, + delimiter: t.Optional[str] = None, + ecs_compatibility: t.Optional[t.Union[str, t.Literal["disabled", "v1"]]] = None, + error_trace: t.Optional[bool] = None, + explain: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + format: t.Optional[ + t.Union[ + str, t.Literal["delimited", "ndjson", "semi_structured_text", "xml"] + ] + ] = None, + grok_pattern: t.Optional[str] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + quote: t.Optional[str] = None, + should_trim_fields: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + timestamp_field: t.Optional[str] = None, + timestamp_format: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Find the structure of text messages. + Find the structure of a list of text messages. + The messages must contain data that is suitable to be ingested into Elasticsearch.

+

This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.

+

The response from the API contains:

+
    +
  • Sample messages.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. + Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+

If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. + It helps determine why the returned structure was chosen.

+ + + ``_ + + :param messages: The list of messages you want to analyze. + :param column_names: If the format is `delimited`, you can specify the column + names in a comma-separated list. If this parameter is not specified, the + structure finder uses the column names from the header row of the text. If + the text does not have a header role, columns are named "column1", "column2", + "column3", for example. + :param delimiter: If you the format is `delimited`, you can specify the character + used to delimit the values in each row. Only a single character is supported; + the delimiter cannot have multiple characters. By default, the API considers + the following possibilities: comma, tab, semi-colon, and pipe (`|`). In this + default scenario, all rows must have the same number of fields for the delimited + format to be detected. If you specify a delimiter, up to 10% of the rows + can have a different number of columns than the first row. + :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns. + Use this parameter to specify whether to use ECS Grok patterns instead of + legacy ones when the structure finder creates a Grok pattern. This setting + primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` + matches the input. If the structure finder identifies a common structure + but has no idea of meaning then generic field names such as `path`, `ipaddress`, + `field1`, and `field2` are used in the `grok_pattern` output, with the intention + that a user who knows the meanings rename these fields before using it. + :param explain: If this parameter is set to true, the response includes a field + named `explanation`, which is an array of strings that indicate how the structure + finder produced its result. + :param format: The high level structure of the text. By default, the API chooses + the format. In this default scenario, all rows must have the same number + of fields for a delimited format to be detected. If the format is `delimited` + and the delimiter is not set, however, the API tolerates up to 5% of rows + that have a different number of columns than the first row. + :param grok_pattern: If the format is `semi_structured_text`, you can specify + a Grok pattern that is used to extract fields from every message in the text. + The name of the timestamp field in the Grok pattern must match what is specified + in the `timestamp_field` parameter. If that parameter is not specified, the + name of the timestamp field in the Grok pattern must match "timestamp". If + `grok_pattern` is not specified, the structure finder creates a Grok pattern. + :param quote: If the format is `delimited`, you can specify the character used + to quote the values in each row if they contain newlines or the delimiter + character. Only a single character is supported. If this parameter is not + specified, the default value is a double quote (`"`). If your delimited text + format does not use quoting, a workaround is to set this argument to a character + that does not appear anywhere in the sample. + :param should_trim_fields: If the format is `delimited`, you can specify whether + values between delimiters should have whitespace trimmed from them. If this + parameter is not specified and the delimiter is pipe (`|`), the default value + is true. Otherwise, the default value is `false`. + :param timeout: The maximum amount of time that the structure analysis can take. + If the analysis is still running when the timeout expires, it will be stopped. + :param timestamp_field: The name of the field that contains the primary timestamp + of each record in the text. In particular, if the text was ingested into + an index, this is the field that would be used to populate the `@timestamp` + field. If the format is `semi_structured_text`, this field must match the + name of the appropriate extraction in the `grok_pattern`. Therefore, for + semi-structured text, it is best not to specify this parameter unless `grok_pattern` + is also specified. For structured text, if you specify this parameter, the + field must exist within the text. If this parameter is not specified, the + structure finder makes a decision about which field (if any) is the primary + timestamp field. For structured text, it is not compulsory to have a timestamp + in the text. + :param timestamp_format: The Java time format of the timestamp field in the text. + Only a subset of Java time format letter groups are supported: * `a` * `d` + * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` + * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter + groups (fractional seconds) of length one to nine are supported providing + they occur after `ss` and are separated from the `ss` by a period (`.`), + comma (`,`), or colon (`:`). Spacing and punctuation is also permitted with + the exception a question mark (`?`), newline, and carriage return, together + with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS + 'in' yyyy` is a valid override format. One valuable use case for this parameter + is when the format is semi-structured text, there are multiple timestamp + formats in the text, and you know which format corresponds to the primary + timestamp, but you do not want to specify the full `grok_pattern`. Another + is when the timestamp format is one that the structure finder does not consider + by default. If this parameter is not specified, the structure finder chooses + the best format from a built-in set. If the special value `null` is specified, + the structure finder will not look for a primary timestamp in the text. When + the format is semi-structured text, this will result in the structure finder + treating the text as single-line messages. + """ + if messages is None and body is None: + raise ValueError("Empty value passed for parameter 'messages'") + __path_parts: t.Dict[str, str] = {} + __path = "/_text_structure/find_message_structure" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if column_names is not None: + __query["column_names"] = column_names + if delimiter is not None: + __query["delimiter"] = delimiter + if ecs_compatibility is not None: + __query["ecs_compatibility"] = ecs_compatibility + if error_trace is not None: + __query["error_trace"] = error_trace + if explain is not None: + __query["explain"] = explain + if filter_path is not None: + __query["filter_path"] = filter_path + if format is not None: + __query["format"] = format + if grok_pattern is not None: + __query["grok_pattern"] = grok_pattern + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if quote is not None: + __query["quote"] = quote + if should_trim_fields is not None: + __query["should_trim_fields"] = should_trim_fields + if timeout is not None: + __query["timeout"] = timeout + if timestamp_field is not None: + __query["timestamp_field"] = timestamp_field + if timestamp_format is not None: + __query["timestamp_format"] = timestamp_format + if not __body: + if messages is not None: + __body["messages"] = messages + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="text_structure.find_message_structure", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_name="text_files", ) @@ -50,47 +414,73 @@ async def find_structure( timestamp_format: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Finds the structure of a text file. The text file must contain data that is suitable - to be ingested into Elasticsearch. + .. raw:: html + +

Find the structure of a text file. + The text file must contain data that is suitable to be ingested into Elasticsearch.

+

This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + Unlike other Elasticsearch endpoints, the data that is posted to this endpoint does not need to be UTF-8 encoded and in JSON format. + It must, however, be text; binary text formats are not currently supported. + The size is limited to the Elasticsearch HTTP receive buffer size, which defaults to 100 Mb.

+

The response from the API contains:

+
    +
  • A couple of messages from the beginning of the text.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.
  • +
  • Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

- ``_ + + ``_ :param text_files: - :param charset: The text’s character set. It must be a character set that is - supported by the JVM that Elasticsearch uses. For example, UTF-8, UTF-16LE, - windows-1252, or EUC-JP. If this parameter is not specified, the structure + :param charset: The text's character set. It must be a character set that is + supported by the JVM that Elasticsearch uses. For example, `UTF-8`, `UTF-16LE`, + `windows-1252`, or `EUC-JP`. If this parameter is not specified, the structure finder chooses an appropriate character set. - :param column_names: If you have set format to delimited, you can specify the + :param column_names: If you have set format to `delimited`, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named "column1", "column2", - "column3", etc. - :param delimiter: If you have set format to delimited, you can specify the character - used to delimit the values in each row. Only a single character is supported; - the delimiter cannot have multiple characters. By default, the API considers - the following possibilities: comma, tab, semi-colon, and pipe (|). In this - default scenario, all rows must have the same number of fields for the delimited - format to be detected. If you specify a delimiter, up to 10% of the rows - can have a different number of columns than the first row. - :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns - (disabled or v1, default: disabled). - :param explain: If this parameter is set to true, the response includes a field + "column3", for example. + :param delimiter: If you have set `format` to `delimited`, you can specify the + character used to delimit the values in each row. Only a single character + is supported; the delimiter cannot have multiple characters. By default, + the API considers the following possibilities: comma, tab, semi-colon, and + pipe (`|`). In this default scenario, all rows must have the same number + of fields for the delimited format to be detected. If you specify a delimiter, + up to 10% of the rows can have a different number of columns than the first + row. + :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns. + Use this parameter to specify whether to use ECS Grok patterns instead of + legacy ones when the structure finder creates a Grok pattern. Valid values + are `disabled` and `v1`. This setting primarily has an impact when a whole + message Grok pattern such as `%{CATALINALOG}` matches the input. If the structure + finder identifies a common structure but has no idea of meaning then generic + field names such as `path`, `ipaddress`, `field1`, and `field2` are used + in the `grok_pattern` output, with the intention that a user who knows the + meanings rename these fields before using it. + :param explain: If this parameter is set to `true`, the response includes a field named explanation, which is an array of strings that indicate how the structure - finder produced its result. - :param format: The high level structure of the text. Valid values are ndjson, - xml, delimited, and semi_structured_text. By default, the API chooses the - format. In this default scenario, all rows must have the same number of fields - for a delimited format to be detected. If the format is set to delimited - and the delimiter is not set, however, the API tolerates up to 5% of rows - that have a different number of columns than the first row. - :param grok_pattern: If you have set format to semi_structured_text, you can - specify a Grok pattern that is used to extract fields from every message + finder produced its result. If the structure finder produces unexpected results + for some text, use this query parameter to help you determine why the returned + structure was chosen. + :param format: The high level structure of the text. Valid values are `ndjson`, + `xml`, `delimited`, and `semi_structured_text`. By default, the API chooses + the format. In this default scenario, all rows must have the same number + of fields for a delimited format to be detected. If the format is set to + `delimited` and the delimiter is not set, however, the API tolerates up to + 5% of rows that have a different number of columns than the first row. + :param grok_pattern: If you have set `format` to `semi_structured_text`, you + can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match - what is specified in the timestamp_field parameter. If that parameter is + what is specified in the `timestamp_field` parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match - "timestamp". If grok_pattern is not specified, the structure finder creates + "timestamp". If `grok_pattern` is not specified, the structure finder creates a Grok pattern. - :param has_header_row: If you have set format to delimited, you can use this + :param has_header_row: If you have set `format` to `delimited`, you can use this parameter to indicate whether the column names are in the first row of the text. If this parameter is not specified, the structure finder guesses based on the similarity of the first row of the text to other rows. @@ -100,26 +490,58 @@ async def find_structure( that this may lead to very long processing times if the way to group lines into messages is misdetected. :param lines_to_sample: The number of lines to include in the structural analysis, - starting from the beginning of the text. The minimum is 2; If the value of + starting from the beginning of the text. The minimum is 2. If the value of this parameter is greater than the number of lines in the text, the analysis proceeds (as long as there are at least two lines in the text) for all of - the lines. - :param quote: If you have set format to delimited, you can specify the character + the lines. NOTE: The number of lines and the variation of the lines affects + the speed of the analysis. For example, if you upload text where the first + 1000 lines are all variations on the same message, the analysis will find + more commonality than would be seen with a bigger sample. If possible, however, + it is more efficient to upload sample text with more variety in the first + 1000 lines than to request analysis of 100000 lines to achieve some variety. + :param quote: If you have set `format` to `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not - specified, the default value is a double quote ("). If your delimited text + specified, the default value is a double quote (`"`). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. - :param should_trim_fields: If you have set format to delimited, you can specify + :param should_trim_fields: If you have set `format` to `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. - If this parameter is not specified and the delimiter is pipe (|), the default - value is true. Otherwise, the default value is false. - :param timeout: Sets the maximum amount of time that the structure analysis make - take. If the analysis is still running when the timeout expires then it will - be aborted. - :param timestamp_field: Optional parameter to specify the timestamp field in - the file + If this parameter is not specified and the delimiter is pipe (`|`), the default + value is `true`. Otherwise, the default value is `false`. + :param timeout: The maximum amount of time that the structure analysis can take. + If the analysis is still running when the timeout expires then it will be + stopped. + :param timestamp_field: The name of the field that contains the primary timestamp + of each record in the text. In particular, if the text were ingested into + an index, this is the field that would be used to populate the `@timestamp` + field. If the `format` is `semi_structured_text`, this field must match the + name of the appropriate extraction in the `grok_pattern`. Therefore, for + semi-structured text, it is best not to specify this parameter unless `grok_pattern` + is also specified. For structured text, if you specify this parameter, the + field must exist within the text. If this parameter is not specified, the + structure finder makes a decision about which field (if any) is the primary + timestamp field. For structured text, it is not compulsory to have a timestamp + in the text. :param timestamp_format: The Java time format of the timestamp field in the text. + Only a subset of Java time format letter groups are supported: * `a` * `d` + * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` + * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter + groups (fractional seconds) of length one to nine are supported providing + they occur after `ss` and separated from the `ss` by a `.`, `,` or `:`. Spacing + and punctuation is also permitted with the exception of `?`, newline and + carriage return, together with literal text enclosed in single quotes. For + example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. One + valuable use case for this parameter is when the format is semi-structured + text, there are multiple timestamp formats in the text, and you know which + format corresponds to the primary timestamp, but you do not want to specify + the full `grok_pattern`. Another is when the timestamp format is one that + the structure finder does not consider by default. If this parameter is not + specified, the structure finder chooses the best format from a built-in set. + If the special value `null` is specified the structure finder will not look + for a primary timestamp in the text. When the format is semi-structured text + this will result in the structure finder treating the text as single-line + messages. """ if text_files is None and body is None: raise ValueError( @@ -191,14 +613,21 @@ async def test_grok_pattern( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Tests a Grok pattern on some text. + .. raw:: html + +

Test a Grok pattern. + Test a Grok pattern on one or more lines of text. + The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings.

+ - ``_ + ``_ - :param grok_pattern: Grok pattern to run on the text. - :param text: Lines of text to run the Grok pattern on. - :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns - (disabled or v1, default: disabled). + :param grok_pattern: The Grok pattern to run on the text. + :param text: The lines of text to run the Grok pattern on. + :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns. + Use this parameter to specify whether to use ECS Grok patterns instead of + legacy ones when the structure finder creates a Grok pattern. Valid values + are `disabled` and `v1`. """ if grok_pattern is None and body is None: raise ValueError("Empty value passed for parameter 'grok_pattern'") diff --git a/elasticsearch/_async/client/transform.py b/elasticsearch/_async/client/transform.py index e1fa776c7..010f6de9a 100644 --- a/elasticsearch/_async/client/transform.py +++ b/elasticsearch/_async/client/transform.py @@ -39,9 +39,13 @@ async def delete_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a transform. Deletes a transform. + .. raw:: html - ``_ +

Delete a transform. + Deletes a transform.

+ + + ``_ :param transform_id: Identifier for the transform. :param delete_dest_index: If this value is true, the destination index is deleted @@ -99,9 +103,13 @@ async def get_transform( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get transforms. Retrieves configuration information for transforms. + .. raw:: html + +

Get transforms. + Retrieves configuration information for transforms.

+ - ``_ + ``_ :param transform_id: Identifier for the transform. It can be a transform identifier or a wildcard expression. You can get information for all transforms by using @@ -168,9 +176,13 @@ async def get_transform_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get transform stats. Retrieves usage information for transforms. + .. raw:: html - ``_ +

Get transform stats. + Retrieves usage information for transforms.

+ + + ``_ :param transform_id: Identifier for the transform. It can be a transform identifier or a wildcard expression. You can get information for all transforms by using @@ -249,14 +261,16 @@ async def preview_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview a transform. Generates a preview of the results that you will get when - you create a transform with the same configuration. It returns a maximum of 100 - results. The calculations are based on all the current data in the source index. - It also generates a list of mappings and settings for the destination index. - These values are determined based on the field types of the source index and - the transform aggregations. + .. raw:: html + +

Preview a transform. + Generates a preview of the results that you will get when you create a transform with the same configuration.

+

It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also + generates a list of mappings and settings for the destination index. These values are determined based on the field + types of the source index and the transform aggregations.

+ - ``_ + ``_ :param transform_id: Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform configuration details in @@ -371,29 +385,29 @@ async def put_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a transform. Creates a transform. A transform copies data from source - indices, transforms it, and persists it into an entity-centric destination index. - You can also think of the destination index as a two-dimensional tabular data - structure (known as a data frame). The ID for each document in the data frame - is generated from a hash of the entity, so there is a unique row per entity. - You must choose either the latest or pivot method for your transform; you cannot - use both in a single transform. If you choose to use the pivot method for your - transform, the entities are defined by the set of `group_by` fields in the pivot - object. If you choose to use the latest method, the entities are defined by the - `unique_key` field values in the latest object. You must have `create_index`, - `index`, and `read` privileges on the destination index and `read` and `view_index_metadata` - privileges on the source indices. When Elasticsearch security features are enabled, - the transform remembers which roles the user that created it had at the time - of creation and uses those same roles. If those roles do not have the required - privileges on the source and destination indices, the transform fails when it - attempts unauthorized operations. NOTE: You must use Kibana or this API to create - a transform. Do not add a transform directly into any `.transform-internal*` - indices using the Elasticsearch index API. If Elasticsearch security features - are enabled, do not give users any privileges on `.transform-internal*` indices. - If you used transforms prior to 7.5, also do not give users any privileges on - `.data-frame-internal*` indices. - - ``_ + .. raw:: html + +

Create a transform. + Creates a transform.

+

A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as + a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a + unique row per entity.

+

You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If + you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in + the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values + in the latest object.

+

You must have create_index, index, and read privileges on the destination index and read and + view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the + transform remembers which roles the user that created it had at the time of creation and uses those same roles. If + those roles do not have the required privileges on the source and destination indices, the transform fails when it + attempts unauthorized operations.

+

NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any + .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do + not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not + give users any privileges on .data-frame-internal* indices.

+ + + ``_ :param transform_id: Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -491,11 +505,15 @@ async def reset_transform( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset a transform. Resets a transform. Before you can reset it, you must stop - it; alternatively, use the `force` query parameter. If the destination index - was created by the transform, it is deleted. + .. raw:: html - ``_ +

Reset a transform. + Resets a transform. + Before you can reset it, you must stop it; alternatively, use the force query parameter. + If the destination index was created by the transform, it is deleted.

+ + + ``_ :param transform_id: Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -541,13 +559,17 @@ async def schedule_now_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Schedule a transform to start now. Instantly runs a transform to process data. - If you _schedule_now a transform, it will process the new data instantly, without - waiting for the configured frequency interval. After _schedule_now API is called, - the transform will be processed again at now + frequency unless _schedule_now - API is called again in the meantime. + .. raw:: html + +

Schedule a transform to start now. + Instantly runs a transform to process data.

+

If you _schedule_now a transform, it will process the new data instantly, + without waiting for the configured frequency interval. After _schedule_now API is called, + the transform will be processed again at now + frequency unless _schedule_now API + is called again in the meantime.

+ - ``_ + ``_ :param transform_id: Identifier for the transform. :param timeout: Controls the time to wait for the scheduling to take place @@ -592,26 +614,26 @@ async def start_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a transform. Starts a transform. When you start a transform, it creates - the destination index if it does not already exist. The `number_of_shards` is - set to `1` and the `auto_expand_replicas` is set to `0-1`. If it is a pivot transform, - it deduces the mapping definitions for the destination index from the source - indices and the transform aggregations. If fields in the destination index are - derived from scripts (as in the case of `scripted_metric` or `bucket_script` - aggregations), the transform uses dynamic mappings unless an index template exists. - If it is a latest transform, it does not deduce mapping definitions; it uses - dynamic mappings. To use explicit mappings, create the destination index before - you start the transform. Alternatively, you can create an index template, though - it does not affect the deduced mappings in a pivot transform. When the transform - starts, a series of validations occur to ensure its success. If you deferred - validation when you created the transform, they occur when you start the transform—​with - the exception of privilege checks. When Elasticsearch security features are enabled, - the transform remembers which roles the user that created it had at the time - of creation and uses those same roles. If those roles do not have the required - privileges on the source and destination indices, the transform fails when it - attempts unauthorized operations. - - ``_ + .. raw:: html + +

Start a transform. + Starts a transform.

+

When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is + set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping + definitions for the destination index from the source indices and the transform aggregations. If fields in the + destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), + the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce + mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you + start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings + in a pivot transform.

+

When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you + created the transform, they occur when you start the transform—​with the exception of privilege checks. When + Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the + time of creation and uses those same roles. If those roles do not have the required privileges on the source and + destination indices, the transform fails when it attempts unauthorized operations.

+ + + ``_ :param transform_id: Identifier for the transform. :param from_: Restricts the set of transformed entities to those changed after @@ -663,9 +685,13 @@ async def stop_transform( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop transforms. Stops one or more transforms. + .. raw:: html - ``_ +

Stop transforms. + Stops one or more transforms.

+ + + ``_ :param transform_id: Identifier for the transform. To stop multiple transforms, use a comma-separated list or a wildcard expression. To stop all transforms, @@ -756,16 +782,18 @@ async def update_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a transform. Updates certain properties of a transform. All updated properties - except `description` do not take effect until after the transform starts the - next checkpoint, thus there is data consistency in each checkpoint. To use this - API, you must have `read` and `view_index_metadata` privileges for the source - indices. You must also have `index` and `read` privileges for the destination - index. When Elasticsearch security features are enabled, the transform remembers - which roles the user who updated it had at the time of update and runs with those - privileges. + .. raw:: html + +

Update a transform. + Updates certain properties of a transform.

+

All updated properties except description do not take effect until after the transform starts the next checkpoint, + thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata + privileges for the source indices. You must also have index and read privileges for the destination index. When + Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the + time of update and runs with those privileges.

+ - ``_ + ``_ :param transform_id: Identifier for the transform. :param defer_validation: When true, deferrable validations are not run. This @@ -844,15 +872,23 @@ async def upgrade_transforms( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Upgrades all transforms. This API identifies transforms that have a legacy configuration - format and upgrades them to the latest version. It also cleans up the internal - data structures that store the transform state and checkpoints. The upgrade does - not affect the source and destination indices. The upgrade also does not affect - the roles that transforms use when Elasticsearch security features are enabled; - the role used to read source data and write to the destination index remains - unchanged. - - ``_ + .. raw:: html + +

Upgrade all transforms. + Transforms are compatible across minor versions and between supported major versions. + However, over time, the format of transform configuration information may change. + This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. + It also cleans up the internal data structures that store the transform state and checkpoints. + The upgrade does not affect the source and destination indices. + The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged.

+

If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. + Resolve the issue then re-run the process again. + A summary is returned when the upgrade is finished.

+

To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. + You may want to perform a recent cluster backup prior to the upgrade.

+ + + ``_ :param dry_run: When true, the request checks for updates but does not run them. :param timeout: Period to wait for a response. If no response is received before diff --git a/elasticsearch/_async/client/utils.py b/elasticsearch/_async/client/utils.py index ec0a6e4b8..97918d9e4 100644 --- a/elasticsearch/_async/client/utils.py +++ b/elasticsearch/_async/client/utils.py @@ -20,10 +20,12 @@ _TYPE_HOSTS, CLIENT_META_SERVICE, SKIP_IN_PATH, + Stability, _base64_auth_header, _quote, _quote_query, _rewrite_parameters, + _stability_warning, client_node_configs, is_requests_http_auth, is_requests_node_class, @@ -37,8 +39,10 @@ "_quote_query", "_TYPE_HOSTS", "SKIP_IN_PATH", + "Stability", "client_node_configs", "_rewrite_parameters", + "_stability_warning", "is_requests_http_auth", "is_requests_node_class", ] diff --git a/elasticsearch/_async/client/watcher.py b/elasticsearch/_async/client/watcher.py index 387c90355..83615b26b 100644 --- a/elasticsearch/_async/client/watcher.py +++ b/elasticsearch/_async/client/watcher.py @@ -37,12 +37,22 @@ async def ack_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Acknowledges a watch, manually throttling the execution of the watch's actions. + .. raw:: html - ``_ +

Acknowledge a watch. + Acknowledging a watch enables you to manually throttle the execution of the watch's actions.

+

The acknowledgement state of an action is stored in the status.actions.<id>.ack.state structure.

+

IMPORTANT: If the specified watch is currently being executed, this API will return an error + The reason for this behavior is to prevent overwriting the watch status from a watch execution.

+

Acknowledging an action throttles further executions of that action until its ack.state is reset to awaits_successful_execution. + This happens when the condition of the watch is not met (the condition evaluates to false).

- :param watch_id: Watch ID - :param action_id: A comma-separated list of the action ids to be acked + + ``_ + + :param watch_id: The watch identifier. + :param action_id: A comma-separated list of the action identifiers to acknowledge. + If you omit this parameter, all of the actions of the watch are acknowledged. """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") @@ -88,11 +98,15 @@ async def activate_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Activates a currently inactive watch. + .. raw:: html + +

Activate a watch. + A watch can be either active or inactive.

- ``_ - :param watch_id: Watch ID + ``_ + + :param watch_id: The watch identifier. """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") @@ -128,11 +142,15 @@ async def deactivate_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deactivates a currently active watch. + .. raw:: html + +

Deactivate a watch. + A watch can be either active or inactive.

+ - ``_ + ``_ - :param watch_id: Watch ID + :param watch_id: The watch identifier. """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") @@ -168,11 +186,19 @@ async def delete_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes a watch from Watcher. + .. raw:: html - ``_ +

Delete a watch. + When the watch is removed, the document representing the watch in the .watches index is gone and it will never be run again.

+

Deleting a watch does not delete any watch execution records related to this watch from the watch history.

+

IMPORTANT: Deleting a watch must be done by using only this API. + Do not delete the watch directly from the .watches index using the Elasticsearch delete document API + When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the .watches index.

- :param id: Watch ID + + ``_ + + :param id: The watch identifier. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -237,17 +263,23 @@ async def execute_watch( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - This API can be used to force execution of the watch outside of its triggering - logic or to simulate the watch execution for debugging purposes. For testing - and debugging purposes, you also have fine-grained control on how the watch runs. - You can execute the watch without executing all of its actions or alternatively - by simulating them. You can also force execution by ignoring the watch condition - and control whether a watch record would be written to the watch history after - execution. + .. raw:: html + +

Run a watch. + This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.

+

For testing and debugging purposes, you also have fine-grained control on how the watch runs. + You can run the watch without running all of its actions or alternatively by simulating them. + You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.

+

You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. + This serves as great tool for testing and debugging your watches prior to adding them to Watcher.

+

When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches. + If your user is allowed to read index a, but not index b, then the exact same set of rules will apply during execution of a watch.

+

When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.

- ``_ - :param id: Identifier for the watch. + ``_ + + :param id: The watch identifier. :param action_modes: Determines how to handle the watch actions as part of the watch execution. :param alternative_input: When present, the watch uses this object as a payload @@ -258,12 +290,12 @@ async def execute_watch( :param record_execution: When set to `true`, the watch record representing the watch execution result is persisted to the `.watcher-history` index for the current time. In addition, the status of the watch is updated, possibly throttling - subsequent executions. This can also be specified as an HTTP parameter. + subsequent runs. This can also be specified as an HTTP parameter. :param simulated_actions: :param trigger_data: This structure is parsed as the data of the trigger event - that will be used during the watch execution + that will be used during the watch execution. :param watch: When present, this watch is used instead of the one specified in - the request. This watch is not persisted to the index and record_execution + the request. This watch is not persisted to the index and `record_execution` cannot be set. """ __path_parts: t.Dict[str, str] @@ -315,6 +347,53 @@ async def execute_watch( path_parts=__path_parts, ) + @_rewrite_parameters() + async def get_settings( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get Watcher index settings. + Get settings for the Watcher internal index (.watches). + Only a subset of settings are shown, for example index.auto_expand_replicas and index.number_of_replicas.

+ + + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_watcher/settings" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.get_settings", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def get_watch( self, @@ -326,11 +405,14 @@ async def get_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a watch by its ID. + .. raw:: html + +

Get a watch.

+ - ``_ + ``_ - :param id: Watch ID + :param id: The watch identifier. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -362,6 +444,7 @@ async def get_watch( "input", "metadata", "throttle_period", + "throttle_period_in_millis", "transform", "trigger", ), @@ -381,30 +464,51 @@ async def put_watch( input: t.Optional[t.Mapping[str, t.Any]] = None, metadata: t.Optional[t.Mapping[str, t.Any]] = None, pretty: t.Optional[bool] = None, - throttle_period: t.Optional[str] = None, + throttle_period: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + throttle_period_in_millis: t.Optional[t.Any] = None, transform: t.Optional[t.Mapping[str, t.Any]] = None, trigger: t.Optional[t.Mapping[str, t.Any]] = None, version: t.Optional[int] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a new watch, or updates an existing one. - - ``_ - - :param id: Watch ID - :param actions: - :param active: Specify whether the watch is in/active by default - :param condition: + .. raw:: html + +

Create or update a watch. + When a watch is registered, a new document that represents the watch is added to the .watches index and its trigger is immediately registered with the relevant trigger engine. + Typically for the schedule trigger, the scheduler is the trigger engine.

+

IMPORTANT: You must use Kibana or this API to create a watch. + Do not add a watch directly to the .watches index by using the Elasticsearch index API. + If Elasticsearch security features are enabled, do not give users write privileges on the .watches index.

+

When you add a watch you can also define its initial active state by setting the active parameter.

+

When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges. + If the user is able to read index a, but not index b, the same will apply when the watch runs.

+ + + ``_ + + :param id: The identifier for the watch. + :param actions: The list of actions that will be run if the condition matches. + :param active: The initial state of the watch. The default value is `true`, which + means the watch is active by default. + :param condition: The condition that defines if the actions should be run. :param if_primary_term: only update the watch if the last operation that has changed the watch has the specified primary term :param if_seq_no: only update the watch if the last operation that has changed the watch has the specified sequence number - :param input: - :param metadata: - :param throttle_period: - :param transform: - :param trigger: + :param input: The input that defines the input that loads the data for the watch. + :param metadata: Metadata JSON that will be copied into the history entries. + :param throttle_period: The minimum time between actions being run. The default + is 5 seconds. This default can be changed in the config file with the setting + `xpack.watcher.throttle.period.default_period`. If both this value and the + `throttle_period_in_millis` parameter are specified, Watcher uses the last + parameter included in the request. + :param throttle_period_in_millis: Minimum time in milliseconds between actions + being run. Defaults to 5000. If both this value and the throttle_period parameter + are specified, Watcher uses the last parameter included in the request. + :param transform: The transform that processes the watch payload to prepare it + for the watch actions. + :param trigger: The trigger that defines when the watch should run. :param version: Explicit version number for concurrency control """ if id in SKIP_IN_PATH: @@ -440,6 +544,8 @@ async def put_watch( __body["metadata"] = metadata if throttle_period is not None: __body["throttle_period"] = throttle_period + if throttle_period_in_millis is not None: + __body["throttle_period_in_millis"] = throttle_period_in_millis if transform is not None: __body["transform"] = transform if trigger is not None: @@ -485,16 +591,21 @@ async def query_watches( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves stored watches. + .. raw:: html - ``_ +

Query watches. + Get all registered watches in a paginated manner and optionally filter watches by a query.

+

Note that only the _id and metadata.* fields are queryable or sortable.

- :param from_: The offset from the first result to fetch. Needs to be non-negative. - :param query: Optional, query filter watches to be returned. - :param search_after: Optional search After to do pagination using last hit’s - sort values. - :param size: The number of hits to return. Needs to be non-negative. - :param sort: Optional sort definition. + + ``_ + + :param from_: The offset from the first result to fetch. It must be non-negative. + :param query: A query that filters the watches to be returned. + :param search_after: Retrieve the next page of hits using a set of sort values + from the previous page. + :param size: The number of hits to return. It must be non-negative. + :param sort: One or more fields used to sort the search results. """ __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_query/watches" @@ -555,9 +666,13 @@ async def start( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Starts Watcher if it is not already running. + .. raw:: html + +

Start the watch service. + Start the Watcher service if it is not already running.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_start" @@ -612,9 +727,14 @@ async def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the current Watcher metrics. + .. raw:: html + +

Get Watcher statistics. + This API always returns basic metrics. + You retrieve more metrics by using the metric parameter.

+ - ``_ + ``_ :param metric: Defines which additional metrics are included in the response. :param emit_stacktraces: Defines whether stack traces are generated for each @@ -655,12 +775,21 @@ async def stop( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stops Watcher if it is running. + .. raw:: html - ``_ +

Stop the watch service. + Stop the Watcher service if it is running.

+ + + ``_ + + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. To indicate that the request should never timeout, set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_stop" @@ -671,6 +800,8 @@ async def stop( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} @@ -682,3 +813,74 @@ async def stop( endpoint_id="watcher.stop", path_parts=__path_parts, ) + + @_rewrite_parameters( + body_fields=("index_auto_expand_replicas", "index_number_of_replicas"), + parameter_aliases={ + "index.auto_expand_replicas": "index_auto_expand_replicas", + "index.number_of_replicas": "index_number_of_replicas", + }, + ) + async def update_settings( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + index_auto_expand_replicas: t.Optional[str] = None, + index_number_of_replicas: t.Optional[int] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update Watcher index settings. + Update settings for the Watcher internal index (.watches). + Only a subset of settings can be modified. + This includes index.auto_expand_replicas and index.number_of_replicas.

+ + + ``_ + + :param index_auto_expand_replicas: + :param index_number_of_replicas: + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_watcher/settings" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if not __body: + if index_auto_expand_replicas is not None: + __body["index.auto_expand_replicas"] = index_auto_expand_replicas + if index_number_of_replicas is not None: + __body["index.number_of_replicas"] = index_number_of_replicas + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="watcher.update_settings", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_async/client/xpack.py b/elasticsearch/_async/client/xpack.py index a0c5042fe..36e87da61 100644 --- a/elasticsearch/_async/client/xpack.py +++ b/elasticsearch/_async/client/xpack.py @@ -34,16 +34,27 @@ async def info( self, *, accept_enterprise: t.Optional[bool] = None, - categories: t.Optional[t.Sequence[str]] = None, + categories: t.Optional[ + t.Sequence[t.Union[str, t.Literal["build", "features", "license"]]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Provides general information about the installed X-Pack features. + .. raw:: html - ``_ +

Get information. + The information provided by the API includes:

+
    +
  • Build information including the build number and timestamp.
  • +
  • License information about the currently installed license.
  • +
  • Feature information for the features that are currently enabled and available under the current license.
  • +
+ + + ``_ :param accept_enterprise: If this param is used it must be set to true :param categories: A comma-separated list of the information categories to include @@ -85,14 +96,19 @@ async def usage( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - This API provides information about which features are currently enabled and - available under the current license and some usage statistics. + .. raw:: html + +

Get usage information. + Get information about the features that are currently enabled and available under the current license. + The API also provides some usage statistics.

+ - ``_ + ``_ - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_xpack/usage" diff --git a/elasticsearch/_async/helpers.py b/elasticsearch/_async/helpers.py index 1ab55850b..e4d5e6bc5 100644 --- a/elasticsearch/_async/helpers.py +++ b/elasticsearch/_async/helpers.py @@ -136,7 +136,6 @@ def aiter(x: Union[Iterable[T], AsyncIterable[T]]) -> AsyncIterator[T]: return x.__aiter__() async def f() -> AsyncIterable[T]: - nonlocal x ix: Iterable[T] = x for item in ix: yield item @@ -173,6 +172,7 @@ async def async_streaming_bulk( max_backoff: float = 600, yield_ok: bool = True, ignore_status: Union[int, Collection[int]] = (), + retry_on_status: Union[int, Collection[int]] = (429,), *args: Any, **kwargs: Any, ) -> AsyncIterable[Tuple[bool, Dict[str, Any]]]: @@ -184,10 +184,11 @@ async def async_streaming_bulk( entire input is consumed and sent. If you specify ``max_retries`` it will also retry any documents that were - rejected with a ``429`` status code. To do this it will wait (**by calling - asyncio.sleep**) for ``initial_backoff`` seconds and then, - every subsequent rejection for the same chunk, for double the time every - time up to ``max_backoff`` seconds. + rejected with a ``429`` status code. Use ``retry_on_status`` to + configure which status codes will be retried. To do this it will wait + (**by calling asyncio.sleep which will block**) for ``initial_backoff`` seconds + and then, every subsequent rejection for the same chunk, for double the time + every time up to ``max_backoff`` seconds. :arg client: instance of :class:`~elasticsearch.AsyncElasticsearch` to use :arg actions: iterable or async iterable containing the actions to be executed @@ -200,8 +201,11 @@ async def async_streaming_bulk( :arg expand_action_callback: callback executed on each action passed in, should return a tuple containing the action line and the data line (`None` if data line should be omitted). + :arg retry_on_status: HTTP status code that will trigger a retry. + (if `None` is specified only status 429 will retry). :arg max_retries: maximum number of times a document will be retried when - ``429`` is received, set to 0 (default) for no retries on ``429`` + retry_on_status (defaulting to ``429``) is received, + set to 0 (default) for no retries :arg initial_backoff: number of seconds we should wait before the first retry. Any subsequent retries will be powers of ``initial_backoff * 2**retry_number`` @@ -213,6 +217,9 @@ async def async_streaming_bulk( client = client.options() client._client_meta = (("h", "bp"),) + if isinstance(retry_on_status, int): + retry_on_status = (retry_on_status,) + async def map_actions() -> AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY]: async for item in aiter(actions): yield expand_action_callback(item) @@ -249,7 +256,7 @@ async def map_actions() -> AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY]: ] ok: bool info: Dict[str, Any] - async for data, (ok, info) in azip( # type: ignore + async for data, (ok, info) in azip( # type: ignore[assignment, misc] bulk_data, _process_bulk_chunk( client, @@ -264,11 +271,11 @@ async def map_actions() -> AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY]: ): if not ok: action, info = info.popitem() - # retry if retries enabled, we get 429, and we are not - # in the last attempt + # retry if retries enabled, we are not in the last attempt, + # and status in retry_on_status (defaulting to 429) if ( max_retries - and info["status"] == 429 + and info["status"] in retry_on_status and (attempt + 1) <= max_retries ): # _process_bulk_chunk expects strings so we need to @@ -281,8 +288,9 @@ async def map_actions() -> AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY]: yield ok, info except ApiError as e: - # suppress 429 errors since we will retry them - if attempt == max_retries or e.status_code != 429: + # suppress any status in retry_on_status (429 by default) + # since we will retry them + if attempt == max_retries or e.status_code not in retry_on_status: raise else: if not to_retry: diff --git a/elasticsearch/_otel.py b/elasticsearch/_otel.py index 264d8aa35..f37ca24cd 100644 --- a/elasticsearch/_otel.py +++ b/elasticsearch/_otel.py @@ -25,7 +25,7 @@ from opentelemetry import trace _tracer: trace.Tracer | None = trace.get_tracer("elasticsearch-api") -except ModuleNotFoundError: +except ImportError: _tracer = None from elastic_transport import OpenTelemetrySpan @@ -102,7 +102,7 @@ def helpers_span(self, span_name: str) -> Generator[OpenTelemetrySpan, None, Non @contextlib.contextmanager def use_span(self, span: OpenTelemetrySpan) -> Generator[None, None, None]: - if not self.enabled or self.tracer is None: + if not self.enabled or self.tracer is None or span.otel_span is None: yield return diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 24c88d49a..20fd44322 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -70,6 +70,7 @@ from .searchable_snapshots import SearchableSnapshotsClient from .security import SecurityClient from .shutdown import ShutdownClient +from .simulate import SimulateClient from .slm import SlmClient from .snapshot import SnapshotClient from .sql import SqlClient @@ -82,8 +83,10 @@ _TYPE_HOSTS, CLIENT_META_SERVICE, SKIP_IN_PATH, + Stability, _quote, _rewrite_parameters, + _stability_warning, client_node_configs, is_requests_http_auth, is_requests_node_class, @@ -463,6 +466,7 @@ def __init__( self.searchable_snapshots = SearchableSnapshotsClient(self) self.security = SecurityClient(self) self.slm = SlmClient(self) + self.simulate = SimulateClient(self) self.shutdown = ShutdownClient(self) self.sql = SqlClient(self) self.ssl = SslClient(self) @@ -622,12 +626,14 @@ def bulk( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + list_executed_pipelines: t.Optional[bool] = None, pipeline: t.Optional[str] = None, pretty: t.Optional[bool] = None, refresh: t.Optional[ t.Union[bool, str, t.Literal["false", "true", "wait_for"]] ] = None, require_alias: t.Optional[bool] = None, + require_data_stream: t.Optional[bool] = None, routing: t.Optional[str] = None, source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None, source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None, @@ -638,37 +644,131 @@ def bulk( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Bulk index or delete documents. Performs multiple indexing or delete operations - in a single API call. This reduces overhead and can greatly increase indexing - speed. - - ``_ + .. raw:: html + +

Bulk index or delete documents. + Perform multiple index, create, delete, and update actions in a single request. + This reduces overhead and can greatly increase indexing speed.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:

+
    +
  • To use the create action, you must have the create_doc, create, index, or write index privilege. Data streams support only the create action.
  • +
  • To use the index action, you must have the create, index, or write index privilege.
  • +
  • To use the delete action, you must have the delete or write index privilege.
  • +
  • To use the update action, you must have the index or write index privilege.
  • +
  • To automatically create a data stream or index with a bulk API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
  • To make the result of a bulk operation visible to search using the refresh parameter, you must have the maintenance or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

The actions are specified in the request body using a newline delimited JSON (NDJSON) structure:

+
action_and_meta_data\\n
+          optional_source\\n
+          action_and_meta_data\\n
+          optional_source\\n
+          ....
+          action_and_meta_data\\n
+          optional_source\\n
+          
+

The index and create actions expect a source on the next line and have the same semantics as the op_type parameter in the standard index API. + A create action fails if a document with the same ID already exists in the target + An index action adds or replaces a document as necessary.

+

NOTE: Data streams support only the create action. + To update or delete a document in a data stream, you must target the backing index containing the document.

+

An update action expects that the partial doc, upsert, and script and its options are specified on the next line.

+

A delete action does not expect a source on the next line and has the same semantics as the standard delete API.

+

NOTE: The final line of data must end with a newline character (\\n). + Each newline character may be preceded by a carriage return (\\r). + When sending NDJSON data to the _bulk endpoint, use a Content-Type header of application/json or application/x-ndjson. + Because this format uses literal newline characters (\\n) as delimiters, make sure that the JSON actions and sources are not pretty printed.

+

If you provide a target in the request path, it is used for any actions that don't explicitly specify an _index argument.

+

A note on the format: the idea here is to make processing as fast as possible. + As some of the actions are redirected to other shards on other nodes, only action_meta_data is parsed on the receiving node side.

+

Client libraries using this protocol should try and strive to do something similar on the client side, and reduce buffering as much as possible.

+

There is no "correct" number of actions to perform in a single bulk request. + Experiment with different settings to find the optimal size for your particular workload. + Note that Elasticsearch limits the maximum size of a HTTP request to 100mb by default so clients must ensure that no request exceeds this size. + It is not possible to index a single document that exceeds the size limit, so you must pre-process any such documents into smaller pieces before sending them to Elasticsearch. + For instance, split documents into pages or chapters before indexing them, or store raw binary data in a system outside Elasticsearch and replace the raw data with a link to the external system in the documents that you send to Elasticsearch.

+

Client suppport for bulk requests

+

Some of the officially supported clients provide helpers to assist with bulk requests and reindexing:

+
    +
  • Go: Check out esutil.BulkIndexer
  • +
  • Perl: Check out Search::Elasticsearch::Client::5_0::Bulk and Search::Elasticsearch::Client::5_0::Scroll
  • +
  • Python: Check out elasticsearch.helpers.*
  • +
  • JavaScript: Check out client.helpers.*
  • +
  • .NET: Check out BulkAllObservable
  • +
  • PHP: Check out bulk indexing.
  • +
+

Submitting bulk requests with cURL

+

If you're providing text file input to curl, you must use the --data-binary flag instead of plain -d. + The latter doesn't preserve newlines. For example:

+
$ cat requests
+          { "index" : { "_index" : "test", "_id" : "1" } }
+          { "field1" : "value1" }
+          $ curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@requests"; echo
+          {"took":7, "errors": false, "items":[{"index":{"_index":"test","_id":"1","_version":1,"result":"created","forced_refresh":false}}]}
+          
+

Optimistic concurrency control

+

Each index and delete action within a bulk API call may include the if_seq_no and if_primary_term parameters in their respective action and meta data lines. + The if_seq_no and if_primary_term parameters control how operations are run, based on the last modification to existing documents. See Optimistic concurrency control for more details.

+

Versioning

+

Each bulk item can include the version value using the version field. + It automatically follows the behavior of the index or delete operation based on the _version mapping. + It also support the version_type.

+

Routing

+

Each bulk item can include the routing value using the routing field. + It automatically follows the behavior of the index or delete operation based on the _routing mapping.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+

Wait for active shards

+

When making bulk calls, you can set the wait_for_active_shards parameter to require a minimum number of shard copies to be active before starting to process the bulk request.

+

Refresh

+

Control when the changes made by this request are visible to search.

+

NOTE: Only the shards that receive the bulk request will be affected by refresh. + Imagine a _bulk?refresh=wait_for request with three documents in it that happen to be routed to different shards in an index with five shards. + The request will only wait for those three shards to refresh. + The other two shards that make up the index do not participate in the _bulk request at all.

+ + + ``_ :param operations: - :param index: Name of the data stream, index, or index alias to perform bulk + :param index: The name of the data stream, index, or index alias to perform bulk actions on. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. - If the index has a default ingest pipeline specified, then setting the value - to `_none` disables the default ingest pipeline for this request. If a final - pipeline is configured it will always run, regardless of the value of this + :param list_executed_pipelines: If `true`, the response will include the ingest + pipelines that were run for each index or create. + :param pipeline: The pipeline identifier to use to preprocess incoming documents. + If the index has a default ingest pipeline specified, setting the value to + `_none` turns off the default ingest pipeline for this request. If a final + pipeline is configured, it will always run regardless of the value of this parameter. :param refresh: If `true`, Elasticsearch refreshes 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` do nothing with refreshes. + this operation visible to search. If `wait_for`, wait for a refresh to make + this operation visible to search. If `false`, do nothing with refreshes. Valid values: `true`, `false`, `wait_for`. - :param require_alias: If `true`, the request’s actions must target an index alias. - :param routing: Custom value used to route operations to a specific shard. - :param source: `true` or `false` to return the `_source` field or not, or a list - of fields to return. + :param require_alias: If `true`, the request's actions must target an index alias. + :param require_data_stream: If `true`, the request's actions must target a data + stream (existing or to be created). + :param routing: A custom value that is used to route operations to a specific + shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or contains a list of fields to return. :param source_excludes: A comma-separated list of source fields to exclude from - the response. + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :param timeout: Period each action waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. + :param timeout: The period each action waits for the following operations: automatic + index creation, dynamic mapping updates, and waiting for active shards. The + default is `1m` (one minute), which guarantees Elasticsearch waits for at + least the timeout before failing. The actual wait time could be longer, particularly + when multiple waits occur. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to all or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. Set to `all` or any positive integer + up to the total number of shards in the index (`number_of_replicas+1`). The + default is `1`, which waits for each primary shard to be active. """ if operations is None and body is None: raise ValueError( @@ -690,6 +790,8 @@ def bulk( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if list_executed_pipelines is not None: + __query["list_executed_pipelines"] = list_executed_pipelines if pipeline is not None: __query["pipeline"] = pipeline if pretty is not None: @@ -698,6 +800,8 @@ def bulk( __query["refresh"] = refresh if require_alias is not None: __query["require_alias"] = require_alias + if require_data_stream is not None: + __query["require_data_stream"] = require_data_stream if routing is not None: __query["routing"] = routing if source is not None: @@ -739,11 +843,15 @@ def clear_scroll( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clears the search context and results for a scrolling search. + .. raw:: html + +

Clear a scrolling search. + Clear the search context and results for a scrolling search.

- ``_ - :param scroll_id: Scroll IDs to clear. To clear all scroll IDs, use `_all`. + ``_ + + :param scroll_id: The scroll IDs to clear. To clear all scroll IDs, use `_all`. """ __path_parts: t.Dict[str, str] = {} __path = "/_search/scroll" @@ -789,9 +897,16 @@ def close_point_in_time( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Closes a point-in-time. + .. raw:: html + +

Close a point in time. + A point in time must be opened explicitly before being used in search requests. + The keep_alive parameter tells Elasticsearch how long it should persist. + A point in time is automatically closed when the keep_alive period has elapsed. + However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.

- ``_ + + ``_ :param id: The ID of the point-in-time. """ @@ -863,46 +978,65 @@ def count( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns number of documents matching a query. + .. raw:: html + +

Count search results. + Get the number of documents matching a query.

+

The query can be provided either by using a simple query string as a parameter, or by defining Query DSL within the request body. + The query is optional. When no query is provided, the API uses match_all to count all the documents.

+

The count API supports multi-target syntax. You can run a single count API search across multiple data streams and indices.

+

The operation is broadcast across all shards. + For each shard ID group, a replica is chosen and the search is run against it. + This means that replicas increase the scalability of the count.

+ - ``_ + ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams and indices, omit this - parameter or use `*` or `_all`. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*` or `_all`. :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. - This behavior applies even if the request targets other open indices. + This behavior applies even if the request targets other open indices. For + example, a request targeting `foo*,bar*` returns an error if an index starts + with `foo` but no index starts with `bar`. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - This parameter can only be used when the `q` query string parameter is specified. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the `q` query string parameter is specified. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. :param default_operator: The default operator for query string query: `AND` or - `OR`. This parameter can only be used when the `q` query string parameter + `OR`. This parameter can be used only when the `q` query string parameter is specified. - :param df: Field to use as default where no field prefix is given in the query - string. This parameter can only be used when the `q` query string parameter + :param df: The field to use as a default when no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter is specified. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. - :param ignore_throttled: If `true`, concrete, expanded or aliased indices are + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. + :param ignore_throttled: If `true`, concrete, expanded, or aliased indices are ignored when frozen. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. - :param min_score: Sets the minimum `_score` value that documents must have to - be included in the result. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. - :param query: Defines the search definition using the Query DSL. - :param routing: Custom value used to route operations to a specific shard. - :param terminate_after: Maximum number of documents to collect for each shard. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. + :param min_score: The minimum `_score` value that documents must have to be included + in the result. + :param preference: The node or shard the operation should be performed on. By + default, it is random. + :param q: The query in Lucene query string syntax. This parameter cannot be used + with a request body. + :param query: Defines the search query using Query DSL. A request body query + cannot be used with the `q` query string parameter. + :param routing: A custom value used to route operations to a specific shard. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - Elasticsearch collects documents before sorting. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this parameter to each shard handling the request. + When possible, let Elasticsearch perform early termination automatically. + Avoid specifying this parameter for requests that target data streams with + backing indices across multiple data tiers. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -996,38 +1130,100 @@ def create( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Index a document. Adds a JSON document to the specified data stream or index - and makes it searchable. If the target is an index and the document already exists, - the request updates the document and increments its version. - - ``_ - - :param index: Name of the data stream or index to target. If the target doesn’t + .. raw:: html + +

Create a new document in the index.

+

You can index a new JSON document with the /<target>/_doc/ or /<target>/_create/<_id> APIs + Using _create guarantees that the document is indexed only if it does not already exist. + It returns a 409 response when a document with a same ID already exists in the index. + To update an existing document, you must use the /<target>/_doc/ API.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:

+
    +
  • To add a document using the PUT /<target>/_create/<_id> or POST /<target>/_create/<_id> request formats, you must have the create_doc, create, index, or write index privilege.
  • +
  • To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

Automatically create data streams and indices

+

If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream.

+

If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.

+

NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.

+

If no mapping exists, the index operation creates a dynamic mapping. + By default, new fields and objects are automatically added to the mapping if needed.

+

Automatic index creation is controlled by the action.auto_create_index setting. + If it is true, any index can be created automatically. + You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. + Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. + When a list is specified, the default behaviour is to disallow.

+

NOTE: The action.auto_create_index setting affects the automatic creation of indices only. + It does not affect the creation of data streams.

+

Routing

+

By default, shard placement — or routing — is controlled by using a hash of the document's ID value. + For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter.

+

When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. + This does come at the (very minimal) cost of an additional document parsing pass. + If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+

** Distributed**

+

The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. + After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.

+

Active shards

+

To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. + If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. + By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). + This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. + To alter this behavior per operation, use the wait_for_active_shards request parameter.

+

Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). + Specifying a negative value or a number greater than the number of shard copies will throw an error.

+

For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). + If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. + This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. + If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. + This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. + However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. + The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.

+

It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. + After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. + The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed.

+ + + ``_ + + :param index: The name of the data stream or index to target. If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. If - the target doesn’t exist and doesn’t match a data stream template, this request + the target doesn't exist and doesn’t match a data stream template, this request creates the index. - :param id: Unique identifier for the document. + :param id: A unique identifier for the document. To automatically generate a + document ID, use the `POST //_doc/` request format. :param document: - :param pipeline: ID of the pipeline to use to preprocess incoming documents. - If the index has a default ingest pipeline specified, then setting the value - to `_none` disables the default ingest pipeline for this request. If a final - pipeline is configured it will always run, regardless of the value of this + :param pipeline: The ID of the pipeline to use to preprocess incoming documents. + If the index has a default ingest pipeline specified, setting the value to + `_none` turns off the default ingest pipeline for this request. If a final + pipeline is configured, it will always run regardless of the value of this parameter. :param refresh: If `true`, Elasticsearch refreshes 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` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period the request waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. + :param routing: A custom value that is used to route operations to a specific + shard. + :param timeout: The period the request waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. Elasticsearch + waits for at least the specified timeout period before failing. The actual + wait time could be longer, particularly when multiple waits occur. This parameter + is useful for situations where the primary shard assigned to perform the + operation might not be available when the operation runs. Some reasons for + this might be that the primary shard is currently recovering from a gateway + or undergoing relocation. By default, the operation will wait on the primary + shard to become available for at least 1 minute before failing and responding + with an error. The actual wait time could be longer, particularly when multiple + waits occur. + :param version: The explicit version number for concurrency control. It must + be a non-negative long number. + :param version_type: The version type. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. You can set it to `all` or any positive + integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1102,29 +1298,60 @@ def delete( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a document. Removes a JSON document from the specified index. - - ``_ - - :param index: Name of the target index. - :param id: Unique identifier for the document. + .. raw:: html + +

Delete a document.

+

Remove a JSON document from the specified index.

+

NOTE: You cannot send deletion requests directly to a data stream. + To delete a document in a data stream, you must target the backing index containing the document.

+

Optimistic concurrency control

+

Delete operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. + If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409.

+

Versioning

+

Each document indexed is versioned. + When deleting a document, the version can be specified to make sure the relevant document you are trying to delete is actually being deleted and it has not changed in the meantime. + Every write operation run on a document, deletes included, causes its version to be incremented. + The version number of a deleted document remains available for a short time after deletion to allow for control of concurrent operations. + The length of time for which a deleted document's version remains available is determined by the index.gc_deletes index setting.

+

Routing

+

If routing is used during indexing, the routing value also needs to be specified to delete a document.

+

If the _routing mapping is set to required and no routing value is specified, the delete API throws a RoutingMissingException and rejects the request.

+

For example:

+
DELETE /my-index-000001/_doc/1?routing=shard-1
+          
+

This request deletes the document with ID 1, but it is routed based on the user. + The document is not deleted if the correct routing is not specified.

+

Distributed

+

The delete operation gets hashed into a specific shard ID. + It then gets redirected into the primary shard within that ID group and replicated (if needed) to shard replicas within that ID group.

+ + + ``_ + + :param index: The name of the target index. + :param id: A unique identifier for the document. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param refresh: If `true`, Elasticsearch refreshes 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` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period to wait for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. - :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. + :param routing: A custom value used to route operations to a specific shard. + :param timeout: The period to wait for active shards. This parameter is useful + for situations where the primary shard assigned to perform the delete operation + might not be available when the delete operation runs. Some reasons for this + might be that the primary shard is currently recovering from a store or undergoing + relocation. By default, the delete operation will wait on the primary shard + to become available for up to 1 minute before failing and responding with + an error. + :param version: An explicit version number for concurrency control. It must match + the current version of the document for the request to succeed. + :param version_type: The version type. + :param wait_for_active_shards: The minimum number of shard copies that must be + active before proceeding with the operation. You can set it to `all` or any + positive integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1224,72 +1451,148 @@ def delete_by_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete documents. Deletes documents that match the specified query. - - ``_ - - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams or indices, omit this - parameter or use `*` or `_all`. + .. raw:: html + +

Delete documents.

+

Deletes documents that match the specified query.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:

+
    +
  • read
  • +
  • delete or write
  • +
+

You can specify the query criteria in the request URI or the request body using the same syntax as the search API. + When you submit a delete by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and deletes matching documents using internal versioning. + If a document changes between the time that the snapshot is taken and the delete operation is processed, it results in a version conflict and the delete operation fails.

+

NOTE: Documents with a version equal to 0 cannot be deleted using delete by query because internal versioning does not support 0 as a valid version number.

+

While processing a delete by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents to delete. + A bulk delete request is performed for each batch of matching documents. + If a search or bulk request is rejected, the requests are retried up to 10 times, with exponential back off. + If the maximum retry limit is reached, processing halts and all failed requests are returned in the response. + Any delete requests that completed successfully still stick, they are not rolled back.

+

You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. + Note that if you opt to count version conflicts the operation could attempt to delete more documents from the source than max_docs until it has successfully deleted max_docs documents, or it has gone through every document in the source query.

+

Throttling delete requests

+

To control the rate at which delete by query issues batches of delete operations, you can set requests_per_second to any positive decimal number. + This pads each batch with a wait time to throttle the rate. + Set requests_per_second to -1 to disable throttling.

+

Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. + The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. + By default the batch size is 1000, so if requests_per_second is set to 500:

+
target_time = 1000 / 500 per second = 2 seconds
+          wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
+          
+

Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Delete by query supports sliced scroll to parallelize the delete process. + This can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

Setting slices to auto lets Elasticsearch choose the number of slices to use. + This setting will use one slice per shard, up to a certain limit. + If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards. + Adding slices to the delete by query operation creates sub-requests which means it has some quirks:

+
    +
  • You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices.
  • +
  • Fetching the status of the task for the request with slices only contains the status of completed slices.
  • +
  • These sub-requests are individually addressable for things like cancellation and rethrottling.
  • +
  • Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally.
  • +
  • Canceling the request with slices will cancel each sub-request.
  • +
  • Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.
  • +
  • Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the earlier point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being deleted.
  • +
  • Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time.
  • +
+

If you're slicing manually or otherwise tuning automatic slicing, keep in mind that:

+
    +
  • Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.
  • +
  • Delete performance scales linearly across available resources with the number of slices.
  • +
+

Whether query or delete performance dominates the runtime depends on the documents being reindexed and cluster resources.

+

Cancel a delete by query operation

+

Any delete by query can be canceled using the task cancel API. For example:

+
POST _tasks/r1A2WoRbTwKZ516z6NEs5A:36619/_cancel
+          
+

The task ID can be found by using the get tasks API.

+

Cancellation should happen quickly but might take a few seconds. + The get task status API will continue to list the delete by query task until this task checks that it has been cancelled and terminates itself.

+ + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams or indices, + omit this parameter or use `*` or `_all`. :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: Analyzer to use for the query string. This parameter can be + used only when the `q` query string parameter is specified. :param conflicts: What to do if delete by query hits version conflicts: `abort` or `proceed`. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. :param from_: Starting offset (default: 0) :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. :param max_docs: The maximum number of documents to delete. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. - :param query: Specifies the documents to delete using the Query DSL. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: A query in the Lucene query string syntax. + :param query: The documents to delete specified with Query DSL. :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. + delete by query after the request completes. This is different than the delete + API's `refresh` parameter, which causes just the shard that received the + delete request to be refreshed. Unlike the delete API, it does not support + `wait_for`. :param request_cache: If `true`, the request cache is used for this request. Defaults to the index-level setting. :param requests_per_second: The throttle for this request in sub-requests per second. - :param routing: Custom value used to route operations to a specific shard. - :param scroll: Period to retain the search context for scrolling. - :param scroll_size: Size of the scroll request that powers the operation. - :param search_timeout: Explicit timeout for each search request. Defaults to - no timeout. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param routing: A custom value used to route operations to a specific shard. + :param scroll: The period to retain the search context for scrolling. + :param scroll_size: The size of the scroll request that powers the operation. + :param search_timeout: The explicit timeout for each search request. It defaults + to no timeout. + :param search_type: The type of the search operation. Available options include + `query_then_fetch` and `dfs_query_then_fetch`. :param slice: Slice the request manually using the provided slice ID and total number of slices. :param slices: The number of slices this task should be divided into. - :param sort: A comma-separated list of : pairs. - :param stats: Specific `tag` of the request for logging and statistical purposes. - :param terminate_after: Maximum number of documents to collect for each shard. + :param sort: A comma-separated list of `:` pairs. + :param stats: The specific `tag` of the request for logging and statistical purposes. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. - :param timeout: Period each deletion request waits for active shards. + :param timeout: The period each deletion request waits for active shards. :param version: If `true`, returns the document version as part of a hit. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to all or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. Set to `all` or any positive integer + up to the total number of shards in the index (`number_of_replicas+1`). The + `timeout` value controls how long each write request waits for unavailable + shards to become available. :param wait_for_completion: If `true`, the request blocks until the operation - is complete. + is complete. If `false`, Elasticsearch performs some preflight checks, launches + the request, and returns a task you can use to cancel or get the status of + the task. Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. + When you are done with a task, you should delete the task document so Elasticsearch + can reclaim the space. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1402,13 +1705,18 @@ def delete_by_query_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Changes the number of requests per second for a particular Delete By Query operation. + .. raw:: html + +

Throttle a delete by query operation.

+

Change the number of requests per second for a particular delete by query operation. + Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.

+ - ``_ + ``_ :param task_id: The ID for the task. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. To disable throttling, set it to `-1`. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -1448,16 +1756,22 @@ def delete_script( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a script or search template. Deletes a stored script or search template. + .. raw:: html - ``_ +

Delete a script or search template. + Deletes a stored script or search template.

- :param id: Identifier for the stored script or search template. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + + ``_ + + :param id: The identifier for the stored script or search template. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. It can also be set to `-1` to indicate that the request + should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. It can + also be set to `-1` to indicate that the request should never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -1516,32 +1830,60 @@ def exists( ] = None, ) -> HeadApiResponse: """ - Check a document. Checks if a specified document exists. - - ``_ - - :param index: Comma-separated list of data streams, indices, and aliases. Supports - wildcards (`*`). - :param id: Identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + .. raw:: html + +

Check a document.

+

Verify that a document exists. + For example, check to see if a document with the _id 0 exists:

+
HEAD my-index-000001/_doc/0
+          
+

If the document exists, the API returns a status code of 200 - OK. + If the document doesn’t exist, the API returns 404 - Not Found.

+

Versioning support

+

You can use the version parameter to check the document only if its current version is equal to the specified one.

+

Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. + The old version of the document doesn't disappear immediately, although you won't be able to access it. + Elasticsearch cleans up deleted documents in the background as you continue to index more data.

+ + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases. It + supports wildcards (`*`). + :param id: A unique document identifier. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. If it is + set to `_local`, the operation will prefer to be run on a local allocated + shard when possible. If it is set to a custom value, the value is used to + guarantee that the same shards will be used for the same custom value. This + can help with "jumping values" when hitting different shards in different + refresh states. A sample value can be something like the web session ID or + the user name. :param realtime: If `true`, the request is real-time as opposed to near-real-time. - :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. - :param routing: Target the specified primary shard. - :param source: `true` or `false` to return the `_source` field or not, or a list - of fields to return. - :param source_excludes: A comma-separated list of source fields to exclude in - the response. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the `_source` parameter defaults to false. + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. If no fields are specified, no stored fields are included in the + response. If this field is specified, the `_source` parameter defaults to + `false`. :param version: Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1617,29 +1959,38 @@ def exists_source( ] = None, ) -> HeadApiResponse: """ - Check for a document source. Checks if a document's `_source` is stored. + .. raw:: html - ``_ +

Check for a document source.

+

Check whether a document source exists in an index. + For example:

+
HEAD my-index-000001/_source/1
+          
+

A document's source is not available if it is disabled in the mapping.

- :param index: Comma-separated list of data streams, indices, and aliases. Supports - wildcards (`*`). - :param id: Identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param realtime: If true, the request is real-time as opposed to near-real-time. - :param refresh: If `true`, Elasticsearch refreshes all shards involved in the - delete by query after the request completes. - :param routing: Target the specified primary shard. - :param source: `true` or `false` to return the `_source` field or not, or a list - of fields to return. + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases. It + supports wildcards (`*`). + :param id: A unique identifier for the document. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. + :param realtime: If `true`, the request is real-time as opposed to near-real-time. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. :param source_excludes: A comma-separated list of source fields to exclude in the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -1717,34 +2068,47 @@ def explain( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain a document match result. Returns information about why a specific document - matches, or doesn’t match, a query. + .. raw:: html + +

Explain a document match result. + Get information about why a specific document matches, or doesn't match, a query. + It computes a score explanation for a query and a specific document.

+ - ``_ + ``_ - :param index: Index names used to limit the request. Only a single index name - can be provided to this parameter. - :param id: Defines the document ID. + :param index: Index names that are used to limit the request. Only a single index + name can be provided to this parameter. + :param id: The document identifier. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the `q` query string parameter is specified. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: The query in the Lucene query string syntax. :param query: Defines the search definition using the Query DSL. - :param routing: Custom value used to route operations to a specific shard. - :param source: True or false to return the `_source` field or not, or a list + :param routing: A custom value used to route operations to a specific shard. + :param source: `True` or `false` to return the `_source` field or not or a list of fields to return. :param source_excludes: A comma-separated list of source fields to exclude from - the response. + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. :param stored_fields: A comma-separated list of stored fields to return in the response. """ @@ -1837,14 +2201,18 @@ def field_caps( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The field capabilities API returns the information about the capabilities of - fields among multiple indices. The field capabilities API returns runtime fields - like any other field. For example, a runtime field with a type of keyword is - returned as any other field that belongs to the `keyword` family. + .. raw:: html - ``_ +

Get the field capabilities.

+

Get information about the capabilities of fields among multiple indices.

+

For data streams, the API returns field capabilities among the stream’s backing indices. + It returns runtime fields like any other field. + For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the keyword family.

- :param index: Comma-separated list of data streams, indices, and aliases used + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. :param allow_no_indices: If false, the request returns an error if any wildcard @@ -1852,25 +2220,32 @@ def field_caps( This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. - :param fields: List of fields to retrieve capabilities for. Wildcard (`*`) expressions - are supported. - :param filters: An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. Supports comma-separated + values, such as `open,hidden`. + :param fields: A list of fields to retrieve capabilities for. Wildcard (`*`) + expressions are supported. + :param filters: A comma-separated list of filters to apply to the response. :param ignore_unavailable: If `true`, missing or closed indices are not included in the response. :param include_empty_fields: If false, empty fields are not included in the response. :param include_unmapped: If true, unmapped fields are included in the response. - :param index_filter: Allows to filter indices if the provided query rewrites - to match_none on every shard. - :param runtime_mappings: Defines ad-hoc runtime fields in the request similar + :param index_filter: Filter indices if the provided query rewrites to `match_none` + on every shard. IMPORTANT: The filtering is done on a best-effort basis, + it uses index statistics and mappings to rewrite queries to `match_none` + instead of fully running the request. For instance a range query over a date + field can rewrite to `match_none` if all documents within a shard (including + deleted documents) are outside of the provided range. However, not all queries + can rewrite to `match_none` so this API may return an index even if the provided + filter matches no document. + :param runtime_mappings: Define ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings. - :param types: Only return results for fields that have one of the types in the - list + :param types: A comma-separated list of field types to include. Any fields that + do not match one of these types will be excluded from the results. It defaults + to empty, meaning that all field types are returned. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -1956,36 +2331,87 @@ def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a document by its ID. Retrieves the document with the specified ID from an - index. - - ``_ - - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. - :param force_synthetic_source: Should this request force synthetic _source? Use - this to test if the mapping supports synthetic _source and to get a sense - of the worst case performance. Fetches with this enabled will be slower the - enabling synthetic source natively in the index. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + .. raw:: html + +

Get a document by its ID.

+

Get a document and its source or stored fields from an index.

+

By default, this API is realtime and is not affected by the refresh rate of the index (when data will become visible for search). + In the case where stored fields are requested with the stored_fields parameter and the document has been updated but is not yet refreshed, the API will have to parse and analyze the source to extract the stored fields. + To turn off realtime behavior, set the realtime parameter to false.

+

Source filtering

+

By default, the API returns the contents of the _source field unless you have used the stored_fields parameter or the _source field is turned off. + You can turn off _source retrieval by using the _source parameter:

+
GET my-index-000001/_doc/0?_source=false
+          
+

If you only need one or two fields from the _source, use the _source_includes or _source_excludes parameters to include or filter out particular fields. + This can be helpful with large documents where partial retrieval can save on network overhead + Both parameters take a comma separated list of fields or wildcard expressions. + For example:

+
GET my-index-000001/_doc/0?_source_includes=*.id&_source_excludes=entities
+          
+

If you only want to specify includes, you can use a shorter notation:

+
GET my-index-000001/_doc/0?_source=*.id
+          
+

Routing

+

If routing is used during indexing, the routing value also needs to be specified to retrieve a document. + For example:

+
GET my-index-000001/_doc/2?routing=user1
+          
+

This request gets the document with ID 2, but it is routed based on the user. + The document is not fetched if the correct routing is not specified.

+

Distributed

+

The GET operation is hashed into a specific shard ID. + It is then redirected to one of the replicas within that shard ID and returns the result. + The replicas are the primary shard and its replicas within that shard ID group. + This means that the more replicas you have, the better your GET scaling will be.

+

Versioning support

+

You can use the version parameter to retrieve the document only if its current version is equal to the specified one.

+

Internally, Elasticsearch has marked the old document as deleted and added an entirely new document. + The old version of the document doesn't disappear immediately, although you won't be able to access it. + Elasticsearch cleans up deleted documents in the background as you continue to index more data.

+ + + ``_ + + :param index: The name of the index that contains the document. + :param id: A unique document identifier. + :param force_synthetic_source: Indicates whether the request forces synthetic + `_source`. Use this paramater to test if the mapping supports synthetic `_source` + and to get a sense of the worst case performance. Fetches with this parameter + enabled will be slower than enabling synthetic source natively in the index. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. If it is + set to `_local`, the operation will prefer to be run on a local allocated + shard when possible. If it is set to a custom value, the value is used to + guarantee that the same shards will be used for the same custom value. This + can help with "jumping values" when hitting different shards in different + refresh states. A sample value can be something like the web session ID or + the user name. :param realtime: If `true`, the request is real-time as opposed to near-real-time. - :param refresh: If true, Elasticsearch refreshes the affected shards to make - this operation visible to search. If false, do nothing with refreshes. - :param routing: Target the specified primary shard. - :param source: True or false to return the _source field or not, or a list of - fields to return. - :param source_excludes: A comma-separated list of source fields to exclude in - the response. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. + :param source_excludes: A comma-separated list of source fields to exclude from + the response. You can also use this parameter to exclude fields from the + subset specified in `_source_includes` query parameter. If the `_source` + parameter is `false`, this parameter is ignored. :param source_includes: A comma-separated list of source fields to include in - the response. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the `_source` parameter defaults to false. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: internal, external, external_gte. + the response. If this parameter is specified, only these source fields are + returned. You can exclude fields from this subset using the `_source_excludes` + query parameter. If the `_source` parameter is `false`, this parameter is + ignored. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. If no fields are specified, no stored fields are included in the + response. If this field is specified, the `_source` parameter defaults to + `false`. Only leaf fields can be retrieved with the `stored_field` option. + Object fields can't be returned;​if specified, the request fails. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2046,12 +2472,19 @@ def get_script( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a script or search template. Retrieves a stored script or search template. + .. raw:: html + +

Get a script or search template. + Retrieves a stored script or search template.

- ``_ - :param id: Identifier for the stored script or search template. - :param master_timeout: Specify timeout for connection to master + ``_ + + :param id: The identifier for the stored script or search template. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. It can also be set to `-1` to indicate that the request should + never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -2088,9 +2521,13 @@ def get_script_context( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns all script contexts. + .. raw:: html + +

Get script contexts.

+

Get a list of supported script contexts and their methods.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_context" @@ -2123,9 +2560,13 @@ def get_script_languages( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns available script types, languages and contexts + .. raw:: html + +

Get script languages.

+

Get a list of available script types, languages, and contexts.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_script_language" @@ -2178,29 +2619,41 @@ def get_source( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Get a document's source. Returns the source of a document. + .. raw:: html - ``_ +

Get a document's source.

+

Get the source of a document. + For example:

+
GET my-index-000001/_source/1
+          
+

You can use the source filtering parameters to control which parts of the _source are returned:

+
GET my-index-000001/_source/1/?_source_includes=*.id&_source_excludes=entities
+          
- :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param realtime: Boolean) If true, the request is real-time as opposed to near-real-time. - :param refresh: If true, Elasticsearch refreshes the affected shards to make - this operation visible to search. If false, do nothing with refreshes. - :param routing: Target the specified primary shard. - :param source: True or false to return the _source field or not, or a list of - fields to return. + + ``_ + + :param index: The name of the index that contains the document. + :param id: A unique document identifier. + :param preference: The node or shard the operation should be performed on. By + default, the operation is randomized between the shard replicas. + :param realtime: If `true`, the request is real-time as opposed to near-real-time. + :param refresh: If `true`, the request refreshes the relevant shards before retrieving + the document. Setting it to `true` should be done after careful thought and + verification that this does not cause a heavy load on the system (and slow + down indexing). + :param routing: A custom value used to route operations to a specific shard. + :param source: Indicates whether to return the `_source` field (`true` or `false`) + or lists the fields to return. :param source_excludes: A comma-separated list of source fields to exclude in the response. :param source_includes: A comma-separated list of source fields to include in the response. - :param stored_fields: - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: internal, external, external_gte. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. + :param version: The version number for concurrency control. It must match the + current version of the document for the request to succeed. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2261,9 +2714,24 @@ def health_report( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the health of the cluster. + .. raw:: html + +

Get the cluster health. + Get a report with the health status of an Elasticsearch cluster. + The report contains a list of indicators that compose Elasticsearch functionality.

+

Each indicator has a health status of: green, unknown, yellow or red. + The indicator will provide an explanation and metadata describing the reason for its current health status.

+

The cluster’s status is controlled by the worst indicator status.

+

In the event that an indicator’s status is non-green, a list of impacts may be present in the indicator result which detail the functionalities that are negatively affected by the health issue. + Each impact carries with it a severity level, an area of the system that is affected, and a simple description of the impact on the system.

+

Some health indicators can determine the root cause of a health problem and prescribe a set of steps that can be performed in order to improve the health of the system. + The root cause and remediation steps are encapsulated in a diagnosis. + A diagnosis contains a cause detailing a root cause analysis, an action containing a brief description of the steps to take to fix the problem, the list of affected resources (if applicable), and a detailed step-by-step troubleshooting guide to fix the diagnosed problem.

+

NOTE: The health indicators perform root cause analysis of non-green health statuses. This can be computationally expensive when called frequently. + When setting up automated polling of the API for health status, set verbose to false to disable the more expensive analysis logic.

- ``_ + + ``_ :param feature: A feature of the cluster, as returned by the top-level health report API. @@ -2336,44 +2804,148 @@ def index( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Index a document. Adds a JSON document to the specified data stream or index - and makes it searchable. If the target is an index and the document already exists, - the request updates the document and increments its version. - - ``_ - - :param index: Name of the data stream or index to target. + .. raw:: html + +

Create or update a document in an index.

+

Add a JSON document to the specified data stream or index and make it searchable. + If the target is an index and the document already exists, the request updates the document and increments its version.

+

NOTE: You cannot use this API to send update requests for existing documents in a data stream.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or index alias:

+
    +
  • To add or overwrite a document using the PUT /<target>/_doc/<_id> request format, you must have the create, index, or write index privilege.
  • +
  • To add a document using the POST /<target>/_doc/ request format, you must have the create_doc, create, index, or write index privilege.
  • +
  • To automatically create a data stream or index with this API request, you must have the auto_configure, create_index, or manage index privilege.
  • +
+

Automatic data stream creation requires a matching index template with data stream enabled.

+

NOTE: Replica shards might not all be started when an indexing operation returns successfully. + By default, only the primary is required. Set wait_for_active_shards to change this default behavior.

+

Automatically create data streams and indices

+

If the request's target doesn't exist and matches an index template with a data_stream definition, the index operation automatically creates the data stream.

+

If the target doesn't exist and doesn't match a data stream template, the operation automatically creates the index and applies any matching index templates.

+

NOTE: Elasticsearch includes several built-in index templates. To avoid naming collisions with these templates, refer to index pattern documentation.

+

If no mapping exists, the index operation creates a dynamic mapping. + By default, new fields and objects are automatically added to the mapping if needed.

+

Automatic index creation is controlled by the action.auto_create_index setting. + If it is true, any index can be created automatically. + You can modify this setting to explicitly allow or block automatic creation of indices that match specified patterns or set it to false to turn off automatic index creation entirely. + Specify a comma-separated list of patterns you want to allow or prefix each pattern with + or - to indicate whether it should be allowed or blocked. + When a list is specified, the default behaviour is to disallow.

+

NOTE: The action.auto_create_index setting affects the automatic creation of indices only. + It does not affect the creation of data streams.

+

Optimistic concurrency control

+

Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified by the if_seq_no and if_primary_term parameters. + If a mismatch is detected, the operation will result in a VersionConflictException and a status code of 409.

+

Routing

+

By default, shard placement — or routing — is controlled by using a hash of the document's ID value. + For more explicit control, the value fed into the hash function used by the router can be directly specified on a per-operation basis using the routing parameter.

+

When setting up explicit mapping, you can also use the _routing field to direct the index operation to extract the routing value from the document itself. + This does come at the (very minimal) cost of an additional document parsing pass. + If the _routing mapping is defined and set to be required, the index operation will fail if no routing value is provided or extracted.

+

NOTE: Data streams do not support custom routing unless they were created with the allow_custom_routing setting enabled in the template.

+
    +
  • ** Distributed**
  • +
+

The index operation is directed to the primary shard based on its route and performed on the actual node containing this shard. + After the primary shard completes the operation, if needed, the update is distributed to applicable replicas.

+

Active shards

+

To improve the resiliency of writes to the system, indexing operations can be configured to wait for a certain number of active shard copies before proceeding with the operation. + If the requisite number of active shard copies are not available, then the write operation must wait and retry, until either the requisite shard copies have started or a timeout occurs. + By default, write operations only wait for the primary shards to be active before proceeding (that is to say wait_for_active_shards is 1). + This default can be overridden in the index settings dynamically by setting index.write.wait_for_active_shards. + To alter this behavior per operation, use the wait_for_active_shards request parameter.

+

Valid values are all or any positive integer up to the total number of configured copies per shard in the index (which is number_of_replicas+1). + Specifying a negative value or a number greater than the number of shard copies will throw an error.

+

For example, suppose you have a cluster of three nodes, A, B, and C and you create an index index with the number of replicas set to 3 (resulting in 4 shard copies, one more copy than there are nodes). + If you attempt an indexing operation, by default the operation will only ensure the primary copy of each shard is available before proceeding. + This means that even if B and C went down and A hosted the primary shard copies, the indexing operation would still proceed with only one copy of the data. + If wait_for_active_shards is set on the request to 3 (and all three nodes are up), the indexing operation will require 3 active shard copies before proceeding. + This requirement should be met because there are 3 active nodes in the cluster, each one holding a copy of the shard. + However, if you set wait_for_active_shards to all (or to 4, which is the same in this situation), the indexing operation will not proceed as you do not have all 4 copies of each shard active in the index. + The operation will timeout unless a new node is brought up in the cluster to host the fourth copy of the shard.

+

It is important to note that this setting greatly reduces the chances of the write operation not writing to the requisite number of shard copies, but it does not completely eliminate the possibility, because this check occurs before the write operation starts. + After the write operation is underway, it is still possible for replication to fail on any number of shard copies but still succeed on the primary. + The _shards section of the API response reveals the number of shard copies on which replication succeeded and failed.

+

No operation (noop) updates

+

When updating a document by using this API, a new version of the document is always created even if the document hasn't changed. + If this isn't acceptable use the _update API with detect_noop set to true. + The detect_noop option isn't available on this API because it doesn’t fetch the old source and isn't able to compare it against the new source.

+

There isn't a definitive rule for when noop updates aren't acceptable. + It's a combination of lots of factors like how frequently your data source sends updates that are actually noops and how many queries per second Elasticsearch runs on the shard receiving the updates.

+

Versioning

+

Each indexed document is given a version number. + By default, internal versioning is used that starts at 1 and increments with each update, deletes included. + Optionally, the version number can be set to an external value (for example, if maintained in a database). + To enable this functionality, version_type should be set to external. + The value provided must be a numeric, long value greater than or equal to 0, and less than around 9.2e+18.

+

NOTE: Versioning is completely real time, and is not affected by the near real time aspects of search operations. + If no version is provided, the operation runs without any version checks.

+

When using the external version type, the system checks to see if the version number passed to the index request is greater than the version of the currently stored document. + If true, the document will be indexed and the new version number used. + If the value provided is less than or equal to the stored document's version number, a version conflict will occur and the index operation will fail. For example:

+
PUT my-index-000001/_doc/1?version=2&version_type=external
+          {
+            "user": {
+              "id": "elkbee"
+            }
+          }
+
+          In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
+          If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).
+
+          A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
+          Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.
+          
+ + + ``_ + + :param index: The name of the data stream or index to target. If the target doesn't + exist and matches the name or wildcard (`*`) pattern of an index template + with a `data_stream` definition, this request creates the data stream. If + the target doesn't exist and doesn't match a data stream template, this request + creates the index. You can check for existing targets with the resolve index + API. :param document: - :param id: Unique identifier for the document. + :param id: A unique identifier for the document. To automatically generate a + document ID, use the `POST //_doc/` request format and omit this + parameter. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. - :param op_type: Set to create to only index the document if it does not already + :param op_type: Set to `create` to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, - the indexing operation will fail. Same as using the `/_create` endpoint. - Valid values: `index`, `create`. If document id is specified, it defaults - to `index`. Otherwise, it defaults to `create`. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. + the indexing operation will fail. The behavior is the same as using the `/_create` + endpoint. If a document ID is specified, this paramater defaults to `index`. + Otherwise, it defaults to `create`. If the request targets a data stream, + an `op_type` of `create` is required. + :param pipeline: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. :param refresh: If `true`, Elasticsearch refreshes 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` do nothing with refreshes. - Valid values: `true`, `false`, `wait_for`. + this operation visible to search. If `wait_for`, it waits for a refresh to + make this operation visible to search. If `false`, it does nothing with refreshes. :param require_alias: If `true`, the destination must be an index alias. - :param routing: Custom value used to route operations to a specific shard. - :param timeout: Period the request waits for the following operations: automatic - index creation, dynamic mapping updates, waiting for active shards. - :param version: Explicit version number for concurrency control. The specified - version must match the current version of the document for the request to - succeed. - :param version_type: Specific version type: `external`, `external_gte`. + :param routing: A custom value that is used to route operations to a specific + shard. + :param timeout: The period the request waits for the following operations: automatic + index creation, dynamic mapping updates, waiting for active shards. This + parameter is useful for situations where the primary shard assigned to perform + the operation might not be available when the operation runs. Some reasons + for this might be that the primary shard is currently recovering from a gateway + or undergoing relocation. By default, the operation will wait on the primary + shard to become available for at least 1 minute before failing and responding + with an error. The actual wait time could be longer, particularly when multiple + waits occur. + :param version: An explicit version number for concurrency control. It must be + a non-negative long number. + :param version_type: The version type. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to all or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. You can set it to `all` or any positive + integer up to the total number of shards in the index (`number_of_replicas+1`). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2447,9 +3019,13 @@ def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster info. Returns basic information about the cluster. + .. raw:: html - ``_ +

Get cluster info. + Get basic build, version, and cluster information.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/" @@ -2483,6 +3059,7 @@ def info( ), parameter_aliases={"_source": "source"}, ) + @_stability_warning(Stability.EXPERIMENTAL) def knn_search( self, *, @@ -2503,30 +3080,48 @@ def knn_search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Performs a kNN search. - - ``_ + .. raw:: html + +

Run a knn search.

+

NOTE: The kNN search API has been replaced by the knn option in the search API.

+

Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. + Given a query vector, the API finds the k closest vectors and returns those documents as search hits.

+

Elasticsearch uses the HNSW algorithm to support efficient kNN search. + Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. + This means the results returned are not always the true k closest neighbors.

+

The kNN search API supports restricting the search using a filter. + The search will return the top k documents that also match the filter query.

+

A kNN search response has the exact same structure as a search API response. + However, certain sections have a meaning specific to kNN search:

+
    +
  • The document _score is determined by the similarity between the query and document vector.
  • +
  • The hits.total object contains the total number of nearest neighbor candidates considered, which is num_candidates * num_shards. The hits.total.relation will always be eq, indicating an exact value.
  • +
+ + + ``_ :param index: A comma-separated list of index names to search; use `_all` or - to perform the operation on all indices - :param knn: kNN query to execute + to perform the operation on all indices. + :param knn: The kNN query to run. :param docvalue_fields: The request returns doc values for field names matching - these patterns in the hits.fields property of the response. Accepts wildcard - (*) patterns. + these patterns in the `hits.fields` property of the response. It accepts + wildcard (`*`) patterns. :param fields: The request returns values for field names matching these patterns - in the hits.fields property of the response. Accepts wildcard (*) patterns. - :param filter: Query to filter the documents that can match. The kNN search will - return the top `k` documents that also match this filter. The value can be - a single query or a list of queries. If `filter` isn't provided, all documents - are allowed to match. - :param routing: A comma-separated list of specific routing values + in the `hits.fields` property of the response. It accepts wildcard (`*`) + patterns. + :param filter: A query to filter the documents that can match. The kNN search + will return the top `k` documents that also match this filter. The value + can be a single query or a list of queries. If `filter` isn't provided, all + documents are allowed to match. + :param routing: A comma-separated list of specific routing values. :param source: Indicates which source fields are returned for matching documents. - These fields are returned in the hits._source property of the search response. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the _source parameter defaults to false. You can pass - _source: true to return both source fields and stored fields in the search - response. + These fields are returned in the `hits._source` property of the search response. + :param stored_fields: A list of stored fields to return as part of a hit. If + no fields are specified, no stored fields are included in the response. If + this field is specified, the `_source` parameter defaults to `false`. You + can pass `_source: true` to return both source fields and stored fields in + the search response. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -2604,9 +3199,23 @@ def mget( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows to get multiple documents in one request. + .. raw:: html + +

Get multiple documents.

+

Get multiple JSON documents by ID from one or more indices. + If you specify an index in the request URI, you only need to specify the document IDs in the request body. + To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.

+

Filter source fields

+

By default, the _source field is returned for every document (if stored). + Use the _source and _source_include or source_exclude attributes to filter what fields are returned for a particular document. + You can include the _source, _source_includes, and _source_excludes query parameters in the request URI to specify the defaults to use when there are no per-document instructions.

+

Get stored fields

+

Use the stored_fields attribute to specify the set of stored fields you want to retrieve. + Any requested fields that are not stored are ignored. + You can include the stored_fields query parameter in the request URI to specify the defaults to use when there are no per-document instructions.

- ``_ + + ``_ :param index: Name of the index to retrieve documents from when `ids` are specified, or when a document in the `docs` array does not specify an index. @@ -2725,9 +3334,23 @@ def msearch( typed_keys: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows to execute several search operations in one request. + .. raw:: html + +

Run multiple searches.

+

The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. + The structure is as follows:

+
header\\n
+          body\\n
+          header\\n
+          body\\n
+          
+

This structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.

+

IMPORTANT: The final line of data must end with a newline character \\n. + Each newline character may be preceded by a carriage return \\r. + When sending requests to this endpoint the Content-Type header should be set to application/x-ndjson.

+ - ``_ + ``_ :param searches: :param index: Comma-separated list of data streams, indices, and index aliases @@ -2857,22 +3480,35 @@ def msearch_template( typed_keys: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Runs multiple templated searches with a single request. + .. raw:: html + +

Run multiple templated searches.

+

Run multiple templated searches with a single request. + If you are providing a text file or text input to curl, use the --data-binary flag instead of -d to preserve newlines. + For example:

+
$ cat requests
+          { "index": "my-index" }
+          { "id": "my-search-template", "params": { "query_string": "hello world", "from": 0, "size": 10 }}
+          { "index": "my-other-index" }
+          { "id": "my-other-search-template", "params": { "query_type": "match_all" }}
+
+          $ curl -H "Content-Type: application/x-ndjson" -XGET localhost:9200/_msearch/template --data-binary "@requests"; echo
+          
- ``_ + + ``_ :param search_templates: - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams and indices, omit this - parameter or use `*`. + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*`. :param ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. - :param max_concurrent_searches: Maximum number of concurrent searches the API - can run. + :param max_concurrent_searches: The maximum number of concurrent searches the + API can run. :param rest_total_hits_as_int: If `true`, the response returns `hits.total` as an integer. If `false`, it returns `hits.total` as an object. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param search_type: The type of the search operation. :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ @@ -2952,30 +3588,41 @@ def mtermvectors( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns multiple termvectors in one request. + .. raw:: html + +

Get multiple term vectors.

+

Get multiple term vectors with a single request. + You can specify existing documents by index and ID or provide artificial documents in the body of the request. + You can specify the index in the request body or request URI. + The response contains a docs array with all the fetched termvectors. + Each element has the structure provided by the termvectors API.

+

Artificial documents

+

You can also use mtermvectors to generate term vectors for artificial documents provided in the body of the request. + The mapping used is determined by the specified _index.

- ``_ - :param index: Name of the index that contains the documents. - :param docs: Array of existing or artificial documents. + ``_ + + :param index: The name of the index that contains the documents. + :param docs: An array of existing or artificial documents. :param field_statistics: If `true`, the response includes the document count, sum of document frequencies, and sum of total term frequencies. - :param fields: Comma-separated list or wildcard expressions of fields to include - in the statistics. Used as the default list unless a specific field list - is provided in the `completion_fields` or `fielddata_fields` parameters. - :param ids: Simplified syntax to specify documents by their ID if they're in + :param fields: A comma-separated list or wildcard expressions of fields to include + in the statistics. It is used as the default list unless a specific field + list is provided in the `completion_fields` or `fielddata_fields` parameters. + :param ids: A simplified syntax to specify documents by their ID if they're in the same index. :param offsets: If `true`, the response includes term offsets. :param payloads: If `true`, the response includes term payloads. :param positions: If `true`, the response includes term positions. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param realtime: If true, the request is real-time as opposed to near-real-time. - :param routing: Custom value used to route operations to a specific shard. + :param routing: A custom value used to route operations to a specific shard. :param term_statistics: If true, the response includes term frequency and document frequency. :param version: If `true`, returns the document version as part of a hit. - :param version_type: Specific version type. + :param version_type: The version type. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -3044,6 +3691,7 @@ def open_point_in_time( *, index: t.Union[str, t.Sequence[str]], keep_alive: t.Union[str, t.Literal[-1], t.Literal[0]], + allow_partial_search_results: t.Optional[bool] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ t.Union[ @@ -3063,30 +3711,59 @@ def open_point_in_time( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - A search request by default executes against the most recent visible data of - the target indices, which is called point in time. Elasticsearch pit (point in - time) is a lightweight view into the state of the data as it existed when initiated. - In some cases, it’s preferred to perform multiple search requests using the same - point in time. For example, if refreshes happen between `search_after` requests, - then the results of those requests might not be consistent as changes happening - between searches are only visible to the more recent point in time. - - ``_ + .. raw:: html + +

Open a point in time.

+

A search request by default runs against the most recent visible data of the target indices, + which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the + state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple + search requests using the same point in time. For example, if refreshes happen between + search_after requests, then the results of those requests might not be consistent as changes happening + between searches are only visible to the more recent point in time.

+

A point in time must be opened explicitly before being used in search requests.

+

A subsequent search request with the pit parameter must not specify index, routing, or preference values as these parameters are copied from the point in time.

+

Just like regular searches, you can use from and size to page through point in time search results, up to the first 10,000 hits. + If you want to retrieve more hits, use PIT with search_after.

+

IMPORTANT: The open point in time request and each subsequent search request can return different identifiers; always use the most recently received ID for the next search request.

+

When a PIT that contains shard failures is used in a search request, the missing are always reported in the search response as a NoShardAvailableActionException exception. + To get rid of these exceptions, a new PIT needs to be created so that shards missing from the previous PIT can be handled, assuming they become available in the meantime.

+

Keeping point in time alive

+

The keep_alive parameter, which is passed to a open point in time request and search request, extends the time to live of the corresponding point in time. + The value does not need to be long enough to process all data — it just needs to be long enough for the next request.

+

Normally, the background merge process optimizes the index by merging together smaller segments to create new, bigger segments. + Once the smaller segments are no longer needed they are deleted. + However, open point-in-times prevent the old segments from being deleted since they are still in use.

+

TIP: Keeping older segments alive means that more disk space and file handles are needed. + Ensure that you have configured your nodes to have ample free file handles.

+

Additionally, if a segment contains deleted or updated documents then the point in time must keep track of whether each document in the segment was live at the time of the initial search request. + Ensure that your nodes have sufficient heap space if you have many open point-in-times on an index that is subject to ongoing deletes or updates. + Note that a point-in-time doesn't prevent its associated indices from being deleted. + You can check how many point-in-times (that is, search contexts) are open with the nodes stats API.

+ + + ``_ :param index: A comma-separated list of index names to open point in time; use `_all` or empty string to perform the operation on all indices - :param keep_alive: Extends the time to live of the corresponding point in time. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param keep_alive: Extend the length of time that the point in time persists. + :param allow_partial_search_results: Indicates whether the point in time tolerates + unavailable shards or shard failures when initially creating the PIT. If + `false`, creating a point in time request when a shard is missing or unavailable + will throw an exception. If `true`, the point in time will contain all the + shards that are available at the time of the request. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. - :param index_filter: Allows to filter indices if the provided query rewrites - to `match_none` on every shard. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param routing: Custom value used to route operations to a specific shard. + :param index_filter: Filter indices if the provided query rewrites to `match_none` + on every shard. + :param preference: The node or shard the operation should be performed on. By + default, it is random. + :param routing: A custom value that is used to route operations to a specific + shard. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -3098,6 +3775,8 @@ def open_point_in_time( __body: t.Dict[str, t.Any] = body if body is not None else {} if keep_alive is not None: __query["keep_alive"] = keep_alive + if allow_partial_search_results is not None: + __query["allow_partial_search_results"] = allow_partial_search_results if error_trace is not None: __query["error_trace"] = error_trace if expand_wildcards is not None: @@ -3150,23 +3829,27 @@ def put_script( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a script or search template. Creates or updates a stored script - or search template. - - ``_ - - :param id: Identifier for the stored script or search template. Must be unique - within the cluster. - :param script: Contains the script or search template, its parameters, and its - language. - :param context: Context in which the script or search template should run. To - prevent errors, the API immediately compiles the script or template in this - context. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + .. raw:: html + +

Create or update a script or search template. + Creates or updates a stored script or search template.

+ + + ``_ + + :param id: The identifier for the stored script or search template. It must be + unique within the cluster. + :param script: The script or search template, its parameters, and its language. + :param context: The context in which the script or search template should run. + To prevent errors, the API immediately compiles the script or template in + this context. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. It can also be set to `-1` to indicate that the request + should never timeout. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. It can + also be set to `-1` to indicate that the request should never timeout. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -3236,14 +3919,17 @@ def rank_eval( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables you to evaluate the quality of ranked search results over a set of typical - search queries. + .. raw:: html + +

Evaluate ranked search results.

+

Evaluate the quality of ranked search results over a set of typical search queries.

+ - ``_ + ``_ :param requests: A set of typical search requests, together with their provided ratings. - :param index: Comma-separated list of data streams, indices, and index aliases + :param index: A comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (`*`) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use `_all` or `*`. @@ -3331,33 +4017,187 @@ def reindex( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reindex documents. Copies documents from a source to a destination. The source - can be any existing index, alias, or data stream. The destination must differ - from the source. For example, you cannot reindex a data stream into itself. - - ``_ + .. raw:: html + +

Reindex documents.

+

Copy documents from a source to a destination. + You can copy all documents to the destination index or reindex a subset of the documents. + The source can be any existing index, alias, or data stream. + The destination must differ from the source. + For example, you cannot reindex a data stream into itself.

+

IMPORTANT: Reindex requires _source to be enabled for all documents in the source. + The destination should be configured as wanted before calling the reindex API. + Reindex does not copy the settings from the source or its associated template. + Mappings, shard counts, and replicas, for example, must be configured ahead of time.

+

If the Elasticsearch security features are enabled, you must have the following security privileges:

+
    +
  • The read index privilege for the source data stream, index, or alias.
  • +
  • The write index privilege for the destination data stream, index, or index alias.
  • +
  • To automatically create a data stream or index with a reindex API request, you must have the auto_configure, create_index, or manage index privilege for the destination data stream, index, or alias.
  • +
  • If reindexing from a remote cluster, the source.remote.user must have the monitor cluster privilege and the read index privilege for the source data stream, index, or alias.
  • +
+

If reindexing from a remote cluster, you must explicitly allow the remote host in the reindex.remote.whitelist setting. + Automatic data stream creation requires a matching index template with data stream enabled.

+

The dest element can be configured like the index API to control optimistic concurrency control. + Omitting version_type or setting it to internal causes Elasticsearch to blindly dump documents into the destination, overwriting any that happen to have the same ID.

+

Setting version_type to external causes Elasticsearch to preserve the version from the source, create any documents that are missing, and update any documents that have an older version in the destination than they do in the source.

+

Setting op_type to create causes the reindex API to create only missing documents in the destination. + All existing documents will cause a version conflict.

+

IMPORTANT: Because data streams are append-only, any reindex request to a destination data stream must have an op_type of create. + A reindex can only add new documents to a destination data stream. + It cannot update existing documents in a destination data stream.

+

By default, version conflicts abort the reindex process. + To continue reindexing if there are conflicts, set the conflicts request body property to proceed. + In this case, the response includes a count of the version conflicts that were encountered. + Note that the handling of other error types is unaffected by the conflicts property. + Additionally, if you opt to count version conflicts, the operation could attempt to reindex more documents from the source than max_docs until it has successfully indexed max_docs documents into the target or it has gone through every document in the source query.

+

NOTE: The reindex API makes no effort to handle ID collisions. + The last document written will "win" but the order isn't usually predictable so it is not a good idea to rely on this behavior. + Instead, make sure that IDs are unique by using a script.

+

Running reindex asynchronously

+

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. + Elasticsearch creates a record of this task as a document at _tasks/<task_id>.

+

Reindex from multiple sources

+

If you have many sources to reindex it is generally better to reindex them one at a time rather than using a glob pattern to pick up multiple sources. + That way you can resume the process if there are any errors by removing the partially completed source and starting over. + It also makes parallelizing the process fairly simple: split the list of sources to reindex and run each list in parallel.

+

For example, you can use a bash script like this:

+
for index in i1 i2 i3 i4 i5; do
+            curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{
+              "source": {
+                "index": "'$index'"
+              },
+              "dest": {
+                "index": "'$index'-reindexed"
+              }
+            }'
+          done
+          
+

** Throttling**

+

Set requests_per_second to any positive decimal number (1.4, 6, 1000, for example) to throttle the rate at which reindex issues batches of index operations. + Requests are throttled by padding each batch with a wait time. + To turn off throttling, set requests_per_second to -1.

+

The throttling is done by waiting between batches so that the scroll that reindex uses internally can be given a timeout that takes into account the padding. + The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. + By default the batch size is 1000, so if requests_per_second is set to 500:

+
target_time = 1000 / 500 per second = 2 seconds
+          wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
+          
+

Since the batch is issued as a single bulk request, large batch sizes cause Elasticsearch to create many requests and then wait for a while before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Reindex supports sliced scroll to parallelize the reindexing process. + This parallelization can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

NOTE: Reindexing from remote clusters does not support manual or automatic slicing.

+

You can slice a reindex request manually by providing a slice ID and total number of slices to each request. + You can also let reindex automatically parallelize by using sliced scroll to slice on _id. + The slices parameter specifies the number of slices to use.

+

Adding slices to the reindex request just automates the manual process, creating sub-requests which means it has some quirks:

+
    +
  • You can see these requests in the tasks API. These sub-requests are "child" tasks of the task for the request with slices.
  • +
  • Fetching the status of the task for the request with slices only contains the status of completed slices.
  • +
  • These sub-requests are individually addressable for things like cancellation and rethrottling.
  • +
  • Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally.
  • +
  • Canceling the request with slices will cancel each sub-request.
  • +
  • Due to the nature of slices, each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.
  • +
  • Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the previous point about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being reindexed.
  • +
  • Each sub-request gets a slightly different snapshot of the source, though these are all taken at approximately the same time.
  • +
+

If slicing automatically, setting slices to auto will choose a reasonable number for most indices. + If slicing manually or otherwise tuning automatic slicing, use the following guidelines.

+

Query performance is most efficient when the number of slices is equal to the number of shards in the index. + If that number is large (for example, 500), choose a lower number as too many slices will hurt performance. + Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.

+

Indexing performance scales linearly across available resources with the number of slices.

+

Whether query or indexing performance dominates the runtime depends on the documents being reindexed and cluster resources.

+

Modify documents during reindexing

+

Like _update_by_query, reindex operations support a script that modifies the document. + Unlike _update_by_query, the script is allowed to modify the document's metadata.

+

Just as in _update_by_query, you can set ctx.op to change the operation that is run on the destination. + For example, set ctx.op to noop if your script decides that the document doesn’t have to be indexed in the destination. This "no operation" will be reported in the noop counter in the response body. + Set ctx.op to delete if your script decides that the document must be deleted from the destination. + The deletion will be reported in the deleted counter in the response body. + Setting ctx.op to anything else will return an error, as will setting any other field in ctx.

+

Think of the possibilities! Just be careful; you are able to change:

+
    +
  • _id
  • +
  • _index
  • +
  • _version
  • +
  • _routing
  • +
+

Setting _version to null or clearing it from the ctx map is just like not sending the version in an indexing request. + It will cause the document to be overwritten in the destination regardless of the version on the target or the version type you use in the reindex API.

+

Reindex from remote

+

Reindex supports reindexing from a remote Elasticsearch cluster. + The host parameter must contain a scheme, host, port, and optional path. + The username and password parameters are optional and when they are present the reindex operation will connect to the remote Elasticsearch node using basic authentication. + Be sure to use HTTPS when using basic authentication or the password will be sent in plain text. + There are a range of settings available to configure the behavior of the HTTPS connection.

+

When using Elastic Cloud, it is also possible to authenticate against the remote cluster through the use of a valid API key. + Remote hosts must be explicitly allowed with the reindex.remote.whitelist setting. + It can be set to a comma delimited list of allowed remote host and port combinations. + Scheme is ignored; only the host and port are used. + For example:

+
reindex.remote.whitelist: [otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*"]
+          
+

The list of allowed hosts must be configured on any nodes that will coordinate the reindex. + This feature should work with remote clusters of any version of Elasticsearch. + This should enable you to upgrade from any version of Elasticsearch to the current version by reindexing from a cluster of the old version.

+

WARNING: Elasticsearch does not support forward compatibility across major versions. + For example, you cannot reindex from a 7.x cluster into a 6.x cluster.

+

To enable queries sent to older versions of Elasticsearch, the query parameter is sent directly to the remote host without validation or modification.

+

NOTE: Reindexing from remote clusters does not support manual or automatic slicing.

+

Reindexing from a remote server uses an on-heap buffer that defaults to a maximum size of 100mb. + If the remote index includes very large documents you'll need to use a smaller batch size. + It is also possible to set the socket read timeout on the remote connection with the socket_timeout field and the connection timeout with the connect_timeout field. + Both default to 30 seconds.

+

Configuring SSL parameters

+

Reindex from remote supports configurable SSL settings. + These must be specified in the elasticsearch.yml file, with the exception of the secure settings, which you add in the Elasticsearch keystore. + It is not possible to configure SSL in the body of the reindex request.

+ + + ``_ :param dest: The destination you are copying to. :param source: The source you are copying from. - :param conflicts: Set to proceed to continue reindexing even if there are conflicts. - :param max_docs: The maximum number of documents to reindex. + :param conflicts: Indicates whether to continue reindexing even when there are + conflicts. + :param max_docs: The maximum number of documents to reindex. By default, all + documents are reindexed. If it is a value less then or equal to `scroll_size`, + a scroll will not be used to retrieve the results for the operation. If `conflicts` + is set to `proceed`, the reindex operation could attempt to reindex more + documents from the source than `max_docs` until it has successfully indexed + `max_docs` documents into the target or it has gone through every document + in the source query. :param refresh: If `true`, the request refreshes affected shards to make this operation visible to search. :param requests_per_second: The throttle for this request in sub-requests per - second. Defaults to no throttle. + second. By default, there is no throttle. :param require_alias: If `true`, the destination must be an index alias. :param script: The script to run to update the document source or metadata when reindexing. - :param scroll: Specifies how long a consistent view of the index should be maintained - for scrolled search. + :param scroll: The period of time that a consistent view of the index should + be maintained for scrolled search. :param size: - :param slices: The number of slices this task should be divided into. Defaults - to 1 slice, meaning the task isn’t sliced into subtasks. - :param timeout: Period each indexing waits for automatic index creation, dynamic - mapping updates, and waiting for active shards. + :param slices: The number of slices this task should be divided into. It defaults + to one slice, which means the task isn't sliced into subtasks. Reindex supports + sliced scroll to parallelize the reindexing process. This parallelization + can improve efficiency and provide a convenient way to break the request + down into smaller parts. NOTE: Reindexing from remote clusters does not support + manual or automatic slicing. If set to `auto`, Elasticsearch chooses the + number of slices to use. This setting will use one slice per shard, up to + a certain limit. If there are multiple sources, it will choose the number + of slices based on the index or backing index with the smallest number of + shards. + :param timeout: The period each indexing waits for automatic index creation, + dynamic mapping updates, and waiting for active shards. By default, Elasticsearch + waits for at least one minute before failing. The actual wait time could + be longer, particularly when multiple waits occur. :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + before proceeding with the operation. Set it to `all` or any positive integer + up to the total number of shards in the index (`number_of_replicas+1`). The + default value is one, which means it waits for each primary shard to be active. :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ @@ -3429,13 +4269,24 @@ def reindex_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Copies documents from a source to a destination. + .. raw:: html + +

Throttle a reindex operation.

+

Change the number of requests per second for a particular reindex operation. + For example:

+
POST _reindex/r1A2WoRbTwKZ516z6NEs5A:36619/_rethrottle?requests_per_second=-1
+          
+

Rethrottling that speeds up the query takes effect immediately. + Rethrottling that slows down the query will take effect after completing the current batch. + This behavior prevents scroll timeouts.

+ - ``_ + ``_ - :param task_id: Identifier for the task. + :param task_id: The task identifier, which can be found by using the tasks API. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. It can be either `-1` to turn off throttling or any decimal number + like `1.7` or `12` to throttle to that level. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") @@ -3480,17 +4331,21 @@ def render_search_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Renders a search template as a search request body. + .. raw:: html + +

Render a search template.

+

Render a search template as a search request body.

+ - ``_ + ``_ - :param id: ID of the search template to render. If no `source` is specified, + :param id: The ID of the search template to render. If no `source` is specified, this or the `id` request body parameter is required. :param file: :param params: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. - :param source: An inline search template. Supports the same parameters as the - search API's request body. These parameters also support Mustache variables. + :param source: An inline search template. It supports the same parameters as + the search API's request body. These parameters also support Mustache variables. If no `id` or `` is specified, this parameter is required. """ __path_parts: t.Dict[str, str] @@ -3535,6 +4390,7 @@ def render_search_template( @_rewrite_parameters( body_fields=("context", "context_setup", "script"), ) + @_stability_warning(Stability.EXPERIMENTAL) def scripts_painless_execute( self, *, @@ -3548,9 +4404,13 @@ def scripts_painless_execute( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Run a script. Runs a script and returns a result. + .. raw:: html + +

Run a script. + Runs a script and returns a result.

- ``_ + + ``_ :param context: The context that the script should run in. :param context_setup: Additional parameters for the `context`. @@ -3606,15 +4466,27 @@ def scroll( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows to retrieve a large numbers of results from a single search request. + .. raw:: html + +

Run a scrolling search.

+

IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the search_after parameter with a point in time (PIT).

+

The scroll API gets large sets of results from a single scrolling search request. + To get the necessary scroll ID, submit a search API request that includes an argument for the scroll query parameter. + The scroll parameter indicates how long Elasticsearch should retain the search context for the request. + The search response returns a scroll ID in the _scroll_id response body parameter. + You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. + If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.

+

You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.

+

IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.

+ - ``_ + ``_ - :param scroll_id: Scroll ID of the search. + :param scroll_id: The scroll ID of the search. :param rest_total_hits_as_int: If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. - :param scroll: Period to retain the search context for scrolling. + :param scroll: The period to retain the search context for scrolling. """ if scroll_id is None and body is None: raise ValueError("Empty value passed for parameter 'scroll_id'") @@ -3796,15 +4668,29 @@ def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns search hits that match the query defined in the request. You can provide - search queries using the `q` query string parameter or the request body. If both - are specified, only the query parameter is used. - - ``_ - - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams and indices, omit this - parameter or use `*` or `_all`. + .. raw:: html + +

Run a search.

+

Get search hits that match the query defined in the request. + You can provide search queries using the q query string parameter or the request body. + If both are specified, only the query parameter is used.

+

If the Elasticsearch security features are enabled, you must have the read index privilege for the target data stream, index, or alias. For cross-cluster search, refer to the documentation about configuring CCS privileges. + To search a point in time (PIT) for an alias, you must have the read index privilege for the alias's data streams or indices.

+

Search slicing

+

When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently with the slice and pit properties. + By default the splitting is done first on the shards, then locally on each shard. + The local splitting partitions the shard into contiguous ranges based on Lucene document IDs.

+

For instance if the number of shards is equal to 2 and you request 4 slices, the slices 0 and 2 are assigned to the first shard and the slices 1 and 3 are assigned to the second shard.

+

IMPORTANT: The same point-in-time ID should be used for all slices. + If different PIT IDs are used, slices can overlap and miss documents. + This situation can occur because the splitting criterion is based on Lucene document IDs, which are not stable across changes to the index.

+ + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*` or `_all`. :param aggregations: Defines the aggregations that are run as part of the search request. :param aggs: Defines the aggregations that are run as part of the search request. @@ -3813,45 +4699,46 @@ def search( This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. - :param allow_partial_search_results: If true, returns partial results if there - are shard request timeouts or shard failures. If false, returns an error - with no partial results. - :param analyze_wildcard: If true, wildcard and prefix queries are analyzed. This - parameter can only be used when the q query string parameter is specified. - :param analyzer: Analyzer to use for the query string. This parameter can only - be used when the q query string parameter is specified. + :param allow_partial_search_results: If `true` and there are shard request timeouts + or shard failures, the request returns partial results. If `false`, it returns + an error with no partial results. To override the default behavior, you can + set the `search.default_allow_partial_results` cluster setting to `false`. + :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. :param batched_reduce_size: The number of shard results that should be reduced - at once on the coordinating node. This value should be used as a protection - mechanism to reduce the memory overhead per search request if the potential - number of shards in the request can be large. - :param ccs_minimize_roundtrips: If true, network round-trips between the coordinating - node and the remote clusters are minimized when executing cross-cluster search + at once on the coordinating node. If the potential number of shards in the + request can be large, this value should be used as a protection mechanism + to reduce the memory overhead per search request. + :param ccs_minimize_roundtrips: If `true`, network round-trips between the coordinating + node and the remote clusters are minimized when running cross-cluster search (CCS) requests. :param collapse: Collapses search results the values of the specified field. - :param default_operator: The default operator for query string query: AND or - OR. This parameter can only be used when the `q` query string parameter is - specified. - :param df: Field to use as default where no field prefix is given in the query - string. This parameter can only be used when the q query string parameter + :param default_operator: The default operator for the query string query: `AND` + or `OR`. This parameter can be used only when the `q` query string parameter is specified. - :param docvalue_fields: Array of wildcard (`*`) patterns. The request returns - doc values for field names matching these patterns in the `hits.fields` property - of the response. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. - :param explain: If true, returns detailed information about score computation - as part of a hit. + :param df: The field to use as a default when no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param docvalue_fields: An array of wildcard (`*`) field patterns. The request + returns doc values for field names matching these patterns in the `hits.fields` + property of the response. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values such as `open,hidden`. + :param explain: If `true`, the request returns detailed information about score + computation as part of a hit. :param ext: Configuration of search extensions defined by Elasticsearch plugins. - :param fields: Array of wildcard (`*`) patterns. The request returns values for - field names matching these patterns in the `hits.fields` property of the - response. + :param fields: An array of wildcard (`*`) field patterns. The request returns + values for field names matching these patterns in the `hits.fields` property + of the response. :param force_synthetic_source: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index. - :param from_: Starting document offset. Needs to be non-negative. By default, + :param from_: The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. To page through more hits, use the `search_after` parameter. :param highlight: Specifies the highlighter to use for retrieving highlighted @@ -3860,95 +4747,101 @@ def search( be ignored when frozen. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. - :param include_named_queries_score: Indicates whether hit.matched_queries should - be rendered as a map that includes the name of the matched query associated - with its score (true) or as an array containing the name of the matched queries - (false) This functionality reruns each named query on every hit in a search - response. Typically, this adds a small overhead to a request. However, using - computationally expensive named queries on a large number of hits may add - significant overhead. - :param indices_boost: Boosts the _score of documents from specified indices. - :param knn: Defines the approximate kNN search to run. + :param include_named_queries_score: If `true`, the response includes the score + contribution from any named queries. This functionality reruns each named + query on every hit in a search response. Typically, this adds a small overhead + to a request. However, using computationally expensive named queries on a + large number of hits may add significant overhead. + :param indices_boost: Boost the `_score` of documents from specified indices. + The boost value is the factor by which scores are multiplied. A boost value + greater than `1.0` increases the score. A boost value between `0` and `1.0` + decreases the score. + :param knn: The approximate kNN search to run. :param lenient: If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can - only be used when the `q` query string parameter is specified. - :param max_concurrent_shard_requests: Defines the number of concurrent shard - requests per node this search executes concurrently. This value should be - used to limit the impact of the search on the cluster in order to limit the - number of concurrent shard requests. + be used only when the `q` query string parameter is specified. + :param max_concurrent_shard_requests: The number of concurrent shard requests + per node that the search runs concurrently. This value should be used to + limit the impact of the search on the cluster in order to limit the number + of concurrent shard requests. :param min_compatible_shard_node: The minimum version of the node that can handle - the request Any handling node with a lower version will fail the request. - :param min_score: Minimum `_score` for matching documents. Documents with a lower - `_score` are not included in the search results. - :param pit: Limits the search to a point in time (PIT). If you provide a PIT, + the request. Any handling node with a lower version will fail the request. + :param min_score: The minimum `_score` for matching documents. Documents with + a lower `_score` are not included in the search results. + :param pit: Limit the search to a point in time (PIT). If you provide a PIT, you cannot specify an `` in the request path. :param post_filter: Use the `post_filter` parameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results. - :param pre_filter_shard_size: Defines a threshold that enforces a pre-filter - roundtrip to prefilter search shards based on query rewriting if the number - of shards the search request expands to exceeds the threshold. This filter - roundtrip can limit the number of shards significantly if for instance a - shard can not match any documents based on its rewrite method (if date filters - are mandatory to match but the shard bounds and the query are disjoint). - When unspecified, the pre-filter phase is executed if any of these conditions - is met: the request targets more than 128 shards; the request targets one - or more read-only index; the primary sort of the query targets an indexed + :param pre_filter_shard_size: A threshold that enforces a pre-filter roundtrip + to prefilter search shards based on query rewriting if the number of shards + the search request expands to exceeds the threshold. This filter roundtrip + can limit the number of shards significantly if for instance a shard can + not match any documents based on its rewrite method (if date filters are + mandatory to match but the shard bounds and the query are disjoint). When + unspecified, the pre-filter phase is executed if any of these conditions + is met: * The request targets more than 128 shards. * The request targets + one or more read-only index. * The primary sort of the query targets an indexed field. - :param preference: Nodes and shards used for the search. By default, Elasticsearch + :param preference: The nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, - accounting for allocation awareness. Valid values are: `_only_local` to run - the search only on shards on the local node; `_local` to, if possible, run - the search on shards on the local node, or if not, select shards using the - default method; `_only_nodes:,` to run the search on only - the specified nodes IDs, where, if suitable shards exist on more than one - selected node, use shards on those nodes using the default method, or if - none of the specified nodes are available, select shards from any available - node using the default method; `_prefer_nodes:,` to if + accounting for allocation awareness. Valid values are: * `_only_local` to + run the search only on shards on the local node; * `_local` to, if possible, + run the search on shards on the local node, or if not, select shards using + the default method; * `_only_nodes:,` to run the search + on only the specified nodes IDs, where, if suitable shards exist on more + than one selected node, use shards on those nodes using the default method, + or if none of the specified nodes are available, select shards from any available + node using the default method; * `_prefer_nodes:,` to if possible, run the search on the specified nodes IDs, or if not, select shards - using the default method; `_shards:,` to run the search only - on the specified shards; `` (any string that does not start + using the default method; * `_shards:,` to run the search only + on the specified shards; * `` (any string that does not start with `_`) to route searches with the same `` to the same shards in the same order. :param profile: Set to `true` to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution. - :param q: Query in the Lucene query string syntax using query parameter search. - Query parameter searches do not support the full Elasticsearch Query DSL - but are handy for testing. - :param query: Defines the search definition using the Query DSL. - :param rank: Defines the Reciprocal Rank Fusion (RRF) to use. + :param q: A query in the Lucene query string syntax. Query parameter searches + do not support the full Elasticsearch Query DSL but are handy for testing. + IMPORTANT: This parameter overrides the query parameter in the request body. + If both parameters are specified, documents matching the query request body + parameter are not returned. + :param query: The search definition using the Query DSL. + :param rank: The Reciprocal Rank Fusion (RRF) to use. :param request_cache: If `true`, the caching of search results is enabled for - requests where `size` is `0`. Defaults to index level settings. + requests where `size` is `0`. It defaults to index level settings. :param rescore: Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the `query` and `post_filter` phases. :param rest_total_hits_as_int: Indicates whether `hits.total` should be rendered as an integer or an object in the rest search response. :param retriever: A retriever is a specification to describe top documents returned from a search. A retriever replaces other elements of the search API that - also return top documents such as query and knn. - :param routing: Custom value used to route operations to a specific shard. - :param runtime_mappings: Defines one or more runtime fields in the search request. - These fields take precedence over mapped fields with the same name. + also return top documents such as `query` and `knn`. + :param routing: A custom value that is used to route operations to a specific + shard. + :param runtime_mappings: One or more runtime fields in the search request. These + fields take precedence over mapped fields with the same name. :param script_fields: Retrieve a script evaluation (based on different fields) for each hit. - :param scroll: Period to retain the search context for scrolling. See Scroll - search results. By default, this value cannot exceed `1d` (24 hours). You - can change this limit using the `search.max_keep_alive` cluster-level setting. + :param scroll: The period to retain the search context for scrolling. By default, + this value cannot exceed `1d` (24 hours). You can change this limit by using + the `search.max_keep_alive` cluster-level setting. :param search_after: Used to retrieve the next page of hits using a set of sort values from the previous page. - :param search_type: How distributed term frequencies are calculated for relevance - scoring. - :param seq_no_primary_term: If `true`, returns sequence number and primary term - of the last modification of each hit. - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param slice: Can be used to split a scrolled search into multiple slices that - can be consumed independently. + :param search_type: Indicates how distributed term frequencies are calculated + for relevance scoring. + :param seq_no_primary_term: If `true`, the request returns sequence number and + primary term of the last modification of each hit. + :param size: The number of hits to return, which must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` property. + :param slice: Split a scrolled search into multiple slices that can be consumed + independently. :param sort: A comma-separated list of : pairs. - :param source: Indicates which source fields are returned for matching documents. - These fields are returned in the hits._source property of the search response. + :param source: The source fields that are returned for matching documents. These + fields are returned in the `hits._source` property of the search response. + If the `stored_fields` property is specified, the `_source` property defaults + to `false`. Otherwise, it defaults to `true`. :param source_excludes: A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. If the `_source` @@ -3958,45 +4851,46 @@ def search( returned. You can exclude fields from this subset using the `_source_excludes` query parameter. If the `_source` parameter is `false`, this parameter is ignored. - :param stats: Stats groups to associate with the search. Each group maintains + :param stats: The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API. - :param stored_fields: List of stored fields to return as part of a hit. If no - fields are specified, no stored fields are included in the response. If this - field is specified, the `_source` parameter defaults to `false`. You can - pass `_source: true` to return both source fields and stored fields in the - search response. + :param stored_fields: A comma-separated list of stored fields to return as part + of a hit. If no fields are specified, no stored fields are included in the + response. If this field is specified, the `_source` property defaults to + `false`. You can pass `_source: true` to return both source fields and stored + fields in the search response. :param suggest: Defines a suggester that provides similar looking terms based on a provided text. - :param suggest_field: Specifies which field to use for suggestions. - :param suggest_mode: Specifies the suggest mode. This parameter can only be used - when the `suggest_field` and `suggest_text` query string parameters are specified. - :param suggest_size: Number of suggestions to return. This parameter can only - be used when the `suggest_field` and `suggest_text` query string parameters + :param suggest_field: The field to use for suggestions. + :param suggest_mode: The suggest mode. This parameter can be used only when the + `suggest_field` and `suggest_text` query string parameters are specified. + :param suggest_size: The number of suggestions to return. This parameter can + be used only when the `suggest_field` and `suggest_text` query string parameters are specified. :param suggest_text: The source text for which the suggestions should be returned. - This parameter can only be used when the `suggest_field` and `suggest_text` + This parameter can be used only when the `suggest_field` and `suggest_text` query string parameters are specified. - :param terminate_after: Maximum number of documents to collect for each shard. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - Elasticsearch collects documents before sorting. Use with caution. Elasticsearch - applies this parameter to each shard handling the request. When possible, - let Elasticsearch perform early termination automatically. Avoid specifying - this parameter for requests that target data streams with backing indices - across multiple data tiers. If set to `0` (default), the query does not terminate - early. - :param timeout: Specifies the period of time to wait for a response from each - shard. If no response is received before the timeout expires, the request - fails and returns an error. Defaults to no timeout. - :param track_scores: If true, calculate and return document scores, even if the - scores are not used for sorting. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this property to each shard handling the request. When + possible, let Elasticsearch perform early termination automatically. Avoid + specifying this property for requests that target data streams with backing + indices across multiple data tiers. If set to `0` (default), the query does + not terminate early. + :param timeout: The period of time to wait for a response from each shard. If + no response is received before the timeout expires, the request fails and + returns an error. Defaults to no timeout. + :param track_scores: If `true`, calculate and return document scores, even if + the scores are not used for sorting. :param track_total_hits: Number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. :param typed_keys: If `true`, aggregation and suggester names are be prefixed by their respective types in the response. - :param version: If true, returns document version as part of a hit. + :param version: If `true`, the request returns the document version as part of + a hit. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -4228,52 +5122,376 @@ def search_mvt( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> BinaryApiResponse: """ - Search a vector tile. Searches a vector tile for geospatial values. - - ``_ + .. raw:: html + +

Search a vector tile.

+

Search a vector tile for geospatial values. + Before using this API, you should be familiar with the Mapbox vector tile specification. + The API returns results as a binary mapbox vector tile.

+

Internally, Elasticsearch translates a vector tile search API request into a search containing:

+
    +
  • A geo_bounding_box query on the <field>. The query uses the <zoom>/<x>/<y> tile as a bounding box.
  • +
  • A geotile_grid or geohex_grid aggregation on the <field>. The grid_agg parameter determines the aggregation type. The aggregation uses the <zoom>/<x>/<y> tile as a bounding box.
  • +
  • Optionally, a geo_bounds aggregation on the <field>. The search only includes this aggregation if the exact_bounds parameter is true.
  • +
  • If the optional parameter with_labels is true, the internal search will include a dynamic runtime field that calls the getLabelPosition function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.
  • +
+

For example, Elasticsearch may translate a vector tile search API request with a grid_agg argument of geotile and an exact_bounds argument of true into the following search

+
GET my-index/_search
+          {
+            "size": 10000,
+            "query": {
+              "geo_bounding_box": {
+                "my-geo-field": {
+                  "top_left": {
+                    "lat": -40.979898069620134,
+                    "lon": -45
+                  },
+                  "bottom_right": {
+                    "lat": -66.51326044311186,
+                    "lon": 0
+                  }
+                }
+              }
+            },
+            "aggregations": {
+              "grid": {
+                "geotile_grid": {
+                  "field": "my-geo-field",
+                  "precision": 11,
+                  "size": 65536,
+                  "bounds": {
+                    "top_left": {
+                      "lat": -40.979898069620134,
+                      "lon": -45
+                    },
+                    "bottom_right": {
+                      "lat": -66.51326044311186,
+                      "lon": 0
+                    }
+                  }
+                }
+              },
+              "bounds": {
+                "geo_bounds": {
+                  "field": "my-geo-field",
+                  "wrap_longitude": false
+                }
+              }
+            }
+          }
+          
+

The API returns results as a binary Mapbox vector tile. + Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:

+
    +
  • A hits layer containing a feature for each <field> value matching the geo_bounding_box query.
  • +
  • An aggs layer containing a feature for each cell of the geotile_grid or geohex_grid. The layer only contains features for cells with matching data.
  • +
  • A meta layer containing: +
      +
    • A feature containing a bounding box. By default, this is the bounding box of the tile.
    • +
    • Value ranges for any sub-aggregations on the geotile_grid or geohex_grid.
    • +
    • Metadata for the search.
    • +
    +
  • +
+

The API only returns features that can display at its zoom level. + For example, if a polygon feature has no area at its zoom level, the API omits it. + The API returns errors as UTF-8 encoded JSON.

+

IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter. + If you specify both parameters, the query parameter takes precedence.

+

Grid precision for geotile

+

For a grid_agg of geotile, you can use cells in the aggs layer as tiles for lower zoom levels. + grid_precision represents the additional zoom levels available through these cells. The final precision is computed by as follows: <zoom> + grid_precision. + For example, if <zoom> is 7 and grid_precision is 8, then the geotile_grid aggregation will use a precision of 15. + The maximum final precision is 29. + The grid_precision also determines the number of cells for the grid as follows: (2^grid_precision) x (2^grid_precision). + For example, a value of 8 divides the tile into a grid of 256 x 256 cells. + The aggs layer only contains features for cells with matching data.

+

Grid precision for geohex

+

For a grid_agg of geohex, Elasticsearch uses <zoom> and grid_precision to calculate a final precision as follows: <zoom> + grid_precision.

+

This precision determines the H3 resolution of the hexagonal cells produced by the geohex aggregation. + The following table maps the H3 resolution for each precision. + For example, if <zoom> is 3 and grid_precision is 3, the precision is 6. + At a precision of 6, hexagonal cells have an H3 resolution of 2. + If <zoom> is 3 and grid_precision is 4, the precision is 7. + At a precision of 7, hexagonal cells have an H3 resolution of 3.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PrecisionUnique tile binsH3 resolutionUnique hex binsRatio
14012230.5
21601227.625
364184213.15625
425618423.2890625
51024258825.744140625
64096258821.436035156
7163843411622.512329102
8655363411620.6280822754
926214442881221.099098206
10104857642881220.2747745514
114194304520168420.4808526039
12167772166141178820.8414913416
13671088646141178820.2103728354
142684354567988251620.3681524172
15107374182486917761220.644266719
16429496729686917761220.1610666797
1717179869184948424328420.2818666889
186871947673610338970298820.4932667053
19274877906944112372792091620.8632167343
201099511627776112372792091620.2158041836
2143980465111041216609544641220.3776573213
221759218604441613116266812488420.6609003122
237036874417766413116266812488420.165225078
2428147497671065614813867687418820.2891438866
251125899906842620155697073811931620.5060018015
264503599627370500155697073811931620.1265004504
2718014398509482000155697073811931620.03162511259
2872057594037927900155697073811931620.007906278149
29288230376151712000155697073811931620.001976569537
+

Hexagonal cells don't align perfectly on a vector tile. + Some cells may intersect more than one vector tile. + To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level. + Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density.

+ + + ``_ :param index: Comma-separated list of data streams, indices, or aliases to search :param field: Field containing geospatial data to return :param zoom: Zoom level for the vector tile to search :param x: X coordinate for the vector tile to search :param y: Y coordinate for the vector tile to search - :param aggs: Sub-aggregations for the geotile_grid. Supports the following aggregation - types: - avg - cardinality - max - min - sum - :param buffer: Size, in pixels, of a clipping buffer outside the tile. This allows - renderers to avoid outline artifacts from geometries that extend past the - extent of the tile. - :param exact_bounds: If false, the meta layer’s feature is the bounding box of - the tile. If true, the meta layer’s feature is a bounding box resulting from - a geo_bounds aggregation. The aggregation runs on values that intersect - the // tile with wrap_longitude set to false. The resulting bounding - box may be larger than the vector tile. - :param extent: Size, in pixels, of a side of the tile. Vector tiles are square + :param aggs: Sub-aggregations for the geotile_grid. It supports the following + aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats` + - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank` + - `stats` - `sum` - `value count` The aggregation names can't start with + `_mvt_`. The `_mvt_` prefix is reserved for internal aggregations. + :param buffer: The size, in pixels, of a clipping buffer outside the tile. This + allows renderers to avoid outline artifacts from geometries that extend past + the extent of the tile. + :param exact_bounds: If `false`, the meta layer's feature is the bounding box + of the tile. If `true`, the meta layer's feature is a bounding box resulting + from a `geo_bounds` aggregation. The aggregation runs on values that + intersect the `//` tile with `wrap_longitude` set to `false`. + The resulting bounding box may be larger than the vector tile. + :param extent: The size, in pixels, of a side of the tile. Vector tiles are square with equal sides. - :param fields: Fields to return in the `hits` layer. Supports wildcards (`*`). - This parameter does not support fields with array values. Fields with array - values may return inconsistent results. - :param grid_agg: Aggregation used to create a grid for the `field`. + :param fields: The fields to return in the `hits` layer. It supports wildcards + (`*`). This parameter does not support fields with array values. Fields with + array values may return inconsistent results. + :param grid_agg: The aggregation used to create a grid for the `field`. :param grid_precision: Additional zoom levels available through the aggs layer. - For example, if is 7 and grid_precision is 8, you can zoom in up to - level 15. Accepts 0-8. If 0, results don’t include the aggs layer. + For example, if `` is `7` and `grid_precision` is `8`, you can zoom + in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer. :param grid_type: Determines the geometry type for features in the aggs layer. - In the aggs layer, each feature represents a geotile_grid cell. If 'grid' - each feature is a Polygon of the cells bounding box. If 'point' each feature + In the aggs layer, each feature represents a `geotile_grid` cell. If `grid, + each feature is a polygon of the cells bounding box. If `point`, each feature is a Point that is the centroid of the cell. - :param query: Query DSL used to filter documents for the search. + :param query: The query DSL used to filter documents for the search. :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. - :param size: Maximum number of features to return in the hits layer. Accepts - 0-10000. If 0, results don’t include the hits layer. - :param sort: Sorts features in the hits layer. By default, the API calculates - a bounding box for each feature. It sorts features based on this box’s diagonal + :param size: The maximum number of features to return in the hits layer. Accepts + 0-10000. If 0, results don't include the hits layer. + :param sort: Sort the features in the hits layer. By default, the API calculates + a bounding box for each feature. It sorts features based on this box's diagonal length, from longest to shortest. - :param track_total_hits: Number of hits matching the query to count accurately. + :param track_total_hits: The number of hits matching the query to count accurately. If `true`, the exact number of hits is returned at the cost of some performance. If `false`, the response does not include the total number of hits matching the query. :param with_labels: If `true`, the hits and aggs layers will contain additional point features representing suggested label positions for the original features. + * `Point` and `MultiPoint` features will have one of the points selected. + * `Polygon` and `MultiPolygon` features will have a single point generated, + either the centroid, if it is within the polygon, or another point within + the polygon selected from the sorted triangle-tree. * `LineString` features + will likewise provide a roughly central point selected from the triangle-tree. + * The aggregation results will provide one central point for each aggregation + bucket. All attributes from the original features will also be copied to + the new label features. In addition, the new features will be distinguishable + using the tag `_mvt_label_position`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4382,13 +5600,20 @@ def search_shards( routing: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about the indices and shards that a search request would - be executed against. + .. raw:: html + +

Get the search shards.

+

Get the indices and shards that a search request would be run against. + This information can be useful for working out issues or planning optimizations with routing and shard preferences. + When filtered aliases are used, the filter is returned as part of the indices section.

+

If the Elasticsearch security features are enabled, you must have the view_index_metadata or manage index privilege for the target data stream, index, or alias.

- ``_ - :param index: Returns the indices and shards that a search request would be executed - against. + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams and indices, + omit this parameter or use `*` or `_all`. :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For @@ -4402,9 +5627,9 @@ def search_shards( a missing or closed index. :param local: If `true`, the request retrieves information from the local node only. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param routing: Custom value used to route operations to a specific shard. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param routing: A custom value used to route operations to a specific shard. """ __path_parts: t.Dict[str, str] if index not in SKIP_IN_PATH: @@ -4484,12 +5709,15 @@ def search_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Runs a search with a search template. + .. raw:: html + +

Run a search with a search template.

- ``_ - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (*). + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For @@ -4497,32 +5725,34 @@ def search_template( with `foo` but no index starts with `bar`. :param ccs_minimize_roundtrips: If `true`, network round-trips are minimized for cross-cluster search requests. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. Supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param explain: If `true`, returns detailed information about score calculation - as part of each hit. - :param id: ID of the search template to use. If no source is specified, this - parameter is required. + as part of each hit. If you specify both this and the `explain` query parameter, + the API uses only the query parameter. + :param id: The ID of the search template to use. If no `source` is specified, + this parameter is required. :param ignore_throttled: If `true`, specified concrete, expanded, or aliased indices are not included in the response when throttled. :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param params: Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param profile: If `true`, the query execution is profiled. - :param rest_total_hits_as_int: If true, hits.total are rendered as an integer - in the response. - :param routing: Custom value used to route operations to a specific shard. + :param rest_total_hits_as_int: If `true`, `hits.total` is rendered as an integer + in the response. If `false`, it is rendered as an object. + :param routing: A custom value used to route operations to a specific shard. :param scroll: Specifies how long a consistent view of the index should be maintained for scrolled search. :param search_type: The type of the search operation. :param source: An inline search template. Supports the same parameters as the - search API's request body. Also supports Mustache variables. If no id is - specified, this parameter is required. + search API's request body. It also supports Mustache variables. If no `id` + is specified, this parameter is required. :param typed_keys: If `true`, the response prefixes aggregation and suggester names with their respective types. """ @@ -4616,28 +5846,39 @@ def terms_enum( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The terms enum API can be used to discover terms in the index that begin with - the provided string. It is designed for low-latency look-ups used in auto-complete - scenarios. + .. raw:: html - ``_ +

Get terms in an index.

+

Discover terms that match a partial string in an index. + This API is designed for low-latency look-ups used in auto-complete scenarios.

+
+

info + The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.

+
- :param index: Comma-separated list of data streams, indices, and index aliases - to search. Wildcard (*) expressions are supported. + + ``_ + + :param index: A comma-separated list of data streams, indices, and index aliases + to search. Wildcard (`*`) expressions are supported. To search all data streams + or indices, omit this parameter or use `*` or `_all`. :param field: The string to match at the start of indexed terms. If not provided, all terms in the field are considered. - :param case_insensitive: When true the provided search string is matched against + :param case_insensitive: When `true`, the provided search string is matched against index terms without case sensitivity. - :param index_filter: Allows to filter an index shard if the provided query rewrites - to match_none. - :param search_after: - :param size: How many matching terms to return. - :param string: The string after which terms in the index should be returned. - Allows for a form of pagination if the last result from one request is passed - as the search_after parameter for a subsequent request. - :param timeout: The maximum length of time to spend collecting results. Defaults - to "1s" (one second). If the timeout is exceeded the complete flag set to - false in the response and the results may be partial or empty. + :param index_filter: Filter an index shard if the provided query rewrites to + `match_none`. + :param search_after: The string after which terms in the index should be returned. + It allows for a form of pagination if the last result from one request is + passed as the `search_after` parameter for a subsequent request. + :param size: The number of matching terms to return. + :param string: The string to match at the start of indexed terms. If it is not + provided, all terms in the field are considered. > info > The prefix string + cannot be larger than the largest possible keyword value, which is Lucene's + term byte-length limit of 32766. + :param timeout: The maximum length of time to spend collecting results. If the + timeout is exceeded the `complete` flag set to `false` in the response and + the results may be partial or empty. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4716,33 +5957,77 @@ def termvectors( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get term vector information. Returns information and statistics about terms in - the fields of a particular document. - - ``_ - - :param index: Name of the index that contains the document. - :param id: Unique identifier of the document. + .. raw:: html + +

Get term vector information.

+

Get information and statistics about terms in the fields of a particular document.

+

You can retrieve term vectors for documents stored in the index or for artificial documents passed in the body of the request. + You can specify the fields you are interested in through the fields parameter or by adding the fields to the request body. + For example:

+
GET /my-index-000001/_termvectors/1?fields=message
+          
+

Fields can be specified using wildcards, similar to the multi match query.

+

Term vectors are real-time by default, not near real-time. + This can be changed by setting realtime parameter to false.

+

You can request three types of values: term information, term statistics, and field statistics. + By default, all term information and field statistics are returned for all fields but term statistics are excluded.

+

Term information

+
    +
  • term frequency in the field (always returned)
  • +
  • term positions (positions: true)
  • +
  • start and end offsets (offsets: true)
  • +
  • term payloads (payloads: true), as base64 encoded bytes
  • +
+

If the requested information wasn't stored in the index, it will be computed on the fly if possible. + Additionally, term vectors could be computed for documents not even existing in the index, but instead provided by the user.

+
+

warn + Start and end offsets assume UTF-16 encoding is being used. If you want to use these offsets in order to get the original text that produced this token, you should make sure that the string you are taking a sub-string of is also encoded using UTF-16.

+
+

Behaviour

+

The term and field statistics are not accurate. + Deleted documents are not taken into account. + The information is only retrieved for the shard the requested document resides in. + The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context. + By default, when requesting term vectors of artificial documents, a shard to get the statistics from is randomly selected. + Use routing only to hit a particular shard.

+ + + ``_ + + :param index: The name of the index that contains the document. + :param id: A unique identifier for the document. :param doc: An artificial document (a document not present in the index) for which you want to retrieve term vectors. - :param field_statistics: If `true`, the response includes the document count, - sum of document frequencies, and sum of total term frequencies. - :param fields: Comma-separated list or wildcard expressions of fields to include - in the statistics. Used as the default list unless a specific field list - is provided in the `completion_fields` or `fielddata_fields` parameters. - :param filter: Filter terms based on their tf-idf scores. + :param field_statistics: If `true`, the response includes: * The document count + (how many documents contain this field). * The sum of document frequencies + (the sum of document frequencies for all terms in this field). * The sum + of total term frequencies (the sum of total term frequencies of each term + in this field). + :param fields: A comma-separated list or wildcard expressions of fields to include + in the statistics. It is used as the default list unless a specific field + list is provided in the `completion_fields` or `fielddata_fields` parameters. + :param filter: Filter terms based on their tf-idf scores. This could be useful + in order find out a good characteristic vector of a document. This feature + works in a similar manner to the second phase of the More Like This Query. :param offsets: If `true`, the response includes term offsets. :param payloads: If `true`, the response includes term payloads. - :param per_field_analyzer: Overrides the default per-field analyzer. + :param per_field_analyzer: Override the default per-field analyzer. This is useful + in order to generate term vectors in any fashion, especially when using artificial + documents. When providing an analyzer for a field that already stores term + vectors, the term vectors will be regenerated. :param positions: If `true`, the response includes term positions. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. + :param preference: The node or shard the operation should be performed on. It + is random by default. :param realtime: If true, the request is real-time as opposed to near-real-time. - :param routing: Custom value used to route operations to a specific shard. - :param term_statistics: If `true`, the response includes term frequency and document - frequency. + :param routing: A custom value that is used to route operations to a specific + shard. + :param term_statistics: If `true`, the response includes: * The total term frequency + (how often a term occurs in all documents). * The document frequency (the + number of documents containing the current term). By default these values + are not returned since term statistics can have a serious performance impact. :param version: If `true`, returns the document version as part of a hit. - :param version_type: Specific version type. + :param version_type: The version type. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -4859,46 +6144,65 @@ def update( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a document. Updates a document by running a script or passing a partial - document. - - ``_ - - :param index: The name of the index - :param id: Document ID - :param detect_noop: Set to false to disable setting 'result' in the response - to 'noop' if no change to the document occurred. - :param doc: A partial update to an existing document. - :param doc_as_upsert: Set to true to use the contents of 'doc' as the value of - 'upsert' + .. raw:: html + +

Update a document.

+

Update a document by running a script or passing a partial document.

+

If the Elasticsearch security features are enabled, you must have the index or write index privilege for the target index or index alias.

+

The script can update, delete, or skip modifying the document. + The API also supports passing a partial document, which is merged into the existing document. + To fully replace an existing document, use the index API. + This operation:

+
    +
  • Gets the document (collocated with the shard) from the index.
  • +
  • Runs the specified script.
  • +
  • Indexes the result.
  • +
+

The document must still be reindexed, but using this API removes some network roundtrips and reduces chances of version conflicts between the GET and the index operation.

+

The _source field must be enabled to use this API. + In addition to _source, you can access the following variables through the ctx map: _index, _type, _id, _version, _routing, and _now (the current timestamp).

+ + + ``_ + + :param index: The name of the target index. By default, the index is created + automatically if it doesn't exist. + :param id: A unique identifier for the document to be updated. + :param detect_noop: If `true`, the `result` in the response is set to `noop` + (no operation) when there are no changes to the document. + :param doc: A partial update to an existing document. If both `doc` and `script` + are specified, `doc` is ignored. + :param doc_as_upsert: If `true`, use the contents of 'doc' as the value of 'upsert'. + NOTE: Using ingest pipelines with `doc_as_upsert` is not supported. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param lang: The script language. :param refresh: If 'true', Elasticsearch refreshes 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' do nothing with refreshes. - :param require_alias: If true, the destination must be an index alias. - :param retry_on_conflict: Specify how many times should the operation be retried + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', it does nothing with refreshes. + :param require_alias: If `true`, the destination must be an index alias. + :param retry_on_conflict: The number of times the operation should be retried when a conflict occurs. - :param routing: Custom value used to route operations to a specific shard. - :param script: Script to execute to update the document. - :param scripted_upsert: Set to true to execute the script whether or not the - document exists. - :param source: Set to false to disable source retrieval. You can also specify - a comma-separated list of the fields you want to retrieve. - :param source_excludes: Specify the source fields you want to exclude. - :param source_includes: Specify the source fields you want to retrieve. - :param timeout: Period to wait for dynamic mapping updates and active shards. - This guarantees Elasticsearch waits for at least the timeout before failing. - The actual wait time could be longer, particularly when multiple waits occur. + :param routing: A custom value used to route operations to a specific shard. + :param script: The script to run to update the document. + :param scripted_upsert: If `true`, run the script whether or not the document + exists. + :param source: If `false`, turn off source retrieval. You can also specify a + comma-separated list of the fields you want to retrieve. + :param source_excludes: The source fields you want to exclude. + :param source_includes: The source fields you want to retrieve. + :param timeout: The period to wait for the following operations: dynamic mapping + updates and waiting for active shards. Elasticsearch waits for at least the + timeout period before failing. The actual wait time could be longer, particularly + when multiple waits occur. :param upsert: If the document does not already exist, the contents of 'upsert' - are inserted as a new document. If the document exists, the 'script' is executed. - :param wait_for_active_shards: The number of shard copies that must be active - before proceeding with the operations. Set to 'all' or any positive integer - up to the total number of shards in the index (number_of_replicas+1). Defaults - to 1 meaning the primary shard. + are inserted as a new document. If the document exists, the 'script' is run. + :param wait_for_active_shards: The number of copies of each shard that must be + active before proceeding with the operation. Set to 'all' or any positive + integer up to the total number of shards in the index (`number_of_replicas`+1). + The default value of `1` means it waits for each primary shard to be active. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5024,82 +6328,166 @@ def update_by_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update documents. Updates documents that match the specified query. If no query - is specified, performs an update on every document in the data stream or index - without modifying the source, which is useful for picking up mapping changes. - - ``_ - - :param index: Comma-separated list of data streams, indices, and aliases to search. - Supports wildcards (`*`). To search all data streams or indices, omit this - parameter or use `*` or `_all`. + .. raw:: html + +

Update documents. + Updates documents that match the specified query. + If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.

+

If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:

+
    +
  • read
  • +
  • index or write
  • +
+

You can specify the query criteria in the request URI or the request body using the same syntax as the search API.

+

When you submit an update by query request, Elasticsearch gets a snapshot of the data stream or index when it begins processing the request and updates matching documents using internal versioning. + When the versions match, the document is updated and the version number is incremented. + If a document changes between the time that the snapshot is taken and the update operation is processed, it results in a version conflict and the operation fails. + You can opt to count version conflicts instead of halting and returning by setting conflicts to proceed. + Note that if you opt to count version conflicts, the operation could attempt to update more documents from the source than max_docs until it has successfully updated max_docs documents or it has gone through every document in the source query.

+

NOTE: Documents with a version equal to 0 cannot be updated using update by query because internal versioning does not support 0 as a valid version number.

+

While processing an update by query request, Elasticsearch performs multiple search requests sequentially to find all of the matching documents. + A bulk update request is performed for each batch of matching documents. + Any query or update failures cause the update by query request to fail and the failures are shown in the response. + Any update requests that completed successfully still stick, they are not rolled back.

+

Throttling update requests

+

To control the rate at which update by query issues batches of update operations, you can set requests_per_second to any positive decimal number. + This pads each batch with a wait time to throttle the rate. + Set requests_per_second to -1 to turn off throttling.

+

Throttling uses a wait time between batches so that the internal scroll requests can be given a timeout that takes the request padding into account. + The padding time is the difference between the batch size divided by the requests_per_second and the time spent writing. + By default the batch size is 1000, so if requests_per_second is set to 500:

+
target_time = 1000 / 500 per second = 2 seconds
+          wait_time = target_time - write_time = 2 seconds - .5 seconds = 1.5 seconds
+          
+

Since the batch is issued as a single _bulk request, large batch sizes cause Elasticsearch to create many requests and wait before starting the next set. + This is "bursty" instead of "smooth".

+

Slicing

+

Update by query supports sliced scroll to parallelize the update process. + This can improve efficiency and provide a convenient way to break the request down into smaller parts.

+

Setting slices to auto chooses a reasonable number for most data streams and indices. + This setting will use one slice per shard, up to a certain limit. + If there are multiple source data streams or indices, it will choose the number of slices based on the index or backing index with the smallest number of shards.

+

Adding slices to _update_by_query just automates the manual process of creating sub-requests, which means it has some quirks:

+
    +
  • You can see these requests in the tasks APIs. These sub-requests are "child" tasks of the task for the request with slices.
  • +
  • Fetching the status of the task for the request with slices only contains the status of completed slices.
  • +
  • These sub-requests are individually addressable for things like cancellation and rethrottling.
  • +
  • Rethrottling the request with slices will rethrottle the unfinished sub-request proportionally.
  • +
  • Canceling the request with slices will cancel each sub-request.
  • +
  • Due to the nature of slices each sub-request won't get a perfectly even portion of the documents. All documents will be addressed, but some slices may be larger than others. Expect larger slices to have a more even distribution.
  • +
  • Parameters like requests_per_second and max_docs on a request with slices are distributed proportionally to each sub-request. Combine that with the point above about distribution being uneven and you should conclude that using max_docs with slices might not result in exactly max_docs documents being updated.
  • +
  • Each sub-request gets a slightly different snapshot of the source data stream or index though these are all taken at approximately the same time.
  • +
+

If you're slicing manually or otherwise tuning automatic slicing, keep in mind that:

+
    +
  • Query performance is most efficient when the number of slices is equal to the number of shards in the index or backing index. If that number is large (for example, 500), choose a lower number as too many slices hurts performance. Setting slices higher than the number of shards generally does not improve efficiency and adds overhead.
  • +
  • Update performance scales linearly across available resources with the number of slices.
  • +
+

Whether query or update performance dominates the runtime depends on the documents being reindexed and cluster resources.

+

Update the document source

+

Update by query supports scripts to update the document source. + As with the update API, you can set ctx.op to change the operation that is performed.

+

Set ctx.op = "noop" if your script decides that it doesn't have to make any changes. + The update by query operation skips updating the document and increments the noop counter.

+

Set ctx.op = "delete" if your script decides that the document should be deleted. + The update by query operation deletes the document and increments the deleted counter.

+

Update by query supports only index, noop, and delete. + Setting ctx.op to anything else is an error. + Setting any other field in ctx is an error. + This API enables you to only modify the source of matching documents; you cannot move them.

+ + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases to + search. It supports wildcards (`*`). To search all data streams or indices, + omit this parameter or use `*` or `_all`. :param allow_no_indices: If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed. - :param analyzer: Analyzer to use for the query string. - :param conflicts: What to do if update by query hits version conflicts: `abort` - or `proceed`. + This parameter can be used only when the `q` query string parameter is specified. + :param analyzer: The analyzer to use for the query string. This parameter can + be used only when the `q` query string parameter is specified. + :param conflicts: The preferred behavior when update by query hits version conflicts: + `abort` or `proceed`. :param default_operator: The default operator for query string query: `AND` or - `OR`. - :param df: Field to use as default where no field prefix is given in the query - string. - :param expand_wildcards: Type of index that wildcard patterns can match. If the - request can target data streams, this argument determines whether wildcard - expressions match hidden data streams. Supports comma-separated values, such - as `open,hidden`. Valid values are: `all`, `open`, `closed`, `hidden`, `none`. + `OR`. This parameter can be used only when the `q` query string parameter + is specified. + :param df: The field to use as default where no field prefix is given in the + query string. This parameter can be used only when the `q` query string parameter + is specified. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. Valid values are: `all`, `open`, `closed`, + `hidden`, `none`. :param from_: Starting offset (default: 0) :param ignore_unavailable: If `false`, the request returns an error if it targets a missing or closed index. :param lenient: If `true`, format-based query failures (such as providing text - to a numeric field) in the query string will be ignored. + to a numeric field) in the query string will be ignored. This parameter can + be used only when the `q` query string parameter is specified. :param max_docs: The maximum number of documents to update. - :param pipeline: ID of the pipeline to use to preprocess incoming documents. + :param pipeline: The ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter. - :param preference: Specifies the node or shard the operation should be performed - on. Random by default. - :param q: Query in the Lucene query string syntax. - :param query: Specifies the documents to update using the Query DSL. + :param preference: The node or shard the operation should be performed on. It + is random by default. + :param q: A query in the Lucene query string syntax. + :param query: The documents to update using the Query DSL. :param refresh: If `true`, Elasticsearch refreshes affected shards to make the - operation visible to search. + operation visible to search after the request completes. This is different + than the update API's `refresh` parameter, which causes just the shard that + received the request to be refreshed. :param request_cache: If `true`, the request cache is used for this request. + It defaults to the index-level setting. :param requests_per_second: The throttle for this request in sub-requests per second. - :param routing: Custom value used to route operations to a specific shard. + :param routing: A custom value used to route operations to a specific shard. :param script: The script to run to update the document source or metadata when updating. - :param scroll: Period to retain the search context for scrolling. - :param scroll_size: Size of the scroll request that powers the operation. - :param search_timeout: Explicit timeout for each search request. - :param search_type: The type of the search operation. Available options: `query_then_fetch`, - `dfs_query_then_fetch`. + :param scroll: The period to retain the search context for scrolling. + :param scroll_size: The size of the scroll request that powers the operation. + :param search_timeout: An explicit timeout for each search request. By default, + there is no timeout. + :param search_type: The type of the search operation. Available options include + `query_then_fetch` and `dfs_query_then_fetch`. :param slice: Slice the request manually using the provided slice ID and total number of slices. :param slices: The number of slices this task should be divided into. :param sort: A comma-separated list of : pairs. - :param stats: Specific `tag` of the request for logging and statistical purposes. - :param terminate_after: Maximum number of documents to collect for each shard. + :param stats: The specific `tag` of the request for logging and statistical purposes. + :param terminate_after: The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. - Elasticsearch collects documents before sorting. Use with caution. Elasticsearch - applies this parameter to each shard handling the request. When possible, - let Elasticsearch perform early termination automatically. Avoid specifying - this parameter for requests that target data streams with backing indices - across multiple data tiers. - :param timeout: Period each update request waits for the following operations: - dynamic mapping updates, waiting for active shards. + Elasticsearch collects documents before sorting. IMPORTANT: Use with caution. + Elasticsearch applies this parameter to each shard handling the request. + When possible, let Elasticsearch perform early termination automatically. + Avoid specifying this parameter for requests that target data streams with + backing indices across multiple data tiers. + :param timeout: The period each update request waits for the following operations: + dynamic mapping updates, waiting for active shards. By default, it is one + minute. This guarantees Elasticsearch waits for at least the timeout before + failing. The actual wait time could be longer, particularly when multiple + waits occur. :param version: If `true`, returns the document version as part of a hit. :param version_type: Should the document increment the version number (internal) on hit or not (reindex) :param wait_for_active_shards: The number of shard copies that must be active before proceeding with the operation. Set to `all` or any positive integer - up to the total number of shards in the index (`number_of_replicas+1`). + up to the total number of shards in the index (`number_of_replicas+1`). The + `timeout` parameter controls how long each write request waits for unavailable + shards to become available. Both work exactly the way they work in the bulk + API. :param wait_for_completion: If `true`, the request blocks until the operation - is complete. + is complete. If `false`, Elasticsearch performs some preflight checks, launches + the request, and returns a task ID that you can use to cancel or get the + status of the task. Elasticsearch creates a record of this task as a document + at `.tasks/task/${taskId}`. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") @@ -5222,13 +6610,18 @@ def update_by_query_rethrottle( requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]: """ - Changes the number of requests per second for a particular Update By Query operation. + .. raw:: html + +

Throttle an update by query operation.

+

Change the number of requests per second for a particular update by query operation. + Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.

- ``_ + + ``_ :param task_id: The ID for the task. :param requests_per_second: The throttle for this request in sub-requests per - second. + second. To turn off throttling, set it to `-1`. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'task_id'") diff --git a/elasticsearch/_sync/client/_base.py b/elasticsearch/_sync/client/_base.py index 8929b1db7..868b71073 100644 --- a/elasticsearch/_sync/client/_base.py +++ b/elasticsearch/_sync/client/_base.py @@ -298,7 +298,6 @@ def _perform_request( def mimetype_header_to_compat(header: str) -> None: # Converts all parts of a Accept/Content-Type headers # from application/X -> application/vnd.elasticsearch+X - nonlocal request_headers mimetype = request_headers.get(header, None) if mimetype: request_headers[header] = _COMPAT_MIMETYPE_RE.sub( diff --git a/elasticsearch/_sync/client/async_search.py b/elasticsearch/_sync/client/async_search.py index 8fbf3188d..9899aaf72 100644 --- a/elasticsearch/_sync/client/async_search.py +++ b/elasticsearch/_sync/client/async_search.py @@ -36,13 +36,15 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an async search by identifier. If the search is still running, the search - request will be cancelled. Otherwise, the saved search results are deleted. If - the Elasticsearch security features are enabled, the deletion of a specific async - search is restricted to: the authenticated user that submitted the original search - request; users that have the `cancel_task` cluster privilege. + .. raw:: html - ``_ +

Delete an async search.

+

If the asynchronous search is still running, it is cancelled. + Otherwise, the saved search results are deleted. + If the Elasticsearch security features are enabled, the deletion of a specific async search is restricted to: the authenticated user that submitted the original search request; users that have the cancel_task cluster privilege.

+ + + ``_ :param id: A unique identifier for the async search. """ @@ -85,12 +87,14 @@ def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the results of a previously submitted async search request given its - identifier. If the Elasticsearch security features are enabled, access to the - results of a specific async search is restricted to the user or API key that - submitted it. + .. raw:: html + +

Get async search results.

+

Retrieve the results of a previously submitted asynchronous search request. + If the Elasticsearch security features are enabled, access to the results of a specific async search is restricted to the user or API key that submitted it.

+ - ``_ + ``_ :param id: A unique identifier for the async search. :param keep_alive: Specifies how long the async search should be available in @@ -145,17 +149,23 @@ def status( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get async search status Retrieves the status of a previously submitted async - search request given its identifier, without retrieving search results. If the - Elasticsearch security features are enabled, use of this API is restricted to - the `monitoring_user` role. + .. raw:: html + +

Get the async search status.

+

Get the status of a previously submitted async search request given its identifier, without retrieving search results. + If the Elasticsearch security features are enabled, use of this API is restricted to the monitoring_user role.

+ - ``_ + ``_ :param id: A unique identifier for the async search. + :param keep_alive: Specifies how long the async search needs to be available. + Ongoing async searches and any saved search results are deleted after this + period. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -168,6 +178,8 @@ def status( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if keep_alive is not None: + __query["keep_alive"] = keep_alive if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} @@ -269,7 +281,6 @@ def submit( min_score: t.Optional[float] = None, pit: t.Optional[t.Mapping[str, t.Any]] = None, post_filter: t.Optional[t.Mapping[str, t.Any]] = None, - pre_filter_shard_size: t.Optional[int] = None, preference: t.Optional[str] = None, pretty: t.Optional[bool] = None, profile: t.Optional[bool] = None, @@ -283,7 +294,6 @@ def submit( routing: t.Optional[str] = None, runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, - scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, search_after: t.Optional[ t.Sequence[t.Union[None, bool, float, int, str, t.Any]] ] = None, @@ -323,17 +333,16 @@ def submit( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Runs a search request asynchronously. When the primary sort of the results is - an indexed field, shards get sorted based on minimum and maximum value that they - hold for that field, hence partial results become available following the sort - criteria that was requested. Warning: Async search does not support scroll nor - search requests that only include the suggest section. By default, Elasticsearch - doesn’t allow you to store an async search response larger than 10Mb and an attempt - to do this results in an error. The maximum allowed size for a stored async search - response can be set by changing the `search.max_async_search_response_size` cluster - level setting. + .. raw:: html + +

Run an async search.

+

When the primary sort of the results is an indexed field, shards get sorted based on minimum and maximum value that they hold for that field. Partial results become available following the sort criteria that was requested.

+

Warning: Asynchronous search does not support scroll or search requests that include only the suggest section.

+

By default, Elasticsearch does not allow you to store an async search response larger than 10Mb and an attempt to do this results in an error. + The maximum allowed size for a stored async search response can be set by changing the search.max_async_search_response_size cluster level setting.

+ - ``_ + ``_ :param index: A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices @@ -394,10 +403,6 @@ def submit( :param pit: Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an in the request path. :param post_filter: - :param pre_filter_shard_size: The default value cannot be changed, which enforces - the execution of a pre-filter roundtrip to retrieve statistics from each - shard so that the ones that surely don’t hold any document matching the query - get skipped. :param preference: Specify the node or shard the operation should be performed on (default: random) :param profile: @@ -406,13 +411,13 @@ def submit( :param request_cache: Specify if request cache should be used for this request or not, defaults to true :param rescore: - :param rest_total_hits_as_int: + :param rest_total_hits_as_int: Indicates whether hits.total should be rendered + as an integer or an object in the rest search response :param routing: A comma-separated list of specific routing values :param runtime_mappings: Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name. :param script_fields: Retrieve a script evaluation (based on different fields) for each hit. - :param scroll: :param search_after: :param search_type: Search operation type :param seq_no_primary_term: If true, returns sequence number and primary term @@ -519,8 +524,6 @@ def submit( __query["max_concurrent_shard_requests"] = max_concurrent_shard_requests if min_compatible_shard_node is not None: __query["min_compatible_shard_node"] = min_compatible_shard_node - if pre_filter_shard_size is not None: - __query["pre_filter_shard_size"] = pre_filter_shard_size if preference is not None: __query["preference"] = preference if pretty is not None: @@ -533,8 +536,6 @@ def submit( __query["rest_total_hits_as_int"] = rest_total_hits_as_int if routing is not None: __query["routing"] = routing - if scroll is not None: - __query["scroll"] = scroll if search_type is not None: __query["search_type"] = search_type if source_excludes is not None: diff --git a/elasticsearch/_sync/client/autoscaling.py b/elasticsearch/_sync/client/autoscaling.py index 2b2a23fc2..6a3768a98 100644 --- a/elasticsearch/_sync/client/autoscaling.py +++ b/elasticsearch/_sync/client/autoscaling.py @@ -33,15 +33,25 @@ def delete_autoscaling_policy( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. - Direct use is not supported. + .. raw:: html - ``_ +

Delete an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ + + ``_ :param name: the name of the autoscaling policy + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -54,8 +64,12 @@ def delete_autoscaling_policy( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "DELETE", @@ -73,13 +87,28 @@ def get_autoscaling_capacity( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets the current autoscaling capacity based on the configured autoscaling policy. - Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. + .. raw:: html + +

Get the autoscaling capacity.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

This API gets the current autoscaling capacity based on the configured autoscaling policy. + It will return information to size the cluster appropriately to the current workload.

+

The required_capacity is calculated as the maximum of the required_capacity result of all individual deciders that are enabled for the policy.

+

The operator should verify that the current_nodes match the operator’s knowledge of the cluster to avoid making autoscaling decisions based on stale or incomplete information.

+

The response contains decider-specific information you can use to diagnose how and why autoscaling determined a certain capacity was required. + This information is provided for diagnosis only. + Do not use this information to make autoscaling decisions.

+ + + ``_ - ``_ + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_autoscaling/capacity" @@ -90,6 +119,8 @@ def get_autoscaling_capacity( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} @@ -110,15 +141,22 @@ def get_autoscaling_policy( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. - Direct use is not supported. + .. raw:: html - ``_ +

Get an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ + + ``_ :param name: the name of the autoscaling policy + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -131,6 +169,8 @@ def get_autoscaling_policy( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} @@ -155,16 +195,26 @@ def put_autoscaling_policy( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. - Direct use is not supported. + .. raw:: html + +

Create or update an autoscaling policy.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+ - ``_ + ``_ :param name: the name of the autoscaling policy :param policy: + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -183,8 +233,12 @@ def put_autoscaling_policy( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __body = policy if policy is not None else body __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] diff --git a/elasticsearch/_sync/client/cat.py b/elasticsearch/_sync/client/cat.py index 067ededb6..cbacf8a67 100644 --- a/elasticsearch/_sync/client/cat.py +++ b/elasticsearch/_sync/client/cat.py @@ -20,7 +20,13 @@ from elastic_transport import ObjectApiResponse, TextApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class CatClient(NamespacedClient): @@ -51,18 +57,22 @@ def aliases( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get aliases. Retrieves the cluster’s index aliases, including filter and routing - information. The API does not return data stream aliases. CAT APIs are only intended - for human consumption using the command line or the Kibana console. They are - not intended for use by applications. For application consumption, use the aliases - API. + .. raw:: html - ``_ +

Get aliases.

+

Get the cluster's index aliases, including filter and routing information. + This API does not return data stream aliases.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API.

+ + + ``_ :param name: A comma-separated list of aliases to retrieve. Supports wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or `_all`. - :param expand_wildcards: Whether to expand wildcard expression to concrete indices - that are open, closed or both. + :param expand_wildcards: The type of index that wildcard patterns can match. + If the request can target data streams, this argument determines whether + wildcard expressions match hidden data streams. It supports comma-separated + values, such as `open,hidden`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -72,7 +82,10 @@ def aliases( the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. + :param master_timeout: The period to wait for a connection to the master node. + If the master node is not available before the timeout expires, the request + fails and returns an error. To indicated that the request should never timeout, + you can set it to `-1`. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -141,13 +154,16 @@ def allocation( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Provides a snapshot of the number of shards allocated to each data node and their - disk space. IMPORTANT: cat APIs are only intended for human consumption using - the command line or Kibana console. They are not intended for use by applications. + .. raw:: html + +

Get shard allocation information.

+

Get a snapshot of the number of shards allocated to each data node and their disk space.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.

- ``_ - :param node_id: Comma-separated list of node identifiers or names used to limit + ``_ + + :param node_id: A comma-separated list of node identifiers or names used to limit the returned information. :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set @@ -225,17 +241,19 @@ def component_templates( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get component templates. Returns information about component templates in a cluster. - Component templates are building blocks for constructing index templates that - specify index mappings, settings, and aliases. CAT APIs are only intended for - human consumption using the command line or Kibana console. They are not intended - for use by applications. For application consumption, use the get component template - API. + .. raw:: html + +

Get component templates.

+

Get information about component templates in a cluster. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use the get component template API.

- ``_ - :param name: The name of the component template. Accepts wildcard expressions. - If omitted, all component templates are returned. + ``_ + + :param name: The name of the component template. It accepts wildcard expressions. + If it is omitted, all component templates are returned. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. @@ -245,7 +263,7 @@ def component_templates( the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. + :param master_timeout: The period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -302,35 +320,30 @@ def count( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get a document count. Provides quick access to a document count for a data stream, - an index, or an entire cluster. The document count only includes live documents, - not deleted documents which have not yet been removed by the merge process. CAT - APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the count API. + .. raw:: html - ``_ +

Get a document count.

+

Get quick access to a document count for a data stream, an index, or an entire cluster. + The document count only includes live documents, not deleted documents which have not yet been removed by the merge process.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use the count API.

- :param index: Comma-separated list of data streams, indices, and aliases used - to limit the request. Supports wildcards (`*`). To target all data streams + + ``_ + + :param index: A comma-separated list of data streams, indices, and aliases used + to limit the request. It supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -356,10 +369,6 @@ def count( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -390,19 +399,20 @@ def fielddata( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the amount of heap memory currently used by the field data cache on every - data node in the cluster. IMPORTANT: cat APIs are only intended for human consumption - using the command line or Kibana console. They are not intended for use by applications. - For application consumption, use the nodes stats API. + .. raw:: html - ``_ +

Get field data cache information.

+

Get the amount of heap memory currently used by the field data cache on every data node in the cluster.

+

IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use the nodes stats API.

+ + + ``_ :param fields: Comma-separated list of fields used to limit returned information. To retrieve all fields, omit this parameter. @@ -412,11 +422,6 @@ def fielddata( :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -444,10 +449,6 @@ def fielddata( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -474,8 +475,6 @@ def health( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, time: t.Optional[ @@ -485,30 +484,27 @@ def health( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the health status of a cluster, similar to the cluster health API. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the cluster health API. This API is often used to check malfunctioning clusters. - To help you track cluster health alongside log files and alerting systems, the - API returns timestamps in two formats: `HH:MM:SS`, which is human-readable but - includes no date information; `Unix epoch time`, which is machine-sortable and - includes date information. The latter format is useful for cluster recoveries - that take multiple days. You can use the cat health API to verify cluster health - across multiple nodes. You also can use the API to track the recovery of a large - cluster over a longer period of time. - - ``_ + .. raw:: html + +

Get the cluster health status.

+

IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use the cluster health API. + This API is often used to check malfunctioning clusters. + To help you track cluster health alongside log files and alerting systems, the API returns timestamps in two formats: + HH:MM:SS, which is human-readable but includes no date information; + Unix epoch time, which is machine-sortable and includes date information. + The latter format is useful for cluster recoveries that take multiple days. + You can use the cat health API to verify cluster health across multiple nodes. + You also can use the API to track the recovery of a large cluster over a longer period of time.

+ + + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. @@ -531,10 +527,6 @@ def health( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -556,66 +548,19 @@ def health( ) @_rewrite_parameters() - def help( - self, - *, - error_trace: t.Optional[bool] = None, - filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, - format: t.Optional[str] = None, - h: t.Optional[t.Union[str, t.Sequence[str]]] = None, - help: t.Optional[bool] = None, - human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - pretty: t.Optional[bool] = None, - s: t.Optional[t.Union[str, t.Sequence[str]]] = None, - v: t.Optional[bool] = None, - ) -> TextApiResponse: + def help(self) -> TextApiResponse: """ - Get CAT help. Returns help for the CAT APIs. + .. raw:: html - ``_ +

Get CAT help.

+

Get help for the CAT APIs.

- :param format: Specifies the format to return the columnar data in, can be set - to `text`, `json`, `cbor`, `yaml`, or `smile`. - :param h: List of columns to appear in the response. Supports simple wildcards. - :param help: When set to `true` will output available columns. This option can't - be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. - :param s: List of columns that determine how the table should be sorted. Sorting - defaults to ascending and can be changed by setting `:asc` or `:desc` as - a suffix to the column name. - :param v: When set to `true` will enable verbose output. + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_cat" __query: t.Dict[str, t.Any] = {} - if error_trace is not None: - __query["error_trace"] = error_trace - if filter_path is not None: - __query["filter_path"] = filter_path - if format is not None: - __query["format"] = format - if h is not None: - __query["h"] = h - if help is not None: - __query["help"] = help - if human is not None: - __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout - if pretty is not None: - __query["pretty"] = pretty - if s is not None: - __query["s"] = s - if v is not None: - __query["v"] = v __headers = {"accept": "text/plain"} return self.perform_request( # type: ignore[return-value] "GET", @@ -650,7 +595,6 @@ def indices( help: t.Optional[bool] = None, human: t.Optional[bool] = None, include_unloaded_segments: t.Optional[bool] = None, - local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, pri: t.Optional[bool] = None, @@ -661,18 +605,25 @@ def indices( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get index information. Returns high-level information about indices in a cluster, - including backing indices for data streams. Use this request to get the following - information for each index in a cluster: - shard count - document count - deleted - document count - primary store size - total store size of all shards, including - shard replicas These metrics are retrieved directly from Lucene, which Elasticsearch - uses internally to power indexing and search. As a result, all document counts - include hidden nested documents. To get an accurate count of Elasticsearch documents, - use the cat count or count APIs. CAT APIs are only intended for human consumption - using the command line or Kibana console. They are not intended for use by applications. - For application consumption, use an index endpoint. - - ``_ + .. raw:: html + +

Get index information.

+

Get high-level information about indices in a cluster, including backing indices for data streams.

+

Use this request to get the following information for each index in a cluster:

+
    +
  • shard count
  • +
  • document count
  • +
  • deleted document count
  • +
  • primary store size
  • +
  • total store size of all shards, including shard replicas
  • +
+

These metrics are retrieved directly from Lucene, which Elasticsearch uses internally to power indexing and search. As a result, all document counts include hidden nested documents. + To get an accurate count of Elasticsearch documents, use the cat count or count APIs.

+

CAT APIs are only intended for human consumption using the command line or Kibana console. + They are not intended for use by applications. For application consumption, use an index endpoint.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -688,10 +639,6 @@ def indices( be combined with any other query string option. :param include_unloaded_segments: If true, the response includes information from segments that are not loaded into memory. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. :param pri: If true, the response only includes information from primary shards. :param s: List of columns that determine how the table should be sorted. Sorting @@ -728,8 +675,6 @@ def indices( __query["human"] = human if include_unloaded_segments is not None: __query["include_unloaded_segments"] = include_unloaded_segments - if local is not None: - __query["local"] = local if master_timeout is not None: __query["master_timeout"] = master_timeout if pretty is not None: @@ -769,12 +714,14 @@ def master( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the master node, including the ID, bound IP address, - and name. IMPORTANT: cat APIs are only intended for human consumption using the - command line or Kibana console. They are not intended for use by applications. - For application consumption, use the nodes info API. + .. raw:: html + +

Get master node information.

+

Get information about the master node, including the ID, bound IP address, and name.

+

IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

+ - ``_ + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -888,8 +835,6 @@ def ml_data_frame_analytics( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -939,17 +884,22 @@ def ml_data_frame_analytics( ], ] ] = None, - time: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get data frame analytics jobs. Returns configuration and usage information about - data frame analytics jobs. CAT APIs are only intended for human consumption using - the Kibana console or command line. They are not intended for use by applications. - For application consumption, use the get data frame analytics jobs statistics - API. + .. raw:: html + +

Get data frame analytics jobs.

+

Get configuration and usage information about data frame analytics jobs.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get data frame analytics jobs statistics API.

- ``_ + + ``_ :param id: The ID of the data frame analytics to fetch :param allow_no_match: Whether to ignore if a wildcard expression matches no @@ -960,11 +910,6 @@ def ml_data_frame_analytics( :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. :param time: Unit used to display time values. @@ -994,10 +939,6 @@ def ml_data_frame_analytics( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -1067,8 +1008,6 @@ def ml_datafeeds( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -1116,14 +1055,19 @@ def ml_datafeeds( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get datafeeds. Returns configuration and usage information about datafeeds. This - API returns a maximum of 10,000 datafeeds. If the Elasticsearch security features - are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` - cluster privileges to use this API. CAT APIs are only intended for human consumption - using the Kibana console or command line. They are not intended for use by applications. - For application consumption, use the get datafeed statistics API. + .. raw:: html + +

Get datafeeds.

+

Get configuration and usage information about datafeeds. + This API returns a maximum of 10,000 datafeeds. + If the Elasticsearch security features are enabled, you must have monitor_ml, monitor, manage_ml, or manage + cluster privileges to use this API.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get datafeed statistics API.

+ - ``_ + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. @@ -1139,11 +1083,6 @@ def ml_datafeeds( :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. :param time: The unit used to display time values. @@ -1171,10 +1110,6 @@ def ml_datafeeds( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -1343,8 +1278,6 @@ def ml_jobs( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -1488,15 +1421,19 @@ def ml_jobs( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get anomaly detection jobs. Returns configuration and usage information for anomaly - detection jobs. This API returns a maximum of 10,000 jobs. If the Elasticsearch - security features are enabled, you must have `monitor_ml`, `monitor`, `manage_ml`, - or `manage` cluster privileges to use this API. CAT APIs are only intended for - human consumption using the Kibana console or command line. They are not intended - for use by applications. For application consumption, use the get anomaly detection - job statistics API. + .. raw:: html + +

Get anomaly detection jobs.

+

Get configuration and usage information for anomaly detection jobs. + This API returns a maximum of 10,000 jobs. + If the Elasticsearch security features are enabled, you must have monitor_ml, + monitor, manage_ml, or manage cluster privileges to use this API.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get anomaly detection job statistics API.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param allow_no_match: Specifies what to do when the request: * Contains wildcard @@ -1512,11 +1449,6 @@ def ml_jobs( :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. :param time: The unit used to display time values. @@ -1546,10 +1478,6 @@ def ml_jobs( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: @@ -1629,8 +1557,6 @@ def ml_trained_models( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -1677,15 +1603,22 @@ def ml_trained_models( ] ] = None, size: t.Optional[int] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get trained models. Returns configuration and usage information about inference - trained models. CAT APIs are only intended for human consumption using the Kibana - console or command line. They are not intended for use by applications. For application - consumption, use the get trained models statistics API. + .. raw:: html - ``_ +

Get trained models.

+

Get configuration and usage information about inference trained models.

+

IMPORTANT: CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get trained models statistics API.

+ + + ``_ :param model_id: A unique identifier for the trained model. :param allow_no_match: Specifies what to do when the request: contains wildcard @@ -1702,14 +1635,10 @@ def ml_trained_models( :param h: A comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: A comma-separated list of column names or aliases used to sort the response. :param size: The maximum number of transforms to display. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -1738,16 +1667,14 @@ def ml_trained_models( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s if size is not None: __query["size"] = size + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -1777,12 +1704,14 @@ def nodeattrs( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about custom node attributes. IMPORTANT: cat APIs are only - intended for human consumption using the command line or Kibana console. They - are not intended for use by applications. For application consumption, use the - nodes info API. + .. raw:: html + +

Get node attribute information.

+

Get information about custom node attributes. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

+ - ``_ + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -1849,19 +1778,23 @@ def nodes( help: t.Optional[bool] = None, human: t.Optional[bool] = None, include_unloaded_segments: t.Optional[bool] = None, - local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the nodes in a cluster. IMPORTANT: cat APIs are only - intended for human consumption using the command line or Kibana console. They - are not intended for use by applications. For application consumption, use the - nodes info API. + .. raw:: html + +

Get node information.

+

Get information about the nodes in a cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

+ - ``_ + ``_ :param bytes: The unit used to display byte values. :param format: Specifies the format to return the columnar data in, can be set @@ -1873,14 +1806,11 @@ def nodes( be combined with any other query string option. :param include_unloaded_segments: If true, the response includes information from segments that are not loaded into memory. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} @@ -1904,14 +1834,14 @@ def nodes( __query["human"] = human if include_unloaded_segments is not None: __query["include_unloaded_segments"] = include_unloaded_segments - if local is not None: - __query["local"] = local if master_timeout is not None: __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -1938,15 +1868,20 @@ def pending_tasks( master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns cluster-level changes that have not yet been executed. IMPORTANT: cat - APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the pending cluster tasks API. + .. raw:: html + +

Get pending task information.

+

Get information about cluster-level changes that have not yet taken effect. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the pending cluster tasks API.

+ - ``_ + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -1961,6 +1896,7 @@ def pending_tasks( :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] = {} @@ -1986,6 +1922,8 @@ def pending_tasks( __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2008,6 +1946,7 @@ def plugins( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, + include_bootstrap: t.Optional[bool] = None, local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, @@ -2015,18 +1954,21 @@ def plugins( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns a list of plugins running on each node of a cluster. IMPORTANT: cat APIs - are only intended for human consumption using the command line or Kibana console. - They are not intended for use by applications. For application consumption, use - the nodes info API. + .. raw:: html + +

Get plugin information.

+

Get a list of plugins running on each node of a cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

- ``_ + + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. + :param include_bootstrap: Include bootstrap plugins in the response :param local: If `true`, the request computes the list of selected nodes from the local cluster state. If `false` the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating @@ -2052,6 +1994,8 @@ def plugins( __query["help"] = help if human is not None: __query["human"] = human + if include_bootstrap is not None: + __query["include_bootstrap"] = include_bootstrap if local is not None: __query["local"] = local if master_timeout is not None: @@ -2088,23 +2032,24 @@ def recovery( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about ongoing and completed shard recoveries. Shard recovery - is the process of initializing a shard copy, such as restoring a primary shard - from a snapshot or syncing a replica shard from a primary shard. When a shard - recovery completes, the recovered shard is available for search and indexing. - For data streams, the API returns information about the stream’s backing indices. - IMPORTANT: cat APIs are only intended for human consumption using the command - line or Kibana console. They are not intended for use by applications. For application - consumption, use the index recovery API. + .. raw:: html + +

Get shard recovery information.

+

Get information about ongoing and completed shard recoveries. + Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or syncing a replica shard from a primary shard. When a shard recovery completes, the recovered shard is available for search and indexing. + For data streams, the API returns information about the stream’s backing indices. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index recovery API.

- ``_ + + ``_ :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2118,14 +2063,10 @@ def recovery( :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2154,14 +2095,12 @@ def recovery( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2191,12 +2130,14 @@ def repositories( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns the snapshot repositories for a cluster. IMPORTANT: cat APIs are only - intended for human consumption using the command line or Kibana console. They - are not intended for use by applications. For application consumption, use the - get snapshot repository API. + .. raw:: html + +

Get snapshot repository information.

+

Get a list of snapshot repositories for a cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot repository API.

- ``_ + + ``_ :param format: Specifies the format to return the columnar data in, can be set to `text`, `json`, `cbor`, `yaml`, or `smile`. @@ -2269,13 +2210,15 @@ def segments( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns low-level information about the Lucene segments in index shards. For - data streams, the API returns information about the backing indices. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the index segments API. + .. raw:: html + +

Get segment information.

+

Get low-level information about the Lucene segments in index shards. + For data streams, the API returns information about the backing indices. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the index segments API.

- ``_ + + ``_ :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2352,19 +2295,24 @@ def shards( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the shards in a cluster. For data streams, the API - returns information about the backing indices. IMPORTANT: cat APIs are only intended - for human consumption using the command line or Kibana console. They are not - intended for use by applications. + .. raw:: html + +

Get shard information.

+

Get information about the shards in a cluster. + For data streams, the API returns information about the backing indices. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.

+ - ``_ + ``_ :param index: A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2375,14 +2323,11 @@ def shards( :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2407,14 +2352,14 @@ def shards( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local if master_timeout is not None: __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2439,20 +2384,24 @@ def snapshots( help: t.Optional[bool] = None, human: t.Optional[bool] = None, ignore_unavailable: t.Optional[bool] = None, - local: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about the snapshots stored in one or more repositories. A - snapshot is a backup of an index or running Elasticsearch cluster. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the get snapshot API. + .. raw:: html + +

Get snapshot information.

+

Get information about the snapshots stored in one or more repositories. + A snapshot is a backup of an index or running Elasticsearch cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get snapshot API.

+ - ``_ + ``_ :param repository: A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. `_all` returns all repositories. @@ -2464,14 +2413,11 @@ def snapshots( be combined with any other query string option. :param ignore_unavailable: If `true`, the response does not include information from unavailable snapshots. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. :param master_timeout: Period to wait for a connection to the master node. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. :param v: When set to `true` will enable verbose output. """ __path_parts: t.Dict[str, str] @@ -2496,14 +2442,14 @@ def snapshots( __query["human"] = human if ignore_unavailable is not None: __query["ignore_unavailable"] = ignore_unavailable - if local is not None: - __query["local"] = local if master_timeout is not None: __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time if v is not None: __query["v"] = v __headers = {"accept": "text/plain,application/json"} @@ -2517,6 +2463,7 @@ def snapshots( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def tasks( self, *, @@ -2528,21 +2475,26 @@ def tasks( h: t.Optional[t.Union[str, t.Sequence[str]]] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - node_id: t.Optional[t.Sequence[str]] = None, + nodes: t.Optional[t.Sequence[str]] = None, parent_task_id: t.Optional[str] = None, pretty: t.Optional[bool] = None, s: t.Optional[t.Union[str, t.Sequence[str]]] = None, + time: t.Optional[ + t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]] + ] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, v: t.Optional[bool] = None, + wait_for_completion: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about tasks currently executing in the cluster. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the task management API. + .. raw:: html - ``_ +

Get task information.

+

Get information about tasks currently running in the cluster. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the task management API.

+ + + ``_ :param actions: The task action names, which are used to limit the response. :param detailed: If `true`, the response includes detailed information about @@ -2552,18 +2504,18 @@ def tasks( :param h: List of columns to appear in the response. Supports simple wildcards. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. - :param node_id: Unique node identifiers, which are used to limit the response. + :param nodes: Unique node identifiers, which are used to limit the response. :param parent_task_id: The parent task identifier, which is used to limit the response. :param s: List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting `:asc` or `:desc` as a suffix to the column name. + :param time: Unit used to display time values. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. :param v: When set to `true` will enable verbose output. + :param wait_for_completion: If `true`, the request blocks until the task has + completed. """ __path_parts: t.Dict[str, str] = {} __path = "/_cat/tasks" @@ -2584,20 +2536,22 @@ def tasks( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout - if node_id is not None: - __query["node_id"] = node_id + if nodes is not None: + __query["nodes"] = nodes if parent_task_id is not None: __query["parent_task_id"] = parent_task_id if pretty is not None: __query["pretty"] = pretty if s is not None: __query["s"] = s + if time is not None: + __query["time"] = time + if timeout is not None: + __query["timeout"] = timeout if v is not None: __query["v"] = v + if wait_for_completion is not None: + __query["wait_for_completion"] = wait_for_completion __headers = {"accept": "text/plain,application/json"} return self.perform_request( # type: ignore[return-value] "GET", @@ -2626,13 +2580,15 @@ def templates( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns information about index templates in a cluster. You can use index templates - to apply index settings and field mappings to new indices at creation. IMPORTANT: - cat APIs are only intended for human consumption using the command line or Kibana - console. They are not intended for use by applications. For application consumption, - use the get index template API. + .. raw:: html + +

Get index template information.

+

Get information about the index templates in a cluster. + You can use index templates to apply index settings and field mappings to new indices at creation. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the get index template API.

+ - ``_ + ``_ :param name: The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned. @@ -2712,13 +2668,15 @@ def thread_pool( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Returns thread pool statistics for each node in a cluster. Returned information - includes all built-in thread pools and custom thread pools. IMPORTANT: cat APIs - are only intended for human consumption using the command line or Kibana console. - They are not intended for use by applications. For application consumption, use - the nodes info API. + .. raw:: html + +

Get thread pool statistics.

+

Get thread pool statistics for each node in a cluster. + Returned information includes all built-in thread pools and custom thread pools. + IMPORTANT: cat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.

+ - ``_ + ``_ :param thread_pool_patterns: A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions. @@ -2876,8 +2834,6 @@ def transforms( ] = None, help: t.Optional[bool] = None, human: t.Optional[bool] = None, - local: t.Optional[bool] = None, - master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, s: t.Optional[ t.Union[ @@ -2968,12 +2924,16 @@ def transforms( v: t.Optional[bool] = None, ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]: """ - Get transforms. Returns configuration and usage information about transforms. - CAT APIs are only intended for human consumption using the Kibana console or - command line. They are not intended for use by applications. For application - consumption, use the get transform statistics API. + .. raw:: html + +

Get transform information.

+

Get configuration and usage information about transforms.

+

CAT APIs are only intended for human consumption using the Kibana + console or command line. They are not intended for use by applications. For + application consumption, use the get transform statistics API.

+ - ``_ + ``_ :param transform_id: A transform identifier or a wildcard expression. If you do not specify one of these options, the API returns information for all @@ -2991,11 +2951,6 @@ def transforms( :param h: Comma-separated list of column names to display. :param help: When set to `true` will output available columns. This option can't be combined with any other query string option. - :param local: If `true`, the request computes the list of selected nodes from - the local cluster state. If `false` the list of selected nodes are computed - from the cluster state of the master node. In both cases the coordinating - node will send requests for further information to each selected node. - :param master_timeout: Period to wait for a connection to the master node. :param s: Comma-separated list of column names or column aliases used to sort the response. :param size: The maximum number of transforms to obtain. @@ -3026,10 +2981,6 @@ def transforms( __query["help"] = help if human is not None: __query["human"] = human - if local is not None: - __query["local"] = local - if master_timeout is not None: - __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty if s is not None: diff --git a/elasticsearch/_sync/client/ccr.py b/elasticsearch/_sync/client/ccr.py index 79683d2a7..fed08925a 100644 --- a/elasticsearch/_sync/client/ccr.py +++ b/elasticsearch/_sync/client/ccr.py @@ -36,9 +36,13 @@ def delete_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes auto-follow patterns. + .. raw:: html - ``_ +

Delete auto-follow patterns. + Delete a collection of cross-cluster replication auto-follow patterns.

+ + + ``_ :param name: The name of the auto follow pattern. """ @@ -107,9 +111,14 @@ def follow( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a new follower index configured to follow the referenced leader index. + .. raw:: html + +

Create a follower. + Create a cross-cluster replication follower index that follows a specific leader index. + When the API returns, the follower index exists and cross-cluster replication starts replicating operations from the leader index to the follower index.

+ - ``_ + ``_ :param index: The name of the follower index :param leader_index: @@ -198,10 +207,14 @@ def follow_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about all follower indices, including parameters and status - for each follower index + .. raw:: html - ``_ +

Get follower information. + Get information about all cross-cluster replication follower indices. + For example, the results include follower index names, leader index names, replication options, and whether the follower indices are active or paused.

+ + + ``_ :param index: A comma-separated list of index patterns; use `_all` to perform the operation on all indices @@ -240,10 +253,14 @@ def follow_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves follower stats. return shard-level stats about the following tasks - associated with each shard for the specified indices. + .. raw:: html + +

Get follower stats. + Get cross-cluster replication follower stats. + The API returns shard-level stats about the "following tasks" associated with each shard for the specified indices.

- ``_ + + ``_ :param index: A comma-separated list of index patterns; use `_all` to perform the operation on all indices @@ -294,9 +311,21 @@ def forget_follower( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes the follower retention leases from the leader. + .. raw:: html + +

Forget a follower. + Remove the cross-cluster replication follower retention leases from the leader.

+

A following index takes out retention leases on its leader index. + These leases are used to increase the likelihood that the shards of the leader index retain the history of operations that the shards of the following index need to run replication. + When a follower index is converted to a regular index by the unfollow API (either by directly calling the API or by index lifecycle management tasks), these leases are removed. + However, removal of the leases can fail, for example when the remote cluster containing the leader index is unavailable. + While the leases will eventually expire on their own, their extended existence can cause the leader index to hold more history than necessary and prevent index lifecycle management from performing some operations on the leader index. + This API exists to enable manually removing the leases when the unfollow API is unable to do so.

+

NOTE: This API does not stop replication by a following index. If you use this API with a follower index that is still actively following, the following index will add back retention leases on the leader. + The only purpose of this API is to handle the case of failure to remove the following retention leases after the unfollow API is invoked.

+ - ``_ + ``_ :param index: the name of the leader index for which specified follower retention leases should be removed @@ -350,10 +379,13 @@ def get_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets configured auto-follow patterns. Returns the specified auto-follow pattern - collection. + .. raw:: html - ``_ +

Get auto-follow patterns. + Get cross-cluster replication auto-follow patterns.

+ + + ``_ :param name: Specifies the auto-follow pattern collection that you want to retrieve. If you do not specify a name, the API returns information for all collections. @@ -395,9 +427,18 @@ def pause_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Pauses an auto-follow pattern + .. raw:: html + +

Pause an auto-follow pattern. + Pause a cross-cluster replication auto-follow pattern. + When the API returns, the auto-follow pattern is inactive. + New indices that are created on the remote cluster and match the auto-follow patterns are ignored.

+

You can resume auto-following with the resume auto-follow pattern API. + When it resumes, the auto-follow pattern is active again and automatically configures follower indices for newly created indices on the remote cluster that match its patterns. + Remote indices that were created while the pattern was paused will also be followed, unless they have been deleted or closed in the interim.

- ``_ + + ``_ :param name: The name of the auto follow pattern that should pause discovering new indices to follow. @@ -436,10 +477,16 @@ def pause_follow( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Pauses a follower index. The follower index will not fetch any additional operations - from the leader index. + .. raw:: html + +

Pause a follower. + Pause a cross-cluster replication follower index. + The follower index will not fetch any additional operations from the leader index. + You can resume following with the resume follower API. + You can pause and resume a follower index to change the configuration of the following task.

- ``_ + + ``_ :param index: The name of the follower index that should pause following its leader index. @@ -512,11 +559,17 @@ def put_auto_follow_pattern( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a new named collection of auto-follow patterns against a specified remote - cluster. Newly created indices on the remote cluster matching any of the specified - patterns will be automatically configured as follower indices. + .. raw:: html + +

Create or update auto-follow patterns. + Create a collection of cross-cluster replication auto-follow patterns for a remote cluster. + Newly created indices on the remote cluster that match any of the patterns are automatically configured as follower indices. + Indices on the remote cluster that were created before the auto-follow pattern was created will not be auto-followed even if they match the pattern.

+

This API can also be used to update auto-follow patterns. + NOTE: Follower indices that were configured automatically before updating an auto-follow pattern will remain unchanged even if they do not match against the new patterns.

- ``_ + + ``_ :param name: The name of the collection of auto-follow patterns. :param remote_cluster: The remote cluster containing the leader indices to match @@ -638,9 +691,15 @@ def resume_auto_follow_pattern( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resumes an auto-follow pattern that has been paused + .. raw:: html + +

Resume an auto-follow pattern. + Resume a cross-cluster replication auto-follow pattern that was paused. + The auto-follow pattern will resume configuring following indices for newly created indices that match its patterns on the remote cluster. + Remote indices created while the pattern was paused will also be followed unless they have been deleted or closed in the interim.

+ - ``_ + ``_ :param name: The name of the auto follow pattern to resume discovering new indices to follow. @@ -703,9 +762,16 @@ def resume_follow( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Resumes a follower index that has been paused + .. raw:: html - ``_ +

Resume a follower. + Resume a cross-cluster replication follower index that was paused. + The follower index could have been paused with the pause follower API. + Alternatively it could be paused due to replication that cannot be retried due to failures during following tasks. + When this API returns, the follower index will resume fetching operations from the leader index.

+ + + ``_ :param index: The name of the follow index to resume following. :param max_outstanding_read_requests: @@ -785,9 +851,13 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets all stats related to cross-cluster replication. + .. raw:: html + +

Get cross-cluster replication stats. + This API returns stats about auto-following and the same shard-level stats as the get follower stats API.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ccr/stats" @@ -821,10 +891,16 @@ def unfollow( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stops the following task associated with a follower index and removes index metadata - and settings associated with cross-cluster replication. + .. raw:: html + +

Unfollow an index. + Convert a cross-cluster replication follower index to a regular index. + The API stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication. + The follower index must be paused and closed before you call the unfollow API.

+

NOTE: Currently cross-cluster replication does not support converting an existing regular index to a follower index. Converting a follower index to a regular index is an irreversible operation.

+ - ``_ + ``_ :param index: The name of the follower index that should be turned into a regular index. diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py index 19dc76b99..2045006e4 100644 --- a/elasticsearch/_sync/client/cluster.py +++ b/elasticsearch/_sync/client/cluster.py @@ -44,9 +44,16 @@ def allocation_explain( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Provides explanations for shard allocations in the cluster. + .. raw:: html - ``_ +

Explain the shard allocations. + Get explanations for shard allocations in the cluster. + For unassigned shards, it provides an explanation for why the shard is unassigned. + For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. + This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.

+ + + ``_ :param current_node: Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. @@ -113,11 +120,13 @@ def delete_component_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete component templates. Deletes component templates. Component templates - are building blocks for constructing index templates that specify index mappings, - settings, and aliases. + .. raw:: html + +

Delete component templates. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

- ``_ + + ``_ :param name: Comma-separated list or wildcard expression of component template names used to limit the request. @@ -165,9 +174,13 @@ def delete_voting_config_exclusions( wait_for_removal: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clears cluster voting config exclusions. + .. raw:: html + +

Clear cluster voting config exclusions. + Remove master-eligible nodes from the voting configuration exclusion list.

- ``_ + + ``_ :param wait_for_removal: Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions @@ -212,10 +225,13 @@ def exists_component_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check component templates. Returns information about whether a particular component - template exists. + .. raw:: html + +

Check component templates. + Returns information about whether a particular component template exists.

+ - ``_ + ``_ :param name: Comma-separated list of component template names used to limit the request. Wildcard (*) expressions are supported. @@ -268,9 +284,13 @@ def get_component_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get component templates. Retrieves information about component templates. + .. raw:: html + +

Get component templates. + Get information about component templates.

+ - ``_ + ``_ :param name: Comma-separated list of component template names used to limit the request. Wildcard (`*`) expressions are supported. @@ -331,10 +351,13 @@ def get_settings( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster-wide settings. By default, it returns only settings that have - been explicitly defined. + .. raw:: html - ``_ +

Get cluster-wide settings. + By default, it returns only settings that have been explicitly defined.

+ + + ``_ :param flat_settings: If `true`, returns settings in flat format. :param include_defaults: If `true`, returns default cluster settings from the @@ -414,17 +437,19 @@ def health( ] = None, ) -> ObjectApiResponse[t.Any]: """ - The cluster health API returns a simple status on the health of the cluster. - You can also use the API to get the health status of only specified data streams - and indices. For data streams, the API retrieves the health status of the stream’s - backing indices. The cluster health status is: green, yellow or red. On the shard - level, a red status indicates that the specific shard is not allocated in the - cluster, yellow means that the primary shard is allocated but replicas are not, - and green means that all shards are allocated. The index level status is controlled - by the worst shard status. The cluster status is controlled by the worst index - status. - - ``_ + .. raw:: html + +

Get the cluster health status. + You can also use the API to get the health status of only specified data streams and indices. + For data streams, the API retrieves the health status of the stream’s backing indices.

+

The cluster health status is: green, yellow or red. + On the shard level, a red status indicates that the specific shard is not allocated in the cluster. Yellow means that the primary shard is allocated but replicas are not. Green means that all shards are allocated. + The index level status is controlled by the worst shard status.

+

One of the main benefits of the API is the ability to wait until the cluster reaches a certain high watermark health level. + The cluster status is controlled by the worst index status.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (`*`) are supported. To target @@ -526,9 +551,13 @@ def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get cluster info. Returns basic information about the cluster. + .. raw:: html - ``_ +

Get cluster info. + Returns basic information about the cluster.

+ + + ``_ :param target: Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest. @@ -568,16 +597,16 @@ def pending_tasks( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster-level changes (such as create index, update mapping, allocate - or fail shard) that have not yet been executed. NOTE: This API returns a list - of any pending updates to the cluster state. These are distinct from the tasks - reported by the Task Management API which include periodic tasks and tasks initiated - by the user, such as node stats, search queries, or create index requests. However, - if a user-initiated task such as a create index command causes a cluster state - update, the activity of this task might be reported by both task api and pending - cluster tasks API. + .. raw:: html + +

Get the pending cluster tasks. + Get information about cluster-level changes (such as create index, update mapping, allocate or fail shard) that have not yet taken effect.

+

NOTE: This API returns a list of any pending updates to the cluster state. + These are distinct from the tasks reported by the task management API which include periodic tasks and tasks initiated by the user, such as node stats, search queries, or create index requests. + However, if a user-initiated task such as a create index command causes a cluster state update, the activity of this task might be reported by both task api and pending cluster tasks API.

+ - ``_ + ``_ :param local: If `true`, the request retrieves information from the local node only. If `false`, information is retrieved from the master node. @@ -623,9 +652,26 @@ def post_voting_config_exclusions( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the cluster voting config exclusions by node ids or node names. + .. raw:: html - ``_ +

Update voting configuration exclusions. + Update the cluster voting config exclusions by node IDs or node names. + By default, if there are more than three master-eligible nodes in the cluster and you remove fewer than half of the master-eligible nodes in the cluster at once, the voting configuration automatically shrinks. + If you want to shrink the voting configuration to contain fewer than three nodes or to remove half or more of the master-eligible nodes in the cluster at once, use this API to remove departing nodes from the voting configuration manually. + The API adds an entry for each specified node to the cluster’s voting configuration exclusions list. + It then waits until the cluster has reconfigured its voting configuration to exclude the specified nodes.

+

Clusters should have no voting configuration exclusions in normal operation. + Once the excluded nodes have stopped, clear the voting configuration exclusions with DELETE /_cluster/voting_config_exclusions. + This API waits for the nodes to be fully removed from the cluster before it returns. + If your cluster has voting configuration exclusions for nodes that you no longer intend to remove, use DELETE /_cluster/voting_config_exclusions?wait_for_removal=false to clear the voting configuration exclusions without waiting for the nodes to leave the cluster.

+

A response to POST /_cluster/voting_config_exclusions with an HTTP status code of 200 OK guarantees that the node has been removed from the voting configuration and will not be reinstated until the voting configuration exclusions are cleared by calling DELETE /_cluster/voting_config_exclusions. + If the call to POST /_cluster/voting_config_exclusions fails or returns a response with an HTTP status code other than 200 OK then the node may not have been removed from the voting configuration. + In that case, you may safely retry the call.

+

NOTE: Voting exclusions are required only when you remove at least half of the master-eligible nodes from a cluster in a short time period. + They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.

+ + + ``_ :param node_ids: A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify @@ -685,22 +731,25 @@ def put_component_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a component template. Creates or updates a component template. - Component templates are building blocks for constructing index templates that - specify index mappings, settings, and aliases. An index template can be composed - of multiple component templates. To use a component template, specify it in an - index template’s `composed_of` list. Component templates are only applied to - new data streams and indices as part of a matching index template. Settings and - mappings specified directly in the index template or the create index request - override any settings or mappings specified in a component template. Component - templates are only used during index creation. For data streams, this includes - data stream creation and the creation of a stream’s backing indices. Changes - to component templates do not affect existing indices, including a stream’s backing - indices. You can use C-style `/* *\\/` block comments in component templates. - You can include comments anywhere in the request body except before the opening - curly bracket. - - ``_ + .. raw:: html + +

Create or update a component template. + Component templates are building blocks for constructing index templates that specify index mappings, settings, and aliases.

+

An index template can be composed of multiple component templates. + To use a component template, specify it in an index template’s composed_of list. + Component templates are only applied to new data streams and indices as part of a matching index template.

+

Settings and mappings specified directly in the index template or the create index request override any settings or mappings specified in a component template.

+

Component templates are only used during index creation. + For data streams, this includes data stream creation and the creation of a stream’s backing indices. + Changes to component templates do not affect existing indices, including a stream’s backing indices.

+

You can use C-style /* *\\/ block comments in component templates. + You can include comments anywhere in the request body except before the opening curly bracket.

+

Applying component templates

+

You cannot directly apply a component template to a data stream or index. + To be applied, a component template must be included in an index template's composed_of list.

+ + + ``_ :param name: Name of the component template to create. Elasticsearch includes the following built-in component templates: `logs-mappings`; `logs-settings`; @@ -721,8 +770,8 @@ def put_component_template( :param master_timeout: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - :param meta: Optional user metadata about the component template. May have any - contents. This map is not automatically generated by Elasticsearch. This + :param meta: Optional user metadata about the component template. It may have + any contents. This map is not automatically generated by Elasticsearch. This information is stored in the cluster state, so keeping it short is preferable. To unset `_meta`, replace the template without specifying this information. :param version: Version number used to manage component templates externally. @@ -787,9 +836,25 @@ def put_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the cluster settings. + .. raw:: html - ``_ +

Update the cluster settings. + Configure and update dynamic settings on a running cluster. + You can also configure dynamic settings locally on an unstarted or shut down node in elasticsearch.yml.

+

Updates made with this API can be persistent, which apply across cluster restarts, or transient, which reset after a cluster restart. + You can also reset transient or persistent settings by assigning them a null value.

+

If you configure the same setting using multiple methods, Elasticsearch applies the settings in following order of precedence: 1) Transient setting; 2) Persistent setting; 3) elasticsearch.yml setting; 4) Default setting value. + For example, you can apply a transient setting to override a persistent setting or elasticsearch.yml setting. + However, a change to an elasticsearch.yml setting will not override a defined transient or persistent setting.

+

TIP: In Elastic Cloud, use the user settings feature to configure all cluster settings. This method automatically rejects unsafe settings that could break your cluster. + If you run Elasticsearch on your own hardware, use this API to configure dynamic cluster settings. + Only use elasticsearch.yml for static cluster settings and node settings. + The API doesn’t require a restart and ensures a setting’s value is the same on all nodes.

+

WARNING: Transient cluster settings are no longer recommended. Use persistent cluster settings instead. + If a cluster becomes unstable, transient settings can clear unexpectedly, resulting in a potentially undesired cluster configuration.

+ + + ``_ :param flat_settings: Return settings in flat format (default: false) :param master_timeout: Explicit operation timeout for connection to master node @@ -841,11 +906,14 @@ def remote_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - The cluster remote info API allows you to retrieve all of the configured remote - cluster information. It returns connection and endpoint information keyed by - the configured remote cluster alias. + .. raw:: html + +

Get remote cluster information. + Get all of the configured remote cluster information. + This API returns connection and endpoint information keyed by the configured remote cluster alias.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_remote/info" @@ -888,15 +956,29 @@ def reroute( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows to manually change the allocation of individual shards in the cluster. + .. raw:: html + +

Reroute the cluster. + Manually change the allocation of individual shards in the cluster. + For example, a shard can be moved from one node to another explicitly, an allocation can be canceled, and an unassigned shard can be explicitly allocated to a specific node.

+

It is important to note that after processing any reroute commands Elasticsearch will perform rebalancing as normal (respecting the values of settings such as cluster.routing.rebalance.enable) in order to remain in a balanced state. + For example, if the requested allocation includes moving a shard from node1 to node2 then this may cause a shard to be moved from node2 back to node1 to even things out.

+

The cluster can be set to disable allocations using the cluster.routing.allocation.enable setting. + If allocations are disabled then the only allocations that will be performed are explicit ones given using the reroute command, and consequent allocations due to rebalancing.

+

The cluster will attempt to allocate a shard a maximum of index.allocation.max_retries times in a row (defaults to 5), before giving up and leaving the shard unallocated. + This scenario can be caused by structural problems such as having an analyzer which refers to a stopwords file which doesn’t exist on all nodes.

+

Once the problem has been corrected, allocation can be manually retried by calling the reroute API with the ?retry_failed URI query parameter, which will attempt a single retry round for these shards.

- ``_ + + ``_ :param commands: Defines the commands to perform. - :param dry_run: If true, then the request simulates the operation only and returns - the resulting state. + :param dry_run: If true, then the request simulates the operation. It will calculate + the result of applying the commands to the current cluster state and return + the resulting cluster state after the commands (and rebalancing) have been + applied; it will not actually perform the requested changes. :param explain: If true, then the response contains an explanation of why the - commands can or cannot be executed. + commands can or cannot run. :param master_timeout: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. @@ -975,9 +1057,25 @@ def state( wait_for_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns a comprehensive information about the state of the cluster. + .. raw:: html + +

Get the cluster state. + Get comprehensive information about the state of the cluster.

+

The cluster state is an internal data structure which keeps track of a variety of information needed by every node, including the identity and attributes of the other nodes in the cluster; cluster-wide settings; index metadata, including the mapping and settings for each index; the location and status of every shard copy in the cluster.

+

The elected master node ensures that every node in the cluster has a copy of the same cluster state. + This API lets you retrieve a representation of this internal state for debugging or diagnostic purposes. + You may need to consult the Elasticsearch source code to determine the precise meaning of the response.

+

By default the API will route requests to the elected master node since this node is the authoritative source of cluster states. + You can also retrieve the cluster state held on the node handling the API request by adding the ?local=true query parameter.

+

Elasticsearch may need to expend significant effort to compute a response to this API in larger clusters, and the response may comprise a very large quantity of data. + If you use this API repeatedly, your cluster may become unstable.

+

WARNING: The response is a representation of an internal data structure. + Its format is not subject to the same compatibility guarantees as other more stable APIs and may change from version to version. + Do not query this API using external monitoring tools. + Instead, obtain the information you require using other more stable cluster APIs.

+ - ``_ + ``_ :param metric: Limit the information returned to the specified metrics :param index: A comma-separated list of index names; use `_all` or empty string @@ -1053,21 +1151,23 @@ def stats( node_id: t.Optional[t.Union[str, t.Sequence[str]]] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, - flat_settings: t.Optional[bool] = None, human: t.Optional[bool] = None, + include_remotes: t.Optional[bool] = None, pretty: t.Optional[bool] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster statistics. It returns basic index metrics (shard numbers, store - size, memory usage) and information about the current nodes that form the cluster - (number, roles, os, jvm versions, memory usage, cpu and installed plugins). + .. raw:: html + +

Get cluster statistics. + Get basic index metrics (shard numbers, store size, memory usage) and information about the current nodes that form the cluster (number, roles, os, jvm versions, memory usage, cpu and installed plugins).

- ``_ + + ``_ :param node_id: Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. - :param flat_settings: If `true`, returns settings in flat format. + :param include_remotes: Include remote cluster data into the response :param timeout: Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, timed out nodes are included in the response’s `_nodes.failed` property. @@ -1085,10 +1185,10 @@ def stats( __query["error_trace"] = error_trace if filter_path is not None: __query["filter_path"] = filter_path - if flat_settings is not None: - __query["flat_settings"] = flat_settings if human is not None: __query["human"] = human + if include_remotes is not None: + __query["include_remotes"] = include_remotes if pretty is not None: __query["pretty"] = pretty if timeout is not None: diff --git a/elasticsearch/_sync/client/connector.py b/elasticsearch/_sync/client/connector.py index d097da30b..76c7d8735 100644 --- a/elasticsearch/_sync/client/connector.py +++ b/elasticsearch/_sync/client/connector.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class ConnectorClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def check_in( self, *, @@ -36,9 +43,13 @@ def check_in( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the last_seen field in the connector, and sets it to current timestamp + .. raw:: html - ``_ +

Check in a connector.

+

Update the last_seen field in the connector and set it to the current timestamp.

+ + + ``_ :param connector_id: The unique identifier of the connector to be checked in """ @@ -66,6 +77,7 @@ def check_in( ) @_rewrite_parameters() + @_stability_warning(Stability.BETA) def delete( self, *, @@ -77,9 +89,16 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a connector. + .. raw:: html + +

Delete a connector.

+

Removes a connector and associated sync jobs. + This is a destructive action that is not recoverable. + NOTE: This action doesn’t delete any API keys, ingest pipelines, or data indices associated with the connector. + These need to be removed manually.

- ``_ + + ``_ :param connector_id: The unique identifier of the connector to be deleted :param delete_sync_jobs: A flag indicating if associated sync jobs should be @@ -111,6 +130,7 @@ def delete( ) @_rewrite_parameters() + @_stability_warning(Stability.BETA) def get( self, *, @@ -121,9 +141,13 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a connector. + .. raw:: html + +

Get a connector.

+

Get the details about a connector.

- ``_ + + ``_ :param connector_id: The unique identifier of the connector """ @@ -166,6 +190,7 @@ def get( "sync_cursor", ), ) + @_stability_warning(Stability.EXPERIMENTAL) def last_sync( self, *, @@ -215,9 +240,14 @@ def last_sync( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates last sync stats in the connector document + .. raw:: html + +

Update the connector last sync stats.

+

Update the fields related to the last sync of a connector. + This action is used for analytics and monitoring.

- ``_ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param last_access_control_sync_error: @@ -294,6 +324,7 @@ def last_sync( @_rewrite_parameters( parameter_aliases={"from": "from_"}, ) + @_stability_warning(Stability.BETA) def list( self, *, @@ -309,9 +340,13 @@ def list( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns existing connectors. + .. raw:: html + +

Get all connectors.

+

Get information about all connectors.

- ``_ + + ``_ :param connector_name: A comma-separated list of connector names to fetch connector documents for @@ -367,6 +402,7 @@ def list( "service_type", ), ) + @_stability_warning(Stability.BETA) def post( self, *, @@ -383,9 +419,15 @@ def post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a connector. + .. raw:: html + +

Create a connector.

+

Connectors are Elasticsearch integrations that bring content from third-party data sources, which can be deployed on Elastic Cloud or hosted on your own infrastructure. + Elastic managed connectors (Native connectors) are a managed service on Elastic Cloud. + Self-managed connectors (Connector clients) are self-managed on your infrastructure.

- ``_ + + ``_ :param description: :param index_name: @@ -444,6 +486,7 @@ def post( "service_type", ), ) + @_stability_warning(Stability.BETA) def put( self, *, @@ -461,9 +504,12 @@ def put( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a connector. + .. raw:: html + +

Create or update a connector.

- ``_ + + ``_ :param connector_id: The unique identifier of the connector to be created or updated. ID is auto-generated if not provided. @@ -520,6 +566,7 @@ def put( ) @_rewrite_parameters() + @_stability_warning(Stability.BETA) def sync_job_cancel( self, *, @@ -530,9 +577,14 @@ def sync_job_cancel( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancels a connector sync job. + .. raw:: html + +

Cancel a connector sync job.

+

Cancel a connector sync job, which sets the status to cancelling and updates cancellation_requested_at to the current time. + The connector service is then responsible for setting the status of connector sync jobs to cancelled.

- ``_ + + ``_ :param connector_sync_job_id: The unique identifier of the connector sync job """ @@ -564,6 +616,130 @@ def sync_job_cancel( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def sync_job_check_in( + self, + *, + connector_sync_job_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Check in a connector sync job. + Check in a connector sync job and set the last_seen field to the current time before updating it in the internal index.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_sync_job_id: The unique identifier of the connector sync job + to be checked in. + """ + if connector_sync_job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_sync_job_id'") + __path_parts: t.Dict[str, str] = { + "connector_sync_job_id": _quote(connector_sync_job_id) + } + __path = ( + f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_check_in' + ) + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + endpoint_id="connector.sync_job_check_in", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("worker_hostname", "sync_cursor"), + ) + @_stability_warning(Stability.EXPERIMENTAL) + def sync_job_claim( + self, + *, + connector_sync_job_id: str, + worker_hostname: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + sync_cursor: t.Optional[t.Any] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Claim a connector sync job. + This action updates the job status to in_progress and sets the last_seen and started_at timestamps to the current time. + Additionally, it can set the sync_cursor property for the sync job.

+

This API is not intended for direct connector management by users. + It supports the implementation of services that utilize the connector protocol to communicate with Elasticsearch.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_sync_job_id: The unique identifier of the connector sync job. + :param worker_hostname: The host name of the current system that will run the + job. + :param sync_cursor: The cursor object from the last incremental sync job. This + should reference the `sync_cursor` field in the connector state for which + the job runs. + """ + if connector_sync_job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_sync_job_id'") + if worker_hostname is None and body is None: + raise ValueError("Empty value passed for parameter 'worker_hostname'") + __path_parts: t.Dict[str, str] = { + "connector_sync_job_id": _quote(connector_sync_job_id) + } + __path = f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_claim' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if worker_hostname is not None: + __body["worker_hostname"] = worker_hostname + if sync_cursor is not None: + __body["sync_cursor"] = sync_cursor + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.sync_job_claim", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.BETA) def sync_job_delete( self, *, @@ -574,9 +750,14 @@ def sync_job_delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a connector sync job. + .. raw:: html + +

Delete a connector sync job.

+

Remove a connector sync job and its associated data. + This is a destructive action that is not recoverable.

+ - ``_ + ``_ :param connector_sync_job_id: The unique identifier of the connector sync job to be deleted @@ -606,7 +787,69 @@ def sync_job_delete( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("error",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + def sync_job_error( + self, + *, + connector_sync_job_id: str, + error: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Set a connector sync job error. + Set the error field for a connector sync job and set its status to error.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_sync_job_id: The unique identifier for the connector sync job. + :param error: The error for the connector sync job error field. + """ + if connector_sync_job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_sync_job_id'") + if error is None and body is None: + raise ValueError("Empty value passed for parameter 'error'") + __path_parts: t.Dict[str, str] = { + "connector_sync_job_id": _quote(connector_sync_job_id) + } + __path = f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_error' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if error is not None: + __body["error"] = error + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.sync_job_error", + path_parts=__path_parts, + ) + @_rewrite_parameters() + @_stability_warning(Stability.BETA) def sync_job_get( self, *, @@ -617,9 +860,12 @@ def sync_job_get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a connector sync job. + .. raw:: html + +

Get a connector sync job.

+ - ``_ + ``_ :param connector_sync_job_id: The unique identifier of the connector sync job """ @@ -651,6 +897,7 @@ def sync_job_get( @_rewrite_parameters( parameter_aliases={"from": "from_"}, ) + @_stability_warning(Stability.BETA) def sync_job_list( self, *, @@ -685,9 +932,13 @@ def sync_job_list( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Lists connector sync jobs. + .. raw:: html - ``_ +

Get all connector sync jobs.

+

Get information about all stored connector sync jobs listed by their creation date in ascending order.

+ + + ``_ :param connector_id: A connector id to fetch connector sync jobs for :param from_: Starting offset (default: 0) @@ -729,6 +980,7 @@ def sync_job_list( @_rewrite_parameters( body_fields=("id", "job_type", "trigger_method"), ) + @_stability_warning(Stability.BETA) def sync_job_post( self, *, @@ -746,9 +998,13 @@ def sync_job_post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a connector sync job. + .. raw:: html + +

Create a connector sync job.

+

Create a connector sync job document in the internal index and initialize its counters and timestamps with default values.

+ - ``_ + ``_ :param id: The id of the associated connector :param job_type: @@ -786,7 +1042,111 @@ def sync_job_post( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=( + "deleted_document_count", + "indexed_document_count", + "indexed_document_volume", + "last_seen", + "metadata", + "total_document_count", + ), + ) + @_stability_warning(Stability.EXPERIMENTAL) + def sync_job_update_stats( + self, + *, + connector_sync_job_id: str, + deleted_document_count: t.Optional[int] = None, + indexed_document_count: t.Optional[int] = None, + indexed_document_volume: t.Optional[int] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + last_seen: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + metadata: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + total_document_count: t.Optional[int] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Set the connector sync job stats. + Stats include: deleted_document_count, indexed_document_count, indexed_document_volume, and total_document_count. + You can also update last_seen. + This API is mainly used by the connector service for updating sync job information.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_sync_job_id: The unique identifier of the connector sync job. + :param deleted_document_count: The number of documents the sync job deleted. + :param indexed_document_count: The number of documents the sync job indexed. + :param indexed_document_volume: The total size of the data (in MiB) the sync + job indexed. + :param last_seen: The timestamp to use in the `last_seen` property for the connector + sync job. + :param metadata: The connector-specific metadata. + :param total_document_count: The total number of documents in the target index + after the sync job finished. + """ + if connector_sync_job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_sync_job_id'") + if deleted_document_count is None and body is None: + raise ValueError( + "Empty value passed for parameter 'deleted_document_count'" + ) + if indexed_document_count is None and body is None: + raise ValueError( + "Empty value passed for parameter 'indexed_document_count'" + ) + if indexed_document_volume is None and body is None: + raise ValueError( + "Empty value passed for parameter 'indexed_document_volume'" + ) + __path_parts: t.Dict[str, str] = { + "connector_sync_job_id": _quote(connector_sync_job_id) + } + __path = f'/_connector/_sync_job/{__path_parts["connector_sync_job_id"]}/_stats' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if deleted_document_count is not None: + __body["deleted_document_count"] = deleted_document_count + if indexed_document_count is not None: + __body["indexed_document_count"] = indexed_document_count + if indexed_document_volume is not None: + __body["indexed_document_volume"] = indexed_document_volume + if last_seen is not None: + __body["last_seen"] = last_seen + if metadata is not None: + __body["metadata"] = metadata + if total_document_count is not None: + __body["total_document_count"] = total_document_count + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.sync_job_update_stats", + path_parts=__path_parts, + ) + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def update_active_filtering( self, *, @@ -797,9 +1157,13 @@ def update_active_filtering( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Activates the valid draft filtering for a connector. + .. raw:: html + +

Activate the connector draft filter.

+

Activates the valid draft filtering for a connector.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated """ @@ -829,6 +1193,7 @@ def update_active_filtering( @_rewrite_parameters( body_fields=("api_key_id", "api_key_secret_id"), ) + @_stability_warning(Stability.BETA) def update_api_key_id( self, *, @@ -842,9 +1207,16 @@ def update_api_key_id( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the API key id in the connector document + .. raw:: html - ``_ +

Update the connector API key ID.

+

Update the api_key_id and api_key_secret_id fields of a connector. + You can specify the ID of the API key used for authorization and the ID of the connector secret where the API key is stored. + The connector secret ID is required only for Elastic managed (native) connectors. + Self-managed connectors (connector clients) do not use this field.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param api_key_id: @@ -883,6 +1255,7 @@ def update_api_key_id( @_rewrite_parameters( body_fields=("configuration", "values"), ) + @_stability_warning(Stability.BETA) def update_configuration( self, *, @@ -896,9 +1269,13 @@ def update_configuration( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the configuration field in the connector document + .. raw:: html + +

Update the connector configuration.

+

Update the configuration field in the connector document.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param configuration: @@ -937,6 +1314,7 @@ def update_configuration( @_rewrite_parameters( body_fields=("error",), ) + @_stability_warning(Stability.EXPERIMENTAL) def update_error( self, *, @@ -949,9 +1327,15 @@ def update_error( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the filtering field in the connector document + .. raw:: html - ``_ +

Update the connector error field.

+

Set the error field for the connector. + If the error provided in the request body is non-null, the connector’s status is updated to error. + Otherwise, if the error is reset to null, the connector status is updated to connected.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param error: @@ -986,9 +1370,78 @@ def update_error( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("features",), + ) + @_stability_warning(Stability.EXPERIMENTAL) + def update_features( + self, + *, + connector_id: str, + features: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update the connector features. + Update the connector features in the connector document. + This API can be used to control the following aspects of a connector:

+
    +
  • document-level security
  • +
  • incremental syncs
  • +
  • advanced sync rules
  • +
  • basic sync rules
  • +
+

Normally, the running connector service automatically manages these features. + However, you can use this API to override the default behavior.

+

To sync data using self-managed connectors, you need to deploy the Elastic connector service on your own infrastructure. + This service runs automatically on Elastic Cloud for Elastic managed connectors.

+ + + ``_ + + :param connector_id: The unique identifier of the connector to be updated. + :param features: + """ + if connector_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'connector_id'") + if features is None and body is None: + raise ValueError("Empty value passed for parameter 'features'") + __path_parts: t.Dict[str, str] = {"connector_id": _quote(connector_id)} + __path = f'/_connector/{__path_parts["connector_id"]}/_features' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if features is not None: + __body["features"] = features + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="connector.update_features", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("advanced_snippet", "filtering", "rules"), ) + @_stability_warning(Stability.BETA) def update_filtering( self, *, @@ -1003,9 +1456,15 @@ def update_filtering( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the filtering field in the connector document + .. raw:: html + +

Update the connector filtering.

+

Update the draft filtering configuration of a connector and marks the draft validation state as edited. + The filtering draft is activated once validated by the running Elastic connector service. + The filtering property is used to configure sync rules (both basic and advanced) for a connector.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param advanced_snippet: @@ -1047,6 +1506,7 @@ def update_filtering( @_rewrite_parameters( body_fields=("validation",), ) + @_stability_warning(Stability.EXPERIMENTAL) def update_filtering_validation( self, *, @@ -1059,9 +1519,13 @@ def update_filtering_validation( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the draft filtering validation info for a connector. + .. raw:: html - ``_ +

Update the connector draft filtering validation.

+

Update the draft filtering validation info for a connector.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param validation: @@ -1099,6 +1563,7 @@ def update_filtering_validation( @_rewrite_parameters( body_fields=("index_name",), ) + @_stability_warning(Stability.BETA) def update_index_name( self, *, @@ -1111,9 +1576,13 @@ def update_index_name( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the index_name in the connector document + .. raw:: html + +

Update the connector index name.

+

Update the index_name field of a connector, specifying the index where the data ingested by the connector is stored.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param index_name: @@ -1151,6 +1620,7 @@ def update_index_name( @_rewrite_parameters( body_fields=("description", "name"), ) + @_stability_warning(Stability.BETA) def update_name( self, *, @@ -1164,9 +1634,12 @@ def update_name( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the name and description fields in the connector document + .. raw:: html - ``_ +

Update the connector name and description.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param description: @@ -1205,6 +1678,7 @@ def update_name( @_rewrite_parameters( body_fields=("is_native",), ) + @_stability_warning(Stability.BETA) def update_native( self, *, @@ -1217,9 +1691,12 @@ def update_native( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the is_native flag in the connector document + .. raw:: html + +

Update the connector is_native flag.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param is_native: @@ -1257,6 +1734,7 @@ def update_native( @_rewrite_parameters( body_fields=("pipeline",), ) + @_stability_warning(Stability.BETA) def update_pipeline( self, *, @@ -1269,9 +1747,13 @@ def update_pipeline( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the pipeline field in the connector document + .. raw:: html - ``_ +

Update the connector pipeline.

+

When you create a new connector, the configuration of an ingest pipeline is populated with default settings.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param pipeline: @@ -1309,6 +1791,7 @@ def update_pipeline( @_rewrite_parameters( body_fields=("scheduling",), ) + @_stability_warning(Stability.BETA) def update_scheduling( self, *, @@ -1321,9 +1804,12 @@ def update_scheduling( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the scheduling field in the connector document + .. raw:: html + +

Update the connector scheduling.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param scheduling: @@ -1361,6 +1847,7 @@ def update_scheduling( @_rewrite_parameters( body_fields=("service_type",), ) + @_stability_warning(Stability.BETA) def update_service_type( self, *, @@ -1373,9 +1860,12 @@ def update_service_type( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the service type of the connector + .. raw:: html - ``_ +

Update the connector service type.

+ + + ``_ :param connector_id: The unique identifier of the connector to be updated :param service_type: @@ -1413,6 +1903,7 @@ def update_service_type( @_rewrite_parameters( body_fields=("status",), ) + @_stability_warning(Stability.EXPERIMENTAL) def update_status( self, *, @@ -1432,9 +1923,12 @@ def update_status( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the status of the connector + .. raw:: html + +

Update the connector status.

+ - ``_ + ``_ :param connector_id: The unique identifier of the connector to be updated :param status: diff --git a/elasticsearch/_sync/client/dangling_indices.py b/elasticsearch/_sync/client/dangling_indices.py index 4cf0ec024..28f228ca6 100644 --- a/elasticsearch/_sync/client/dangling_indices.py +++ b/elasticsearch/_sync/client/dangling_indices.py @@ -39,13 +39,19 @@ def delete_dangling_index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes the specified dangling index + .. raw:: html - ``_ +

Delete a dangling index. + If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

- :param index_uuid: The UUID of the dangling index - :param accept_data_loss: Must be set to true in order to delete the dangling - index + + ``_ + + :param index_uuid: The UUID of the index to delete. Use the get dangling indices + API to find the UUID. + :param accept_data_loss: This parameter must be set to true to acknowledge that + it will no longer be possible to recove data from the dangling index. :param master_timeout: Specify timeout for connection to master :param timeout: Explicit operation timeout """ @@ -94,13 +100,22 @@ def import_dangling_index( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Imports the specified dangling index + .. raw:: html + +

Import a dangling index.

+

If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

- ``_ - :param index_uuid: The UUID of the dangling index - :param accept_data_loss: Must be set to true in order to import the dangling - index + ``_ + + :param index_uuid: The UUID of the index to import. Use the get dangling indices + API to locate the UUID. + :param accept_data_loss: This parameter must be set to true to import a dangling + index. Because Elasticsearch cannot know where the dangling index data came + from or determine which shard copies are fresh and which are stale, it cannot + guarantee that the imported data represents the latest state of the index + when it was last in the cluster. :param master_timeout: Specify timeout for connection to master :param timeout: Explicit operation timeout """ @@ -145,9 +160,15 @@ def list_dangling_indices( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns all dangling indices. + .. raw:: html + +

Get the dangling indices.

+

If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling. + For example, this can happen if you delete more than cluster.indices.tombstones.size indices while an Elasticsearch node is offline.

+

Use this API to list dangling indices, which you can then import or delete.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_dangling" diff --git a/elasticsearch/_sync/client/enrich.py b/elasticsearch/_sync/client/enrich.py index 6a855c402..1d76ab4d0 100644 --- a/elasticsearch/_sync/client/enrich.py +++ b/elasticsearch/_sync/client/enrich.py @@ -36,9 +36,13 @@ def delete_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an enrich policy. Deletes an existing enrich policy and its enrich index. + .. raw:: html - ``_ +

Delete an enrich policy. + Deletes an existing enrich policy and its enrich index.

+ + + ``_ :param name: Enrich policy to delete. """ @@ -77,9 +81,13 @@ def execute_policy( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates the enrich index for an existing enrich policy. + .. raw:: html + +

Run an enrich policy. + Create the enrich index for an existing enrich policy.

- ``_ + + ``_ :param name: Enrich policy to execute. :param wait_for_completion: If `true`, the request blocks other enrich policy @@ -121,9 +129,13 @@ def get_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an enrich policy. Returns information about an enrich policy. + .. raw:: html + +

Get an enrich policy. + Returns information about an enrich policy.

- ``_ + + ``_ :param name: Comma-separated list of enrich policy names used to limit the request. To return information for all enrich policies, omit this parameter. @@ -171,9 +183,13 @@ def put_policy( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an enrich policy. Creates an enrich policy. + .. raw:: html + +

Create an enrich policy. + Creates an enrich policy.

+ - ``_ + ``_ :param name: Name of the enrich policy to create or update. :param geo_match: Matches enrich data to incoming documents based on a `geo_shape` @@ -224,10 +240,13 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get enrich stats. Returns enrich coordinator statistics and information about - enrich policies that are currently executing. + .. raw:: html + +

Get enrich stats. + Returns enrich coordinator statistics and information about enrich policies that are currently executing.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_enrich/_stats" diff --git a/elasticsearch/_sync/client/eql.py b/elasticsearch/_sync/client/eql.py index ce3e515f3..6b97b985b 100644 --- a/elasticsearch/_sync/client/eql.py +++ b/elasticsearch/_sync/client/eql.py @@ -36,10 +36,14 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an async EQL search or a stored synchronous EQL search. The API also - deletes results for the search. + .. raw:: html - ``_ +

Delete an async EQL search. + Delete an async EQL search or a stored synchronous EQL search. + The API also deletes results for the search.

+ + + ``_ :param id: Identifier for the search to delete. A search ID is provided in the EQL search API's response for an async search. A search ID is also provided @@ -83,10 +87,13 @@ def get( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current status and available results for an async EQL search or a - stored synchronous EQL search. + .. raw:: html + +

Get async EQL search results. + Get the current status and available results for an async EQL search or a stored synchronous EQL search.

+ - ``_ + ``_ :param id: Identifier for the search. :param keep_alive: Period for which the search and its results are stored on @@ -134,10 +141,13 @@ def get_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current status for an async EQL search or a stored synchronous EQL - search without returning results. + .. raw:: html - ``_ +

Get the async EQL status. + Get the current status for an async EQL search or a stored synchronous EQL search without returning results.

+ + + ``_ :param id: Identifier for the search. """ @@ -223,9 +233,14 @@ def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns results matching a query expressed in Event Query Language (EQL) + .. raw:: html + +

Get EQL search results. + Returns search results for an Event Query Language (EQL) query. + EQL assumes each document in a data stream or index corresponds to an event.

+ - ``_ + ``_ :param index: The name of the index to scope the operation :param query: EQL query you wish to run. diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py index 844223895..6fcfbfa50 100644 --- a/elasticsearch/_sync/client/esql.py +++ b/elasticsearch/_sync/client/esql.py @@ -20,7 +20,7 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import _rewrite_parameters +from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters class EsqlClient(NamespacedClient): @@ -30,6 +30,288 @@ class EsqlClient(NamespacedClient): "query", "columnar", "filter", + "include_ccs_metadata", + "locale", + "params", + "profile", + "tables", + ), + ignore_deprecated_options={"params"}, + ) + def async_query( + self, + *, + query: t.Optional[str] = None, + columnar: t.Optional[bool] = None, + delimiter: t.Optional[str] = None, + drop_null_columns: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter: t.Optional[t.Mapping[str, t.Any]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + format: t.Optional[ + t.Union[ + str, + t.Literal[ + "arrow", "cbor", "csv", "json", "smile", "tsv", "txt", "yaml" + ], + ] + ] = None, + human: t.Optional[bool] = None, + include_ccs_metadata: t.Optional[bool] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + keep_on_completion: t.Optional[bool] = None, + locale: t.Optional[str] = None, + params: t.Optional[ + t.Sequence[t.Union[None, bool, float, int, str, t.Any]] + ] = None, + pretty: t.Optional[bool] = None, + profile: t.Optional[bool] = None, + tables: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Mapping[str, t.Any]]] + ] = None, + wait_for_completion_timeout: t.Optional[ + t.Union[str, t.Literal[-1], t.Literal[0]] + ] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Run an async ES|QL query. + Asynchronously run an ES|QL (Elasticsearch query language) query, monitor its progress, and retrieve results when they become available.

+

The API accepts the same parameters and request body as the synchronous query API, along with additional async related properties.

+ + + ``_ + + :param query: The ES|QL query API accepts an ES|QL query string in the query + parameter, runs it, and returns the results. + :param columnar: By default, ES|QL returns results as rows. For example, FROM + returns each individual document as one row. For the JSON, YAML, CBOR and + smile formats, ES|QL can return the results in a columnar fashion where one + row represents all the values of a certain column in the results. + :param delimiter: The character to use between values within a CSV row. It is + valid only for the CSV format. + :param drop_null_columns: Indicates whether columns that are entirely `null` + will be removed from the `columns` and `values` portion of the results. If + `true`, the response will include an extra section under the name `all_columns` + which has the name of all the columns. + :param filter: Specify a Query DSL query in the filter parameter to filter the + set of documents that an ES|QL query runs on. + :param format: A short version of the Accept header, for example `json` or `yaml`. + :param include_ccs_metadata: When set to `true` and performing a cross-cluster + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. + :param keep_alive: The period for which the query and its results are stored + in the cluster. The default period is five days. When this period expires, + the query and its results are deleted, even if the query is still ongoing. + If the `keep_on_completion` parameter is false, Elasticsearch only stores + async queries that do not complete within the period set by the `wait_for_completion_timeout` + parameter, regardless of this value. + :param keep_on_completion: Indicates whether the query and its results are stored + in the cluster. If false, the query and its results are stored in the cluster + only if the request does not complete during the period set by the `wait_for_completion_timeout` + parameter. + :param locale: + :param params: To avoid any attempts of hacking or code injection, extract the + values in a separate list of parameters. Use question mark placeholders (?) + in the query string for each of the parameters. + :param profile: If provided and `true` the response will include an extra `profile` + object with information on how the query was executed. This information is + for human debugging and its format can change at any time but it can give + some insight into the performance of each part of the query. + :param tables: Tables to use with the LOOKUP operation. The top level key is + the table name and the next level key is the column name. + :param wait_for_completion_timeout: The period to wait for the request to finish. + By default, the request waits for 1 second for the query results. If the + query completes during this period, results are returned Otherwise, a query + ID is returned that can later be used to retrieve the results. + """ + if query is None and body is None: + raise ValueError("Empty value passed for parameter 'query'") + __path_parts: t.Dict[str, str] = {} + __path = "/_query/async" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if delimiter is not None: + __query["delimiter"] = delimiter + if drop_null_columns is not None: + __query["drop_null_columns"] = drop_null_columns + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if format is not None: + __query["format"] = format + if human is not None: + __query["human"] = human + if keep_alive is not None: + __query["keep_alive"] = keep_alive + if keep_on_completion is not None: + __query["keep_on_completion"] = keep_on_completion + if pretty is not None: + __query["pretty"] = pretty + if wait_for_completion_timeout is not None: + __query["wait_for_completion_timeout"] = wait_for_completion_timeout + if not __body: + if query is not None: + __body["query"] = query + if columnar is not None: + __body["columnar"] = columnar + if filter is not None: + __body["filter"] = filter + if include_ccs_metadata is not None: + __body["include_ccs_metadata"] = include_ccs_metadata + if locale is not None: + __body["locale"] = locale + if params is not None: + __body["params"] = params + if profile is not None: + __body["profile"] = profile + if tables is not None: + __body["tables"] = tables + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="esql.async_query", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + def async_query_delete( + self, + *, + id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Delete an async ES|QL query. + If the query is still running, it is cancelled. + Otherwise, the stored results are deleted.

+

If the Elasticsearch security features are enabled, only the following users can use this API to delete a query:

+
    +
  • The authenticated user that submitted the original query request
  • +
  • Users with the cancel_task cluster privilege
  • +
+ + + ``_ + + :param id: The unique identifier of the query. A query ID is provided in the + ES|QL async query API response for a query that does not complete in the + designated time. A query ID is also provided when the request was submitted + with the `keep_on_completion` parameter set to `true`. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_query/async/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_delete", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + def async_query_get( + self, + *, + id: str, + drop_null_columns: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + wait_for_completion_timeout: t.Optional[ + t.Union[str, t.Literal[-1], t.Literal[0]] + ] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get async ES|QL query results. + Get the current status and available results or stored results for an ES|QL asynchronous query. + If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can retrieve the results using this API.

+ + + ``_ + + :param id: The unique identifier of the query. A query ID is provided in the + ES|QL async query API response for a query that does not complete in the + designated time. A query ID is also provided when the request was submitted + with the `keep_on_completion` parameter set to `true`. + :param drop_null_columns: Indicates whether columns that are entirely `null` + will be removed from the `columns` and `values` portion of the results. If + `true`, the response will include an extra section under the name `all_columns` + which has the name of all the columns. + :param keep_alive: The period for which the query and its results are stored + in the cluster. When this period expires, the query and its results are deleted, + even if the query is still ongoing. + :param wait_for_completion_timeout: The period to wait for the request to finish. + By default, the request waits for complete query results. If the request + completes during the period specified in this parameter, complete query results + are returned. Otherwise, the response returns an `is_running` value of `true` + and no results. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_query/async/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + if drop_null_columns is not None: + __query["drop_null_columns"] = drop_null_columns + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if keep_alive is not None: + __query["keep_alive"] = keep_alive + if pretty is not None: + __query["pretty"] = pretty + if wait_for_completion_timeout is not None: + __query["wait_for_completion_timeout"] = wait_for_completion_timeout + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="esql.async_query_get", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=( + "query", + "columnar", + "filter", + "include_ccs_metadata", "locale", "params", "profile", @@ -47,8 +329,16 @@ def query( error_trace: t.Optional[bool] = None, filter: t.Optional[t.Mapping[str, t.Any]] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, - format: t.Optional[str] = None, + format: t.Optional[ + t.Union[ + str, + t.Literal[ + "arrow", "cbor", "csv", "json", "smile", "tsv", "txt", "yaml" + ], + ] + ] = None, human: t.Optional[bool] = None, + include_ccs_metadata: t.Optional[bool] = None, locale: t.Optional[str] = None, params: t.Optional[ t.Sequence[t.Union[None, bool, float, int, str, t.Any]] @@ -61,9 +351,13 @@ def query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes an ES|QL request + .. raw:: html + +

Run an ES|QL query. + Get search results for an ES|QL (Elasticsearch query language) query.

+ - ``_ + ``_ :param query: The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. @@ -80,6 +374,10 @@ def query( :param filter: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. :param format: A short version of the Accept header, e.g. json, yaml. + :param include_ccs_metadata: When set to `true` and performing a cross-cluster + query, the response will include an extra `_clusters` object with information + about the clusters that participated in the search along with info such as + shards count. :param locale: :param params: To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) @@ -118,6 +416,8 @@ def query( __body["columnar"] = columnar if filter is not None: __body["filter"] = filter + if include_ccs_metadata is not None: + __body["include_ccs_metadata"] = include_ccs_metadata if locale is not None: __body["locale"] = locale if params is not None: diff --git a/elasticsearch/_sync/client/features.py b/elasticsearch/_sync/client/features.py index 5d95b3440..34c50adf2 100644 --- a/elasticsearch/_sync/client/features.py +++ b/elasticsearch/_sync/client/features.py @@ -20,7 +20,7 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import _rewrite_parameters +from .utils import Stability, _rewrite_parameters, _stability_warning class FeaturesClient(NamespacedClient): @@ -35,10 +35,19 @@ def get_features( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets a list of features which can be included in snapshots using the feature_states - field when creating a snapshot + .. raw:: html - ``_ +

Get the features. + Get a list of features that can be included in snapshots using the feature_states field when creating a snapshot. + You can use this API to determine which feature states to include when taking a snapshot. + By default, all feature states are included in a snapshot if that snapshot includes the global state, or none if it does not.

+

A feature state includes one or more system indices necessary for a given feature to function. + In order to ensure data integrity, all system indices that comprise a feature state are snapshotted and restored together.

+

The features listed by this API are a combination of built-in features and features defined by plugins. + In order for a feature state to be listed in this API and recognized as a valid feature state by the create snapshot API, the plugin that defines that feature must be installed on the master node.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_features" @@ -62,6 +71,7 @@ def get_features( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def reset_features( self, *, @@ -71,9 +81,22 @@ def reset_features( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resets the internal state of features, usually by deleting system indices + .. raw:: html + +

Reset the features. + Clear all of the state information stored in system indices by Elasticsearch features, including the security and machine learning indices.

+

WARNING: Intended for development and testing use only. Do not reset features on a production cluster.

+

Return a cluster to the same state as a new installation by resetting the feature state for all Elasticsearch features. + This deletes all state information stored in system indices.

+

The response code is HTTP 200 if the state is successfully reset for all features. + It is HTTP 500 if the reset operation failed for any feature.

+

Note that select features might provide a way to reset particular system indices. + Using this API resets all features, both those that are built-in and implemented as plugins.

+

To list the features that will be affected, use the get features API.

+

IMPORTANT: The features installed on the node you submit this request to are the features that will be reset. Run on the master node if you have any doubts about which plugins are installed on individual nodes.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_features/_reset" diff --git a/elasticsearch/_sync/client/fleet.py b/elasticsearch/_sync/client/fleet.py index 001bcba36..f7bce669d 100644 --- a/elasticsearch/_sync/client/fleet.py +++ b/elasticsearch/_sync/client/fleet.py @@ -20,7 +20,13 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class FleetClient(NamespacedClient): @@ -40,10 +46,12 @@ def global_checkpoints( wait_for_index: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current global checkpoints for an index. This API is design for internal - use by the fleet server project. + .. raw:: html - ``_ +

Returns the current global checkpoints for an index. This API is design for internal use by the fleet server project.

+ + + ``_ :param index: A single index or index alias that resolves to a single index. :param checkpoints: A comma separated list of previous global checkpoints. When @@ -91,6 +99,7 @@ def global_checkpoints( @_rewrite_parameters( body_name="searches", ) + @_stability_warning(Stability.EXPERIMENTAL) def msearch( self, *, @@ -125,10 +134,12 @@ def msearch( wait_for_checkpoints: t.Optional[t.Sequence[int]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) - with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) - API. However, similar to the fleet search API, it supports the wait_for_checkpoints - parameter. + .. raw:: html + +

Executes several fleet searches with a single API request. + The API follows the same structure as the multi search API. However, similar to the fleet search API, it + supports the wait_for_checkpoints parameter.

+ :param searches: :param index: A single target to search. If the target is an index alias, it @@ -277,6 +288,7 @@ def msearch( "from": "from_", }, ) + @_stability_warning(Stability.EXPERIMENTAL) def search( self, *, @@ -370,9 +382,11 @@ def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The purpose of the fleet search api is to provide a search api where the search - will only be executed after provided checkpoint has been processed and is visible - for searches inside of Elasticsearch. + .. raw:: html + +

The purpose of the fleet search api is to provide a search api where the search will only be executed + after provided checkpoint has been processed and is visible for searches inside of Elasticsearch.

+ :param index: A single target to search. If the target is an index alias, it must resolve to a single index. diff --git a/elasticsearch/_sync/client/graph.py b/elasticsearch/_sync/client/graph.py index f411f3242..127b6172c 100644 --- a/elasticsearch/_sync/client/graph.py +++ b/elasticsearch/_sync/client/graph.py @@ -45,10 +45,17 @@ def explore( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Extracts and summarizes information about the documents and terms in an Elasticsearch - data stream or index. + .. raw:: html - ``_ +

Explore graph analytics. + Extract and summarize information about the documents and terms in an Elasticsearch data stream or index. + The easiest way to understand the behavior of this API is to use the Graph UI to explore connections. + An initial request to the _explore API contains a seed query that identifies the documents of interest and specifies the fields that define the vertices and connections you want to include in the graph. + Subsequent requests enable you to spider out from one more vertices of interest. + You can exclude vertices that have already been returned.

+ + + ``_ :param index: Name of the index. :param connections: Specifies or more fields from which you want to extract terms diff --git a/elasticsearch/_sync/client/ilm.py b/elasticsearch/_sync/client/ilm.py index 48a68fa2a..95d569acf 100644 --- a/elasticsearch/_sync/client/ilm.py +++ b/elasticsearch/_sync/client/ilm.py @@ -38,11 +38,13 @@ def delete_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes the specified lifecycle policy definition. You cannot delete policies - that are currently in use. If the policy is being used to manage any indices, - the request fails and returns an error. + .. raw:: html - ``_ +

Delete a lifecycle policy. + You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error.

+ + + ``_ :param name: Identifier for the policy. :param master_timeout: Period to wait for a connection to the master node. If @@ -93,11 +95,15 @@ def explain_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the index’s current lifecycle state, such as the - currently executing phase, action, and step. Shows when the index entered each - one, the definition of the running phase, and information about any failures. + .. raw:: html + +

Explain the lifecycle state. + Get the current lifecycle status for one or more indices. + For data streams, the API retrieves the current lifecycle status for the stream's backing indices.

+

The response indicates when the index entered each lifecycle state, provides the definition of the running phase, and information about any failures.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases to target. Supports wildcards (`*`). To target all data streams and indices, use `*` @@ -157,9 +163,12 @@ def get_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a lifecycle policy. + .. raw:: html + +

Get lifecycle policies.

+ - ``_ + ``_ :param name: Identifier for the policy. :param master_timeout: Period to wait for a connection to the master node. If @@ -208,9 +217,13 @@ def get_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the current index lifecycle management (ILM) status. + .. raw:: html - ``_ +

Get the ILM status. + Get the current index lifecycle management status.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ilm/status" @@ -249,12 +262,24 @@ def migrate_to_data_tiers( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Switches the indices, ILM policies, and legacy, composable and component templates - from using custom node attributes and attribute-based allocation filters to using - data tiers, and optionally deletes one legacy index template.+ Using node roles - enables ILM to automatically move the indices between data tiers. + .. raw:: html + +

Migrate to data tiers routing. + Switch the indices, ILM policies, and legacy, composable, and component templates from using custom node attributes and attribute-based allocation filters to using data tiers. + Optionally, delete one legacy index template. + Using node roles enables ILM to automatically move the indices between data tiers.

+

Migrating away from custom node attributes routing can be manually performed. + This API provides an automated way of performing three out of the four manual steps listed in the migration guide:

+
    +
  1. Stop setting the custom hot attribute on new indices.
  2. +
  3. Remove custom allocation settings from existing ILM policies.
  4. +
  5. Replace custom allocation settings from existing indices with the corresponding tier preference.
  6. +
+

ILM must be stopped before performing the migration. + Use the stop ILM and get ILM status APIs to wait until the reported operation mode is STOPPED.

- ``_ + + ``_ :param dry_run: If true, simulates the migration from node attributes based allocation filters to data tiers, but does not perform the migration. This provides @@ -304,24 +329,41 @@ def move_to_step( *, index: str, current_step: t.Optional[t.Mapping[str, t.Any]] = None, + next_step: t.Optional[t.Mapping[str, t.Any]] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, - next_step: t.Optional[t.Mapping[str, t.Any]] = None, pretty: t.Optional[bool] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Manually moves an index into the specified step and executes that step. + .. raw:: html - ``_ +

Move to a lifecycle step. + Manually move an index into a specific step in the lifecycle policy and run that step.

+

WARNING: This operation can result in the loss of data. Manually moving an index into a specific step runs that step even if it has already been performed. This is a potentially destructive action and this should be considered an expert level API.

+

You must specify both the current step and the step to be executed in the body of the request. + The request will fail if the current step does not match the step currently running for the index + This is to prevent the index from being moved from an unexpected step into the next step.

+

When specifying the target (next_step) to which the index will be moved, either the name or both the action and name fields are optional. + If only the phase is specified, the index will move to the first step of the first action in the target phase. + If the phase and action are specified, the index will move to the first step of the specified action in the specified phase. + Only actions specified in the ILM policy are considered valid. + An index cannot move to a step that is not part of its policy.

+ + + ``_ :param index: The name of the index whose lifecycle step is to change - :param current_step: - :param next_step: + :param current_step: The step that the index is expected to be in. + :param next_step: The step that you want to run. """ if index in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'index'") + if current_step is None and body is None: + raise ValueError("Empty value passed for parameter 'current_step'") + if next_step is None and body is None: + raise ValueError("Empty value passed for parameter 'next_step'") __path_parts: t.Dict[str, str] = {"index": _quote(index)} __path = f'/_ilm/move/{__path_parts["index"]}' __query: t.Dict[str, t.Any] = {} @@ -371,10 +413,14 @@ def put_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a lifecycle policy. If the specified policy exists, the policy is replaced - and the policy version is incremented. + .. raw:: html + +

Create or update a lifecycle policy. + If the specified policy exists, it is replaced and the policy version is incremented.

+

NOTE: Only the latest version of the policy is stored, you cannot revert to previous versions.

- ``_ + + ``_ :param name: Identifier for the policy. :param master_timeout: Period to wait for a connection to the master node. If @@ -431,9 +477,14 @@ def remove_policy( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes the assigned lifecycle policy and stops managing the specified index + .. raw:: html + +

Remove policies from an index. + Remove the assigned lifecycle policies from an index or a data stream's backing indices. + It also stops managing the indices.

+ - ``_ + ``_ :param index: The name of the index to remove policy on """ @@ -471,9 +522,15 @@ def retry( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retries executing the policy for an index that is in the ERROR step. + .. raw:: html - ``_ +

Retry a policy. + Retry running the lifecycle policy for an index that is in the ERROR step. + The API sets the policy back to the step where the error occurred and runs the step. + Use the explain lifecycle state API to determine whether an index is in the ERROR step.

+ + + ``_ :param index: The name of the indices (comma-separated) whose failed lifecycle step is to be retry @@ -513,12 +570,18 @@ def start( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start the index lifecycle management (ILM) plugin. + .. raw:: html + +

Start the ILM plugin. + Start the index lifecycle management plugin if it is currently stopped. + ILM is started automatically when the cluster is formed. + Restarting ILM is necessary only when it has been stopped using the stop ILM API.

- ``_ - :param master_timeout: - :param timeout: + ``_ + + :param master_timeout: Explicit operation timeout for connection to master node + :param timeout: Explicit operation timeout """ __path_parts: t.Dict[str, str] = {} __path = "/_ilm/start" @@ -557,13 +620,19 @@ def stop( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Halts all lifecycle management operations and stops the index lifecycle management - (ILM) plugin + .. raw:: html + +

Stop the ILM plugin. + Halt all lifecycle management operations and stop the index lifecycle management plugin. + This is useful when you are performing maintenance on the cluster and need to prevent ILM from performing any actions on your indices.

+

The API returns as soon as the stop request has been acknowledged, but the plugin might continue to run until in-progress operations complete and the plugin can be safely stopped. + Use the get ILM status API to check whether ILM is running.

+ - ``_ + ``_ - :param master_timeout: - :param timeout: + :param master_timeout: Explicit operation timeout for connection to master node + :param timeout: Explicit operation timeout """ __path_parts: t.Dict[str, str] = {} __path = "/_ilm/stop" diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index 7b59bb318..74a062c4d 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -20,7 +20,13 @@ from elastic_transport import HeadApiResponse, ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class IndicesClient(NamespacedClient): @@ -49,10 +55,13 @@ def add_block( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Add an index block. Limits the operations allowed on an index by blocking specific - operation types. + .. raw:: html - ``_ +

Add an index block. + Limits the operations allowed on an index by blocking specific operation types.

+ + + ``_ :param index: A comma separated list of indices to add a block to :param block: The block to add (one of read, write, read_only or metadata) @@ -137,9 +146,17 @@ def analyze( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Performs analysis on a text string and returns the resulting tokens. + .. raw:: html + +

Get tokens from text analysis. + The analyze API performs analysis on a text string and returns the resulting tokens.

+

Generating excessive amount of tokens may cause a node to run out of memory. + The index.analyze.max_token_count setting enables you to limit the number of tokens that can be produced. + If more than this limit of tokens gets generated, an error occurs. + The _analyze endpoint without a specified index will always use 10000 as its limit.

- ``_ + + ``_ :param index: Index used to derive the analyzer. If specified, the `analyzer` or field parameter overrides this value. If no index is specified or the @@ -238,10 +255,17 @@ def clear_cache( request: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clears the caches of one or more indices. For data streams, the API clears the - caches of the stream’s backing indices. + .. raw:: html + +

Clear the cache. + Clear the cache of one or more indices. + For data streams, the API clears the caches of the stream's backing indices.

+

By default, the clear cache API clears all caches. + To clear only specific caches, use the fielddata, query, or request parameters. + To clear the cache only of specific fields, use the fields parameter.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -324,9 +348,46 @@ def clone( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clones an existing index. - - ``_ + .. raw:: html + +

Clone an index. + Clone an existing index into a new index. + Each original primary shard is cloned into a new primary shard in the new index.

+

IMPORTANT: Elasticsearch does not apply index templates to the resulting index. + The API also does not copy index metadata from the original index. + Index metadata includes aliases, index lifecycle management phase definitions, and cross-cluster replication (CCR) follower information. + For example, if you clone a CCR follower index, the resulting clone will not be a follower index.

+

The clone API copies most index settings from the source index to the resulting index, with the exception of index.number_of_replicas and index.auto_expand_replicas. + To set the number of replicas in the resulting index, configure these settings in the clone request.

+

Cloning works as follows:

+
    +
  • First, it creates a new target index with the same definition as the source index.
  • +
  • Then it hard-links segments from the source index into the target index. If the file system does not support hard-linking, all segments are copied into the new index, which is a much more time consuming process.
  • +
  • Finally, it recovers the target index as though it were a closed index which had just been re-opened.
  • +
+

IMPORTANT: Indices can only be cloned if they meet the following requirements:

+
    +
  • The index must be marked as read-only and have a cluster health status of green.
  • +
  • The target index must not exist.
  • +
  • The source index must have the same number of primary shards as the target index.
  • +
  • The node handling the clone process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+

The current write index on a data stream cannot be cloned. + In order to clone the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be cloned.

+

NOTE: Mappings cannot be specified in the _clone request. The mappings of the source index will be used for the target index.

+

Monitor the cloning process

+

The cloning process can be monitored with the cat recovery API or the cluster health API can be used to wait until all primary shards have been allocated by setting the wait_for_status parameter to yellow.

+

The _clone API returns as soon as the target index has been added to the cluster state, before any shards have been allocated. + At this point, all shards are in the state unassigned. + If, for any reason, the target index can't be allocated, its primary shard will remain unassigned until it can be allocated on that node.

+

Once the primary shard is allocated, it moves to state initializing, and the clone process begins. + When the clone operation completes, the shard will become active. + At that point, Elasticsearch will try to allocate any replicas and may decide to relocate the primary shard to another node.

+

Wait for active shards

+

Because the clone operation creates a new index to clone the shards to, the wait for active shards setting on index creation applies to the clone index action as well.

+ + + ``_ :param index: Name of the source index to clone. :param target: Name of the target index to create. @@ -412,9 +473,25 @@ def close( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Closes an index. - - ``_ + .. raw:: html + +

Close an index. + A closed index is blocked for read or write operations and does not allow all operations that opened indices allow. + It is not possible to index documents or to search for documents in a closed index. + Closed indices do not have to maintain internal data structures for indexing or searching documents, which results in a smaller overhead on the cluster.

+

When opening or closing an index, the master node is responsible for restarting the index shards to reflect the new state of the index. + The shards will then go through the normal recovery process. + The data of opened and closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.

+

You can open and close multiple indices. + An error is thrown if the request explicitly refers to a missing index. + This behaviour can be turned off using the ignore_unavailable=true parameter.

+

By default, you must explicitly name the indices you are opening or closing. + To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. This setting can also be changed with the cluster update settings API.

+

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. + Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false.

+ + + ``_ :param index: Comma-separated list or wildcard expression of index names used to limit the request. @@ -493,9 +570,29 @@ def create( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an index. Creates a new index. - - ``_ + .. raw:: html + +

Create an index. + You can use the create index API to add a new index to an Elasticsearch cluster. + When creating an index, you can specify the following:

+
    +
  • Settings for the index.
  • +
  • Mappings for fields in the index.
  • +
  • Index aliases
  • +
+

Wait for active shards

+

By default, index creation will only return a response to the client when the primary copies of each shard have been started, or the request times out. + The index creation response will indicate what happened. + For example, acknowledged indicates whether the index was successfully created in the cluster, while shards_acknowledged indicates whether the requisite number of shard copies were started for each shard in the index before timing out. + Note that it is still possible for either acknowledged or shards_acknowledged to be false, but for the index creation to be successful. + These values simply indicate whether the operation completed before the timeout. + If acknowledged is false, the request timed out before the cluster state was updated with the newly created index, but it probably will be created sometime soon. + If shards_acknowledged is false, then the request timed out before the requisite number of shards were started (by default just the primaries), even if the cluster state was successfully updated to reflect the newly created index (that is to say, acknowledged is true).

+

You can change the default of only waiting for the primary shards to start through the index setting index.write.wait_for_active_shards. + Note that changing this setting will also affect the wait_for_active_shards value on all subsequent write operations.

+ + + ``_ :param index: Name of the index you wish to create. :param aliases: Aliases for the index. @@ -566,10 +663,14 @@ def create_data_stream( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a data stream. Creates a data stream. You must have a matching index template - with data stream enabled. + .. raw:: html - ``_ +

Create a data stream. + Creates a data stream. + You must have a matching index template with data stream enabled.

+ + + ``_ :param name: Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include `\\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, @@ -628,9 +729,13 @@ def data_streams_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream stats. Retrieves statistics for one or more data streams. + .. raw:: html + +

Get data stream stats. + Retrieves statistics for one or more data streams.

- ``_ + + ``_ :param name: Comma-separated list of data streams used to limit the request. Wildcard expressions (`*`) are supported. To target all data streams in a @@ -689,9 +794,17 @@ def delete( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete indices. Deletes one or more indices. + .. raw:: html + +

Delete indices. + Deleting an index deletes its documents, shards, and metadata. + It does not delete related Kibana components, such as data views, visualizations, or dashboards.

+

You cannot delete the current write index of a data stream. + To delete the index, you must roll over the data stream so a new write index is created. + You can then use the delete index API to delete the previous write index.

- ``_ + + ``_ :param index: Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not support wildcards (`*`) or `_all`. @@ -759,9 +872,13 @@ def delete_alias( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an alias. Removes a data stream or index from an alias. + .. raw:: html + +

Delete an alias. + Removes a data stream or index from an alias.

- ``_ + + ``_ :param index: Comma-separated list of data streams or indices used to limit the request. Supports wildcards (`*`). @@ -823,10 +940,13 @@ def delete_data_lifecycle( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete data stream lifecycles. Removes the data stream lifecycle from a data - stream, rendering it not managed by the data stream lifecycle. + .. raw:: html + +

Delete data stream lifecycles. + Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle.

- ``_ + + ``_ :param name: A comma-separated list of data streams of which the data stream lifecycle will be deleted; use `*` to get all data streams @@ -884,9 +1004,13 @@ def delete_data_stream( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete data streams. Deletes one or more data streams and their backing indices. + .. raw:: html + +

Delete data streams. + Deletes one or more data streams and their backing indices.

+ - ``_ + ``_ :param name: Comma-separated list of data streams to delete. Wildcard (`*`) expressions are supported. @@ -936,12 +1060,15 @@ def delete_index_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an index template. The provided may contain multiple - template names separated by a comma. If multiple template names are specified - then there is no wildcard support and the provided names should match completely - with existing templates. + .. raw:: html + +

Delete an index template. + The provided may contain multiple template names separated by a comma. If multiple template + names are specified then there is no wildcard support and the provided names should match completely with + existing templates.

+ - ``_ + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. @@ -991,9 +1118,13 @@ def delete_template( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a legacy index template. + .. raw:: html - ``_ +

Delete a legacy index template. + IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+ + + ``_ :param name: The name of the legacy index template to delete. Wildcard (`*`) expressions are supported. @@ -1031,6 +1162,7 @@ def delete_template( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def disk_usage( self, *, @@ -1053,9 +1185,18 @@ def disk_usage( run_expensive_tasks: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Analyzes the disk usage of each field of an index or data stream. + .. raw:: html + +

Analyze the index disk usage. + Analyze the disk usage of each field of an index or data stream. + This API might not support indices created in previous Elasticsearch versions. + The result of a small index can be inaccurate as some parts of an index might not be analyzed by the API.

+

NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index store_size value because some small metadata files are ignored and some parts of data files might not be scanned by the API. + Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate. + The stored size of the _id field is likely underestimated while the _source field is overestimated.

+ - ``_ + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. It’s recommended to execute this API with a single @@ -1113,6 +1254,7 @@ def disk_usage( @_rewrite_parameters( body_name="config", ) + @_stability_warning(Stability.EXPERIMENTAL) def downsample( self, *, @@ -1126,11 +1268,18 @@ def downsample( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Aggregates a time series (TSDS) index and stores pre-computed statistical summaries - (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped - by a configured time interval. + .. raw:: html - ``_ +

Downsample an index. + Aggregate a time series (TSDS) index and store pre-computed statistical summaries (min, max, sum, value_count and avg) for each metric field grouped by a configured time interval. + For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. + All documents within an hour interval are summarized and stored as a single document in the downsample index.

+

NOTE: Only indices in a time series data stream are supported. + Neither field nor document level security can be defined on the source index. + The source index must be read only (index.blocks.write: true).

+ + + ``_ :param index: Name of the time series index to downsample. :param target_index: Name of the index to create. @@ -1196,10 +1345,13 @@ def exists( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check indices. Checks if one or more indices, index aliases, or data streams - exist. + .. raw:: html + +

Check indices. + Check if one or more indices, index aliases, or data streams exist.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases. Supports wildcards (`*`). @@ -1275,9 +1427,13 @@ def exists_alias( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check aliases. Checks if one or more data stream or index aliases exist. + .. raw:: html + +

Check aliases. + Checks if one or more data stream or index aliases exist.

- ``_ + + ``_ :param name: Comma-separated list of aliases to check. Supports wildcards (`*`). :param index: Comma-separated list of data streams or indices used to limit the @@ -1345,9 +1501,13 @@ def exists_index_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Returns information about whether a particular index template exists. + .. raw:: html + +

Check index templates. + Check whether index templates exist.

- ``_ + + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. @@ -1394,16 +1554,23 @@ def exists_template( pretty: t.Optional[bool] = None, ) -> HeadApiResponse: """ - Check existence of index templates. Returns information about whether a particular - index template exists. + .. raw:: html + +

Check existence of index templates. + Get information about whether index templates exist. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

- ``_ - :param name: The comma separated names of the index templates - :param flat_settings: Return settings in flat format (default: false) - :param local: Return local information, do not retrieve the state from master - node (default: false) - :param master_timeout: Explicit operation timeout for connection to master node + ``_ + + :param name: A comma-separated list of index template names used to limit the + request. Wildcard (`*`) expressions are supported. + :param flat_settings: Indicates whether to use a flat format for the response. + :param local: Indicates whether to get information from the local node only. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. To indicate that the request should never timeout, set it to `-1`. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -1447,12 +1614,13 @@ def explain_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get the status for a data stream lifecycle. Retrieves information about an index - or data stream’s current data stream lifecycle status, such as time since index - creation, time since rollover, the lifecycle configuration managing the index, - or any errors encountered during lifecycle execution. + .. raw:: html + +

Get the status for a data stream lifecycle. + Get information about an index or data stream's current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.

+ - ``_ + ``_ :param index: The name of the index to explain :param include_defaults: indicates if the API should return the default values @@ -1487,6 +1655,7 @@ def explain_data_lifecycle( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def field_usage_stats( self, *, @@ -1513,9 +1682,17 @@ def field_usage_stats( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns field usage information for each shard and field of an index. + .. raw:: html + +

Get field usage stats. + Get field usage information for each shard and field of an index. + Field usage statistics are automatically captured when queries are running on a cluster. + A shard-level search request that accesses a given field, even if multiple times during that request, is counted as a single use.

+

The response body reports the per-shard usage count of the data structures that back the fields in the index. + A given request will increment each count by a maximum value of 1, even if the request accesses the same field multiple times.

+ - ``_ + ``_ :param index: Comma-separated list or wildcard expression of index names used to limit the request. @@ -1601,9 +1778,20 @@ def flush( wait_if_ongoing: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Flushes one or more data streams or indices. + .. raw:: html - ``_ +

Flush data streams or indices. + Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index. + When restarting, Elasticsearch replays any unflushed operations from the transaction log into the Lucene index to bring it back into the state that it was in before the restart. + Elasticsearch automatically triggers flushes as needed, using heuristics that trade off the size of the unflushed transaction log against the cost of performing each flush.

+

After each operation has been flushed it is permanently stored in the Lucene index. + This may mean that there is no need to maintain an additional copy of it in the transaction log. + The transaction log is made up of multiple files, called generations, and Elasticsearch will delete any generation files when they are no longer needed, freeing up disk space.

+

It is also possible to trigger a flush on one or more indices using the flush API, although it is rare for users to need to call this API directly. + If you call the flush API after indexing some documents then a successful response indicates that Elasticsearch has flushed all the documents that were indexed before the flush API was called.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases to flush. Supports wildcards (`*`). To flush all data streams and indices, omit this @@ -1684,9 +1872,51 @@ def forcemerge( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Performs the force merge operation on one or more indices. - - ``_ + .. raw:: html + +

Force a merge. + Perform the force merge operation on the shards of one or more indices. + For data streams, the API forces a merge on the shards of the stream's backing indices.

+

Merging reduces the number of segments in each shard by merging some of them together and also frees up the space used by deleted documents. + Merging normally happens automatically, but sometimes it is useful to trigger a merge manually.

+

WARNING: We recommend force merging only a read-only index (meaning the index is no longer receiving writes). + When documents are updated or deleted, the old version is not immediately removed but instead soft-deleted and marked with a "tombstone". + These soft-deleted documents are automatically cleaned up during regular segment merges. + But force merge can cause very large (greater than 5 GB) segments to be produced, which are not eligible for regular merges. + So the number of soft-deleted documents can then grow rapidly, resulting in higher disk usage and worse search performance. + If you regularly force merge an index receiving writes, this can also make snapshots more expensive, since the new documents can't be backed up incrementally.

+

Blocks during a force merge

+

Calls to this API block until the merge is complete (unless request contains wait_for_completion=false). + If the client connection is lost before completion then the force merge process will continue in the background. + Any new requests to force merge the same indices will also block until the ongoing force merge is complete.

+

Running force merge asynchronously

+

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to get the status of the task. + However, you can not cancel this task as the force merge task is not cancelable. + Elasticsearch creates a record of this task as a document at _tasks/<task_id>. + When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.

+

Force merging multiple indices

+

You can force merge multiple indices with a single request by targeting:

+
    +
  • One or more data streams that contain multiple backing indices
  • +
  • Multiple indices
  • +
  • One or more aliases
  • +
  • All data streams and indices in a cluster
  • +
+

Each targeted shard is force-merged separately using the force_merge threadpool. + By default each node only has a single force_merge thread which means that the shards on that node are force-merged one at a time. + If you expand the force_merge threadpool on a node then it will force merge its shards in parallel

+

Force merge makes the storage for the shard being merged temporarily increase, as it may require free space up to triple its size in case max_num_segments parameter is set to 1, to rewrite all segments into a new one.

+

Data streams and time-based indices

+

Force-merging is useful for managing a data stream's older backing indices and other time-based indices, particularly after a rollover. + In these cases, each index only receives indexing traffic for a certain period of time. + Once an index receive no more writes, its shards can be force-merged to a single segment. + This can be a good idea because single-segment shards can sometimes use simpler and more efficient data structures to perform searches. + For example:

+
POST /.ds-my-data-stream-2099.03.07-000001/_forcemerge?max_num_segments=1
+          
+ + + ``_ :param index: A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices @@ -1777,10 +2007,14 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index information. Returns information about one or more indices. For data - streams, the API returns information about the stream’s backing indices. + .. raw:: html + +

Get index information. + Get information about one or more indices. For data streams, the API returns information about the + stream’s backing indices.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported. @@ -1867,9 +2101,13 @@ def get_alias( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get aliases. Retrieves information for one or more data stream or index aliases. + .. raw:: html + +

Get aliases. + Retrieves information for one or more data stream or index aliases.

+ - ``_ + ``_ :param index: Comma-separated list of data streams or indices used to limit the request. Supports wildcards (`*`). To target all data streams and indices, @@ -1949,10 +2187,13 @@ def get_data_lifecycle( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data stream lifecycles. Retrieves the data stream lifecycle configuration - of one or more data streams. + .. raw:: html + +

Get data stream lifecycles. + Retrieves the data stream lifecycle configuration of one or more data streams.

+ - ``_ + ``_ :param name: Comma-separated list of data streams to limit the request. Supports wildcards (`*`). To target all data streams, omit this parameter or use `*` @@ -1994,6 +2235,45 @@ def get_data_lifecycle( path_parts=__path_parts, ) + @_rewrite_parameters() + def get_data_lifecycle_stats( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get data stream lifecycle stats. + Get statistics about the data streams that are managed by a data stream lifecycle.

+ + + ``_ + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_lifecycle/stats" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="indices.get_data_lifecycle_stats", + path_parts=__path_parts, + ) + @_rewrite_parameters() def get_data_stream( self, @@ -2016,9 +2296,13 @@ def get_data_stream( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data streams. Retrieves information about one or more data streams. + .. raw:: html + +

Get data streams. + Retrieves information about one or more data streams.

+ - ``_ + ``_ :param name: Comma-separated list of data stream names used to limit the request. Wildcard (`*`) expressions are supported. If omitted, all data streams are @@ -2091,13 +2375,18 @@ def get_field_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get mapping definitions. Retrieves mapping definitions for one or more fields. - For data streams, the API retrieves field mappings for the stream’s backing indices. + .. raw:: html + +

Get mapping definitions. + Retrieves mapping definitions for one or more fields. + For data streams, the API retrieves field mappings for the stream’s backing indices.

+

This API is useful if you don't need a complete mapping or if an index mapping contains a large number of fields.

+ - ``_ + ``_ :param fields: Comma-separated list or wildcard expression of fields used to - limit returned information. + limit returned information. Supports wildcards (`*`). :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indices, omit this parameter or use `*` or `_all`. @@ -2169,9 +2458,13 @@ def get_index_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index templates. Returns information about one or more index templates. + .. raw:: html - ``_ +

Get index templates. + Get information about one or more index templates.

+ + + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. @@ -2242,10 +2535,13 @@ def get_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get mapping definitions. Retrieves mapping definitions for one or more indices. - For data streams, the API retrieves mappings for the stream’s backing indices. + .. raw:: html + +

Get mapping definitions. + For data streams, the API retrieves mappings for the stream’s backing indices.

+ - ``_ + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2327,10 +2623,14 @@ def get_settings( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index settings. Returns setting information for one or more indices. For - data streams, returns setting information for the stream’s backing indices. + .. raw:: html - ``_ +

Get index settings. + Get setting information for one or more indices. + For data streams, it returns setting information for the stream's backing indices.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -2415,9 +2715,14 @@ def get_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get index templates. Retrieves information about one or more index templates. + .. raw:: html + +

Get legacy index templates. + Get information about one or more index templates.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

- ``_ + + ``_ :param name: Comma-separated list of index template names used to limit the request. Wildcard (`*`) expressions are supported. To return all index templates, @@ -2474,16 +2779,22 @@ def migrate_to_data_stream( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Convert an index alias to a data stream. Converts an index alias to a data stream. - You must have a matching index template that is data stream enabled. The alias - must meet the following criteria: The alias must have a write index; All indices - for the alias must have a `@timestamp` field mapping of a `date` or `date_nanos` - field type; The alias must not have any filters; The alias must not use custom - routing. If successful, the request removes the alias and creates a data stream - with the same name. The indices for the alias become hidden backing indices for - the stream. The write index for the alias becomes the write index for the stream. + .. raw:: html + +

Convert an index alias to a data stream. + Converts an index alias to a data stream. + You must have a matching index template that is data stream enabled. + The alias must meet the following criteria: + The alias must have a write index; + All indices for the alias must have a @timestamp field mapping of a date or date_nanos field type; + The alias must not have any filters; + The alias must not use custom routing. + If successful, the request removes the alias and creates a data stream with the same name. + The indices for the alias become hidden backing indices for the stream. + The write index for the alias becomes the write index for the stream.

- ``_ + + ``_ :param name: Name of the index alias to convert to a data stream. :param master_timeout: Period to wait for a connection to the master node. If @@ -2533,10 +2844,13 @@ def modify_data_stream( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update data streams. Performs one or more data stream modification actions in - a single atomic operation. + .. raw:: html + +

Update data streams. + Performs one or more data stream modification actions in a single atomic operation.

- ``_ + + ``_ :param actions: Actions to perform. """ @@ -2594,9 +2908,28 @@ def open( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Opens a closed index. For data streams, the API opens any closed backing indices. - - ``_ + .. raw:: html + +

Open a closed index. + For data streams, the API opens any closed backing indices.

+

A closed index is blocked for read/write operations and does not allow all operations that opened indices allow. + It is not possible to index documents or to search for documents in a closed index. + This allows closed indices to not have to maintain internal data structures for indexing or searching documents, resulting in a smaller overhead on the cluster.

+

When opening or closing an index, the master is responsible for restarting the index shards to reflect the new state of the index. + The shards will then go through the normal recovery process. + The data of opened or closed indices is automatically replicated by the cluster to ensure that enough shard copies are safely kept around at all times.

+

You can open and close multiple indices. + An error is thrown if the request explicitly refers to a missing index. + This behavior can be turned off by using the ignore_unavailable=true parameter.

+

By default, you must explicitly name the indices you are opening or closing. + To open or close indices with _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. + This setting can also be changed with the cluster update settings API.

+

Closed indices consume a significant amount of disk-space which can cause problems in managed environments. + Closing indices can be turned off with the cluster settings API by setting cluster.indices.close.enable to false.

+

Because opening or closing an index allocates its shards, the wait_for_active_shards setting on index creation applies to the _open and _close index actions as well.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). By default, you must explicitly @@ -2669,10 +3002,20 @@ def promote_data_stream( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Promotes a data stream from a replicated data stream managed by CCR to a regular - data stream + .. raw:: html - ``_ +

Promote a data stream. + Promote a data stream from a replicated data stream managed by cross-cluster replication (CCR) to a regular data stream.

+

With CCR auto following, a data stream from a remote cluster can be replicated to the local cluster. + These data streams can't be rolled over in the local cluster. + These replicated data streams roll over only if the upstream data stream rolls over. + In the event that the remote cluster is no longer available, the data stream in the local cluster can be promoted to a regular data stream, which allows these data streams to be rolled over in the local cluster.

+

NOTE: When promoting a data stream, ensure the local cluster has a data stream enabled index template that matches the data stream. + If this is missing, the data stream will not be able to roll over until a matching index template is created. + This will affect the lifecycle management of the data stream and interfere with the data stream size and retention.

+ + + ``_ :param name: The name of the data stream :param master_timeout: Period to wait for a connection to the master node. If @@ -2732,9 +3075,13 @@ def put_alias( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an alias. Adds a data stream or index to an alias. + .. raw:: html + +

Create or update an alias. + Adds a data stream or index to an alias.

- ``_ + + ``_ :param index: Comma-separated list of data streams or indices to add. Supports wildcards (`*`). Wildcard patterns that match both data streams and indices @@ -2834,10 +3181,13 @@ def put_data_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update data stream lifecycles. Update the data stream lifecycle of the specified - data streams. + .. raw:: html + +

Update data stream lifecycles. + Update the data stream lifecycle of the specified data streams.

- ``_ + + ``_ :param name: Comma-separated list of data streams used to limit the request. Supports wildcards (`*`). To target all data streams use `*` or `_all`. @@ -2936,10 +3286,32 @@ def put_index_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an index template. Index templates define settings, mappings, - and aliases that can be applied automatically to new indices. - - ``_ + .. raw:: html + +

Create or update an index template. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

+

Elasticsearch applies templates to new indices based on an wildcard pattern that matches the index name. + Index templates are applied during data stream or index creation. + For data streams, these settings and mappings are applied when the stream's backing indices are created. + Settings and mappings specified in a create index API request override any settings or mappings specified in an index template. + Changes to index templates do not affect existing indices, including the existing backing indices of a data stream.

+

You can use C-style /* *\\/ block comments in index templates. + You can include comments anywhere in the request body, except before the opening curly bracket.

+

Multiple matching templates

+

If multiple index templates match the name of a new index or data stream, the template with the highest priority is used.

+

Multiple templates with overlapping index patterns at the same priority are not allowed and an error will be thrown when attempting to create a template matching an existing index template at identical priorities.

+

Composing aliases, mappings, and settings

+

When multiple component templates are specified in the composed_of field for an index template, they are merged in the order specified, meaning that later component templates override earlier component templates. + Any mappings, settings, or aliases from the parent index template are merged in next. + Finally, any configuration on the index request itself is merged. + Mapping definitions are merged recursively, which means that later mapping components can introduce new field mappings and update the mapping configuration. + If a field mapping is already contained in an earlier component, its definition will be completely overwritten by the later one. + This recursive merging strategy applies not only to field mappings, but also root options like dynamic_templates and meta. + If an earlier component contains a dynamic_templates block, then by default new dynamic_templates entries are appended onto the end. + If an entry already exists with the same key, then it is overwritten by the new definition.

+ + + ``_ :param name: Index or template name :param allow_auto_create: This setting overrides the value of the `action.auto_create_index` @@ -2967,8 +3339,11 @@ def put_index_template( :param master_timeout: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. - :param meta: Optional user metadata about the index template. May have any contents. - This map is not automatically generated by Elasticsearch. + :param meta: Optional user metadata about the index template. It may have any + contents. It is not automatically generated or used by Elasticsearch. This + user-defined object is stored in the cluster state, so keeping it short is + preferable To unset the metadata, replace the template without specifying + it. :param priority: Priority to determine index template precedence when a new data stream or index is created. The index template with the highest priority is chosen. If no priority is specified the template is treated as though @@ -2977,7 +3352,9 @@ def put_index_template( :param template: Template to be applied. It may optionally include an `aliases`, `mappings`, or `settings` configuration. :param version: Version number used to manage index templates externally. This - number is not automatically generated by Elasticsearch. + number is not automatically generated by Elasticsearch. External systems + can use these version numbers to simplify template management. To unset a + version, replace the template without specifying one. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3065,10 +3442,7 @@ def put_mapping( ] = None, dynamic_date_formats: t.Optional[t.Sequence[str]] = None, dynamic_templates: t.Optional[ - t.Union[ - t.Mapping[str, t.Mapping[str, t.Any]], - t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]], - ] + t.Sequence[t.Mapping[str, t.Mapping[str, t.Any]]] ] = None, error_trace: t.Optional[bool] = None, expand_wildcards: t.Optional[ @@ -3096,11 +3470,31 @@ def put_mapping( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update field mappings. Adds new fields to an existing data stream or index. You - can also use this API to change the search settings of existing fields. For data - streams, these changes are applied to all backing indices by default. - - ``_ + .. raw:: html + +

Update field mappings. + Add new fields to an existing data stream or index. + You can also use this API to change the search settings of existing fields and add new properties to existing object fields. + For data streams, these changes are applied to all backing indices by default.

+

Add multi-fields to an existing field

+

Multi-fields let you index the same field in different ways. + You can use this API to update the fields mapping parameter and enable multi-fields for an existing field. + WARNING: If an index (or data stream) contains documents when you add a multi-field, those documents will not have values for the new multi-field. + You can populate the new multi-field with the update by query API.

+

Change supported mapping parameters for an existing field

+

The documentation for each mapping parameter indicates whether you can update it for an existing field using this API. + For example, you can use the update mapping API to update the ignore_above parameter.

+

Change the mapping of an existing field

+

Except for supported mapping parameters, you can't change the mapping or field type of an existing field. + Changing an existing field could invalidate data that's already indexed.

+

If you need to change the mapping of a field in a data stream's backing indices, refer to documentation about modifying data streams. + If you need to change the mapping of a field in other indices, create a new index with the correct mapping and reindex your data into that index.

+

Rename a field

+

Renaming a field would invalidate data already indexed under the old field name. + Instead, add an alias field to create an alternate field name.

+ + + ``_ :param index: A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. @@ -3227,10 +3621,25 @@ def put_settings( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update index settings. Changes dynamic index settings in real time. For data - streams, index setting changes are applied to all backing indices by default. - - ``_ + .. raw:: html + +

Update index settings. + Changes dynamic index settings in real time. + For data streams, index setting changes are applied to all backing indices by default.

+

To revert a setting to the default value, use a null value. + The list of per-index settings that can be updated dynamically on live indices can be found in index module documentation. + To preserve existing settings from being updated, set the preserve_existing parameter to true.

+

NOTE: You can only define new analyzers on closed indices. + To add an analyzer, you must close the index, define the analyzer, and reopen the index. + You cannot close the write index of a data stream. + To update the analyzer for a data stream's write index and future backing indices, update the analyzer in the index template used by the stream. + Then roll over the data stream to apply the new analyzer to the stream's write index and future backing indices. + This affects searches and any new data added to the stream after the rollover. + However, it does not affect the data stream's backing indices or their existing data. + To change the analyzer for existing backing indices, you must create a new data stream and reindex your data into it.

+ + + ``_ :param settings: :param index: Comma-separated list of data streams, indices, and aliases used @@ -3332,14 +3741,30 @@ def put_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an index template. Index templates define settings, mappings, - and aliases that can be applied automatically to new indices. - - ``_ + .. raw:: html + +

Create or update a legacy index template. + Index templates define settings, mappings, and aliases that can be applied automatically to new indices. + Elasticsearch applies templates to new indices based on an index pattern that matches the index name.

+

IMPORTANT: This documentation is about legacy index templates, which are deprecated and will be replaced by the composable templates introduced in Elasticsearch 7.8.

+

Composable templates always take precedence over legacy templates. + If no composable template matches a new index, matching legacy templates are applied according to their order.

+

Index templates are only applied during index creation. + Changes to index templates do not affect existing indices. + Settings and mappings specified in create index API requests override any settings or mappings specified in an index template.

+

You can use C-style /* *\\/ block comments in index templates. + You can include comments anywhere in the request body, except before the opening curly bracket.

+

Indices matching multiple templates

+

Multiple index templates can potentially match an index, in this case, both the settings and mappings are merged into the final configuration of the index. + The order of the merging can be controlled using the order parameter, with lower order being applied first, and higher orders overriding them. + NOTE: Multiple matching templates with the same order value will result in a non-deterministic merging order.

+ + + ``_ :param name: The name of the template :param aliases: Aliases for the index. - :param cause: + :param cause: User defined reason for creating/updating the index template :param create: If true, this request cannot replace or update existing index templates. :param index_patterns: Array of wildcard expressions used to match the names @@ -3354,7 +3779,8 @@ def put_template( with lower values. :param settings: Configuration options for the index. :param version: Version number used to manage index templates externally. This - number is not automatically generated by Elasticsearch. + number is not automatically generated by Elasticsearch. To unset a version, + replace the template without specifying one. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -3413,11 +3839,30 @@ def recovery( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about ongoing and completed shard recoveries for one or more - indices. For data streams, the API returns information for the stream’s backing - indices. - - ``_ + .. raw:: html + +

Get index recovery information. + Get information about ongoing and completed shard recoveries for one or more indices. + For data streams, the API returns information for the stream's backing indices.

+

All recoveries, whether ongoing or complete, are kept in the cluster state and may be reported on at any time.

+

Shard recovery is the process of initializing a shard copy, such as restoring a primary shard from a snapshot or creating a replica shard from a primary shard. + When a shard recovery completes, the recovered shard is available for search and indexing.

+

Recovery automatically occurs during the following processes:

+
    +
  • When creating an index for the first time.
  • +
  • When a node rejoins the cluster and starts up any missing primary shard copies using the data that it holds in its data path.
  • +
  • Creation of new replica shard copies from the primary.
  • +
  • Relocation of a shard copy to a different node in the same cluster.
  • +
  • A snapshot restore operation.
  • +
  • A clone, shrink, or split operation.
  • +
+

You can determine the cause of a shard recovery using the recovery or cat recovery APIs.

+

The index recovery API reports information about completed recoveries only for shard copies that currently exist in the cluster. + It only reports the last recovery for each shard copy and does not report historical information about earlier recoveries, nor does it report information about the recoveries of shard copies that no longer exist. + This means that if a shard copy completes a recovery and then Elasticsearch relocates it onto a different node then the information about the original recovery will not be shown in the recovery API.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -3477,11 +3922,21 @@ def refresh( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Refresh an index. A refresh makes recent operations performed on one or more - indices available for search. For data streams, the API runs the refresh operation - on the stream’s backing indices. + .. raw:: html - ``_ +

Refresh an index. + A refresh makes recent operations performed on one or more indices available for search. + For data streams, the API runs the refresh operation on the stream’s backing indices.

+

By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. + You can change this default interval with the index.refresh_interval setting.

+

Refresh requests are synchronous and do not return a response until the refresh operation completes.

+

Refreshes are resource-intensive. + To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.

+

If your application workflow indexes documents and then runs a search to retrieve the indexed document, it's recommended to use the index API's refresh=wait_for query parameter option. + This option ensures the indexing operation waits for a periodic refresh before running the search.

+ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -3549,9 +4004,22 @@ def reload_search_analyzers( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reloads an index's search analyzers and their resources. + .. raw:: html + +

Reload search analyzers. + Reload an index's search analyzers and their resources. + For data streams, the API reloads search analyzers and resources for the stream's backing indices.

+

IMPORTANT: After reloading the search analyzers you should clear the request cache to make sure it doesn't contain responses derived from the previous versions of the analyzer.

+

You can use the reload search analyzers API to pick up changes to synonym files used in the synonym_graph or synonym token filter of a search analyzer. + To be eligible, the token filter must have an updateable flag of true and only be used in search analyzers.

+

NOTE: This API does not perform a reload for each shard of an index. + Instead, it performs a reload for each node containing index shards. + As a result, the total shard count returned by the API can differ from the number of index shards. + Because reloading affects every node with an index shard, it is important to update the synonym file on every data node in the cluster--including nodes that don't contain a shard replica--before using this API. + This ensures the synonym file is updated everywhere in the cluster in case shards are relocated in the future.

- ``_ + + ``_ :param index: A comma-separated list of index names to reload analyzers for :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves @@ -3613,11 +4081,35 @@ def resolve_cluster( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resolves the specified index expressions to return information about each cluster, - including the local cluster, if included. Multiple patterns and remote clusters - are supported. - - ``_ + .. raw:: html + +

Resolve the cluster. + Resolve the specified index expressions to return information about each cluster, including the local cluster, if included. + Multiple patterns and remote clusters are supported.

+

This endpoint is useful before doing a cross-cluster search in order to determine which remote clusters should be included in a search.

+

You use the same index expression with this endpoint as you would for cross-cluster search. + Index and cluster exclusions are also supported with this endpoint.

+

For each cluster in the index expression, information is returned about:

+
    +
  • Whether the querying ("local") cluster is currently connected to each remote cluster in the index expression scope.
  • +
  • Whether each remote cluster is configured with skip_unavailable as true or false.
  • +
  • Whether there are any indices, aliases, or data streams on that cluster that match the index expression.
  • +
  • Whether the search is likely to have errors returned when you do the cross-cluster search (including any authorization errors if you do not have permission to query the index).
  • +
  • Cluster version information, including the Elasticsearch server version.
  • +
+

For example, GET /_resolve/cluster/my-index-*,cluster*:my-index-* returns information about the local cluster and all remotely configured clusters that start with the alias cluster*. + Each cluster returns information about whether it has any indices, aliases or data streams that match my-index-*.

+

Advantages of using this endpoint before a cross-cluster search

+

You may want to exclude a cluster or index from a search when:

+
    +
  • A remote cluster is not currently connected and is configured with skip_unavailable=false. Running a cross-cluster search under those conditions will cause the entire search to fail.
  • +
  • A cluster has no matching indices, aliases or data streams for the index expression (or your user does not have permissions to search them). For example, suppose your index expression is logs*,remote1:logs* and the remote1 cluster has no indices, aliases or data streams that match logs*. In that case, that cluster will return no results from that cluster if you include it in a cross-cluster search.
  • +
  • The index expression (combined with any query parameters you specify) will likely cause an exception to be thrown when you do the search. In these cases, the "error" field in the _resolve/cluster response will be present. (This is also where security/permission errors will be shown.)
  • +
  • A remote cluster is an older version that does not support the feature you want to use in your search.
  • +
+ + + ``_ :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified @@ -3688,10 +4180,14 @@ def resolve_index( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Resolves the specified name(s) and/or index patterns for indices, aliases, and - data streams. Multiple patterns and remote clusters are supported. + .. raw:: html - ``_ +

Resolve indices. + Resolve the names and/or index patterns for indices, aliases, and data streams. + Multiple patterns and remote clusters are supported.

+ + + ``_ :param name: Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified @@ -3762,9 +4258,37 @@ def rollover( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Roll over to a new index. Creates a new index for a data stream or index alias. - - ``_ + .. raw:: html + +

Roll over to a new index. + TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.

+

The rollover API creates a new index for a data stream or index alias. + The API behavior depends on the rollover target.

+

Roll over a data stream

+

If you roll over a data stream, the API creates a new write index for the stream. + The stream's previous write index becomes a regular backing index. + A rollover also increments the data stream's generation.

+

Roll over an index alias with a write index

+

TIP: Prior to Elasticsearch 7.9, you'd typically use an index alias with a write index to manage time series data. + Data streams replace this functionality, require less maintenance, and automatically integrate with data tiers.

+

If an index alias points to multiple indices, one of the indices must be a write index. + The rollover API creates a new write index for the alias with is_write_index set to true. + The API also sets is_write_index to false for the previous write index.

+

Roll over an index alias with one index

+

If you roll over an index alias that points to only one index, the API creates a new index for the alias and removes the original index from the alias.

+

NOTE: A rollover creates a new index and is subject to the wait_for_active_shards setting.

+

Increment index names for an alias

+

When you roll over an index alias, you can specify a name for the new index. + If you don't specify a name and the current index ends with - and a number, such as my-index-000001 or my-index-3, the new index name increments that number. + For example, if you roll over an alias with a current index of my-index-000001, the rollover creates a new index named my-index-000002. + This number is always six characters and zero-padded, regardless of the previous index's name.

+

If you use an index alias for time series data, you can use date math in the index name to track the rollover date. + For example, you can create an alias that points to an index named <my-index-{now/d}-000001>. + If you create the index on May 6, 2099, the index's name is my-index-2099.05.06-000001. + If you roll over the alias on May 7, 2099, the new index's name is my-index-2099.05.07-000002.

+ + + ``_ :param alias: Name of the data stream or index alias to roll over. :param new_index: Name of the index to create. Supports date math. Data streams @@ -3867,10 +4391,14 @@ def segments( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns low-level information about the Lucene segments in index shards. For - data streams, the API returns information about the stream’s backing indices. + .. raw:: html + +

Get index segments. + Get low-level information about the Lucene segments in index shards. + For data streams, the API returns information about the stream's backing indices.

- ``_ + + ``_ :param index: Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams @@ -3947,10 +4475,22 @@ def shard_stores( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves store information about replica shards in one or more indices. For - data streams, the API retrieves store information for the stream’s backing indices. + .. raw:: html + +

Get index shard stores. + Get store information about replica shards in one or more indices. + For data streams, the API retrieves store information for the stream's backing indices.

+

The index shard stores API returns the following information:

+
    +
  • The node on which each replica shard exists.
  • +
  • The allocation ID for each replica shard.
  • +
  • A unique ID for each replica shard.
  • +
  • Any errors encountered while opening the shard index or from an earlier failure.
  • +
+

By default, the API returns store information only for primary shards that are unassigned or have one or more unassigned replica shards.

+ - ``_ + ``_ :param index: List of data streams, indices, and aliases used to limit the request. :param allow_no_indices: If false, the request returns an error if any wildcard @@ -4019,9 +4559,40 @@ def shrink( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Shrinks an existing index into a new index with fewer primary shards. - - ``_ + .. raw:: html + +

Shrink an index. + Shrink an index into a new index with fewer primary shards.

+

Before you can shrink an index:

+
    +
  • The index must be read-only.
  • +
  • A copy of every shard in the index must reside on the same node.
  • +
  • The index must have a green health status.
  • +
+

To make shard allocation easier, we recommend you also remove the index's replica shards. + You can later re-add replica shards as part of the shrink operation.

+

The requested number of primary shards in the target index must be a factor of the number of shards in the source index. + For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary shards or an index with 15 primary shards can be shrunk into 5, 3 or 1. + If the number of shards in the index is a prime number it can only be shrunk into a single primary shard + Before shrinking, a (primary or replica) copy of every shard in the index must be present on the same node.

+

The current write index on a data stream cannot be shrunk. In order to shrink the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be shrunk.

+

A shrink operation:

+
    +
  • Creates a new target index with the same definition as the source index, but with a smaller number of primary shards.
  • +
  • Hard-links segments from the source index into the target index. If the file system does not support hard-linking, then all segments are copied into the new index, which is a much more time consuming process. Also if using multiple data paths, shards on different data paths require a full copy of segment files if they are not on the same disk since hardlinks do not work across disks.
  • +
  • Recovers the target index as though it were a closed index which had just been re-opened. Recovers shards to the .routing.allocation.initial_recovery._id index setting.
  • +
+

IMPORTANT: Indices can only be shrunk if they satisfy the following requirements:

+
    +
  • The target index must not exist.
  • +
  • The source index must have more primary shards than the target index.
  • +
  • The number of primary shards in the target index must be a factor of the number of primary shards in the source index. The source index must have more primary shards than the target index.
  • +
  • The index must not contain more than 2,147,483,519 documents in total across all shards that will be shrunk into a single shard on the target index as this is the maximum number of docs that can fit into a single shard.
  • +
  • The node handling the shrink process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+ + + ``_ :param index: Name of the source index to shrink. :param target: Name of the target index to create. @@ -4094,10 +4665,13 @@ def simulate_index_template( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate an index. Returns the index configuration that would be applied to the - specified index from an existing index template. + .. raw:: html + +

Simulate an index. + Get the index configuration that would be applied to the specified index from an existing index template.

- ``_ + + ``_ :param name: Name of the index to simulate :param include_defaults: If true, returns all relevant default configurations @@ -4172,10 +4746,13 @@ def simulate_template( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Simulate an index template. Returns the index configuration that would be applied - by a particular index template. + .. raw:: html + +

Simulate an index template. + Get the index configuration that would be applied by a particular index template.

- ``_ + + ``_ :param name: Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter and specify the template @@ -4304,9 +4881,46 @@ def split( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Splits an existing index into a new index with more primary shards. - - ``_ + .. raw:: html + +

Split an index. + Split an index into a new index with more primary shards.

+
    +
  • +

    Before you can split an index:

    +
  • +
  • +

    The index must be read-only.

    +
  • +
  • +

    The cluster health status must be green.

    +
  • +
+

You can do make an index read-only with the following request using the add index block API:

+
PUT /my_source_index/_block/write
+          
+

The current write index on a data stream cannot be split. + In order to split the current write index, the data stream must first be rolled over so that a new write index is created and then the previous write index can be split.

+

The number of times the index can be split (and the number of shards that each original shard can be split into) is determined by the index.number_of_routing_shards setting. + The number of routing shards specifies the hashing space that is used internally to distribute documents across shards with consistent hashing. + For instance, a 5 shard index with number_of_routing_shards set to 30 (5 x 2 x 3) could be split by a factor of 2 or 3.

+

A split operation:

+
    +
  • Creates a new target index with the same definition as the source index, but with a larger number of primary shards.
  • +
  • Hard-links segments from the source index into the target index. If the file system doesn't support hard-linking, all segments are copied into the new index, which is a much more time consuming process.
  • +
  • Hashes all documents again, after low level files are created, to delete documents that belong to a different shard.
  • +
  • Recovers the target index as though it were a closed index which had just been re-opened.
  • +
+

IMPORTANT: Indices can only be split if they satisfy the following requirements:

+
    +
  • The target index must not exist.
  • +
  • The source index must have fewer primary shards than the target index.
  • +
  • The number of primary shards in the target index must be a multiple of the number of primary shards in the source index.
  • +
  • The node handling the split process must have sufficient free disk space to accommodate a second copy of the existing index.
  • +
+ + + ``_ :param index: Name of the source index to split. :param target: Name of the target index to create. @@ -4396,10 +5010,19 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns statistics for one or more indices. For data streams, the API retrieves - statistics for the stream’s backing indices. + .. raw:: html - ``_ +

Get index statistics. + For data streams, the API retrieves statistics for the stream's backing indices.

+

By default, the returned statistics are index-level with primaries and total aggregations. + primaries are the values for only the primary shards. + total are the accumulated values for both primary and replica shards.

+

To get shard-level statistics, set the level parameter to shards.

+

NOTE: When moving to another node, the shard-level statistics for a shard are cleared. + Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed.

+ + + ``_ :param index: A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices @@ -4500,9 +5123,13 @@ def unfreeze( wait_for_active_shards: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Unfreezes an index. + .. raw:: html + +

Unfreeze an index. + When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.

+ - ``_ + ``_ :param index: Identifier for the index. :param allow_no_indices: If `false`, the request returns an error if any wildcard @@ -4574,9 +5201,13 @@ def update_aliases( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update an alias. Adds a data stream or index to an alias. + .. raw:: html - ``_ +

Create or update an alias. + Adds a data stream or index to an alias.

+ + + ``_ :param actions: Actions to perform. :param master_timeout: Period to wait for a connection to the master node. If @@ -4649,9 +5280,13 @@ def validate_query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Validate a query. Validates a query without running it. + .. raw:: html + +

Validate a query. + Validates a query without running it.

+ - ``_ + ``_ :param index: Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (`*`). To search all data streams or indices, omit this diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py index 2fc2a8de6..5430e7283 100644 --- a/elasticsearch/_sync/client/inference.py +++ b/elasticsearch/_sync/client/inference.py @@ -44,9 +44,12 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an inference endpoint + .. raw:: html - ``_ +

Delete an inference endpoint

+ + + ``_ :param inference_id: The inference Id :param task_type: The task type @@ -109,9 +112,12 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get an inference endpoint + .. raw:: html + +

Get an inference endpoint

- ``_ + + ``_ :param task_type: The task type :param inference_id: The inference Id @@ -172,9 +178,12 @@ def inference( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Perform inference on the service + .. raw:: html + +

Perform inference on the service

- ``_ + + ``_ :param inference_id: The inference Id :param input: Inference input. Either a string or an array of strings. @@ -255,9 +264,20 @@ def put( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an inference endpoint + .. raw:: html + +

Create an inference endpoint. + When you create an inference endpoint, the associated machine learning model is automatically deployed if it is not already running. + After creating the endpoint, wait for the model deployment to complete before using it. + To verify the deployment status, use the get trained model statistics API. + Look for "state": "fully_allocated" in the response and ensure that the "allocation_count" matches the "target_allocation_count". + Avoid creating multiple endpoints for the same model unless required, as each endpoint consumes significant resources.

+

IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Mistral, Azure OpenAI, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. + For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. + However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.

- ``_ + + ``_ :param inference_id: The inference Id :param inference_config: @@ -303,3 +323,80 @@ def put( endpoint_id="inference.put", path_parts=__path_parts, ) + + @_rewrite_parameters( + body_name="inference_config", + ) + def update( + self, + *, + inference_id: str, + inference_config: t.Optional[t.Mapping[str, t.Any]] = None, + body: t.Optional[t.Mapping[str, t.Any]] = None, + task_type: t.Optional[ + t.Union[ + str, + t.Literal["completion", "rerank", "sparse_embedding", "text_embedding"], + ] + ] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update an inference endpoint.

+

Modify task_settings, secrets (within service_settings), or num_allocations for an inference endpoint, depending on the specific endpoint service and task_type.

+

IMPORTANT: The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. + For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. + However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.

+ + + ``_ + + :param inference_id: The unique identifier of the inference endpoint. + :param inference_config: + :param task_type: The type of inference task that the model performs. + """ + if inference_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'inference_id'") + if inference_config is None and body is None: + raise ValueError( + "Empty value passed for parameters 'inference_config' and 'body', one of them should be set." + ) + elif inference_config is not None and body is not None: + raise ValueError("Cannot set both 'inference_config' and 'body'") + __path_parts: t.Dict[str, str] + if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH: + __path_parts = { + "task_type": _quote(task_type), + "inference_id": _quote(inference_id), + } + __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}/_update' + elif inference_id not in SKIP_IN_PATH: + __path_parts = {"inference_id": _quote(inference_id)} + __path = f'/_inference/{__path_parts["inference_id"]}/_update' + else: + raise ValueError("Couldn't find a path for the given parameters") + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __body = inference_config if inference_config is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="inference.update", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_sync/client/ingest.py b/elasticsearch/_sync/client/ingest.py index d88d12f97..303fdc9f0 100644 --- a/elasticsearch/_sync/client/ingest.py +++ b/elasticsearch/_sync/client/ingest.py @@ -38,9 +38,13 @@ def delete_geoip_database( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a geoip database configuration. + .. raw:: html - ``_ +

Delete GeoIP database configurations. + Delete one or more IP geolocation database configurations.

+ + + ``_ :param id: A comma-separated list of geoip database configurations to delete :param master_timeout: Period to wait for a connection to the master node. If @@ -76,6 +80,62 @@ def delete_geoip_database( path_parts=__path_parts, ) + @_rewrite_parameters() + def delete_ip_location_database( + self, + *, + id: t.Union[str, t.Sequence[str]], + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Delete IP geolocation database configurations.

+ + + ``_ + + :param id: A comma-separated list of IP location database configurations. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. A value of `-1` indicates that the request should never + time out. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. A value + of `-1` indicates that the request should never time out. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/ip_location/database/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "DELETE", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.delete_ip_location_database", + path_parts=__path_parts, + ) + @_rewrite_parameters() def delete_pipeline( self, @@ -89,9 +149,13 @@ def delete_pipeline( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes one or more existing ingest pipeline. + .. raw:: html + +

Delete pipelines. + Delete one or more ingest pipelines.

- ``_ + + ``_ :param id: Pipeline ID or wildcard expression of pipeline IDs used to limit the request. To delete all ingest pipelines in a cluster, use a value of `*`. @@ -138,9 +202,13 @@ def geo_ip_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Gets download statistics for GeoIP2 databases used with the geoip processor. + .. raw:: html + +

Get GeoIP statistics. + Get download statistics for GeoIP2 databases that are used with the GeoIP processor.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ingest/geoip/stats" @@ -175,9 +243,13 @@ def get_geoip_database( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about one or more geoip database configurations. + .. raw:: html + +

Get GeoIP database configurations. + Get information about one or more IP geolocation database configurations.

+ - ``_ + ``_ :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard (`*`) expressions are supported. To get all database configurations, omit @@ -214,6 +286,61 @@ def get_geoip_database( path_parts=__path_parts, ) + @_rewrite_parameters() + def get_ip_location_database( + self, + *, + id: t.Optional[t.Union[str, t.Sequence[str]]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get IP geolocation database configurations.

+ + + ``_ + + :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard + (`*`) expressions are supported. To get all database configurations, omit + this parameter or use `*`. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. A value of `-1` indicates that the request should never + time out. + """ + __path_parts: t.Dict[str, str] + if id not in SKIP_IN_PATH: + __path_parts = {"id": _quote(id)} + __path = f'/_ingest/ip_location/database/{__path_parts["id"]}' + else: + __path_parts = {} + __path = "/_ingest/ip_location/database" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="ingest.get_ip_location_database", + path_parts=__path_parts, + ) + @_rewrite_parameters() def get_pipeline( self, @@ -227,10 +354,14 @@ def get_pipeline( summary: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about one or more ingest pipelines. This API returns a local - reference of the pipeline. + .. raw:: html + +

Get pipelines. + Get information about one or more ingest pipelines. + This API returns a local reference of the pipeline.

+ - ``_ + ``_ :param id: Comma-separated list of pipeline IDs to retrieve. Wildcard (`*`) expressions are supported. To get all ingest pipelines, omit this parameter or use `*`. @@ -279,12 +410,15 @@ def processor_grok( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Extracts structured fields out of a single text field within a document. You - choose which field to extract matched fields from, as well as the grok pattern - you expect will match. A grok pattern is like a regular expression that supports - aliased expressions that can be reused. + .. raw:: html + +

Run a grok processor. + Extract structured fields out of a single text field within a document. + You must choose which field to extract matched fields from, as well as the grok pattern you expect will match. + A grok pattern is like a regular expression that supports aliased expressions that can be reused.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ingest/processor/grok" @@ -325,9 +459,13 @@ def put_geoip_database( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about one or more geoip database configurations. + .. raw:: html - ``_ +

Create or update a GeoIP database configuration. + Refer to the create or update IP geolocation database configuration API.

+ + + ``_ :param id: ID of the database configuration to create or update. :param maxmind: The configuration necessary to identify which IP geolocation @@ -380,6 +518,77 @@ def put_geoip_database( path_parts=__path_parts, ) + @_rewrite_parameters( + body_name="configuration", + ) + def put_ip_location_database( + self, + *, + id: str, + configuration: t.Optional[t.Mapping[str, t.Any]] = None, + body: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Create or update an IP geolocation database configuration.

+ + + ``_ + + :param id: The database configuration identifier. + :param configuration: + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. A value of `-1` indicates that the request should never + time out. + :param timeout: The period to wait for a response from all relevant nodes in + the cluster after updating the cluster metadata. If no response is received + before the timeout expires, the cluster metadata update still applies but + the response indicates that it was not completely acknowledged. A value of + `-1` indicates that the request should never time out. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if configuration is None and body is None: + raise ValueError( + "Empty value passed for parameters 'configuration' and 'body', one of them should be set." + ) + elif configuration is not None and body is not None: + raise ValueError("Cannot set both 'configuration' and 'body'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_ingest/ip_location/database/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + __body = configuration if configuration is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ingest.put_ip_location_database", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "deprecated", @@ -411,10 +620,13 @@ def put_pipeline( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates an ingest pipeline. Changes made using this API take effect - immediately. + .. raw:: html - ``_ +

Create or update a pipeline. + Changes made using this API take effect immediately.

+ + + ``_ :param id: ID of the ingest pipeline to create or update. :param deprecated: Marks this ingest pipeline as deprecated. When a deprecated @@ -504,9 +716,14 @@ def simulate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes an ingest pipeline against a set of provided documents. + .. raw:: html + +

Simulate a pipeline. + Run an ingest pipeline against a set of provided documents. + You can either specify an existing pipeline to use with the provided documents or supply a pipeline definition in the body of the request.

+ - ``_ + ``_ :param docs: Sample documents to test in the pipeline. :param id: Pipeline to test. If you don’t specify a `pipeline` in the request diff --git a/elasticsearch/_sync/client/license.py b/elasticsearch/_sync/client/license.py index 43135d5a7..d018e4bb5 100644 --- a/elasticsearch/_sync/client/license.py +++ b/elasticsearch/_sync/client/license.py @@ -35,9 +35,14 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes licensing information for the cluster + .. raw:: html - ``_ +

Delete the license. + When the license expires, your subscription level reverts to Basic.

+

If the operator privileges feature is enabled, only operator users can use this API.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_license" @@ -72,11 +77,15 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get license information. Returns information about your Elastic license, including - its type, its status, when it was issued, and when it expires. For more information - about the different types of licenses, refer to [Elastic Stack subscriptions](https://www.elastic.co/subscriptions). + .. raw:: html + +

Get license information. + Get information about your Elastic license including its type, its status, when it was issued, and when it expires.

+

NOTE: If the master node is generating a new cluster state, the get license API may return a 404 Not Found response. + If you receive an unexpected 404 response after cluster startup, wait a short period and retry the request.

+ - ``_ + ``_ :param accept_enterprise: If `true`, this parameter returns enterprise for Enterprise license types. If `false`, this parameter returns platinum for both platinum @@ -120,9 +129,12 @@ def get_basic_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the status of the basic license. + .. raw:: html - ``_ +

Get the basic license status.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_license/basic_status" @@ -155,9 +167,12 @@ def get_trial_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the status of the trial license. + .. raw:: html + +

Get the trial status.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_license/trial_status" @@ -196,9 +211,18 @@ def post( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates the license for the cluster. + .. raw:: html + +

Update the license. + You can update your license at runtime without shutting down your nodes. + License updates take effect immediately. + If the license you are installing does not support all of the features that were available with your previous license, however, you are notified in the response. + You must then re-submit the API request with the acknowledge parameter set to true.

+

NOTE: If Elasticsearch security features are enabled and you are installing a gold or higher license, you must enable TLS on the transport networking layer before you install the license. + If the operator privileges feature is enabled, only operator users can use this API.

- ``_ + + ``_ :param acknowledge: Specifies whether you acknowledge the license changes. :param license: @@ -250,14 +274,17 @@ def post_start_basic( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - The start basic API enables you to initiate an indefinite basic license, which - gives access to all the basic features. If the basic license does not support - all of the features that are available with your current license, however, you - are notified in the response. You must then re-submit the API request with the - acknowledge parameter set to true. To check the status of your basic license, - use the following API: [Get basic status](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-basic-status.html). + .. raw:: html + +

Start a basic license. + Start an indefinite basic license, which gives access to all the basic features.

+

NOTE: In order to start a basic license, you must not currently have a basic license.

+

If the basic license does not support all of the features that are available with your current license, however, you are notified in the response. + You must then re-submit the API request with the acknowledge parameter set to true.

+

To check the status of your basic license, use the get basic license API.

- ``_ + + ``_ :param acknowledge: whether the user has acknowledged acknowledge messages (default: false) @@ -297,10 +324,16 @@ def post_start_trial( type_query_string: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - The start trial API enables you to start a 30-day trial, which gives access to - all subscription features. + .. raw:: html + +

Start a trial. + Start a 30-day trial, which gives access to all subscription features.

+

NOTE: You are allowed to start a trial only if your cluster has not already activated a trial for the current major product version. + For example, if you have already activated a trial for v8.0, you cannot start a new trial until v9.0. You can, however, request an extended trial at https://www.elastic.co/trialextension.

+

To check the status of your trial, use the get trial status API.

+ - ``_ + ``_ :param acknowledge: whether the user has acknowledged acknowledge messages (default: false) diff --git a/elasticsearch/_sync/client/logstash.py b/elasticsearch/_sync/client/logstash.py index 040d5e030..e329058a3 100644 --- a/elasticsearch/_sync/client/logstash.py +++ b/elasticsearch/_sync/client/logstash.py @@ -36,11 +36,16 @@ def delete_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a pipeline used for Logstash Central Management. + .. raw:: html - ``_ +

Delete a Logstash pipeline. + Delete a pipeline that is used for Logstash Central Management. + If the request succeeds, you receive an empty response with an appropriate status code.

- :param id: Identifier for the pipeline. + + ``_ + + :param id: An identifier for the pipeline. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -76,11 +81,15 @@ def get_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves pipelines used for Logstash Central Management. + .. raw:: html + +

Get Logstash pipelines. + Get pipelines that are used for Logstash Central Management.

- ``_ - :param id: Comma-separated list of pipeline identifiers. + ``_ + + :param id: A comma-separated list of pipeline identifiers. """ __path_parts: t.Dict[str, str] if id not in SKIP_IN_PATH: @@ -123,11 +132,16 @@ def put_pipeline( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a pipeline used for Logstash Central Management. + .. raw:: html + +

Create or update a Logstash pipeline.

+

Create a pipeline that is used for Logstash Central Management. + If the specified pipeline exists, it is replaced.

+ - ``_ + ``_ - :param id: Identifier for the pipeline. + :param id: An identifier for the pipeline. :param pipeline: """ if id in SKIP_IN_PATH: diff --git a/elasticsearch/_sync/client/migration.py b/elasticsearch/_sync/client/migration.py index b0bfb2f01..a9476162c 100644 --- a/elasticsearch/_sync/client/migration.py +++ b/elasticsearch/_sync/client/migration.py @@ -36,11 +36,15 @@ def deprecations( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about different cluster, node, and index level settings - that use deprecated features that will be removed or changed in the next major - version. + .. raw:: html - ``_ +

Get deprecation information. + Get information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version.

+

TIP: This APIs is designed for indirect use by the Upgrade Assistant. + You are strongly recommended to use the Upgrade Assistant.

+ + + ``_ :param index: Comma-separate list of data streams or indices to check. Wildcard (*) expressions are supported. @@ -81,9 +85,16 @@ def get_feature_upgrade_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Find out whether system features need to be upgraded or not + .. raw:: html + +

Get feature migration information. + Version upgrades sometimes require changes to how features store configuration information and data in system indices. + Check which features need to be migrated and the status of any migrations that are in progress.

+

TIP: This API is designed for indirect use by the Upgrade Assistant. + You are strongly recommended to use the Upgrade Assistant.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_migration/system_features" @@ -116,9 +127,16 @@ def post_feature_upgrade( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Begin upgrades for system features + .. raw:: html + +

Start the feature migration. + Version upgrades sometimes require changes to how features store configuration information and data in system indices. + This API starts the automatic migration process.

+

Some functionality might be temporarily unavailable during the migration process.

+

TIP: The API is designed for indirect use by the Upgrade Assistant. We strongly recommend you use the Upgrade Assistant.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_migration/system_features" diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index b157260ae..f158cc648 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -36,13 +36,16 @@ def clear_trained_model_deployment_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear trained model deployment cache. Cache will be cleared on all nodes where - the trained model is assigned. A trained model deployment may have an inference - cache enabled. As requests are handled by each allocated node, their responses - may be cached on that individual node. Calling this API clears the caches without - restarting the deployment. + .. raw:: html - ``_ +

Clear trained model deployment cache. + Cache will be cleared on all nodes where the trained model is assigned. + A trained model deployment may have an inference cache enabled. + As requests are handled by each allocated node, their responses may be cached on that individual node. + Calling this API clears the caches without restarting the deployment.

+ + + ``_ :param model_id: The unique identifier of the trained model. """ @@ -88,21 +91,16 @@ def close_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Close anomaly detection jobs. A job can be opened and closed multiple times throughout - its lifecycle. A closed job cannot receive data or perform analysis operations, - but you can still explore and navigate results. When you close a job, it runs - housekeeping tasks such as pruning the model history, flushing buffers, calculating - final results and persisting the model snapshots. Depending upon the size of - the job, it could take several minutes to close and the equivalent time to re-open. - After it is closed, the job has a minimal overhead on the cluster except for - maintaining its meta data. Therefore it is a best practice to close jobs that - are no longer required to process data. If you close an anomaly detection job - whose datafeed is running, the request first tries to stop the datafeed. This - behavior is equivalent to calling stop datafeed API with the same timeout and - force parameters as the close job request. When a datafeed that has a specified - end date stops, it automatically closes its associated job. - - ``_ + .. raw:: html + +

Close anomaly detection jobs. + A job can be opened and closed multiple times throughout its lifecycle. A closed job cannot receive data or perform analysis operations, but you can still explore and navigate results. + When you close a job, it runs housekeeping tasks such as pruning the model history, flushing buffers, calculating final results and persisting the model snapshots. Depending upon the size of the job, it could take several minutes to close and the equivalent time to re-open. After it is closed, the job has a minimal overhead on the cluster except for maintaining its meta data. Therefore it is a best practice to close jobs that are no longer required to process data. + If you close an anomaly detection job whose datafeed is running, the request first tries to stop the datafeed. This behavior is equivalent to calling stop datafeed API with the same timeout and force parameters as the close job request. + When a datafeed that has a specified end date stops, it automatically closes its associated job.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. You can close multiple anomaly detection @@ -161,10 +159,13 @@ def delete_calendar( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a calendar. Removes all scheduled events from a calendar, then deletes - it. + .. raw:: html + +

Delete a calendar. + Removes all scheduled events from a calendar, then deletes it.

- ``_ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. """ @@ -203,9 +204,12 @@ def delete_calendar_event( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete events from a calendar. + .. raw:: html + +

Delete events from a calendar.

+ - ``_ + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param event_id: Identifier for the scheduled event. You can obtain this identifier @@ -251,9 +255,12 @@ def delete_calendar_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete anomaly jobs from a calendar. + .. raw:: html - ``_ +

Delete anomaly jobs from a calendar.

+ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param job_id: An identifier for the anomaly detection jobs. It can be a job @@ -300,9 +307,12 @@ def delete_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a data frame analytics job. + .. raw:: html + +

Delete a data frame analytics job.

- ``_ + + ``_ :param id: Identifier for the data frame analytics job. :param force: If `true`, it deletes a job that is not stopped; this method is @@ -348,9 +358,12 @@ def delete_datafeed( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a datafeed. + .. raw:: html + +

Delete a datafeed.

+ - ``_ + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -400,15 +413,20 @@ def delete_expired_data( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete expired ML data. Deletes all job results, model snapshots and forecast - data that have exceeded their retention days period. Machine learning state documents - that are not associated with any job are also deleted. You can limit the request - to a single or set of anomaly detection jobs by using a job identifier, a group - name, a comma-separated list of jobs, or a wildcard expression. You can delete - expired data for all anomaly detection jobs by using _all, by specifying * as - the , or by omitting the . + .. raw:: html - ``_ +

Delete expired ML data. + Deletes all job results, model snapshots and forecast data that have exceeded + their retention days period. Machine learning state documents that are not + associated with any job are also deleted. + You can limit the request to a single or set of anomaly detection jobs by + using a job identifier, a group name, a comma-separated list of jobs, or a + wildcard expression. You can delete expired data for all anomaly detection + jobs by using _all, by specifying * as the <job_id>, or by omitting the + <job_id>.

+ + + ``_ :param job_id: Identifier for an anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. @@ -465,11 +483,14 @@ def delete_filter( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a filter. If an anomaly detection job references the filter, you cannot - delete the filter. You must update or delete the job before you can delete the - filter. + .. raw:: html + +

Delete a filter. + If an anomaly detection job references the filter, you cannot delete the + filter. You must update or delete the job before you can delete the filter.

- ``_ + + ``_ :param filter_id: A string that uniquely identifies a filter. """ @@ -510,12 +531,16 @@ def delete_forecast( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete forecasts from a job. By default, forecasts are retained for 14 days. - You can specify a different retention period with the `expires_in` parameter - in the forecast jobs API. The delete forecast API enables you to delete one or - more forecasts before they expire. + .. raw:: html + +

Delete forecasts from a job. + By default, forecasts are retained for 14 days. You can specify a + different retention period with the expires_in parameter in the forecast + jobs API. The delete forecast API enables you to delete one or more + forecasts before they expire.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param forecast_id: A comma-separated list of forecast identifiers. If you do @@ -580,14 +605,18 @@ def delete_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an anomaly detection job. All job configuration, model state and results - are deleted. It is not currently possible to delete multiple jobs using wildcards - or a comma separated list. If you delete a job that has a datafeed, the request - first tries to delete the datafeed. This behavior is equivalent to calling the - delete datafeed API with the same timeout and force parameters as the delete - job request. + .. raw:: html + +

Delete an anomaly detection job. + All job configuration, model state and results are deleted. + It is not currently possible to delete multiple jobs using wildcards or a + comma separated list. If you delete a job that has a datafeed, the request + first tries to delete the datafeed. This behavior is equivalent to calling + the delete datafeed API with the same timeout and force parameters as the + delete job request.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param delete_user_annotations: Specifies whether annotations that have been @@ -639,11 +668,15 @@ def delete_model_snapshot( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a model snapshot. You cannot delete the active model snapshot. To delete - that snapshot, first revert to a different one. To identify the active model - snapshot, refer to the `model_snapshot_id` in the results from the get jobs API. + .. raw:: html - ``_ +

Delete a model snapshot. + You cannot delete the active model snapshot. To delete that snapshot, first + revert to a different one. To identify the active model snapshot, refer to + the model_snapshot_id in the results from the get jobs API.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: Identifier for the model snapshot. @@ -688,10 +721,13 @@ def delete_trained_model( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete an unreferenced trained model. The request deletes a trained inference - model that is not referenced by an ingest pipeline. + .. raw:: html + +

Delete an unreferenced trained model. + The request deletes a trained inference model that is not referenced by an ingest pipeline.

- ``_ + + ``_ :param model_id: The unique identifier of the trained model. :param force: Forcefully deletes a trained model that is referenced by ingest @@ -734,11 +770,15 @@ def delete_trained_model_alias( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a trained model alias. This API deletes an existing model alias that refers - to a trained model. If the model alias is missing or refers to a model other - than the one identified by the `model_id`, this API returns an error. + .. raw:: html + +

Delete a trained model alias. + This API deletes an existing model alias that refers to a trained model. If + the model alias is missing or refers to a model other than the one identified + by the model_id, this API returns an error.

+ - ``_ + ``_ :param model_id: The trained model ID to which the model alias refers. :param model_alias: The model alias to delete. @@ -791,11 +831,15 @@ def estimate_model_memory( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Estimate job model memory usage. Makes an estimation of the memory usage for - an anomaly detection job model. It is based on analysis configuration details - for the job and cardinality estimates for the fields it references. + .. raw:: html - ``_ +

Estimate job model memory usage. + Makes an estimation of the memory usage for an anomaly detection job model. + It is based on analysis configuration details for the job and cardinality + estimates for the fields it references.

+ + + ``_ :param analysis_config: For a list of the properties that you can specify in the `analysis_config` component of the body of this API. @@ -858,12 +902,16 @@ def evaluate_data_frame( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evaluate data frame analytics. The API packages together commonly used evaluation - metrics for various types of machine learning features. This has been designed - for use on indexes created by data frame analytics. Evaluation requires both - a ground truth field and an analytics result field to be present. + .. raw:: html + +

Evaluate data frame analytics. + The API packages together commonly used evaluation metrics for various types + of machine learning features. This has been designed for use on indexes + created by data frame analytics. Evaluation requires both a ground truth + field and an analytics result field to be present.

- ``_ + + ``_ :param evaluation: Defines the type of evaluation you want to perform. :param index: Defines the `index` in which the evaluation will be performed. @@ -935,15 +983,20 @@ def explain_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Explain data frame analytics config. This API provides explanations for a data - frame analytics config that either exists already or one that has not been created - yet. The following explanations are provided: * which fields are included or - not in the analysis and why, * how much memory is estimated to be required. The - estimate can be used when deciding the appropriate value for model_memory_limit - setting later on. If you have object fields or fields that are excluded via source - filtering, they are not included in the explanation. + .. raw:: html + +

Explain data frame analytics config. + This API provides explanations for a data frame analytics config that either + exists already or one that has not been created yet. The following + explanations are provided:

+
    +
  • which fields are included or not in the analysis and why,
  • +
  • how much memory is estimated to be required. The estimate can be used when deciding the appropriate value for model_memory_limit setting later on. + If you have object fields or fields that are excluded via source filtering, they are not included in the explanation.
  • +
+ - ``_ + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -1041,16 +1094,20 @@ def flush_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Force buffered data to be processed. The flush jobs API is only applicable when - sending data for analysis using the post data API. Depending on the content of - the buffer, then it might additionally calculate new results. Both flush and - close operations are similar, however the flush is more efficient if you are - expecting to send more data for analysis. When flushing, the job remains open - and is available to continue analyzing data. A close operation additionally prunes - and persists the model state to disk and the job must be opened again before - analyzing further data. + .. raw:: html - ``_ +

Force buffered data to be processed. + The flush jobs API is only applicable when sending data for analysis using + the post data API. Depending on the content of the buffer, then it might + additionally calculate new results. Both flush and close operations are + similar, however the flush is more efficient if you are expecting to send + more data for analysis. When flushing, the job remains open and is available + to continue analyzing data. A close operation additionally prunes and + persists the model state to disk and the job must be opened again before + analyzing further data.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. :param advance_time: Refer to the description for the `advance_time` query parameter. @@ -1116,12 +1173,16 @@ def forecast( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Predict future behavior of a time series. Forecasts are not supported for jobs - that perform population analysis; an error occurs if you try to create a forecast - for a job that has an `over_field_name` in its configuration. Forcasts predict - future behavior based on historical data. + .. raw:: html + +

Predict future behavior of a time series.

+

Forecasts are not supported for jobs that perform population analysis; an + error occurs if you try to create a forecast for a job that has an + over_field_name in its configuration. Forcasts predict future behavior + based on historical data.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. The job must be open when you create a forecast; otherwise, an error occurs. @@ -1201,10 +1262,13 @@ def get_buckets( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for buckets. The API presents a chronological - view of the records, grouped by bucket. + .. raw:: html + +

Get anomaly detection job results for buckets. + The API presents a chronological view of the records, grouped by bucket.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param timestamp: The timestamp of a single bucket result. If you do not specify @@ -1297,9 +1361,12 @@ def get_calendar_events( start: t.Optional[t.Union[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get info about events in calendars. + .. raw:: html - ``_ +

Get info about events in calendars.

+ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids @@ -1363,9 +1430,12 @@ def get_calendars( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get calendar configuration info. + .. raw:: html + +

Get calendar configuration info.

- ``_ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids @@ -1436,9 +1506,12 @@ def get_categories( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for categories. + .. raw:: html + +

Get anomaly detection job results for categories.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param category_id: Identifier for the category, which is unique in the job. @@ -1518,11 +1591,15 @@ def get_data_frame_analytics( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data frame analytics job configuration info. You can get information for - multiple data frame analytics jobs in a single API request by using a comma-separated - list of data frame analytics jobs or a wildcard expression. + .. raw:: html + +

Get data frame analytics job configuration info. + You can get information for multiple data frame analytics jobs in a single + API request by using a comma-separated list of data frame analytics jobs or a + wildcard expression.

+ - ``_ + ``_ :param id: Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame @@ -1592,9 +1669,12 @@ def get_data_frame_analytics_stats( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get data frame analytics jobs usage info. + .. raw:: html - ``_ +

Get data frame analytics job stats.

+ + + ``_ :param id: Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame @@ -1657,14 +1737,18 @@ def get_datafeed_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get datafeeds usage info. You can get statistics for multiple datafeeds in a - single API request by using a comma-separated list of datafeeds or a wildcard - expression. You can get statistics for all datafeeds by using `_all`, by specifying - `*` as the ``, or by omitting the ``. If the datafeed is stopped, - the only information you receive is the `datafeed_id` and the `state`. This API - returns a maximum of 10,000 datafeeds. + .. raw:: html + +

Get datafeeds stats. + You can get statistics for multiple datafeeds in a single API request by + using a comma-separated list of datafeeds or a wildcard expression. You can + get statistics for all datafeeds by using _all, by specifying * as the + <feed_id>, or by omitting the <feed_id>. If the datafeed is stopped, the + only information you receive is the datafeed_id and the state. + This API returns a maximum of 10,000 datafeeds.

- ``_ + + ``_ :param datafeed_id: Identifier for the datafeed. It can be a datafeed identifier or a wildcard expression. If you do not specify one of these options, the @@ -1718,13 +1802,17 @@ def get_datafeeds( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get datafeeds configuration info. You can get information for multiple datafeeds - in a single API request by using a comma-separated list of datafeeds or a wildcard - expression. You can get information for all datafeeds by using `_all`, by specifying - `*` as the ``, or by omitting the ``. This API returns a maximum - of 10,000 datafeeds. + .. raw:: html + +

Get datafeeds configuration info. + You can get information for multiple datafeeds in a single API request by + using a comma-separated list of datafeeds or a wildcard expression. You can + get information for all datafeeds by using _all, by specifying * as the + <feed_id>, or by omitting the <feed_id>. + This API returns a maximum of 10,000 datafeeds.

+ - ``_ + ``_ :param datafeed_id: Identifier for the datafeed. It can be a datafeed identifier or a wildcard expression. If you do not specify one of these options, the @@ -1785,9 +1873,13 @@ def get_filters( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get filters. You can get a single filter or all filters. + .. raw:: html - ``_ +

Get filters. + You can get a single filter or all filters.

+ + + ``_ :param filter_id: A string that uniquely identifies a filter. :param from_: Skips the specified number of filters. @@ -1847,11 +1939,15 @@ def get_influencers( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job results for influencers. Influencers are the entities - that have contributed to, or are to blame for, the anomalies. Influencer results - are available only if an `influencer_field_name` is specified in the job configuration. + .. raw:: html + +

Get anomaly detection job results for influencers. + Influencers are the entities that have contributed to, or are to blame for, + the anomalies. Influencer results are available only if an + influencer_field_name is specified in the job configuration.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param desc: If true, the results are sorted in descending order. @@ -1930,9 +2026,12 @@ def get_job_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection jobs usage info. + .. raw:: html + +

Get anomaly detection job stats.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. It can be a job identifier, a group name, a comma-separated list of jobs, or a wildcard expression. If @@ -1987,13 +2086,16 @@ def get_jobs( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection jobs configuration info. You can get information for multiple - anomaly detection jobs in a single API request by using a group name, a comma-separated - list of jobs, or a wildcard expression. You can get information for all anomaly - detection jobs by using `_all`, by specifying `*` as the ``, or by omitting - the ``. + .. raw:: html - ``_ +

Get anomaly detection jobs configuration info. + You can get information for multiple anomaly detection jobs in a single API + request by using a group name, a comma-separated list of jobs, or a wildcard + expression. You can get information for all anomaly detection jobs by using + _all, by specifying * as the <job_id>, or by omitting the <job_id>.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. If you do not specify one of these @@ -2052,11 +2154,14 @@ def get_memory_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get machine learning memory usage info. Get information about how machine learning - jobs and trained models are using memory, on each node, both within the JVM heap, - and natively, outside of the JVM. + .. raw:: html + +

Get machine learning memory usage info. + Get information about how machine learning jobs and trained models are using memory, + on each node, both within the JVM heap, and natively, outside of the JVM.

- ``_ + + ``_ :param node_id: The names of particular nodes in the cluster to target. For example, `nodeId1,nodeId2` or `ml:true` @@ -2109,9 +2214,12 @@ def get_model_snapshot_upgrade_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly detection job model snapshot upgrade usage info. + .. raw:: html + +

Get anomaly detection job model snapshot upgrade usage info.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: A numerical character string that uniquely identifies the @@ -2180,9 +2288,12 @@ def get_model_snapshots( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get model snapshots info. + .. raw:: html + +

Get model snapshots info.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: A numerical character string that uniquely identifies the @@ -2281,21 +2392,28 @@ def get_overall_buckets( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get overall bucket results. Retrievs overall bucket results that summarize the - bucket results of multiple anomaly detection jobs. The `overall_score` is calculated - by combining the scores of all the buckets within the overall bucket span. First, - the maximum `anomaly_score` per anomaly detection job in the overall bucket is - calculated. Then the `top_n` of those scores are averaged to result in the `overall_score`. - This means that you can fine-tune the `overall_score` so that it is more or less - sensitive to the number of jobs that detect an anomaly at the same time. For - example, if you set `top_n` to `1`, the `overall_score` is the maximum bucket - score in the overall bucket. Alternatively, if you set `top_n` to the number - of jobs, the `overall_score` is high only when all jobs detect anomalies in that - overall bucket. If you set the `bucket_span` parameter (to a value greater than - its default), the `overall_score` is the maximum `overall_score` of the overall - buckets that have a span equal to the jobs' largest bucket span. - - ``_ + .. raw:: html + +

Get overall bucket results.

+

Retrievs overall bucket results that summarize the bucket results of + multiple anomaly detection jobs.

+

The overall_score is calculated by combining the scores of all the + buckets within the overall bucket span. First, the maximum + anomaly_score per anomaly detection job in the overall bucket is + calculated. Then the top_n of those scores are averaged to result in + the overall_score. This means that you can fine-tune the + overall_score so that it is more or less sensitive to the number of + jobs that detect an anomaly at the same time. For example, if you set + top_n to 1, the overall_score is the maximum bucket score in the + overall bucket. Alternatively, if you set top_n to the number of jobs, + the overall_score is high only when all jobs detect anomalies in that + overall bucket. If you set the bucket_span parameter (to a value + greater than its default), the overall_score is the maximum + overall_score of the overall buckets that have a span equal to the + jobs' largest bucket span.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. It can be a job identifier, a group name, a comma-separated list of jobs or groups, or a wildcard expression. @@ -2390,17 +2508,22 @@ def get_records( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get anomaly records for an anomaly detection job. Records contain the detailed - analytical results. They describe the anomalous activity that has been identified - in the input data based on the detector configuration. There can be many anomaly - records depending on the characteristics and size of the input data. In practice, - there are often too many to be able to manually process them. The machine learning - features therefore perform a sophisticated aggregation of the anomaly records - into buckets. The number of record results depends on the number of anomalies - found in each bucket, which relates to the number of time series being modeled - and the number of detectors. + .. raw:: html - ``_ +

Get anomaly records for an anomaly detection job. + Records contain the detailed analytical results. They describe the anomalous + activity that has been identified in the input data based on the detector + configuration. + There can be many anomaly records depending on the characteristics and size + of the input data. In practice, there are often too many to be able to + manually process them. The machine learning features therefore perform a + sophisticated aggregation of the anomaly records into buckets. + The number of record results depends on the number of anomalies found in each + bucket, which relates to the number of time series being modeled and the + number of detectors.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. :param desc: Refer to the description for the `desc` query parameter. @@ -2488,14 +2611,18 @@ def get_trained_models( ], ] ] = None, + include_model_definition: t.Optional[bool] = None, pretty: t.Optional[bool] = None, size: t.Optional[int] = None, tags: t.Optional[t.Union[str, t.Sequence[str]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get trained model configuration info. + .. raw:: html + +

Get trained model configuration info.

- ``_ + + ``_ :param model_id: The unique identifier of the trained model or a model alias. You can get information for multiple trained models in a single API request @@ -2514,6 +2641,8 @@ def get_trained_models( :param from_: Skips the specified number of models. :param include: A comma delimited string of optional fields to include in the response body. + :param include_model_definition: parameter is deprecated! Use [include=definition] + instead :param size: Specifies the maximum number of models to obtain. :param tags: A comma delimited string of tags. A trained model can have many tags, or none. When supplied, only trained models that contain all the supplied @@ -2543,6 +2672,8 @@ def get_trained_models( __query["human"] = human if include is not None: __query["include"] = include + if include_model_definition is not None: + __query["include_model_definition"] = include_model_definition if pretty is not None: __query["pretty"] = pretty if size is not None: @@ -2575,11 +2706,14 @@ def get_trained_models_stats( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get trained models usage info. You can get usage information for multiple trained - models in a single API request by using a comma-separated list of model IDs or - a wildcard expression. + .. raw:: html + +

Get trained models usage info. + You can get usage information for multiple trained + models in a single API request by using a comma-separated list of model IDs or a wildcard expression.

+ - ``_ + ``_ :param model_id: The unique identifier of the trained model or a model alias. It can be a comma-separated list or a wildcard expression. @@ -2640,9 +2774,12 @@ def infer_trained_model( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evaluate a trained model. + .. raw:: html - ``_ +

Evaluate a trained model.

+ + + ``_ :param model_id: The unique identifier of the trained model. :param docs: An array of objects to pass to the model for inference. The objects @@ -2697,14 +2834,19 @@ def info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Return ML defaults and limits. Returns defaults and limits used by machine learning. - This endpoint is designed to be used by a user interface that needs to fully - understand machine learning configurations where some options are not specified, - meaning that the defaults should be used. This endpoint may be used to find out - what those defaults are. It also provides information about the maximum size - of machine learning jobs that could run in the current cluster configuration. + .. raw:: html + +

Get machine learning information. + Get defaults and limits used by machine learning. + This endpoint is designed to be used by a user interface that needs to fully + understand machine learning configurations where some options are not + specified, meaning that the defaults should be used. This endpoint may be + used to find out what those defaults are. It also provides information about + the maximum size of machine learning jobs that could run in the current + cluster configuration.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ml/info" @@ -2742,14 +2884,18 @@ def open_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Open anomaly detection jobs. An anomaly detection job must be opened to be ready - to receive and analyze data. It can be opened and closed multiple times throughout - its lifecycle. When you open a new job, it starts with an empty model. When you - open an existing job, the most recent model state is automatically loaded. The - job is ready to resume its analysis from where it left off, once new data is - received. + .. raw:: html + +

Open anomaly detection jobs. + An anomaly detection job must be opened to be ready to receive and analyze + data. It can be opened and closed multiple times throughout its lifecycle. + When you open a new job, it starts with an empty model. + When you open an existing job, the most recent model state is automatically + loaded. The job is ready to resume its analysis from where it left off, once + new data is received.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param timeout: Refer to the description for the `timeout` query parameter. @@ -2801,9 +2947,12 @@ def post_calendar_events( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Add scheduled events to the calendar. + .. raw:: html + +

Add scheduled events to the calendar.

+ - ``_ + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param events: A list of one of more scheduled events. The event’s start and @@ -2857,11 +3006,14 @@ def post_data( reset_start: t.Optional[t.Union[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Send data to an anomaly detection job for analysis. IMPORTANT: For each job, - data can be accepted from only a single connection at a time. It is not currently - possible to post data to multiple jobs using wildcards or a comma-separated list. + .. raw:: html - ``_ +

Send data to an anomaly detection job for analysis.

+

IMPORTANT: For each job, data can be accepted from only a single connection at a time. + It is not currently possible to post data to multiple jobs using wildcards or a comma-separated list.

+ + + ``_ :param job_id: Identifier for the anomaly detection job. The job must have a state of open to receive and process the data. @@ -2922,10 +3074,13 @@ def preview_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview features used by data frame analytics. Previews the extracted features - used by a data frame analytics config. + .. raw:: html + +

Preview features used by data frame analytics. + Previews the extracted features used by a data frame analytics config.

- ``_ + + ``_ :param id: Identifier for the data frame analytics job. :param config: A data frame analytics config as described in create data frame @@ -2985,17 +3140,20 @@ def preview_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview a datafeed. This API returns the first "page" of search results from - a datafeed. You can preview an existing datafeed or provide configuration details - for a datafeed and anomaly detection job in the API. The preview shows the structure - of the data that will be passed to the anomaly detection engine. IMPORTANT: When - Elasticsearch security features are enabled, the preview uses the credentials - of the user that called the API. However, when the datafeed starts it uses the - roles of the last user that created or updated the datafeed. To get a preview - that accurately reflects the behavior of the datafeed, use the appropriate credentials. - You can also use secondary authorization headers to supply the credentials. + .. raw:: html + +

Preview a datafeed. + This API returns the first "page" of search results from a datafeed. + You can preview an existing datafeed or provide configuration details for a datafeed + and anomaly detection job in the API. The preview shows the structure of the data + that will be passed to the anomaly detection engine. + IMPORTANT: When Elasticsearch security features are enabled, the preview uses the credentials of the user that + called the API. However, when the datafeed starts it uses the roles of the last user that created or updated the + datafeed. To get a preview that accurately reflects the behavior of the datafeed, use the appropriate credentials. + You can also use secondary authorization headers to supply the credentials.

+ - ``_ + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -3069,9 +3227,12 @@ def put_calendar( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a calendar. + .. raw:: html + +

Create a calendar.

+ - ``_ + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param description: A description of the calendar. @@ -3123,9 +3284,12 @@ def put_calendar_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Add anomaly detection job to calendar. + .. raw:: html - ``_ +

Add anomaly detection job to calendar.

+ + + ``_ :param calendar_id: A string that uniquely identifies a calendar. :param job_id: An identifier for the anomaly detection jobs. It can be a job @@ -3169,9 +3333,11 @@ def put_calendar_job( "description", "headers", "max_num_threads", + "meta", "model_memory_limit", "version", ), + parameter_aliases={"_meta": "meta"}, ignore_deprecated_options={"headers"}, ) def put_data_frame_analytics( @@ -3189,17 +3355,24 @@ def put_data_frame_analytics( headers: t.Optional[t.Mapping[str, t.Union[str, t.Sequence[str]]]] = None, human: t.Optional[bool] = None, max_num_threads: t.Optional[int] = None, + meta: t.Optional[t.Mapping[str, t.Any]] = None, model_memory_limit: t.Optional[str] = None, pretty: t.Optional[bool] = None, version: t.Optional[str] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a data frame analytics job. This API creates a data frame analytics job - that performs an analysis on the source indices and stores the outcome in a destination - index. + .. raw:: html + +

Create a data frame analytics job. + This API creates a data frame analytics job that performs an analysis on the + source indices and stores the outcome in a destination index. + By default, the query used in the source configuration is {"match_all": {}}.

+

If the destination index does not exist, it is created automatically when you start the job.

+

If you supply only a subset of the regression or classification parameters, hyperparameter optimization occurs. It determines a value for each of the undefined parameters.

- ``_ + + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -3249,6 +3422,7 @@ def put_data_frame_analytics( Using more threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself. + :param meta: :param model_memory_limit: The approximate maximum amount of memory resources that are permitted for analytical processing. If your `elasticsearch.yml` file contains an `xpack.ml.max_model_memory_limit` setting, an error occurs @@ -3293,6 +3467,8 @@ def put_data_frame_analytics( __body["headers"] = headers if max_num_threads is not None: __body["max_num_threads"] = max_num_threads + if meta is not None: + __body["_meta"] = meta if model_memory_limit is not None: __body["model_memory_limit"] = model_memory_limit if version is not None: @@ -3311,6 +3487,7 @@ def put_data_frame_analytics( @_rewrite_parameters( body_fields=( "aggregations", + "aggs", "chunking_config", "delayed_data_check_config", "frequency", @@ -3333,6 +3510,7 @@ def put_datafeed( *, datafeed_id: str, aggregations: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, + aggs: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, allow_no_indices: t.Optional[bool] = None, chunking_config: t.Optional[t.Mapping[str, t.Any]] = None, delayed_data_check_config: t.Optional[t.Mapping[str, t.Any]] = None, @@ -3365,19 +3543,21 @@ def put_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a datafeed. Datafeeds retrieve data from Elasticsearch for analysis by - an anomaly detection job. You can associate only one datafeed with each anomaly - detection job. The datafeed contains a query that runs at a defined interval - (`frequency`). If you are concerned about delayed data, you can add a delay (`query_delay') - at each interval. When Elasticsearch security features are enabled, your datafeed - remembers which roles the user who created it had at the time of creation and - runs the query using those same roles. If you provide secondary authorization - headers, those credentials are used instead. You must use Kibana, this API, or - the create anomaly detection jobs API to create a datafeed. Do not add a datafeed - directly to the `.ml-config` index. Do not give users `write` privileges on the - `.ml-config` index. + .. raw:: html + +

Create a datafeed. + Datafeeds retrieve data from Elasticsearch for analysis by an anomaly detection job. + You can associate only one datafeed with each anomaly detection job. + The datafeed contains a query that runs at a defined interval (frequency). + If you are concerned about delayed data, you can add a delay (query_delay') at each interval. By default, the datafeed uses the following query: {"match_all": {"boost": 1}}`.

+

When Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had + at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, + those credentials are used instead. + You must use Kibana, this API, or the create anomaly detection jobs API to create a datafeed. Do not add a datafeed + directly to the .ml-config index. Do not give users write privileges on the .ml-config index.

+ - ``_ + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -3386,6 +3566,8 @@ def put_datafeed( :param aggregations: If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data. + :param aggs: If set, the datafeed performs aggregation searches. Support for + aggregations is limited and should be used only with low cardinality data. :param allow_no_indices: If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the `_all` string or when no indices are specified. @@ -3417,11 +3599,11 @@ def put_datafeed( :param ignore_unavailable: If true, unavailable indices (missing or closed) are ignored. :param indexes: An array of index names. Wildcards are supported. If any of the - indices are in remote clusters, the machine learning nodes must have the - `remote_cluster_client` role. + indices are in remote clusters, the master nodes and the machine learning + nodes must have the `remote_cluster_client` role. :param indices: An array of index names. Wildcards are supported. If any of the - indices are in remote clusters, the machine learning nodes must have the - `remote_cluster_client` role. + indices are in remote clusters, the master nodes and the machine learning + nodes must have the `remote_cluster_client` role. :param indices_options: Specifies index expansion options that are used during search :param job_id: Identifier for the anomaly detection job. @@ -3473,6 +3655,8 @@ def put_datafeed( if not __body: if aggregations is not None: __body["aggregations"] = aggregations + if aggs is not None: + __body["aggs"] = aggs if chunking_config is not None: __body["chunking_config"] = chunking_config if delayed_data_check_config is not None: @@ -3528,11 +3712,14 @@ def put_filter( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a filter. A filter contains a list of strings. It can be used by one or - more anomaly detection jobs. Specifically, filters are referenced in the `custom_rules` - property of detector configuration objects. + .. raw:: html + +

Create a filter. + A filter contains a list of strings. It can be used by one or more anomaly detection jobs. + Specifically, filters are referenced in the custom_rules property of detector configuration objects.

+ - ``_ + ``_ :param filter_id: A string that uniquely identifies a filter. :param description: A description of the filter. @@ -3595,6 +3782,7 @@ def put_job( analysis_config: t.Optional[t.Mapping[str, t.Any]] = None, data_description: t.Optional[t.Mapping[str, t.Any]] = None, allow_lazy_open: t.Optional[bool] = None, + allow_no_indices: t.Optional[bool] = None, analysis_limits: t.Optional[t.Mapping[str, t.Any]] = None, background_persist_interval: t.Optional[ t.Union[str, t.Literal[-1], t.Literal[0]] @@ -3604,9 +3792,19 @@ def put_job( datafeed_config: t.Optional[t.Mapping[str, t.Any]] = None, description: t.Optional[str] = None, error_trace: t.Optional[bool] = None, + expand_wildcards: t.Optional[ + t.Union[ + t.Sequence[ + t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]] + ], + t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]], + ] + ] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, groups: t.Optional[t.Sequence[str]] = None, human: t.Optional[bool] = None, + ignore_throttled: t.Optional[bool] = None, + ignore_unavailable: t.Optional[bool] = None, model_plot_config: t.Optional[t.Mapping[str, t.Any]] = None, model_snapshot_retention_days: t.Optional[int] = None, pretty: t.Optional[bool] = None, @@ -3616,10 +3814,14 @@ def put_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an anomaly detection job. If you include a `datafeed_config`, you must - have read index privileges on the source index. + .. raw:: html - ``_ +

Create an anomaly detection job. + If you include a datafeed_config, you must have read index privileges on the source index. + If you include a datafeed_config but do not provide a query, the datafeed uses {"match_all": {"boost": 1}}.

+ + + ``_ :param job_id: The identifier for the anomaly detection job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and @@ -3641,6 +3843,9 @@ def put_job( to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available. + :param allow_no_indices: If `true`, wildcard indices expressions that resolve + into no concrete indices are ignored. This includes the `_all` string or + when no indices are specified. :param analysis_limits: Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for @@ -3664,7 +3869,20 @@ def put_job( using those same roles. If you provide secondary authorization headers, those credentials are used instead. :param description: A description of the job. + :param expand_wildcards: Type of index that wildcard patterns can match. If the + request can target data streams, this argument determines whether wildcard + expressions match hidden data streams. Supports comma-separated values. Valid + values are: * `all`: Match any data stream or index, including hidden ones. + * `closed`: Match closed, non-hidden indices. Also matches any non-hidden + data stream. Data streams cannot be closed. * `hidden`: Match hidden data + streams and hidden indices. Must be combined with `open`, `closed`, or both. + * `none`: Wildcard patterns are not accepted. * `open`: Match open, non-hidden + indices. Also matches any non-hidden data stream. :param groups: A list of job groups. A job can belong to no groups or many. + :param ignore_throttled: If `true`, concrete, expanded or aliased indices are + ignored when frozen. + :param ignore_unavailable: If `true`, unavailable indices (missing or closed) + are ignored. :param model_plot_config: This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance @@ -3704,12 +3922,20 @@ def put_job( __path = f'/_ml/anomaly_detectors/{__path_parts["job_id"]}' __query: t.Dict[str, t.Any] = {} __body: t.Dict[str, t.Any] = body if body is not None else {} + if allow_no_indices is not None: + __query["allow_no_indices"] = allow_no_indices if error_trace is not None: __query["error_trace"] = error_trace + if expand_wildcards is not None: + __query["expand_wildcards"] = expand_wildcards if filter_path is not None: __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if ignore_throttled is not None: + __query["ignore_throttled"] = ignore_throttled + if ignore_unavailable is not None: + __query["ignore_unavailable"] = ignore_unavailable if pretty is not None: __query["pretty"] = pretty if not __body: @@ -3797,10 +4023,13 @@ def put_trained_model( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a trained model. Enable you to supply a trained model that is not created - by data frame analytics. + .. raw:: html - ``_ +

Create a trained model. + Enable you to supply a trained model that is not created by data frame analytics.

+ + + ``_ :param model_id: The unique identifier of the trained model. :param compressed_definition: The compressed (GZipped and Base64 encoded) inference @@ -3900,21 +4129,28 @@ def put_trained_model_alias( reassign: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Create or update a trained model alias. A trained model alias is a logical name - used to reference a single trained model. You can use aliases instead of trained - model identifiers to make it easier to reference your models. For example, you - can use aliases in inference aggregations and processors. An alias must be unique - and refer to only a single trained model. However, you can have multiple aliases - for each trained model. If you use this API to update an alias such that it references - a different trained model ID and the model uses a different type of data frame - analytics, an error occurs. For example, this situation occurs if you have a - trained model for regression analysis and a trained model for classification - analysis; you cannot reassign an alias from one type of trained model to another. - If you use this API to update an alias and there are very few input fields in - common between the old and new trained models for the model alias, the API returns - a warning. - - ``_ + .. raw:: html + +

Create or update a trained model alias. + A trained model alias is a logical name used to reference a single trained + model. + You can use aliases instead of trained model identifiers to make it easier to + reference your models. For example, you can use aliases in inference + aggregations and processors. + An alias must be unique and refer to only a single trained model. However, + you can have multiple aliases for each trained model. + If you use this API to update an alias such that it references a different + trained model ID and the model uses a different type of data frame analytics, + an error occurs. For example, this situation occurs if you have a trained + model for regression analysis and a trained model for classification + analysis; you cannot reassign an alias from one type of trained model to + another. + If you use this API to update an alias and there are very few input fields in + common between the old and new trained models for the model alias, the API + returns a warning.

+ + + ``_ :param model_id: The identifier for the trained model that the alias refers to. :param model_alias: The alias to create or update. This value cannot end in numbers. @@ -3970,9 +4206,12 @@ def put_trained_model_definition_part( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create part of a trained model definition. + .. raw:: html + +

Create part of a trained model definition.

- ``_ + + ``_ :param model_id: The unique identifier of the trained model. :param part: The definition part number. When the definition is loaded for inference @@ -4047,11 +4286,14 @@ def put_trained_model_vocabulary( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a trained model vocabulary. This API is supported only for natural language - processing (NLP) models. The vocabulary is stored in the index as described in - `inference_config.*.vocabulary` of the trained model definition. + .. raw:: html + +

Create a trained model vocabulary. + This API is supported only for natural language processing (NLP) models. + The vocabulary is stored in the index as described in inference_config.*.vocabulary of the trained model definition.

+ - ``_ + ``_ :param model_id: The unique identifier of the trained model. :param vocabulary: The model vocabulary, which must not be empty. @@ -4105,11 +4347,16 @@ def reset_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset an anomaly detection job. All model state and results are deleted. The - job is ready to start over as if it had just been created. It is not currently - possible to reset multiple jobs using wildcards or a comma separated list. + .. raw:: html - ``_ +

Reset an anomaly detection job. + All model state and results are deleted. The job is ready to start over as if + it had just been created. + It is not currently possible to reset multiple jobs using wildcards or a + comma separated list.

+ + + ``_ :param job_id: The ID of the job to reset. :param delete_user_annotations: Specifies whether annotations that have been @@ -4161,15 +4408,19 @@ def revert_model_snapshot( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Revert to a snapshot. The machine learning features react quickly to anomalous - input, learning new behaviors in data. Highly anomalous input increases the variance - in the models whilst the system learns whether this is a new step-change in behavior - or a one-off event. In the case where this anomalous input is known to be a one-off, - then it might be appropriate to reset the model state to a time before this event. - For example, you might consider reverting to a saved snapshot after Black Friday - or a critical system failure. + .. raw:: html + +

Revert to a snapshot. + The machine learning features react quickly to anomalous input, learning new + behaviors in data. Highly anomalous input increases the variance in the + models whilst the system learns whether this is a new step-change in behavior + or a one-off event. In the case where this anomalous input is known to be a + one-off, then it might be appropriate to reset the model state to a time + before this event. For example, you might consider reverting to a saved + snapshot after Black Friday or a critical system failure.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: You can specify `empty` as the . Reverting to @@ -4227,19 +4478,24 @@ def set_upgrade_mode( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Set upgrade_mode for ML indices. Sets a cluster wide upgrade_mode setting that - prepares machine learning indices for an upgrade. When upgrading your cluster, - in some circumstances you must restart your nodes and reindex your machine learning - indices. In those circumstances, there must be no machine learning jobs running. - You can close the machine learning jobs, do the upgrade, then open all the jobs - again. Alternatively, you can use this API to temporarily halt tasks associated - with the jobs and datafeeds and prevent new jobs from opening. You can also use - this API during upgrades that do not require you to reindex your machine learning - indices, though stopping jobs is not a requirement in that case. You can see - the current value for the upgrade_mode setting by using the get machine learning - info API. + .. raw:: html + +

Set upgrade_mode for ML indices. + Sets a cluster wide upgrade_mode setting that prepares machine learning + indices for an upgrade. + When upgrading your cluster, in some circumstances you must restart your + nodes and reindex your machine learning indices. In those circumstances, + there must be no machine learning jobs running. You can close the machine + learning jobs, do the upgrade, then open all the jobs again. Alternatively, + you can use this API to temporarily halt tasks associated with the jobs and + datafeeds and prevent new jobs from opening. You can also use this API + during upgrades that do not require you to reindex your machine learning + indices, though stopping jobs is not a requirement in that case. + You can see the current value for the upgrade_mode setting by using the get + machine learning info API.

+ - ``_ + ``_ :param enabled: When `true`, it enables `upgrade_mode` which temporarily halts all job and datafeed tasks and prohibits new job and datafeed tasks from @@ -4283,18 +4539,23 @@ def start_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a data frame analytics job. A data frame analytics job can be started and - stopped multiple times throughout its lifecycle. If the destination index does - not exist, it is created automatically the first time you start the data frame - analytics job. The `index.number_of_shards` and `index.number_of_replicas` settings - for the destination index are copied from the source index. If there are multiple - source indices, the destination index copies the highest setting values. The - mappings for the destination index are also copied from the source indices. If - there are any mapping conflicts, the job fails to start. If the destination index - exists, it is used as is. You can therefore set up the destination index in advance - with custom settings and mappings. + .. raw:: html - ``_ +

Start a data frame analytics job. + A data frame analytics job can be started and stopped multiple times + throughout its lifecycle. + If the destination index does not exist, it is created automatically the + first time you start the data frame analytics job. The + index.number_of_shards and index.number_of_replicas settings for the + destination index are copied from the source index. If there are multiple + source indices, the destination index copies the highest setting values. The + mappings for the destination index are also copied from the source indices. + If there are any mapping conflicts, the job fails to start. + If the destination index exists, it is used as is. You can therefore set up + the destination index in advance with custom settings and mappings.

+ + + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -4344,19 +4605,20 @@ def start_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start datafeeds. A datafeed must be started in order to retrieve data from Elasticsearch. - A datafeed can be started and stopped multiple times throughout its lifecycle. - Before you can start a datafeed, the anomaly detection job must be open. Otherwise, - an error occurs. If you restart a stopped datafeed, it continues processing input - data from the next millisecond after it was stopped. If new data was indexed - for that exact millisecond between stopping and starting, it will be ignored. - When Elasticsearch security features are enabled, your datafeed remembers which - roles the last user to create or update it had at the time of creation or update - and runs the query using those same roles. If you provided secondary authorization - headers when you created or updated the datafeed, those credentials are used - instead. + .. raw:: html + +

Start datafeeds.

+

A datafeed must be started in order to retrieve data from Elasticsearch. A datafeed can be started and stopped + multiple times throughout its lifecycle.

+

Before you can start a datafeed, the anomaly detection job must be open. Otherwise, an error occurs.

+

If you restart a stopped datafeed, it continues processing input data from the next millisecond after it was stopped. + If new data was indexed for that exact millisecond between stopping and starting, it will be ignored.

+

When Elasticsearch security features are enabled, your datafeed remembers which roles the last user to create or + update it had at the time of creation or update and runs the query using those same roles. If you provided secondary + authorization headers when you created or updated the datafeed, those credentials are used instead.

- ``_ + + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -4423,10 +4685,13 @@ def start_trained_model_deployment( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a trained model deployment. It allocates the model to every machine learning - node. + .. raw:: html + +

Start a trained model deployment. + It allocates the model to every machine learning node.

+ - ``_ + ``_ :param model_id: The unique identifier of the trained model. Currently, only PyTorch models are supported. @@ -4507,10 +4772,14 @@ def stop_data_frame_analytics( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop data frame analytics jobs. A data frame analytics job can be started and - stopped multiple times throughout its lifecycle. + .. raw:: html + +

Stop data frame analytics jobs. + A data frame analytics job can be started and stopped multiple times + throughout its lifecycle.

+ - ``_ + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -4573,10 +4842,14 @@ def stop_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop datafeeds. A datafeed that is stopped ceases to retrieve data from Elasticsearch. - A datafeed can be started and stopped multiple times throughout its lifecycle. + .. raw:: html - ``_ +

Stop datafeeds. + A datafeed that is stopped ceases to retrieve data from Elasticsearch. A datafeed can be started and stopped + multiple times throughout its lifecycle.

+ + + ``_ :param datafeed_id: Identifier for the datafeed. You can stop multiple datafeeds in a single API request by using a comma-separated list of datafeeds or a @@ -4636,9 +4909,12 @@ def stop_trained_model_deployment( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop a trained model deployment. + .. raw:: html + +

Stop a trained model deployment.

- ``_ + + ``_ :param model_id: The unique identifier of the trained model. :param allow_no_match: Specifies what to do when the request: contains wildcard @@ -4701,9 +4977,12 @@ def update_data_frame_analytics( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a data frame analytics job. + .. raw:: html + +

Update a data frame analytics job.

+ - ``_ + ``_ :param id: Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -4809,13 +5088,16 @@ def update_datafeed( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a datafeed. You must stop and start the datafeed for the changes to be - applied. When Elasticsearch security features are enabled, your datafeed remembers - which roles the user who updated it had at the time of the update and runs the - query using those same roles. If you provide secondary authorization headers, - those credentials are used instead. + .. raw:: html - ``_ +

Update a datafeed. + You must stop and start the datafeed for the changes to be applied. + When Elasticsearch security features are enabled, your datafeed remembers which roles the user who updated it had at + the time of the update and runs the query using those same roles. If you provide secondary authorization headers, + those credentials are used instead.

+ + + ``_ :param datafeed_id: A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z @@ -4976,10 +5258,13 @@ def update_filter( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a filter. Updates the description of a filter, adds items, or removes - items from the list. + .. raw:: html + +

Update a filter. + Updates the description of a filter, adds items, or removes items from the list.

- ``_ + + ``_ :param filter_id: A string that uniquely identifies a filter. :param add_items: The items to add to the filter. @@ -5067,10 +5352,13 @@ def update_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an anomaly detection job. Updates certain properties of an anomaly detection - job. + .. raw:: html + +

Update an anomaly detection job. + Updates certain properties of an anomaly detection job.

- ``_ + + ``_ :param job_id: Identifier for the job. :param allow_lazy_open: Advanced configuration option. Specifies whether this @@ -5196,9 +5484,13 @@ def update_model_snapshot( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a snapshot. Updates certain properties of a snapshot. + .. raw:: html + +

Update a snapshot. + Updates certain properties of a snapshot.

+ - ``_ + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: Identifier for the model snapshot. @@ -5257,9 +5549,12 @@ def update_trained_model_deployment( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a trained model deployment. + .. raw:: html - ``_ +

Update a trained model deployment.

+ + + ``_ :param model_id: The unique identifier of the trained model. Currently, only PyTorch models are supported. @@ -5316,16 +5611,21 @@ def upgrade_job_snapshot( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Upgrade a snapshot. Upgrades an anomaly detection model snapshot to the latest - major version. Over time, older snapshot formats are deprecated and removed. - Anomaly detection jobs support only snapshots that are from the current or previous - major version. This API provides a means to upgrade a snapshot to the current - major version. This aids in preparing the cluster for an upgrade to the next - major version. Only one snapshot per anomaly detection job can be upgraded at - a time and the upgraded snapshot cannot be the current snapshot of the anomaly - detection job. + .. raw:: html + +

Upgrade a snapshot. + Upgrades an anomaly detection model snapshot to the latest major version. + Over time, older snapshot formats are deprecated and removed. Anomaly + detection jobs support only snapshots that are from the current or previous + major version. + This API provides a means to upgrade a snapshot to the current major version. + This aids in preparing the cluster for an upgrade to the next major version. + Only one snapshot per anomaly detection job can be upgraded at a time and the + upgraded snapshot cannot be the current snapshot of the anomaly detection + job.

- ``_ + + ``_ :param job_id: Identifier for the anomaly detection job. :param snapshot_id: A numerical character string that uniquely identifies the @@ -5399,9 +5699,12 @@ def validate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Validates an anomaly detection job. + .. raw:: html + +

Validate an anomaly detection job.

+ - ``_ + ``_ :param analysis_config: :param analysis_limits: @@ -5469,9 +5772,12 @@ def validate_detector( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Validates an anomaly detection detector. + .. raw:: html + +

Validate an anomaly detection job.

+ - ``_ + ``_ :param detector: """ diff --git a/elasticsearch/_sync/client/monitoring.py b/elasticsearch/_sync/client/monitoring.py index 923a9b652..eae014b19 100644 --- a/elasticsearch/_sync/client/monitoring.py +++ b/elasticsearch/_sync/client/monitoring.py @@ -42,9 +42,13 @@ def bulk( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Used by the monitoring features to send monitoring data. + .. raw:: html - ``_ +

Send monitoring data. + This API is used by the monitoring features to send monitoring data.

+ + + ``_ :param interval: Collection interval (e.g., '10s' or '10000ms') of the payload :param operations: diff --git a/elasticsearch/_sync/client/nodes.py b/elasticsearch/_sync/client/nodes.py index 918bb8ced..612470b03 100644 --- a/elasticsearch/_sync/client/nodes.py +++ b/elasticsearch/_sync/client/nodes.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse, TextApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class NodesClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def clear_repositories_metering_archive( self, *, @@ -37,15 +44,18 @@ def clear_repositories_metering_archive( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - You can use this API to clear the archived repositories metering information - in the cluster. + .. raw:: html - ``_ +

Clear the archived repositories metering. + Clear the archived repositories metering information in the cluster.

+ + + ``_ :param node_id: Comma-separated list of node IDs or names used to limit returned - information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes). - :param max_archive_version: Specifies the maximum [archive_version](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-repositories-metering-api.html#get-repositories-metering-api-response-body) - to be cleared from the archive. + information. + :param max_archive_version: Specifies the maximum `archive_version` to be cleared + from the archive. """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'node_id'") @@ -76,6 +86,7 @@ def clear_repositories_metering_archive( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def get_repositories_metering_info( self, *, @@ -86,13 +97,15 @@ def get_repositories_metering_info( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - You can use the cluster repositories metering API to retrieve repositories metering - information in a cluster. This API exposes monotonically non-decreasing counters - and it’s expected that clients would durably store the information needed to - compute aggregations over a period of time. Additionally, the information exposed - by this API is volatile, meaning that it won’t be present after node restarts. + .. raw:: html - ``_ +

Get cluster repositories metering. + Get repositories metering information for a cluster. + This API exposes monotonically non-decreasing counters and it is expected that clients would durably store the information needed to compute aggregations over a period of time. + Additionally, the information exposed by this API is volatile, meaning that it will not be present after node restarts.

+ + + ``_ :param node_id: Comma-separated list of node IDs or names used to limit returned information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes). @@ -143,10 +156,14 @@ def hot_threads( ] = None, ) -> TextApiResponse: """ - This API yields a breakdown of the hot threads on each selected node in the cluster. - The output is plain text with a breakdown of each node’s top hot threads. + .. raw:: html + +

Get the hot threads for nodes. + Get a breakdown of the hot threads on each selected node in the cluster. + The output is plain text with a breakdown of the top hot threads for each node.

+ - ``_ + ``_ :param node_id: List of node IDs or names used to limit returned information. :param ignore_idle_threads: If true, known idle threads (e.g. waiting in a socket @@ -219,9 +236,13 @@ def info( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster nodes information. + .. raw:: html - ``_ +

Get node information. + By default, the API returns all attributes and core settings for cluster nodes.

+ + + ``_ :param node_id: Comma-separated list of node IDs or names used to limit returned information. @@ -288,9 +309,18 @@ def reload_secure_settings( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Reloads the keystore on nodes in the cluster. + .. raw:: html + +

Reload the keystore on nodes in the cluster.

+

Secure settings are stored in an on-disk keystore. Certain of these settings are reloadable. + That is, you can change them on disk and reload them without restarting any nodes in the cluster. + When you have updated reloadable secure settings in your keystore, you can use this API to reload those settings on each node.

+

When the Elasticsearch keystore is password protected and not simply obfuscated, you must provide the password for the keystore when you reload the secure settings. + Reloading the settings for the whole cluster assumes that the keystores for all nodes are protected with the same password; this method is allowed only when inter-node communications are encrypted. + Alternatively, you can reload the secure settings on each node by locally accessing the API and passing the node-specific Elasticsearch keystore password.

+ - ``_ + ``_ :param node_id: The names of particular nodes in the cluster to target. :param secure_settings_password: The password for the Elasticsearch keystore. @@ -359,9 +389,14 @@ def stats( types: t.Optional[t.Sequence[str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns cluster nodes statistics. + .. raw:: html - ``_ +

Get node statistics. + Get statistics for nodes in a cluster. + By default, all stats are returned. You can limit the returned information by using metrics.

+ + + ``_ :param node_id: Comma-separated list of node IDs or names used to limit returned information. @@ -476,9 +511,12 @@ def usage( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information on the usage of features. + .. raw:: html + +

Get feature usage information.

+ - ``_ + ``_ :param 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 diff --git a/elasticsearch/_sync/client/query_rules.py b/elasticsearch/_sync/client/query_rules.py index 7b66ca7ed..2b322949c 100644 --- a/elasticsearch/_sync/client/query_rules.py +++ b/elasticsearch/_sync/client/query_rules.py @@ -37,9 +37,14 @@ def delete_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a query rule within a query ruleset. + .. raw:: html - ``_ +

Delete a query rule. + Delete a query rule within a query ruleset. + This is a destructive action that is only recoverable by re-adding the same rule with the create or update query rule API.

+ + + ``_ :param ruleset_id: The unique identifier of the query ruleset containing the rule to delete @@ -85,9 +90,14 @@ def delete_ruleset( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a query ruleset. + .. raw:: html + +

Delete a query ruleset. + Remove a query ruleset and its associated data. + This is a destructive action that is not recoverable.

+ - ``_ + ``_ :param ruleset_id: The unique identifier of the query ruleset to delete """ @@ -126,9 +136,13 @@ def get_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the details about a query rule within a query ruleset + .. raw:: html - ``_ +

Get a query rule. + Get details about a query rule within a query ruleset.

+ + + ``_ :param ruleset_id: The unique identifier of the query ruleset containing the rule to retrieve @@ -174,9 +188,13 @@ def get_ruleset( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the details about a query ruleset + .. raw:: html + +

Get a query ruleset. + Get details about a query ruleset.

+ - ``_ + ``_ :param ruleset_id: The unique identifier of the query ruleset """ @@ -217,12 +235,16 @@ def list_rulesets( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns summarized information about existing query rulesets. + .. raw:: html - ``_ +

Get all query rulesets. + Get summarized information about the query rulesets.

- :param from_: Starting offset (default: 0) - :param size: specifies a max number of results to get + + ``_ + + :param from_: The offset from the first result to fetch. + :param size: The maximum number of results to retrieve. """ __path_parts: t.Dict[str, str] = {} __path = "/_query_rules" @@ -270,17 +292,28 @@ def put_rule( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a query rule within a query ruleset. + .. raw:: html + +

Create or update a query rule. + Create or update a query rule within a query ruleset.

+

IMPORTANT: Due to limitations within pinned queries, you can only pin documents using ids or docs, but cannot use both in single rule. + It is advised to use one or the other in query rulesets, to avoid errors. + Additionally, pinned queries have a maximum limit of 100 pinned hits. + If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.

+ - ``_ + ``_ :param ruleset_id: The unique identifier of the query ruleset containing the - rule to be created or updated + rule to be created or updated. :param rule_id: The unique identifier of the query rule within the specified - ruleset to be created or updated - :param actions: - :param criteria: - :param type: + ruleset to be created or updated. + :param actions: The actions to take when the rule is matched. The format of this + action depends on the rule type. + :param criteria: The criteria that must be met for the rule to be applied. If + multiple criteria are specified for a rule, all criteria must be met for + the rule to be applied. + :param type: The type of rule. :param priority: """ if ruleset_id in SKIP_IN_PATH: @@ -345,12 +378,21 @@ def put_ruleset( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a query ruleset. + .. raw:: html - ``_ +

Create or update a query ruleset. + There is a limit of 100 rules per ruleset. + This limit can be increased by using the xpack.applications.rules.max_rules_per_ruleset cluster setting.

+

IMPORTANT: Due to limitations within pinned queries, you can only select documents using ids or docs, but cannot use both in single rule. + It is advised to use one or the other in query rulesets, to avoid errors. + Additionally, pinned queries have a maximum limit of 100 pinned hits. + If multiple matching rules pin more than 100 documents, only the first 100 documents are pinned in the order they are specified in the ruleset.

+ + + ``_ :param ruleset_id: The unique identifier of the query ruleset to be created or - updated + updated. :param rules: """ if ruleset_id in SKIP_IN_PATH: @@ -382,3 +424,62 @@ def put_ruleset( endpoint_id="query_rules.put_ruleset", path_parts=__path_parts, ) + + @_rewrite_parameters( + body_fields=("match_criteria",), + ) + def test( + self, + *, + ruleset_id: str, + match_criteria: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Test a query ruleset. + Evaluate match criteria against a query ruleset to identify the rules that would match that criteria.

+ + + ``_ + + :param ruleset_id: The unique identifier of the query ruleset to be created or + updated + :param match_criteria: The match criteria to apply to rules in the given query + ruleset. Match criteria should match the keys defined in the `criteria.metadata` + field of the rule. + """ + if ruleset_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'ruleset_id'") + if match_criteria is None and body is None: + raise ValueError("Empty value passed for parameter 'match_criteria'") + __path_parts: t.Dict[str, str] = {"ruleset_id": _quote(ruleset_id)} + __path = f'/_query_rules/{__path_parts["ruleset_id"]}/_test' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if match_criteria is not None: + __body["match_criteria"] = match_criteria + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="query_rules.test", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_sync/client/rollup.py b/elasticsearch/_sync/client/rollup.py index 066427db5..84ca3d410 100644 --- a/elasticsearch/_sync/client/rollup.py +++ b/elasticsearch/_sync/client/rollup.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class RollupClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def delete_job( self, *, @@ -36,9 +43,31 @@ def delete_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an existing rollup job. + .. raw:: html - ``_ +

Delete a rollup job.

+

A job must be stopped before it can be deleted. + If you attempt to delete a started job, an error occurs. + Similarly, if you attempt to delete a nonexistent job, an exception occurs.

+

IMPORTANT: When you delete a job, you remove only the process that is actively monitoring and rolling up data. + The API does not delete any previously rolled up data. + This is by design; a user may wish to roll up a static data set. + Because the data set is static, after it has been fully rolled up there is no need to keep the indexing rollup job around (as there will be no new data). + Thus the job can be deleted, leaving behind the rolled up data for analysis. + If you wish to also remove the rollup data and the rollup index contains the data for only a single job, you can delete the whole rollup index. + If the rollup index stores data from several jobs, you must issue a delete-by-query that targets the rollup job's identifier in the rollup index. For example:

+
POST my_rollup_index/_delete_by_query
+          {
+            "query": {
+              "term": {
+                "_rollup.id": "the_rollup_job_id"
+              }
+            }
+          }
+          
+ + + ``_ :param id: Identifier for the job. """ @@ -66,6 +95,7 @@ def delete_job( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def get_jobs( self, *, @@ -76,9 +106,16 @@ def get_jobs( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the configuration, stats, and status of rollup jobs. + .. raw:: html + +

Get rollup job information. + Get the configuration, stats, and status of rollup jobs.

+

NOTE: This API returns only active (both STARTED and STOPPED) jobs. + If a job was created, ran for a while, then was deleted, the API does not return any details about it. + For details about a historical rollup job, the rollup capabilities API may be more useful.

+ - ``_ + ``_ :param id: Identifier for the rollup job. If it is `_all` or omitted, the API returns all rollup jobs. @@ -110,6 +147,7 @@ def get_jobs( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def get_rollup_caps( self, *, @@ -120,10 +158,20 @@ def get_rollup_caps( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the capabilities of any rollup jobs that have been configured for a specific - index or index pattern. + .. raw:: html - ``_ +

Get the rollup job capabilities. + Get the capabilities of any rollup jobs that have been configured for a specific index or index pattern.

+

This API is useful because a rollup job is often configured to rollup only a subset of fields from the source index. + Furthermore, only certain aggregations can be configured for various fields, leading to a limited subset of functionality depending on that configuration. + This API enables you to inspect an index and determine:

+
    +
  1. Does this index have associated rollup data somewhere in the cluster?
  2. +
  3. If yes to the first question, what fields were rolled up, what aggregations can be performed, and where does the data live?
  4. +
+ + + ``_ :param id: Index, indices or index-pattern to return rollup capabilities for. `_all` may be used to fetch rollup capabilities from all jobs. @@ -155,6 +203,7 @@ def get_rollup_caps( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def get_rollup_index_caps( self, *, @@ -165,10 +214,18 @@ def get_rollup_index_caps( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the rollup capabilities of all jobs inside of a rollup index (for example, - the index where rollup data is stored). + .. raw:: html + +

Get the rollup index capabilities. + Get the rollup capabilities of all jobs inside of a rollup index. + A single rollup index may store the data for multiple rollup jobs and may have a variety of capabilities depending on those jobs. This API enables you to determine:

+
    +
  • What jobs are stored in an index (or indices specified via a pattern)?
  • +
  • What target indices were rolled up, what fields were used in those rollups, and what aggregations can be performed on each job?
  • +
+ - ``_ + ``_ :param index: Data stream or index to check for rollup capabilities. Wildcard (`*`) expressions are supported. @@ -209,6 +266,7 @@ def get_rollup_index_caps( ), ignore_deprecated_options={"headers"}, ) + @_stability_warning(Stability.EXPERIMENTAL) def put_job( self, *, @@ -228,9 +286,16 @@ def put_job( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a rollup job. + .. raw:: html - ``_ +

Create a rollup job.

+

WARNING: From 8.15.0, calling this API in a cluster with no rollup usage will fail with a message about the deprecation and planned removal of rollup features. A cluster needs to contain either a rollup job or a rollup index in order for this API to be allowed to run.

+

The rollup job configuration contains all the details about how the job should run, when it indexes documents, and what future queries will be able to run against the rollup index.

+

There are three main sections to the job configuration: the logistical details about the job (for example, the cron schedule), the fields that are used for grouping, and what metrics to collect for each group.

+

Jobs are created in a STOPPED state. You can start them with the start rollup jobs API.

+ + + ``_ :param id: Identifier for the rollup job. This can be any alphanumeric string and uniquely identifies the data that is associated with the rollup job. @@ -327,6 +392,7 @@ def put_job( @_rewrite_parameters( body_fields=("aggregations", "aggs", "query", "size"), ) + @_stability_warning(Stability.EXPERIMENTAL) def rollup_search( self, *, @@ -344,14 +410,54 @@ def rollup_search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables searching rolled-up data using the standard Query DSL. + .. raw:: html + +

Search rolled-up data. + The rollup search endpoint is needed because, internally, rolled-up documents utilize a different document structure than the original data. + It rewrites standard Query DSL into a format that matches the rollup documents then takes the response and rewrites it back to what a client would expect given the original query.

+

The request body supports a subset of features from the regular search API. + The following functionality is not available:

+

size: Because rollups work on pre-aggregated data, no search hits can be returned and so size must be set to zero or omitted entirely. + highlighter, suggestors, post_filter, profile, explain: These are similarly disallowed.

+

Searching both historical rollup and non-rollup data

+

The rollup search API has the capability to search across both "live" non-rollup data and the aggregated rollup data. + This is done by simply adding the live indices to the URI. For example:

+
GET sensor-1,sensor_rollup/_rollup_search
+          {
+            "size": 0,
+            "aggregations": {
+               "max_temperature": {
+                "max": {
+                  "field": "temperature"
+                }
+              }
+            }
+          }
+          
+

The rollup search endpoint does two things when the search runs:

+
    +
  • The original request is sent to the non-rollup index unaltered.
  • +
  • A rewritten version of the original request is sent to the rollup index.
  • +
+

When the two responses are received, the endpoint rewrites the rollup response and merges the two together. + During the merging process, if there is any overlap in buckets between the two responses, the buckets from the non-rollup index are used.

+ - ``_ + ``_ - :param index: Enables searching rolled-up data using the standard Query DSL. + :param index: A comma-separated list of data streams and indices used to limit + the request. This parameter has the following rules: * At least one data + stream, index, or wildcard expression must be specified. This target can + include a rollup or non-rollup index. For data streams, the stream's backing + indices can only serve as non-rollup indices. Omitting the parameter or using + `_all` are not permitted. * Multiple non-rollup indices may be specified. + * Only one rollup index may be specified. If more than one are supplied, + an exception occurs. * Wildcard expressions (`*`) may be used. If they match + more than one rollup index, an exception occurs. However, you can use an + expression to match multiple non-rollup indices or data streams. :param aggregations: Specifies aggregations. :param aggs: Specifies aggregations. - :param query: Specifies a DSL query. + :param query: Specifies a DSL query that is subject to some limitations. :param rest_total_hits_as_int: Indicates whether hits.total should be rendered as an integer or an object in the rest search response :param size: Must be zero if set, as rollups work on pre-aggregated data. @@ -397,6 +503,7 @@ def rollup_search( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def start_job( self, *, @@ -407,9 +514,14 @@ def start_job( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Starts an existing, stopped rollup job. + .. raw:: html - ``_ +

Start rollup jobs. + If you try to start a job that does not exist, an exception occurs. + If you try to start a job that is already started, nothing happens.

+ + + ``_ :param id: Identifier for the rollup job. """ @@ -437,6 +549,7 @@ def start_job( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def stop_job( self, *, @@ -449,14 +562,28 @@ def stop_job( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stops an existing, started rollup job. + .. raw:: html + +

Stop rollup jobs. + If you try to stop a job that does not exist, an exception occurs. + If you try to stop a job that is already stopped, nothing happens.

+

Since only a stopped job can be deleted, it can be useful to block the API until the indexer has fully stopped. + This is accomplished with the wait_for_completion query parameter, and optionally a timeout. For example:

+
POST _rollup/job/sensor/_stop?wait_for_completion=true&timeout=10s
+          
+

The parameter blocks the API call from returning until either the job has moved to STOPPED or the specified time has elapsed. + If the specified time elapses without the job moving to STOPPED, a timeout exception occurs.

+ - ``_ + ``_ :param id: Identifier for the rollup job. :param timeout: If `wait_for_completion` is `true`, the API blocks for (at maximum) the specified duration while waiting for the job to stop. If more than `timeout` - time has passed, the API throws a timeout exception. + time has passed, the API throws a timeout exception. NOTE: Even if a timeout + occurs, the stop request is still processing and eventually moves the job + to STOPPED. The timeout simply means the API call itself timed out while + waiting for the status change. :param wait_for_completion: If set to `true`, causes the API to block until the indexer state completely stops. If set to `false`, the API returns immediately and the indexer is stopped asynchronously in the background. diff --git a/elasticsearch/_sync/client/search_application.py b/elasticsearch/_sync/client/search_application.py index e6483fe8e..76ef2d456 100644 --- a/elasticsearch/_sync/client/search_application.py +++ b/elasticsearch/_sync/client/search_application.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class SearchApplicationClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.BETA) def delete( self, *, @@ -36,9 +43,13 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a search application. + .. raw:: html - ``_ +

Delete a search application. + Remove a search application and its associated alias. Indices attached to the search application are not removed.

+ + + ``_ :param name: The name of the search application to delete """ @@ -66,6 +77,7 @@ def delete( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def delete_behavioral_analytics( self, *, @@ -76,9 +88,13 @@ def delete_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a behavioral analytics collection. + .. raw:: html + +

Delete a behavioral analytics collection. + The associated data stream is also deleted.

+ - ``_ + ``_ :param name: The name of the analytics collection to be deleted """ @@ -106,6 +122,7 @@ def delete_behavioral_analytics( ) @_rewrite_parameters() + @_stability_warning(Stability.BETA) def get( self, *, @@ -116,9 +133,12 @@ def get( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the details about a search application + .. raw:: html - ``_ +

Get search application details.

+ + + ``_ :param name: The name of the search application """ @@ -146,6 +166,7 @@ def get( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def get_behavioral_analytics( self, *, @@ -156,9 +177,12 @@ def get_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the existing behavioral analytics collections. + .. raw:: html + +

Get behavioral analytics collections.

- ``_ + + ``_ :param name: A list of analytics collections to limit the returned information """ @@ -191,6 +215,7 @@ def get_behavioral_analytics( @_rewrite_parameters( parameter_aliases={"from": "from_"}, ) + @_stability_warning(Stability.BETA) def list( self, *, @@ -203,9 +228,13 @@ def list( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the existing search applications. + .. raw:: html + +

Get search applications. + Get information about search applications.

+ - ``_ + ``_ :param from_: Starting offset. :param q: Query in the Lucene query string syntax. @@ -238,9 +267,78 @@ def list( path_parts=__path_parts, ) + @_rewrite_parameters( + body_name="payload", + ) + @_stability_warning(Stability.EXPERIMENTAL) + def post_behavioral_analytics_event( + self, + *, + collection_name: str, + event_type: t.Union[str, t.Literal["page_view", "search", "search_click"]], + payload: t.Optional[t.Any] = None, + body: t.Optional[t.Any] = None, + debug: t.Optional[bool] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Create a behavioral analytics collection event.

+ + + ``_ + + :param collection_name: The name of the behavioral analytics collection. + :param event_type: The analytics event type. + :param payload: + :param debug: Whether the response type has to include more details + """ + if collection_name in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'collection_name'") + if event_type in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'event_type'") + if payload is None and body is None: + raise ValueError( + "Empty value passed for parameters 'payload' and 'body', one of them should be set." + ) + elif payload is not None and body is not None: + raise ValueError("Cannot set both 'payload' and 'body'") + __path_parts: t.Dict[str, str] = { + "collection_name": _quote(collection_name), + "event_type": _quote(event_type), + } + __path = f'/_application/analytics/{__path_parts["collection_name"]}/event/{__path_parts["event_type"]}' + __query: t.Dict[str, t.Any] = {} + if debug is not None: + __query["debug"] = debug + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + __body = payload if payload is not None else body + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_application.post_behavioral_analytics_event", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_name="search_application", ) + @_stability_warning(Stability.BETA) def put( self, *, @@ -254,9 +352,12 @@ def put( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a search application. + .. raw:: html - ``_ +

Create or update a search application.

+ + + ``_ :param name: The name of the search application to be created or updated. :param search_application: @@ -297,6 +398,7 @@ def put( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def put_behavioral_analytics( self, *, @@ -307,9 +409,12 @@ def put_behavioral_analytics( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a behavioral analytics collection. + .. raw:: html + +

Create a behavioral analytics collection.

- ``_ + + ``_ :param name: The name of the analytics collection to be created or updated. """ @@ -340,6 +445,72 @@ def put_behavioral_analytics( body_fields=("params",), ignore_deprecated_options={"params"}, ) + @_stability_warning(Stability.EXPERIMENTAL) + def render_query( + self, + *, + name: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + params: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Render a search application query. + Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified. + If a parameter used in the search template is not specified in params, the parameter's default value will be used. + The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.

+

You must have read privileges on the backing alias of the search application.

+ + + ``_ + + :param name: The name of the search application to render teh query for. + :param params: + """ + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {"name": _quote(name)} + __path = ( + f'/_application/search_application/{__path_parts["name"]}/_render_query' + ) + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if params is not None: + __body["params"] = params + if not __body: + __body = None # type: ignore[assignment] + __headers = {"accept": "application/json"} + if __body is not None: + __headers["content-type"] = "application/json" + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="search_application.render_query", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("params",), + ignore_deprecated_options={"params"}, + ) + @_stability_warning(Stability.BETA) def search( self, *, @@ -353,9 +524,14 @@ def search( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Perform a search against a search application. + .. raw:: html + +

Run a search application search. + Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template. + Unspecified template parameters are assigned their default values if applicable.

+ - ``_ + ``_ :param name: The name of the search application to be searched. :param params: Query parameters specific to this request, which will override diff --git a/elasticsearch/_sync/client/searchable_snapshots.py b/elasticsearch/_sync/client/searchable_snapshots.py index 823162b57..0d5575c0c 100644 --- a/elasticsearch/_sync/client/searchable_snapshots.py +++ b/elasticsearch/_sync/client/searchable_snapshots.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class SearchableSnapshotsClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def cache_stats( self, *, @@ -37,13 +44,15 @@ def cache_stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieve node-level cache statistics about searchable snapshots. + .. raw:: html - ``_ +

Get cache statistics. + Get statistics about the shared cache for partially mounted indices.

- :param 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 node_id: The names of the nodes in the cluster to target. :param master_timeout: """ __path_parts: t.Dict[str, str] @@ -75,6 +84,7 @@ def cache_stats( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def clear_cache( self, *, @@ -95,11 +105,16 @@ def clear_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Clear the cache of searchable snapshots. + .. raw:: html + +

Clear the cache. + Clear indices and data streams from the shared cache for partially mounted indices.

+ - ``_ + ``_ - :param index: A comma-separated list of index names + :param index: A comma-separated list of data streams, indices, and aliases to + clear from the cache. It supports wildcards (`*`). :param 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) @@ -167,22 +182,33 @@ def mount( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Mount a snapshot as a searchable index. + .. raw:: html - ``_ +

Mount a snapshot. + Mount a snapshot as a searchable snapshot index. + Do not use this API for snapshots managed by index lifecycle management (ILM). + Manually mounting ILM-managed snapshots can interfere with ILM processes.

+ + + ``_ :param repository: The name of the repository containing the snapshot of the - index to mount - :param snapshot: The name of the snapshot of the index to mount - :param index: - :param ignore_index_settings: - :param index_settings: - :param master_timeout: Explicit operation timeout for connection to master node - :param renamed_index: - :param storage: Selects the kind of local storage used to accelerate searches. - Experimental, and defaults to `full_copy` - :param wait_for_completion: Should this request wait until the operation has - completed before returning + index to mount. + :param snapshot: The name of the snapshot of the index to mount. + :param index: The name of the index contained in the snapshot whose data is to + be mounted. If no `renamed_index` is specified, this name will also be used + to create the new index. + :param ignore_index_settings: The names of settings that should be removed from + the index when it is mounted. + :param index_settings: The settings that should be added to the index when it + is mounted. + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. To indicate that the request should never timeout, set it to `-1`. + :param renamed_index: The name of the index that will be created. + :param storage: The mount option for the searchable snapshot index. + :param wait_for_completion: If true, the request blocks until the operation is + complete. """ if repository in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'repository'") @@ -247,11 +273,15 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieve shard-level statistics about searchable snapshots. + .. raw:: html + +

Get searchable snapshot statistics.

+ - ``_ + ``_ - :param index: A comma-separated list of index names + :param index: A comma-separated list of data streams and indices to retrieve + statistics for. :param level: Return stats aggregated at cluster, index or shard level """ __path_parts: t.Dict[str, str] diff --git a/elasticsearch/_sync/client/security.py b/elasticsearch/_sync/client/security.py index 28b98fdba..c8bb4cf4e 100644 --- a/elasticsearch/_sync/client/security.py +++ b/elasticsearch/_sync/client/security.py @@ -44,14 +44,32 @@ def activate_user_profile( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a user profile on behalf of another user. - - ``_ - - :param grant_type: - :param access_token: - :param password: - :param username: + .. raw:: html + +

Activate a user profile.

+

Create or update a user profile on behalf of another user.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + The calling application must have either an access_token or a combination of username and password for the user that the profile document is intended for. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including username, full_name, roles, and the authentication realm. + For example, in the JWT access_token case, the profile user's username is extracted from the JWT token claim pointed to by the claims.principal setting of the JWT realm that authenticated the token.

+

When updating a profile document, the API enables the document if it was disabled. + Any updates do not change existing content for either the labels or data fields.

+ + + ``_ + + :param grant_type: The type of grant. + :param access_token: The user's Elasticsearch access token or JWT. Both `access` + and `id` JWT token types are supported and they depend on the underlying + JWT realm configuration. If you specify the `access_token` grant type, this + parameter is required. It is not valid with other grant types. + :param password: The user's password. If you specify the `password` grant type, + this parameter is required. It is not valid with other grant types. + :param username: The username that identifies the user. If you specify the `password` + grant type, this parameter is required. It is not valid with other grant + types. """ if grant_type is None and body is None: raise ValueError("Empty value passed for parameter 'grant_type'") @@ -97,14 +115,16 @@ def authenticate( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Authenticate a user. Authenticates a user and returns information about the authenticated - user. Include the user information in a [basic auth header](https://en.wikipedia.org/wiki/Basic_access_authentication). - A successful call returns a JSON structure that shows user information such as - their username, the roles that are assigned to the user, any assigned metadata, - and information about the realms that authenticated and authorized the user. - If the user cannot be authenticated, this API returns a 401 status code. + .. raw:: html + +

Authenticate a user.

+

Authenticates a user and returns information about the authenticated user. + Include the user information in a basic auth header. + A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user. + If the user cannot be authenticated, this API returns a 401 status code.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_authenticate" @@ -144,11 +164,14 @@ def bulk_delete_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The role management APIs are generally the preferred way to manage roles, rather - than using file-based role management. The bulk delete roles API cannot delete - roles that are defined in roles files. + .. raw:: html - ``_ +

Bulk delete roles.

+

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The bulk delete roles API cannot delete roles that are defined in roles files.

+ + + ``_ :param names: An array of role names to delete :param refresh: If `true` (the default) then refresh the affected shards to make @@ -202,11 +225,14 @@ def bulk_put_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The role management APIs are generally the preferred way to manage roles, rather - than using file-based role management. The bulk create or update roles API cannot - update roles that are defined in roles files. + .. raw:: html + +

Bulk create or update roles.

+

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The bulk create or update roles API cannot update roles that are defined in roles files.

+ - ``_ + ``_ :param roles: A dictionary of role name to RoleDescriptor objects to add or update :param refresh: If `true` (the default) then refresh the affected shards to make @@ -243,6 +269,90 @@ def bulk_put_role( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("ids", "expiration", "metadata", "role_descriptors"), + ) + def bulk_update_api_keys( + self, + *, + ids: t.Optional[t.Union[str, t.Sequence[str]]] = None, + error_trace: t.Optional[bool] = None, + expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + metadata: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + role_descriptors: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Bulk update API keys. + Update the attributes for multiple API keys.

+

IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required.

+

This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates.

+

It is not possible to update expired or invalidated API keys.

+

This API supports updates to API key access scope, metadata and expiration. + The access scope of each API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. + The snapshot of the owner's permissions is updated automatically on every call.

+

IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified.

+

A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update.

+ + + ``_ + + :param ids: The API key identifiers. + :param expiration: Expiration time for the API keys. By default, API keys never + expire. This property can be omitted to leave the value unchanged. + :param metadata: Arbitrary nested metadata to associate with the API keys. Within + the `metadata` object, top-level keys beginning with an underscore (`_`) + are reserved for system usage. Any information specified with this parameter + fully replaces metadata previously associated with the API key. + :param role_descriptors: The role descriptors to assign to the API keys. An API + key's effective permissions are an intersection of its assigned privileges + and the point-in-time snapshot of permissions of the owner user. You can + assign new privileges by specifying them in this parameter. To remove assigned + privileges, supply the `role_descriptors` parameter as an empty object `{}`. + If an API key has no assigned privileges, it inherits the owner user's full + permissions. The snapshot of the owner's permissions is always updated, whether + you supply the `role_descriptors` parameter. The structure of a role descriptor + is the same as the request for the create API keys API. + """ + if ids is None and body is None: + raise ValueError("Empty value passed for parameter 'ids'") + __path_parts: t.Dict[str, str] = {} + __path = "/_security/api_key/_bulk_update" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if ids is not None: + __body["ids"] = ids + if expiration is not None: + __body["expiration"] = expiration + if metadata is not None: + __body["metadata"] = metadata + if role_descriptors is not None: + __body["role_descriptors"] = role_descriptors + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.bulk_update_api_keys", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("password", "password_hash"), ) @@ -262,9 +372,13 @@ def change_password( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Changes the passwords of users in the native realm and built-in users. + .. raw:: html - ``_ +

Change passwords.

+

Change the passwords of users in the native realm and built-in users.

+ + + ``_ :param username: The user whose password you want to change. If you do not specify this parameter, the password is changed for the current user. @@ -324,10 +438,14 @@ def clear_api_key_cache( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts a subset of all entries from the API key cache. The cache is also automatically - cleared on state changes of the security index. + .. raw:: html + +

Clear the API key cache.

+

Evict a subset of all entries from the API key cache. + The cache is also automatically cleared on state changes of the security index.

- ``_ + + ``_ :param ids: Comma-separated list of API key IDs to evict from the API key cache. To evict all API keys, use `*`. Does not support other wildcard patterns. @@ -366,11 +484,17 @@ def clear_cached_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts application privileges from the native application privileges cache. + .. raw:: html + +

Clear the privileges cache.

+

Evict privileges from the native application privilege cache. + The cache is also automatically cleared for applications that have their privileges updated.

- ``_ - :param application: A comma-separated list of application names + ``_ + + :param application: A comma-separated list of applications. To clear all applications, + use an asterism (`*`). It does not support other wildcard patterns. """ if application in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'application'") @@ -407,13 +531,23 @@ def clear_cached_realms( usernames: t.Optional[t.Sequence[str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts users from the user cache. Can completely clear the cache or evict specific - users. + .. raw:: html + +

Clear the user cache.

+

Evict users from the user cache. + You can completely clear the cache or evict specific users.

+

User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request. + There are realm settings that you can use to configure the user cache. + For more information, refer to the documentation about controlling the user cache.

- ``_ - :param realms: Comma-separated list of realms to clear - :param usernames: Comma-separated list of usernames to clear from the cache + ``_ + + :param realms: A comma-separated list of realms. To clear all realms, use an + asterisk (`*`). It does not support other wildcard patterns. + :param usernames: A comma-separated list of the users to clear from the cache. + If you do not specify this parameter, the API evicts all users from the user + cache. """ if realms in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'realms'") @@ -451,11 +585,17 @@ def clear_cached_roles( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts roles from the native role cache. + .. raw:: html + +

Clear the roles cache.

+

Evict roles from the native role cache.

- ``_ - :param name: Role name + ``_ + + :param name: A comma-separated list of roles to evict from the role cache. To + evict all roles, use an asterisk (`*`). It does not support other wildcard + patterns. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'name'") @@ -493,13 +633,23 @@ def clear_cached_service_tokens( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Evicts tokens from the service account token caches. + .. raw:: html + +

Clear service account token caches.

+

Evict a subset of all entries from the service account token caches. + Two separate caches exist for service account tokens: one cache for tokens backed by the service_tokens file, and another for tokens backed by the .security index. + This API clears matching entries from both caches.

+

The cache for service account tokens backed by the .security index is cleared automatically on state changes of the security index. + The cache for tokens backed by the service_tokens file is cleared automatically on file changes.

- ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: A comma-separated list of service token names + ``_ + + :param namespace: The namespace, which is a top-level grouping of service accounts. + :param service: The name of the service, which must be unique within its namespace. + :param name: A comma-separated list of token names to evict from the service + account token caches. Use a wildcard (`*`) to evict all tokens that belong + to a service account. It does not support other wildcard patterns. """ if namespace in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'namespace'") @@ -552,31 +702,43 @@ def create_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create an API key. Creates an API key for access without requiring basic authentication. - A successful request returns a JSON structure that contains the API key, its - unique id, and its name. If applicable, it also returns expiration information - for the API key in milliseconds. NOTE: By default, API keys never expire. You - can specify expiration information when you create the API keys. + .. raw:: html - ``_ +

Create an API key.

+

Create an API key for access without requiring basic authentication.

+

IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges. + If you specify privileges, the API returns an error.

+

A successful request returns a JSON structure that contains the API key, its unique id, and its name. + If applicable, it also returns expiration information for the API key in milliseconds.

+

NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys.

+

The API keys are created by the Elasticsearch API key service, which is automatically enabled. + To configure or turn off the API key service, refer to API key service setting documentation.

- :param expiration: Expiration time for the API key. By default, API keys never - expire. + + ``_ + + :param expiration: The expiration time for the API key. By default, API keys + never expire. :param metadata: Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with `_` are reserved for system usage. - :param name: Specifies the name for this API key. + :param name: A name for the API key. :param refresh: If `true` (the default) 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` then do nothing with refreshes. - :param role_descriptors: An array of role descriptors for this API key. This - parameter is optional. When it is not specified or is an empty array, then - the API key will have a point in time snapshot of permissions of the authenticated - user. If you supply role descriptors then the resultant permissions would - be an intersection of API keys permissions and authenticated user’s permissions - thereby limiting the access scope for API keys. The structure of role descriptor - is the same as the request for create role API. For more details, see create - or update roles API. + :param role_descriptors: An array of role descriptors for this API key. When + it is not specified or it is an empty array, the API key will have a point + in time snapshot of permissions of the authenticated user. If you supply + role descriptors, the resultant permissions are an intersection of API keys + permissions and the authenticated user's permissions thereby limiting the + access scope for API keys. The structure of role descriptor is the same as + the request for the create role API. For more details, refer to the create + or update roles API. NOTE: Due to the way in which this permission intersection + is calculated, it is not possible to create an API key that is a child of + another API key, unless the derived key is created without any privileges. + In this case, you must explicitly specify a role descriptor with no privileges. + The derived API key can be used for authentication; it will not have authority + to call Elasticsearch APIs. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" @@ -612,6 +774,88 @@ def create_api_key( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("access", "name", "expiration", "metadata"), + ) + def create_cross_cluster_api_key( + self, + *, + access: t.Optional[t.Mapping[str, t.Any]] = None, + name: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + metadata: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Create a cross-cluster API key.

+

Create an API key of the cross_cluster type for the API key based remote cluster access. + A cross_cluster API key cannot be used to authenticate through the REST interface.

+

IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.

+

Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.

+

NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the access property.

+

A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.

+

By default, API keys never expire. You can specify expiration information when you create the API keys.

+

Cross-cluster API keys can only be updated with the update cross-cluster API key API. + Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.

+ + + ``_ + + :param access: The access to be granted to this API key. The access is composed + of permissions for cross-cluster search and cross-cluster replication. At + least one of them must be specified. NOTE: No explicit privileges should + be specified for either search or replication access. The creation process + automatically converts the access specification to a role descriptor which + has relevant privileges assigned accordingly. + :param name: Specifies the name for this API key. + :param expiration: Expiration time for the API key. By default, API keys never + expire. + :param metadata: Arbitrary metadata that you want to associate with the API key. + It supports nested data structure. Within the metadata object, keys beginning + with `_` are reserved for system usage. + """ + if access is None and body is None: + raise ValueError("Empty value passed for parameter 'access'") + if name is None and body is None: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {} + __path = "/_security/cross_cluster/api_key" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if access is not None: + __body["access"] = access + if name is not None: + __body["name"] = name + if expiration is not None: + __body["expiration"] = expiration + if metadata is not None: + __body["metadata"] = metadata + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.create_cross_cluster_api_key", + path_parts=__path_parts, + ) + @_rewrite_parameters() def create_service_token( self, @@ -628,13 +872,26 @@ def create_service_token( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a service accounts token for access without requiring basic authentication. - - ``_ - - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: An identifier for the token name + .. raw:: html + +

Create a service account token.

+

Create a service accounts token for access without requiring basic authentication.

+

NOTE: Service account tokens never expire. + You must actively delete them if they are no longer needed.

+ + + ``_ + + :param namespace: The name of the namespace, which is a top-level grouping of + service accounts. + :param service: The name of the service. + :param name: The name for the service account token. If omitted, a random name + will be generated. Token names must be at least one and no more than 256 + characters. They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes + (`-`), and underscores (`_`), but cannot begin with an underscore. NOTE: + Token names must be unique in the context of the associated service account. + They must also be globally unique with their fully qualified names, which + are comprised of the service account principal and token name, such as `//`. :param refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -683,6 +940,71 @@ def create_service_token( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("x509_certificate_chain",), + ) + def delegate_pki( + self, + *, + x509_certificate_chain: t.Optional[t.Sequence[str]] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Delegate PKI authentication.

+

This API implements the exchange of an X509Certificate chain for an Elasticsearch access token. + The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has delegation.enabled set to true. + A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw username_pattern of the respective realm.

+

This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-​as if the user connected directly to Elasticsearch.

+

IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated. + This is part of the TLS authentication process and it is delegated to the proxy that calls this API. + The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token.

+ + + ``_ + + :param x509_certificate_chain: The X509Certificate chain, which is represented + as an ordered string array. Each string in the array is a base64-encoded + (Section 4 of RFC4648 - not base64url-encoded) of the certificate's DER encoding. + The first element is the target certificate that contains the subject distinguished + name that is requesting access. This may be followed by additional certificates; + each subsequent certificate is used to certify the previous one. + """ + if x509_certificate_chain is None and body is None: + raise ValueError( + "Empty value passed for parameter 'x509_certificate_chain'" + ) + __path_parts: t.Dict[str, str] = {} + __path = "/_security/delegate_pki" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if x509_certificate_chain is not None: + __body["x509_certificate_chain"] = x509_certificate_chain + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.delegate_pki", + path_parts=__path_parts, + ) + @_rewrite_parameters() def delete_privileges( self, @@ -698,12 +1020,21 @@ def delete_privileges( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes application privileges. + .. raw:: html + +

Delete application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_security cluster privilege (or a greater privilege such as all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
- ``_ - :param application: Application name - :param name: Privilege name + ``_ + + :param application: The name of the application. Application privileges are always + associated with exactly one application. + :param name: The name of the privilege. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -754,11 +1085,17 @@ def delete_role( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes roles in the native realm. + .. raw:: html + +

Delete roles.

+

Delete roles in the native realm. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The delete roles API cannot remove roles that are defined in roles files.

+ - ``_ + ``_ - :param name: Role name + :param name: The name of the role. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -802,11 +1139,19 @@ def delete_role_mapping( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes role mappings. + .. raw:: html + +

Delete role mappings.

+

Role mappings define which roles are assigned to each user. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. + The delete role mappings API cannot remove role mappings that are defined in role mapping files.

- ``_ - :param name: Role-mapping name + ``_ + + :param name: The distinct name that identifies the role mapping. The name is + used solely as an identifier to facilitate interaction via the API; it does + not affect the behavior of the mapping in any way. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -852,13 +1197,17 @@ def delete_service_token( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a service account token. + .. raw:: html + +

Delete service account tokens.

+

Delete service account tokens for a service in a specified namespace.

- ``_ - :param namespace: An identifier for the namespace - :param service: An identifier for the service name - :param name: An identifier for the token name + ``_ + + :param namespace: The namespace, which is a top-level grouping of service accounts. + :param service: The service name. + :param name: The name of the service account token. :param refresh: If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. @@ -910,11 +1259,15 @@ def delete_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes users from the native realm. + .. raw:: html + +

Delete users.

+

Delete users from the native realm.

- ``_ - :param username: username + ``_ + + :param username: An identifier for the user. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -958,11 +1311,17 @@ def disable_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Disables users in the native realm. + .. raw:: html + +

Disable users.

+

Disable users in the native realm. + By default, when you create users, they are enabled. + You can use this API to revoke a user's access to Elasticsearch.

- ``_ - :param username: The username of the user to disable + ``_ + + :param username: An identifier for the user. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -1006,14 +1365,23 @@ def disable_user_profile( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Disables a user profile so it's not visible in user profile searches. + .. raw:: html + +

Disable a user profile.

+

Disable user profiles so that they are not visible in user profile searches.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches. + To re-enable a disabled user profile, use the enable user profile API .

- ``_ + + ``_ :param uid: Unique identifier for the user profile. :param refresh: If 'true', Elasticsearch refreshes 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' do nothing with refreshes. + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', it does nothing with refreshes. """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") @@ -1054,11 +1422,16 @@ def enable_user( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables users in the native realm. + .. raw:: html + +

Enable users.

+

Enable users in the native realm. + By default, when you create users, they are enabled.

- ``_ - :param username: The username of the user to enable + ``_ + + :param username: An identifier for the user. :param refresh: If `true` (the default) 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` then do nothing with refreshes. @@ -1102,14 +1475,23 @@ def enable_user_profile( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables a user profile so it's visible in user profile searches. + .. raw:: html - ``_ +

Enable a user profile.

+

Enable user profiles to make them visible in user profile searches.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

When you activate a user profile, it's automatically enabled and visible in user profile searches. + If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again.

- :param uid: Unique identifier for the user profile. + + ``_ + + :param uid: A unique identifier for the user profile. :param refresh: If 'true', Elasticsearch refreshes 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' do nothing with refreshes. + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', nothing is done with refreshes. """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") @@ -1146,10 +1528,15 @@ def enroll_kibana( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Enables a Kibana instance to configure itself for communication with a secured - Elasticsearch cluster. + .. raw:: html - ``_ +

Enroll Kibana.

+

Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster.

+

NOTE: This API is currently intended for internal use only by Kibana. + Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_security/enroll/kibana" @@ -1182,9 +1569,15 @@ def enroll_node( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Allows a new node to join an existing cluster with security features enabled. + .. raw:: html + +

Enroll a node.

+

Enroll a new node to allow it to join an existing cluster with security features enabled.

+

The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster. + The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_security/enroll/node" @@ -1225,13 +1618,15 @@ def get_api_key( with_profile_uid: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get API key information. Retrieves information for one or more API keys. NOTE: - If you have only the `manage_own_api_key` privilege, this API returns only the - API keys that you own. If you have `read_security`, `manage_api_key` or greater - privileges (including `manage_security`), this API returns all API keys regardless - of ownership. + .. raw:: html - ``_ +

Get API key information.

+

Retrieves information for one or more API keys. + NOTE: If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + If you have read_security, manage_api_key or greater privileges (including manage_security), this API returns all API keys regardless of ownership.

+ + + ``_ :param active_only: A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, @@ -1303,10 +1698,13 @@ def get_builtin_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the list of cluster privileges and index privileges that are available - in this version of Elasticsearch. + .. raw:: html + +

Get builtin privileges.

+

Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch.

+ - ``_ + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_security/privilege/_builtin" @@ -1341,12 +1739,23 @@ def get_privileges( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves application privileges. + .. raw:: html - ``_ +

Get application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The read_security cluster privilege (or a greater privilege such as manage_security or all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
- :param application: Application name - :param name: Privilege name + + ``_ + + :param application: The name of the application. Application privileges are always + associated with exactly one application. If you do not specify this parameter, + the API returns information about all privileges for all applications. + :param name: The name of the privilege. If you do not specify this parameter, + the API returns information about all privileges for the requested application. """ __path_parts: t.Dict[str, str] if application not in SKIP_IN_PATH and name not in SKIP_IN_PATH: @@ -1388,11 +1797,15 @@ def get_role( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - The role management APIs are generally the preferred way to manage roles, rather - than using file-based role management. The get roles API cannot retrieve roles - that are defined in roles files. + .. raw:: html + +

Get roles.

+

Get roles in the native realm. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The get roles API cannot retrieve roles that are defined in roles files.

+ - ``_ + ``_ :param name: The name of the role. You can specify multiple roles as a comma-separated list. If you do not specify this parameter, the API returns information about @@ -1435,9 +1848,15 @@ def get_role_mapping( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves role mappings. + .. raw:: html - ``_ +

Get role mappings.

+

Role mappings define which roles are assigned to each user. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. + The get role mappings API cannot retrieve role mappings that are defined in role mapping files.

+ + + ``_ :param name: The distinct name that identifies the role mapping. The name is used solely as an identifier to facilitate interaction via the API; it does @@ -1483,14 +1902,19 @@ def get_service_accounts( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - This API returns a list of service accounts that match the provided path parameter(s). + .. raw:: html + +

Get service accounts.

+

Get a list of service accounts that match the provided path parameters.

+

NOTE: Currently, only the elastic/fleet-server service account is available.

+ - ``_ + ``_ - :param namespace: Name of the namespace. Omit this parameter to retrieve information - about all service accounts. If you omit this parameter, you must also omit - the `service` parameter. - :param service: Name of the service name. Omit this parameter to retrieve information + :param namespace: The name of the namespace. Omit this parameter to retrieve + information about all service accounts. If you omit this parameter, you must + also omit the `service` parameter. + :param service: The service name. Omit this parameter to retrieve information about all service accounts that belong to the specified `namespace`. """ __path_parts: t.Dict[str, str] @@ -1534,12 +1958,19 @@ def get_service_credentials( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information of all service credentials for a service account. + .. raw:: html - ``_ +

Get service account credentials.

+

To use this API, you must have at least the read_security cluster privilege (or a greater privilege such as manage_service_account or manage_security).

+

The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster.

+

NOTE: For tokens backed by the service_tokens file, the API collects them from all nodes of the cluster. + Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens.

- :param namespace: Name of the namespace. - :param service: Name of the service name. + + ``_ + + :param namespace: The name of the namespace. + :param service: The service name. """ if namespace in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'namespace'") @@ -1569,6 +2000,58 @@ def get_service_credentials( path_parts=__path_parts, ) + @_rewrite_parameters() + def get_settings( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get security index settings.

+

Get the user-configurable settings for the security internal index (.security and associated indices). + Only a subset of the index settings — those that are user-configurable—will be shown. + This includes:

+
    +
  • index.auto_expand_replicas
  • +
  • index.number_of_replicas
  • +
+ + + ``_ + + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_security/settings" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="security.get_settings", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "grant_type", @@ -1602,16 +2085,39 @@ def get_token( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a bearer token for access without requiring basic authentication. - - ``_ - - :param grant_type: - :param kerberos_ticket: - :param password: - :param refresh_token: - :param scope: - :param username: + .. raw:: html + +

Get a token.

+

Create a bearer token for access without requiring basic authentication. + The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface. + Alternatively, you can explicitly enable the xpack.security.authc.token.enabled setting. + When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface.

+

The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body.

+

A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available.

+

The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used. + That time period is defined by the xpack.security.authc.token.timeout setting. + If you want to invalidate a token immediately, you can do so by using the invalidate token API.

+ + + ``_ + + :param grant_type: The type of grant. Supported grant types are: `password`, + `_kerberos`, `client_credentials`, and `refresh_token`. + :param kerberos_ticket: The base64 encoded kerberos ticket. If you specify the + `_kerberos` grant type, this parameter is required. This parameter is not + valid with any other supported grant type. + :param password: The user's password. If you specify the `password` grant type, + this parameter is required. This parameter is not valid with any other supported + grant type. + :param refresh_token: The string that was returned when you created the token, + which enables you to extend its life. If you specify the `refresh_token` + grant type, this parameter is required. This parameter is not valid with + any other supported grant type. + :param scope: The scope of the token. Currently tokens are only issued for a + scope of FULL regardless of the value sent with the request. + :param username: The username that identifies the user. If you specify the `password` + grant type, this parameter is required. This parameter is not valid with + any other supported grant type. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" @@ -1661,15 +2167,19 @@ def get_user( with_profile_uid: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about users in the native realm and built-in users. + .. raw:: html + +

Get users.

+

Get information about users in the native realm and built-in users.

- ``_ + + ``_ :param username: An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users. - :param with_profile_uid: If true will return the User Profile ID for a user, - if any. + :param with_profile_uid: Determines whether to retrieve the user profile UID, + if it exists, for the users. """ __path_parts: t.Dict[str, str] if username not in SKIP_IN_PATH: @@ -1712,9 +2222,16 @@ def get_user_privileges( username: t.Optional[t.Union[None, str]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves security privileges for the logged in user. + .. raw:: html + +

Get user privileges.

+

Get the security privileges for the logged in user. + All users can use this API, but only to determine their own privileges. + To check the privileges of other users, you must use the run as feature. + To check whether a user has a specific list of privileges, use the has privileges API.

+ - ``_ + ``_ :param application: The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, @@ -1762,15 +2279,22 @@ def get_user_profile( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a user's profile using the unique profile ID. + .. raw:: html - ``_ +

Get a user profile.

+

Get a user's profile using the unique profile ID.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ + + ``_ :param uid: A unique identifier for the user profile. - :param data: List of filters for the `data` field of the profile document. To - return all content use `data=*`. To return a subset of content use `data=` - to retrieve content nested under the specified ``. By default returns - no `data` content. + :param data: A comma-separated list of filters for the `data` field of the profile + document. To return all content use `data=*`. To return a subset of content + use `data=` to retrieve content nested under the specified ``. + By default returns no `data` content. """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") @@ -1826,31 +2350,37 @@ def grant_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates an API key on behalf of another user. This API is similar to Create API - keys, however it creates the API key for a user that is different than the user - that runs the API. The caller must have authentication credentials (either an - access token, or a username and password) for the user on whose behalf the API - key will be created. It is not possible to use this API to create an API key - without that user’s credentials. The user, for whom the authentication credentials - is provided, can optionally "run as" (impersonate) another user. In this case, - the API key will be created on behalf of the impersonated user. This API is intended - be used by applications that need to create and manage API keys for end users, - but cannot guarantee that those users have permission to create API keys on their - own behalf. A successful grant API key API call returns a JSON structure that - contains the API key, its unique id, and its name. If applicable, it also returns - expiration information for the API key in milliseconds. By default, API keys - never expire. You can specify expiration information when you create the API - keys. - - ``_ - - :param api_key: Defines the API key. + .. raw:: html + +

Grant an API key.

+

Create an API key on behalf of another user. + This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. + The caller must have authentication credentials for the user on whose behalf the API key will be created. + It is not possible to use this API to create an API key without that user's credentials. + The supported user authentication credential types are:

+
    +
  • username and password
  • +
  • Elasticsearch access tokens
  • +
  • JWTs
  • +
+

The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. + In this case, the API key will be created on behalf of the impersonated user.

+

This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. + The API keys are created by the Elasticsearch API key service, which is automatically enabled.

+

A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. + If applicable, it also returns expiration information for the API key in milliseconds.

+

By default, API keys never expire. You can specify expiration information when you create the API keys.

+ + + ``_ + + :param api_key: The API key. :param grant_type: The type of grant. Supported grant types are: `access_token`, `password`. - :param access_token: The user’s access token. If you specify the `access_token` + :param access_token: The user's access token. If you specify the `access_token` grant type, this parameter is required. It is not valid with other grant types. - :param password: The user’s password. If you specify the `password` grant type, + :param password: The user's password. If you specify the `password` grant type, this parameter is required. It is not valid with other grant types. :param run_as: The name of the user to be impersonated. :param username: The user name that identifies the user. If you specify the `password` @@ -1954,6 +2484,7 @@ def has_privileges( "monitor_ml", "monitor_rollup", "monitor_snapshot", + "monitor_stats", "monitor_text_structure", "monitor_transform", "monitor_watcher", @@ -1980,10 +2511,15 @@ def has_privileges( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Check user privileges. Determines whether the specified user has a specified - list of privileges. + .. raw:: html + +

Check user privileges.

+

Determine whether the specified user has a specified list of privileges. + All users can use this API, but only to determine their own privileges. + To check the privileges of other users, you must use the run as feature.

+ - ``_ + ``_ :param user: Username :param application: @@ -2040,12 +2576,17 @@ def has_privileges_user_profile( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Determines whether the users associated with the specified profile IDs have all - the requested privileges. + .. raw:: html - ``_ +

Check user profile privileges.

+

Determine whether the users associated with the specified user profile IDs have all the requested privileges.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

- :param privileges: + + ``_ + + :param privileges: An object containing all the privileges to be checked. :param uids: A list of profile IDs. The privileges are checked for associated users of the profiles. """ @@ -2100,29 +2641,39 @@ def invalidate_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidate API keys. Invalidates one or more API keys. The `manage_api_key` privilege - allows deleting any API keys. The `manage_own_api_key` only allows deleting API - keys that are owned by the user. In addition, with the `manage_own_api_key` privilege, - an invalidation request must be issued in one of the three formats: - Set the - parameter `owner=true`. - Or, set both `username` and `realm_name` to match the - user’s identity. - Or, if the request is issued by an API key, i.e. an API key - invalidates itself, specify its ID in the `ids` field. + .. raw:: html + +

Invalidate API keys.

+

This API invalidates API keys created by the create API key or grant API key APIs. + Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted.

+

To use this API, you must have at least the manage_security, manage_api_key, or manage_own_api_key cluster privileges. + The manage_security privilege allows deleting any API key, including both REST and cross cluster API keys. + The manage_api_key privilege allows deleting any REST API key, but not cross cluster API keys. + The manage_own_api_key only allows deleting REST API keys that are owned by the user. + In addition, with the manage_own_api_key privilege, an invalidation request must be issued in one of the three formats:

+
    +
  • Set the parameter owner=true.
  • +
  • Or, set both username and realm_name to match the user's identity.
  • +
  • Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the ids field.
  • +
- ``_ + + ``_ :param id: :param ids: A list of API key ids. This parameter cannot be used with any of `name`, `realm_name`, or `username`. :param name: An API key name. This parameter cannot be used with any of `ids`, `realm_name` or `username`. - :param owner: Can be used to query API keys owned by the currently authenticated - user. The `realm_name` or `username` parameters cannot be specified when - this parameter is set to `true` as they are assumed to be the currently authenticated - ones. + :param owner: Query API keys owned by the currently authenticated user. The `realm_name` + or `username` parameters cannot be specified when this parameter is set to + `true` as they are assumed to be the currently authenticated ones. NOTE: + At least one of `ids`, `name`, `username`, and `realm_name` must be specified + if `owner` is `false`. :param realm_name: The name of an authentication realm. This parameter cannot be used with either `ids` or `name`, or when `owner` flag is set to `true`. :param username: The username of a user. This parameter cannot be used with either - `ids` or `name`, or when `owner` flag is set to `true`. + `ids` or `name` or when `owner` flag is set to `true`. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/api_key" @@ -2177,14 +2728,30 @@ def invalidate_token( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Invalidates one or more access tokens or refresh tokens. + .. raw:: html - ``_ +

Invalidate a token.

+

The access tokens returned by the get token API have a finite period of time for which they are valid. + After that time period, they can no longer be used. + The time period is defined by the xpack.security.authc.token.timeout setting.

+

The refresh tokens returned by the get token API are only valid for 24 hours. + They can also be used exactly once. + If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API.

+

NOTE: While all parameters are optional, at least one of them is required. + More specifically, either one of token or refresh_token parameters is required. + If none of these two are specified, then realm_name and/or username need to be specified.

- :param realm_name: - :param refresh_token: - :param token: - :param username: + + ``_ + + :param realm_name: The name of an authentication realm. This parameter cannot + be used with either `refresh_token` or `token`. + :param refresh_token: A refresh token. This parameter cannot be used if any of + `refresh_token`, `realm_name`, or `username` are used. + :param token: An access token. This parameter cannot be used if any of `refresh_token`, + `realm_name`, or `username` are used. + :param username: The username of a user. This parameter cannot be used with either + `refresh_token` or `token`. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/oauth2/token" @@ -2218,6 +2785,229 @@ def invalidate_token( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("nonce", "redirect_uri", "state", "realm"), + ) + def oidc_authenticate( + self, + *, + nonce: t.Optional[str] = None, + redirect_uri: t.Optional[str] = None, + state: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + realm: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Authenticate OpenID Connect.

+

Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ + + ``_ + + :param nonce: Associate a client session with an ID token and mitigate replay + attacks. This value needs to be the same as the one that was provided to + the `/_security/oidc/prepare` API or the one that was generated by Elasticsearch + and included in the response to that call. + :param redirect_uri: The URL to which the OpenID Connect Provider redirected + the User Agent in response to an authentication request after a successful + authentication. This URL must be provided as-is (URL encoded), taken from + the body of the response or as the value of a location header in the response + from the OpenID Connect Provider. + :param state: Maintain state between the authentication request and the response. + This value needs to be the same as the one that was provided to the `/_security/oidc/prepare` + API or the one that was generated by Elasticsearch and included in the response + to that call. + :param realm: The name of the OpenID Connect realm. This property is useful in + cases where multiple realms are defined. + """ + if nonce is None and body is None: + raise ValueError("Empty value passed for parameter 'nonce'") + if redirect_uri is None and body is None: + raise ValueError("Empty value passed for parameter 'redirect_uri'") + if state is None and body is None: + raise ValueError("Empty value passed for parameter 'state'") + __path_parts: t.Dict[str, str] = {} + __path = "/_security/oidc/authenticate" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if nonce is not None: + __body["nonce"] = nonce + if redirect_uri is not None: + __body["redirect_uri"] = redirect_uri + if state is not None: + __body["state"] = state + if realm is not None: + __body["realm"] = realm + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.oidc_authenticate", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("access_token", "refresh_token"), + ) + def oidc_logout( + self, + *, + access_token: t.Optional[str] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + refresh_token: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Logout of OpenID Connect.

+

Invalidate an access token and a refresh token that were generated as a response to the /_security/oidc/authenticate API.

+

If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ + + ``_ + + :param access_token: The access token to be invalidated. + :param refresh_token: The refresh token to be invalidated. + """ + if access_token is None and body is None: + raise ValueError("Empty value passed for parameter 'access_token'") + __path_parts: t.Dict[str, str] = {} + __path = "/_security/oidc/logout" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if access_token is not None: + __body["access_token"] = access_token + if refresh_token is not None: + __body["refresh_token"] = refresh_token + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.oidc_logout", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("iss", "login_hint", "nonce", "realm", "state"), + ) + def oidc_prepare_authentication( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + iss: t.Optional[str] = None, + login_hint: t.Optional[str] = None, + nonce: t.Optional[str] = None, + pretty: t.Optional[bool] = None, + realm: t.Optional[str] = None, + state: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Prepare OpenID connect authentication.

+

Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch.

+

The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process.

+

Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs. + These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.

+ + + ``_ + + :param iss: In the case of a third party initiated single sign on, this is the + issuer identifier for the OP that the RP is to send the authentication request + to. It cannot be specified when *realm* is specified. One of *realm* or *iss* + is required. + :param login_hint: In the case of a third party initiated single sign on, it + is a string value that is included in the authentication request as the *login_hint* + parameter. This parameter is not valid when *realm* is specified. + :param nonce: The value used to associate a client session with an ID token and + to mitigate replay attacks. If the caller of the API does not provide a value, + Elasticsearch will generate one with sufficient entropy and return it in + the response. + :param realm: The name of the OpenID Connect realm in Elasticsearch the configuration + of which should be used in order to generate the authentication request. + It cannot be specified when *iss* is specified. One of *realm* or *iss* is + required. + :param state: The value used to maintain state between the authentication request + and the response, typically used as a Cross-Site Request Forgery mitigation. + If the caller of the API does not provide a value, Elasticsearch will generate + one with sufficient entropy and return it in the response. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_security/oidc/prepare" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if iss is not None: + __body["iss"] = iss + if login_hint is not None: + __body["login_hint"] = login_hint + if nonce is not None: + __body["nonce"] = nonce + if realm is not None: + __body["realm"] = realm + if state is not None: + __body["state"] = state + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.oidc_prepare_authentication", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_name="privileges", ) @@ -2237,9 +3027,28 @@ def put_privileges( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Adds or updates application privileges. - - ``_ + .. raw:: html + +

Create or update application privileges.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_security cluster privilege (or a greater privilege such as all).
  • +
  • The "Manage Application Privileges" global privilege for the application being referenced in the request.
  • +
+

Application names are formed from a prefix, with an optional suffix that conform to the following rules:

+
    +
  • The prefix must begin with a lowercase ASCII letter.
  • +
  • The prefix must contain only ASCII letters or digits.
  • +
  • The prefix must be at least 3 characters long.
  • +
  • If the suffix exists, it must begin with either a dash - or _.
  • +
  • The suffix cannot contain any of the following characters: \\, /, *, ?, ", <, >, |, ,, *.
  • +
  • No part of the name can contain whitespace.
  • +
+

Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and ..

+

Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :.

+ + + ``_ :param privileges: :param refresh: If `true` (the default) then refresh the affected shards to make @@ -2285,6 +3094,8 @@ def put_privileges( "global_", "indices", "metadata", + "remote_cluster", + "remote_indices", "run_as", "transient_metadata", ), @@ -2344,6 +3155,7 @@ def put_role( "monitor_ml", "monitor_rollup", "monitor_snapshot", + "monitor_stats", "monitor_text_structure", "monitor_transform", "monitor_watcher", @@ -2373,16 +3185,22 @@ def put_role( refresh: t.Optional[ t.Union[bool, str, t.Literal["false", "true", "wait_for"]] ] = None, + remote_cluster: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, + remote_indices: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, run_as: t.Optional[t.Sequence[str]] = None, transient_metadata: t.Optional[t.Mapping[str, t.Any]] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - The role management APIs are generally the preferred way to manage roles, rather - than using file-based role management. The create or update roles API cannot - update roles that are defined in roles files. + .. raw:: html + +

Create or update roles.

+

The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. + The create or update roles API cannot update roles that are defined in roles files. + File-based role management is not available in Elastic Serverless.

- ``_ + + ``_ :param name: The name of the role. :param applications: A list of application privilege entries. @@ -2398,6 +3216,11 @@ def put_role( :param refresh: If `true` (the default) 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` then do nothing with refreshes. + :param remote_cluster: A list of remote cluster permissions entries. + :param remote_indices: A list of remote indices permissions entries. NOTE: Remote + indices are effective for remote clusters configured with the API key based + model. They have no effect for remote clusters configured with the certificate + based model. :param run_as: A list of users that the owners of this role can impersonate. *Note*: in Serverless, the run-as feature is disabled. For API compatibility, you can still specify an empty `run_as` field, but a non-empty list will @@ -2438,6 +3261,10 @@ def put_role( __body["indices"] = indices if metadata is not None: __body["metadata"] = metadata + if remote_cluster is not None: + __body["remote_cluster"] = remote_cluster + if remote_indices is not None: + __body["remote_indices"] = remote_indices if run_as is not None: __body["run_as"] = run_as if transient_metadata is not None: @@ -2483,19 +3310,48 @@ def put_role_mapping( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates and updates role mappings. - - ``_ + .. raw:: html + +

Create or update role mappings.

+

Role mappings define which roles are assigned to each user. + Each mapping has rules that identify users and a list of roles that are granted to those users. + The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files.

+

NOTE: This API does not create roles. Rather, it maps users to existing roles. + Roles can be created by using the create or update roles API or roles files.

+

Role templates

+

The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name. + For example, all users in the cn=admin,dc=example,dc=com LDAP group should be given the superuser role in Elasticsearch. + The roles field is used for this purpose.

+

For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user. + The role_templates field is used for this purpose.

+

NOTE: To use role templates successfully, the relevant scripting feature must be enabled. + Otherwise, all attempts to create a role mapping with role templates fail.

+

All of the user fields that are available in the role mapping rules are also available in the role templates. + Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated.

+

By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user. + If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names.

+ + + ``_ - :param name: Role-mapping name - :param enabled: - :param metadata: + :param name: The distinct name that identifies the role mapping. The name is + used solely as an identifier to facilitate interaction via the API; it does + not affect the behavior of the mapping in any way. + :param enabled: Mappings that have `enabled` set to `false` are ignored when + role mapping is performed. + :param metadata: Additional metadata that helps define which roles are assigned + to each user. Within the metadata object, keys beginning with `_` are reserved + for system usage. :param refresh: If `true` (the default) 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` then do nothing with refreshes. - :param role_templates: - :param roles: - :param rules: + :param role_templates: A list of Mustache templates that will be evaluated to + determine the roles names that should granted to the users that match the + role mapping rules. Exactly one of `roles` or `role_templates` must be specified. + :param roles: A list of role names that are granted to the users that match the + role mapping rules. Exactly one of `roles` or `role_templates` must be specified. + :param rules: The rules that determine which users should be matched by the mapping. + A rule is a logical condition that is expressed by using a JSON DSL. :param run_as: """ if name in SKIP_IN_PATH: @@ -2570,22 +3426,41 @@ def put_user( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Adds and updates users in the native realm. These users are commonly referred - to as native users. - - ``_ - - :param username: The username of the User - :param email: - :param enabled: - :param full_name: - :param metadata: - :param password: - :param password_hash: - :param refresh: If `true` (the default) 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` then do nothing with refreshes. - :param roles: + .. raw:: html + +

Create or update users.

+

Add and update users in the native realm. + A password is required for adding a new user but is optional when updating an existing user. + To change a user's password without updating any other fields, use the change password API.

+ + + ``_ + + :param username: An identifier for the user. NOTE: Usernames must be at least + 1 and no more than 507 characters. They can contain alphanumeric characters + (a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic + Latin (ASCII) block. Leading or trailing whitespace is not allowed. + :param email: The email of the user. + :param enabled: Specifies whether the user is enabled. + :param full_name: The full name of the user. + :param metadata: Arbitrary metadata that you want to associate with the user. + :param password: The user's password. Passwords must be at least 6 characters + long. When adding a user, one of `password` or `password_hash` is required. + When updating an existing user, the password is optional, so that other fields + on the user (such as their roles) may be updated without modifying the user's + password + :param password_hash: A hash of the user's password. This must be produced using + the same hashing algorithm as has been configured for password storage. For + more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm` + setting in the user cache and password hash algorithm documentation. Using + this parameter allows the client to pre-hash the password for performance + and/or confidentiality reasons. The `password` parameter and the `password_hash` + parameter cannot be used in the same request. + :param refresh: Valid values are `true`, `false`, and `wait_for`. These values + have the same meaning as in the index API, but the default value for this + API is true. + :param roles: A set of roles the user has. The roles determine the user's access + permissions. To create a user without any roles, specify an empty list (`[]`). """ if username in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'username'") @@ -2668,10 +3543,17 @@ def query_api_keys( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Query API keys. Retrieves a paginated list of API keys and their information. - You can optionally filter the results with a query. + .. raw:: html + +

Find API keys with a query.

+

Get a paginated list of API keys and their information. + You can optionally filter the results with a query.

+

To use this API, you must have at least the manage_own_api_key or the read_security cluster privileges. + If you have only the manage_own_api_key privilege, this API returns only the API keys that you own. + If you have the read_security, manage_api_key, or greater privileges (including manage_security), this API returns all API keys regardless of ownership.

- ``_ + + ``_ :param aggregations: Any aggregations to run over the corpus of returned API keys. Aggregations and queries work together. Aggregations are computed only @@ -2685,30 +3567,39 @@ def query_api_keys( `terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`, `composite`, `filter`, and `filters`. Additionally, aggregations only run over the same subset of fields that query works with. - :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which API keys to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following public information associated with an API key: `id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`, - `username`, `realm`, and `metadata`. - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: Other than `id`, all public fields of an API key are eligible for - sorting. In addition, sort can also be applied to the `_doc` field to sort - by index order. + `username`, `realm`, and `metadata`. NOTE: The queryable string values associated + with API keys are internally mapped as keywords. Consequently, if no `analyzer` + parameter is specified for a `match` query, then the provided match query + string is interpreted as a single keyword value. Such a match query is hence + equivalent to a `term` query. + :param search_after: The search after definition. + :param size: The number of hits to return. It must not be negative. The `size` + parameter can be set to `0`, in which case no API key matches are returned, + only the aggregation results. By default, you cannot page through more than + 10,000 hits using the `from` and `size` parameters. To page through more + hits, use the `search_after` parameter. + :param sort: The sort definition. Other than `id`, all public fields of an API + key are eligible for sorting. In addition, sort can also be applied to the + `_doc` field to sort by index order. :param typed_keys: Determines whether aggregation names are prefixed by their respective types in the response. :param with_limited_by: Return the snapshot of the owner user's role descriptors associated with the API key. An API key's actual permission is the intersection - of its assigned role descriptors and the owner user's role descriptors. - :param with_profile_uid: Determines whether to also retrieve the profile uid, - for the API key owner principal, if it exists. + of its assigned role descriptors and the owner user's role descriptors (effectively + limited by it). An API key cannot retrieve any API key’s limited-by role + descriptors (including itself) unless it has `manage_api_key` or higher privileges. + :param with_profile_uid: Determines whether to also retrieve the profile UID + for the API key owner principal. If it exists, the profile UID is returned + under the `profile_uid` response field for each API key. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/api_key" @@ -2795,26 +3686,34 @@ def query_role( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves roles in a paginated manner. You can optionally filter the results - with a query. + .. raw:: html - ``_ +

Find roles with a query.

+

Get roles in a paginated manner. + The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. + The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. + You can optionally filter the results with a query. + Also, the results can be paginated and sorted.

- :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + + ``_ + + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which roles to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with roles: `name`, `description`, - `metadata`, `applications.application`, `applications.privileges`, `applications.resources`. - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: All public fields of a role are eligible for sorting. In addition, - sort can also be applied to the `_doc` field to sort by index order. + `metadata`, `applications.application`, `applications.privileges`, and `applications.resources`. + :param search_after: The search after definition. + :param size: The number of hits to return. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param sort: The sort definition. You can sort on `username`, `roles`, or `enabled`. + In addition, sort can also be applied to the `_doc` field to sort by index + order. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/role" @@ -2881,28 +3780,35 @@ def query_user( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information for Users in a paginated manner. You can optionally filter - the results with a query. + .. raw:: html - ``_ +

Find users with a query.

+

Get information for users in a paginated manner. + You can optionally filter the results with a query.

+

NOTE: As opposed to the get user API, built-in users are excluded from the result. + This API is only for native users.

- :param from_: Starting document offset. By default, you cannot page through more - than 10,000 hits using the from and size parameters. To page through more - hits, use the `search_after` parameter. + + ``_ + + :param from_: The starting document offset. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. :param query: A query to filter which users to return. If the query parameter is missing, it is equivalent to a `match_all` query. The query supports a subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`, `ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`. You can query the following information associated with user: `username`, - `roles`, `enabled` - :param search_after: Search after definition - :param size: The number of hits to return. By default, you cannot page through - more than 10,000 hits using the `from` and `size` parameters. To page through - more hits, use the `search_after` parameter. - :param sort: Fields eligible for sorting are: username, roles, enabled In addition, - sort can also be applied to the `_doc` field to sort by index order. - :param with_profile_uid: If true will return the User Profile ID for the users - in the query result, if any. + `roles`, `enabled`, `full_name`, and `email`. + :param search_after: The search after definition + :param size: The number of hits to return. It must not be negative. By default, + you cannot page through more than 10,000 hits using the `from` and `size` + parameters. To page through more hits, use the `search_after` parameter. + :param sort: The sort definition. Fields eligible for sorting are: `username`, + `roles`, `enabled`. In addition, sort can also be applied to the `_doc` field + to sort by index order. + :param with_profile_uid: Determines whether to retrieve the user profile UID, + if it exists, for the users. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/_query/user" @@ -2960,13 +3866,27 @@ def saml_authenticate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Submits a SAML Response message to Elasticsearch for consumption. + .. raw:: html + +

Authenticate SAML.

+

Submit a SAML response message to Elasticsearch for consumption.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The SAML message that is submitted can be:

+
    +
  • A response to a SAML authentication request that was previously created using the SAML prepare authentication API.
  • +
  • An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow.
  • +
+

In either case, the SAML message needs to be a base64 encoded XML document with a root element of <Response>.

+

After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication. + This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch.

+ - ``_ + ``_ - :param content: The SAML response as it was sent by the user’s browser, usually + :param content: The SAML response as it was sent by the user's browser, usually a Base64 encoded XML document. - :param ids: A json array with all the valid SAML Request Ids that the caller + :param ids: A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. :param realm: The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined. @@ -3022,11 +3942,22 @@ def saml_complete_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Verifies the logout response sent from the SAML IdP. + .. raw:: html - ``_ +

Logout of SAML completely.

+

Verifies the logout response sent from the SAML IdP.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout. + This API verifies the response by ensuring the content is relevant and validating its signature. + An empty response is returned if the verification process is successful. + The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding. + The caller of this API must prepare the request accordingly so that this API can handle either of them.

- :param ids: A json array with all the valid SAML Request Ids that the caller + + ``_ + + :param ids: A JSON array with all the valid SAML Request Ids that the caller of the API has for the current user. :param realm: The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response. @@ -3088,25 +4019,35 @@ def saml_invalidate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Submits a SAML LogoutRequest message to Elasticsearch for consumption. + .. raw:: html + +

Invalidate SAML.

+

Submit a SAML LogoutRequest message to Elasticsearch for consumption.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

The logout request comes from the SAML IdP during an IdP initiated Single Logout. + The custom web application can use this API to have Elasticsearch process the LogoutRequest. + After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message. + Thus the user can be redirected back to their IdP.

+ - ``_ + ``_ :param query_string: The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. This query should include - a single parameter named SAMLRequest that contains a SAML logout request + a single parameter named `SAMLRequest` that contains a SAML logout request that is deflated and Base64 encoded. If the SAML IdP has signed the logout - request, the URL should include two extra parameters named SigAlg and Signature + request, the URL should include two extra parameters named `SigAlg` and `Signature` that contain the algorithm used for the signature and the signature value - itself. In order for Elasticsearch to be able to verify the IdP’s signature, - the value of the query_string field must be an exact match to the string + itself. In order for Elasticsearch to be able to verify the IdP's signature, + the value of the `query_string` field must be an exact match to the string provided by the browser. The client application must not attempt to parse or process the string in any way. :param acs: The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this - parameter or the realm parameter. + parameter or the `realm` parameter. :param realm: The name of the SAML realm in Elasticsearch the configuration. - You must specify either this parameter or the acs parameter. + You must specify either this parameter or the `acs` parameter. """ if query_string is None and body is None: raise ValueError("Empty value passed for parameter 'query_string'") @@ -3155,13 +4096,21 @@ def saml_logout( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Submits a request to invalidate an access token and refresh token. + .. raw:: html - ``_ +

Logout of SAML.

+

Submits a request to invalidate an access token and refresh token.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

This API invalidates the tokens that were generated for a user by the SAML authenticate API. + If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout).

+ + + ``_ :param token: The access token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent token that was received - after refreshing the original one by using a refresh_token. + after refreshing the original one by using a `refresh_token`. :param refresh_token: The refresh token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent refresh token that was received after refreshing the original access token. @@ -3212,19 +4161,31 @@ def saml_prepare_authentication( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a SAML authentication request () as a URL string, based - on the configuration of the respective SAML realm in Elasticsearch. + .. raw:: html + +

Prepare SAML authentication.

+

Create a SAML authentication request (<AuthnRequest>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch.

+

NOTE: This API is intended for use by custom web applications other than Kibana. + If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.

+

This API returns a URL pointing to the SAML Identity Provider. + You can use the URL to redirect the browser of the user in order to continue the authentication process. + The URL includes a single parameter named SAMLRequest, which contains a SAML Authentication request that is deflated and Base64 encoded. + If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named SigAlg and Signature. + These parameters contain the algorithm used for the signature and the signature value itself. + It also returns a random string that uniquely identifies this SAML Authentication request. + The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process.

+ - ``_ + ``_ :param acs: The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. The realm is used to generate the authentication - request. You must specify either this parameter or the realm parameter. + request. You must specify either this parameter or the `realm` parameter. :param realm: The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. You must specify either this - parameter or the acs parameter. + parameter or the `acs` parameter. :param relay_state: A string that will be included in the redirect URL that this - API returns as the RelayState query parameter. If the Authentication Request + API returns as the `RelayState` query parameter. If the Authentication Request is signed, this value is used as part of the signature computation. """ __path_parts: t.Dict[str, str] = {} @@ -3268,9 +4229,15 @@ def saml_service_provider_metadata( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Generate SAML metadata for a SAML 2.0 Service Provider. + .. raw:: html - ``_ +

Create SAML service provider metadata.

+

Generate SAML metadata for a SAML 2.0 Service Provider.

+

The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file. + This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch.

+ + + ``_ :param realm_name: The name of the SAML realm in Elasticsearch. """ @@ -3314,21 +4281,30 @@ def suggest_user_profiles( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get suggestions for user profiles that match specified search criteria. + .. raw:: html + +

Suggest a user profile.

+

Get suggestions for user profiles that match specified search criteria.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+ - ``_ + ``_ - :param data: List of filters for the `data` field of the profile document. To - return all content use `data=*`. To return a subset of content use `data=` - to retrieve content nested under the specified ``. By default returns - no `data` content. + :param data: A comma-separated list of filters for the `data` field of the profile + document. To return all content use `data=*`. To return a subset of content, + use `data=` to retrieve content nested under the specified ``. + By default, the API returns no `data` content. It is an error to specify + `data` as both the query parameter and the request body field. :param hint: Extra search criteria to improve relevance of the suggestion result. Profiles matching the spcified hint are ranked higher in the response. Profiles - not matching the hint don't exclude the profile from the response as long - as the profile matches the `name` field query. - :param name: Query string used to match name-related fields in user profile documents. - Name-related fields are the user's `username`, `full_name`, and `email`. - :param size: Number of profiles to return. + not matching the hint aren't excluded from the response as long as the profile + matches the `name` field query. + :param name: A query string used to match name-related fields in user profile + documents. Name-related fields are the user's `username`, `full_name`, and + `email`. + :param size: The number of profiles to return. """ __path_parts: t.Dict[str, str] = {} __path = "/_security/profile/_suggest" @@ -3383,38 +4359,43 @@ def update_api_key( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update an API key. Updates attributes of an existing API key. Users can only - update API keys that they created or that were granted to them. Use this API - to update API keys created by the create API Key or grant API Key APIs. If you - need to apply the same update to many API keys, you can use bulk update API Keys - to reduce overhead. It’s not possible to update expired API keys, or API keys - that have been invalidated by invalidate API Key. This API supports updates to - an API key’s access scope and metadata. The access scope of an API key is derived - from the `role_descriptors` you specify in the request, and a snapshot of the - owner user’s permissions at the time of the request. The snapshot of the owner’s - permissions is updated automatically on every call. If you don’t specify `role_descriptors` - in the request, a call to this API might still change the API key’s access scope. - This change can occur if the owner user’s permissions have changed since the - API key was created or last modified. To update another user’s API key, use the - `run_as` feature to submit a request on behalf of another user. IMPORTANT: It’s - not possible to use an API key as the authentication credential for this API. - To update an API key, the owner user’s credentials are required. - - ``_ + .. raw:: html + +

Update an API key.

+

Update attributes of an existing API key. + This API supports updates to an API key's access scope, expiration, and metadata.

+

To use this API, you must have at least the manage_own_api_key cluster privilege. + Users can only update API keys that they created or that were granted to them. + To update another user’s API key, use the run_as feature to submit a request on behalf of another user.

+

IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required.

+

Use this API to update API keys created by the create API key or grant API Key APIs. + If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead. + It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API.

+

The access scope of an API key is derived from the role_descriptors you specify in the request and a snapshot of the owner user's permissions at the time of the request. + The snapshot of the owner's permissions is updated automatically on every call.

+

IMPORTANT: If you don't specify role_descriptors in the request, a call to this API might still change the API key's access scope. + This change can occur if the owner user's permissions have changed since the API key was created or last modified.

+ + + ``_ :param id: The ID of the API key to update. - :param expiration: Expiration time for the API key. + :param expiration: The expiration time for the API key. By default, API keys + never expire. This property can be omitted to leave the expiration unchanged. :param metadata: Arbitrary metadata that you want to associate with the API key. - It supports nested data structure. Within the metadata object, keys beginning - with _ are reserved for system usage. - :param role_descriptors: An array of role descriptors for this API key. This - parameter is optional. When it is not specified or is an empty array, then - the API key will have a point in time snapshot of permissions of the authenticated - user. If you supply role descriptors then the resultant permissions would - be an intersection of API keys permissions and authenticated user’s permissions - thereby limiting the access scope for API keys. The structure of role descriptor - is the same as the request for create role API. For more details, see create - or update roles API. + It supports a nested data structure. Within the metadata object, keys beginning + with `_` are reserved for system usage. When specified, this value fully + replaces the metadata previously associated with the API key. + :param role_descriptors: The role descriptors to assign to this API key. The + API key's effective permissions are an intersection of its assigned privileges + and the point in time snapshot of permissions of the owner user. You can + assign new privileges by specifying them in this parameter. To remove assigned + privileges, you can supply an empty `role_descriptors` parameter, that is + to say, an empty object `{}`. If an API key has no assigned privileges, it + inherits the owner user's full permissions. The snapshot of the owner's permissions + is always updated, whether you supply the `role_descriptors` parameter or + not. The structure of a role descriptor is the same as the request for the + create API keys API. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -3452,6 +4433,163 @@ def update_api_key( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("access", "expiration", "metadata"), + ) + def update_cross_cluster_api_key( + self, + *, + id: str, + access: t.Optional[t.Mapping[str, t.Any]] = None, + error_trace: t.Optional[bool] = None, + expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + metadata: t.Optional[t.Mapping[str, t.Any]] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update a cross-cluster API key.

+

Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access.

+

To use this API, you must have at least the manage_security cluster privilege. + Users can only update API keys that they created. + To update another user's API key, use the run_as feature to submit a request on behalf of another user.

+

IMPORTANT: It's not possible to use an API key as the authentication credential for this API. + To update an API key, the owner user's credentials are required.

+

It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API.

+

This API supports updates to an API key's access scope, metadata, and expiration. + The owner user's information, such as the username and realm, is also updated automatically on every call.

+

NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API.

+ + + ``_ + + :param id: The ID of the cross-cluster API key to update. + :param access: The access to be granted to this API key. The access is composed + of permissions for cross cluster search and cross cluster replication. At + least one of them must be specified. When specified, the new access assignment + fully replaces the previously assigned access. + :param expiration: The expiration time for the API key. By default, API keys + never expire. This property can be omitted to leave the value unchanged. + :param metadata: Arbitrary metadata that you want to associate with the API key. + It supports nested data structure. Within the metadata object, keys beginning + with `_` are reserved for system usage. When specified, this information + fully replaces metadata previously associated with the API key. + """ + if id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'id'") + if access is None and body is None: + raise ValueError("Empty value passed for parameter 'access'") + __path_parts: t.Dict[str, str] = {"id": _quote(id)} + __path = f'/_security/cross_cluster/api_key/{__path_parts["id"]}' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if access is not None: + __body["access"] = access + if expiration is not None: + __body["expiration"] = expiration + if metadata is not None: + __body["metadata"] = metadata + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.update_cross_cluster_api_key", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("security", "security_profile", "security_tokens"), + parameter_aliases={ + "security-profile": "security_profile", + "security-tokens": "security_tokens", + }, + ) + def update_settings( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + security: t.Optional[t.Mapping[str, t.Any]] = None, + security_profile: t.Optional[t.Mapping[str, t.Any]] = None, + security_tokens: t.Optional[t.Mapping[str, t.Any]] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update security index settings.

+

Update the user-configurable settings for the security internal index (.security and associated indices). Only a subset of settings are allowed to be modified. This includes index.auto_expand_replicas and index.number_of_replicas.

+

NOTE: If index.auto_expand_replicas is set, index.number_of_replicas will be ignored during updates.

+

If a specific index is not in use on the system and settings are provided for it, the request will be rejected. + This API does not yet support configuring the settings for indices before they are in use.

+ + + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param security: Settings for the index used for most security configuration, + including native realm users and roles configured with the API. + :param security_profile: Settings for the index used to store profile information. + :param security_tokens: Settings for the index used to store tokens. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_security/settings" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if not __body: + if security is not None: + __body["security"] = security + if security_profile is not None: + __body["security-profile"] = security_profile + if security_tokens is not None: + __body["security-tokens"] = security_tokens + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="security.update_settings", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=("data", "labels"), ) @@ -3473,23 +4611,42 @@ def update_user_profile_data( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Updates specific data for the user profile that's associated with the specified - unique ID. - - ``_ + .. raw:: html + +

Update user profile data.

+

Update specific data for the user profile that is associated with a unique ID.

+

NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. + Individual users and external applications should not call this API directly. + Elastic reserves the right to change or remove this feature in future releases without prior notice.

+

To use this API, you must have one of the following privileges:

+
    +
  • The manage_user_profile cluster privilege.
  • +
  • The update_profile_data global privilege for the namespaces that are referenced in the request.
  • +
+

This API updates the labels and data fields of an existing user profile document with JSON objects. + New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request.

+

For both labels and data, content is namespaced by the top-level fields. + The update_profile_data global privilege grants privileges for updating only the allowed namespaces.

+ + + ``_ :param uid: A unique identifier for the user profile. :param data: Non-searchable data that you want to associate with the user profile. - This field supports a nested data structure. + This field supports a nested data structure. Within the `data` object, top-level + keys cannot begin with an underscore (`_`) or contain a period (`.`). The + data object is not searchable, but can be retrieved with the get user profile + API. :param if_primary_term: Only perform the operation if the document has this primary term. :param if_seq_no: Only perform the operation if the document has this sequence number. :param labels: Searchable data that you want to associate with the user profile. - This field supports a nested data structure. + This field supports a nested data structure. Within the labels object, top-level + keys cannot begin with an underscore (`_`) or contain a period (`.`). :param refresh: If 'true', Elasticsearch refreshes 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' do nothing with refreshes. + this operation visible to search. If 'wait_for', it waits for a refresh to + make this operation visible to search. If 'false', nothing is done with refreshes. """ if uid in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'uid'") diff --git a/elasticsearch/_sync/client/shutdown.py b/elasticsearch/_sync/client/shutdown.py index e08eb469a..8aa81ae35 100644 --- a/elasticsearch/_sync/client/shutdown.py +++ b/elasticsearch/_sync/client/shutdown.py @@ -42,10 +42,18 @@ def delete_node( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and - ECK. Direct use is not supported. + .. raw:: html - ``_ +

Cancel node shutdown preparations. + Remove a node from the shutdown list so it can resume normal operations. + You must explicitly clear the shutdown request when a node rejoins the cluster or when a node has permanently left the cluster. + Shutdown requests are never removed automatically by Elasticsearch.

+

NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. + Direct use is not supported.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+ + + ``_ :param node_id: The node id of node to be removed from the shutdown state :param master_timeout: Period to wait for a connection to the master node. If @@ -98,10 +106,16 @@ def get_node( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieve status of a node or nodes that are currently marked as shutting down. - Designed for indirect use by ECE/ESS and ECK. Direct use is not supported. + .. raw:: html + +

Get the shutdown status.

+

Get information about nodes that are ready to be shut down, have shut down preparations still in progress, or have stalled. + The API returns status information for each part of the shut down process.

+

NOTE: This feature is designed for indirect use by Elasticsearch Service, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

- ``_ + + ``_ :param node_id: Which node for which to retrieve the shutdown status :param master_timeout: Period to wait for a connection to the master node. If @@ -166,12 +180,26 @@ def put_node( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct - use is not supported. + .. raw:: html + +

Prepare a node to be shut down.

+

NOTE: This feature is designed for indirect use by Elastic Cloud, Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not supported.

+

If you specify a node that is offline, it will be prepared for shut down when it rejoins the cluster.

+

If the operator privileges feature is enabled, you must be an operator to use this API.

+

The API migrates ongoing tasks and index shards to other nodes as needed to prepare a node to be restarted or shut down and removed from the cluster. + This ensures that Elasticsearch can be stopped safely with minimal disruption to the cluster.

+

You must specify the type of shutdown: restart, remove, or replace. + If a node is already being prepared for shutdown, you can use this API to change the shutdown type.

+

IMPORTANT: This API does NOT terminate the Elasticsearch process. + Monitor the node shutdown status to determine when it is safe to stop Elasticsearch.

+ - ``_ + ``_ - :param node_id: The node id of node to be shut down + :param node_id: The node identifier. This parameter is not validated against + the cluster's active nodes. This enables you to register a node for shut + down while it is offline. No error is thrown if you specify an invalid node + ID. :param reason: A human-readable reason that the node is being shut down. This field provides information for other cluster operators; it does not affect the shut down process. @@ -192,17 +220,17 @@ def put_node( the index.unassigned.node_left.delayed_timeout setting. If you specify both a restart allocation delay and an index-level allocation delay, the longer of the two is used. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. :param target_node_name: Only valid if type is replace. Specifies the name of the node that is replacing the node being shut down. Shards from the shut down node are only allowed to be allocated to the target node, and no other data will be allocated to the target node. During relocation of data certain allocation rules are ignored, such as disk watermarks or user attribute filtering rules. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if node_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'node_id'") diff --git a/elasticsearch/_sync/client/simulate.py b/elasticsearch/_sync/client/simulate.py new file mode 100644 index 000000000..939754394 --- /dev/null +++ b/elasticsearch/_sync/client/simulate.py @@ -0,0 +1,145 @@ +# 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. + +import typing as t + +from elastic_transport import ObjectApiResponse + +from ._base import NamespacedClient +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) + + +class SimulateClient(NamespacedClient): + + @_rewrite_parameters( + body_fields=( + "docs", + "component_template_substitutions", + "index_template_substitutions", + "mapping_addition", + "pipeline_substitutions", + ), + ) + @_stability_warning(Stability.EXPERIMENTAL) + def ingest( + self, + *, + docs: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None, + index: t.Optional[str] = None, + component_template_substitutions: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Any]] + ] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + index_template_substitutions: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Any]] + ] = None, + mapping_addition: t.Optional[t.Mapping[str, t.Any]] = None, + pipeline: t.Optional[str] = None, + pipeline_substitutions: t.Optional[ + t.Mapping[str, t.Mapping[str, t.Any]] + ] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Simulate data ingestion. + Run ingest pipelines against a set of provided documents, optionally with substitute pipeline definitions, to simulate ingesting data into an index.

+

This API is meant to be used for troubleshooting or pipeline development, as it does not actually index any data into Elasticsearch.

+

The API runs the default and final pipeline for that index against a set of documents provided in the body of the request. + If a pipeline contains a reroute processor, it follows that reroute processor to the new index, running that index's pipelines as well the same way that a non-simulated ingest would. + No data is indexed into Elasticsearch. + Instead, the transformed document is returned, along with the list of pipelines that have been run and the name of the index where the document would have been indexed if this were not a simulation. + The transformed document is validated against the mappings that would apply to this index, and any validation error is reported in the result.

+

This API differs from the simulate pipeline API in that you specify a single pipeline for that API, and it runs only that one pipeline. + The simulate pipeline API is more useful for developing a single pipeline, while the simulate ingest API is more useful for troubleshooting the interaction of the various pipelines that get applied when ingesting into an index.

+

By default, the pipeline definitions that are currently in the system are used. + However, you can supply substitute pipeline definitions in the body of the request. + These will be used in place of the pipeline definitions that are already in the system. This can be used to replace existing pipeline definitions or to create new ones. The pipeline substitutions are used only within this request.

+ + + ``_ + + :param docs: Sample documents to test in the pipeline. + :param index: The index to simulate ingesting into. This value can be overridden + by specifying an index on each document. If you specify this parameter in + the request path, it is used for any documents that do not explicitly specify + an index argument. + :param component_template_substitutions: A map of component template names to + substitute component template definition objects. + :param index_template_substitutions: A map of index template names to substitute + index template definition objects. + :param mapping_addition: + :param pipeline: The pipeline to use as the default pipeline. This value can + be used to override the default pipeline of the index. + :param pipeline_substitutions: Pipelines to test. If you don’t specify the `pipeline` + request path parameter, this parameter is required. If you specify both this + and the request path parameter, the API only uses the request path parameter. + """ + if docs is None and body is None: + raise ValueError("Empty value passed for parameter 'docs'") + __path_parts: t.Dict[str, str] + if index not in SKIP_IN_PATH: + __path_parts = {"index": _quote(index)} + __path = f'/_ingest/{__path_parts["index"]}/_simulate' + else: + __path_parts = {} + __path = "/_ingest/_simulate" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pipeline is not None: + __query["pipeline"] = pipeline + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if docs is not None: + __body["docs"] = docs + if component_template_substitutions is not None: + __body["component_template_substitutions"] = ( + component_template_substitutions + ) + if index_template_substitutions is not None: + __body["index_template_substitutions"] = index_template_substitutions + if mapping_addition is not None: + __body["mapping_addition"] = mapping_addition + if pipeline_substitutions is not None: + __body["pipeline_substitutions"] = pipeline_substitutions + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="simulate.ingest", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_sync/client/slm.py b/elasticsearch/_sync/client/slm.py index 86f04928f..9196bc57c 100644 --- a/elasticsearch/_sync/client/slm.py +++ b/elasticsearch/_sync/client/slm.py @@ -33,14 +33,26 @@ def delete_lifecycle( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an existing snapshot lifecycle policy. + .. raw:: html + +

Delete a policy. + Delete a snapshot lifecycle policy definition. + This operation prevents any future snapshots from being taken but does not cancel in-progress snapshots or remove previously-taken snapshots.

- ``_ + + ``_ :param policy_id: The id of the snapshot lifecycle policy to remove + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") @@ -53,8 +65,12 @@ def delete_lifecycle( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "DELETE", @@ -73,15 +89,26 @@ def execute_lifecycle( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Immediately creates a snapshot according to the lifecycle policy, without waiting - for the scheduled time. + .. raw:: html + +

Run a policy. + Immediately create a snapshot according to the snapshot lifecycle policy without waiting for the scheduled time. + The snapshot policy is normally applied according to its schedule, but you might want to manually run a policy before performing an upgrade or other maintenance.

- ``_ + + ``_ :param policy_id: The id of the snapshot lifecycle policy to be executed + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") @@ -94,8 +121,12 @@ def execute_lifecycle( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", @@ -113,12 +144,25 @@ def execute_retention( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes any snapshots that are expired according to the policy's retention rules. + .. raw:: html + +

Run a retention policy. + Manually apply the retention policy to force immediate removal of snapshots that are expired according to the snapshot lifecycle policy retention rules. + The retention policy is normally applied according to its schedule.

+ + + ``_ - ``_ + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/_execute_retention" @@ -129,8 +173,12 @@ def execute_retention( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", @@ -149,15 +197,25 @@ def get_lifecycle( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves one or more snapshot lifecycle policy definitions and information about - the latest snapshot attempts. + .. raw:: html + +

Get policy information. + Get snapshot lifecycle policy definitions and information about the latest snapshot attempts.

+ - ``_ + ``_ :param policy_id: Comma-separated list of snapshot lifecycle policies to retrieve + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] if policy_id not in SKIP_IN_PATH: @@ -173,8 +231,12 @@ def get_lifecycle( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "GET", @@ -192,13 +254,24 @@ def get_stats( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns global and policy-level statistics about actions taken by snapshot lifecycle - management. + .. raw:: html + +

Get snapshot lifecycle management statistics. + Get global and policy-level statistics about actions taken by snapshot lifecycle management.

- ``_ + + ``_ + + :param master_timeout: Period to wait for a connection to the master node. If + no response is received before the timeout expires, the request fails and + returns an error. + :param timeout: Period to wait for a response. If no response is received before + the timeout expires, the request fails and returns an error. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/stats" @@ -209,8 +282,12 @@ def get_stats( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "GET", @@ -228,12 +305,25 @@ def get_status( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the status of snapshot lifecycle management (SLM). + .. raw:: html + +

Get the snapshot lifecycle management status.

+ - ``_ + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. To indicate + that the request should never timeout, set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/status" @@ -244,8 +334,12 @@ def get_status( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "GET", @@ -277,16 +371,23 @@ def put_lifecycle( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a snapshot lifecycle policy. + .. raw:: html - ``_ +

Create or update a policy. + Create or update a snapshot lifecycle policy. + If the policy already exists, this request increments the policy version. + Only the latest version of a policy is stored.

- :param policy_id: ID for the snapshot lifecycle policy you want to create or - update. + + ``_ + + :param policy_id: The identifier for the snapshot lifecycle policy you want to + create or update. :param config: Configuration for each snapshot created by the policy. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. :param name: Name automatically assigned to each snapshot created by the policy. Date math is supported. To prevent conflicting snapshot names, a UUID is automatically appended to each snapshot name. @@ -297,8 +398,9 @@ def put_lifecycle( by the policy. :param schedule: Periodic or absolute schedule at which the policy creates snapshots. SLM applies schedule changes immediately. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. To indicate + that the request should never timeout, set it to `-1`. """ if policy_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'policy_id'") @@ -351,12 +453,27 @@ def start( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Turns on snapshot lifecycle management (SLM). + .. raw:: html + +

Start snapshot lifecycle management. + Snapshot lifecycle management (SLM) starts automatically when a cluster is formed. + Manually starting SLM is necessary only if it has been stopped using the stop SLM API.

- ``_ + + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. To indicate + that the request should never timeout, set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/start" @@ -367,8 +484,12 @@ def start( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", @@ -386,12 +507,31 @@ def stop( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Turns off snapshot lifecycle management (SLM). + .. raw:: html + +

Stop snapshot lifecycle management. + Stop all snapshot lifecycle management (SLM) operations and the SLM plugin. + This API is useful when you are performing maintenance on a cluster and need to prevent SLM from performing any actions on your data streams or indices. + Stopping SLM does not stop any snapshots that are in progress. + You can manually trigger snapshots with the run snapshot lifecycle policy API even if SLM is stopped.

+

The API returns a response as soon as the request is acknowledged, but the plugin might continue to run until in-progress operations complete and it can be safely stopped. + Use the get snapshot lifecycle management status API to see if SLM is running.

+ - ``_ + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. To indicate + that the request should never timeout, set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_slm/stop" @@ -402,8 +542,12 @@ def stop( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout __headers = {"accept": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", diff --git a/elasticsearch/_sync/client/snapshot.py b/elasticsearch/_sync/client/snapshot.py index bb5297e26..c80951da9 100644 --- a/elasticsearch/_sync/client/snapshot.py +++ b/elasticsearch/_sync/client/snapshot.py @@ -20,7 +20,13 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class SnapshotClient(NamespacedClient): @@ -38,10 +44,13 @@ def cleanup_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Triggers the review of a snapshot repository’s contents and deletes any stale - data not referenced by existing snapshots. + .. raw:: html - ``_ +

Clean up the snapshot repository. + Trigger the review of the contents of a snapshot repository and delete any stale data not referenced by existing snapshots.

+ + + ``_ :param name: Snapshot repository to clean up. :param master_timeout: Period to wait for a connection to the master node. @@ -93,9 +102,13 @@ def clone( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clones indices from one snapshot into another snapshot in the same repository. + .. raw:: html + +

Clone a snapshot. + Clone part of all of a snapshot into another snapshot in the same repository.

+ - ``_ + ``_ :param repository: A repository name :param snapshot: The name of the snapshot to clone from @@ -176,9 +189,13 @@ def create( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a snapshot in a repository. + .. raw:: html - ``_ +

Create a snapshot. + Take a snapshot of a cluster or of data streams and indices.

+ + + ``_ :param repository: Repository for the snapshot. :param snapshot: Name of the snapshot. Must be unique in the repository. @@ -280,9 +297,15 @@ def create_repository( verify: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a repository. + .. raw:: html + +

Create or update a snapshot repository. + IMPORTANT: If you are migrating searchable snapshots, the repository name must be identical in the source and destination clusters. + To register a snapshot repository, the cluster's global metadata must be writeable. + Ensure there are no cluster blocks (for example, cluster.blocks.read_only and clsuter.blocks.read_only_allow_delete settings) that prevent write access.

- ``_ + + ``_ :param name: A repository name :param repository: @@ -340,9 +363,12 @@ def delete( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes one or more snapshots. + .. raw:: html + +

Delete snapshots.

+ - ``_ + ``_ :param repository: A repository name :param snapshot: A comma-separated list of snapshot names @@ -391,9 +417,14 @@ def delete_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a repository. + .. raw:: html - ``_ +

Delete snapshot repositories. + When a repository is unregistered, Elasticsearch removes only the reference to the location where the repository is storing the snapshots. + The snapshots themselves are left untouched and in place.

+ + + ``_ :param name: Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. @@ -465,9 +496,12 @@ def get( verbose: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about a snapshot. + .. raw:: html + +

Get snapshot information.

- ``_ + + ``_ :param repository: Comma-separated list of snapshot repository names used to limit the request. Wildcard (*) expressions are supported. @@ -577,9 +611,12 @@ def get_repository( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about a repository. + .. raw:: html + +

Get snapshot repository information.

+ - ``_ + ``_ :param name: A comma-separated list of repository names :param local: Return local information, do not retrieve the state from master @@ -616,6 +653,291 @@ def get_repository( path_parts=__path_parts, ) + @_rewrite_parameters() + def repository_analyze( + self, + *, + name: str, + blob_count: t.Optional[int] = None, + concurrency: t.Optional[int] = None, + detailed: t.Optional[bool] = None, + early_read_node_count: t.Optional[int] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + max_blob_size: t.Optional[t.Union[int, str]] = None, + max_total_data_size: t.Optional[t.Union[int, str]] = None, + pretty: t.Optional[bool] = None, + rare_action_probability: t.Optional[float] = None, + rarely_abort_writes: t.Optional[bool] = None, + read_node_count: t.Optional[int] = None, + register_operation_count: t.Optional[int] = None, + seed: t.Optional[int] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Analyze a snapshot repository. + Analyze the performance characteristics and any incorrect behaviour found in a repository.

+

The response exposes implementation details of the analysis which may change from version to version. + The response body format is therefore not considered stable and may be different in newer versions.

+

There are a large number of third-party storage systems available, not all of which are suitable for use as a snapshot repository by Elasticsearch. + Some storage systems behave incorrectly, or perform poorly, especially when accessed concurrently by multiple clients as the nodes of an Elasticsearch cluster do. This API performs a collection of read and write operations on your repository which are designed to detect incorrect behaviour and to measure the performance characteristics of your storage system.

+

The default values for the parameters are deliberately low to reduce the impact of running an analysis inadvertently and to provide a sensible starting point for your investigations. + Run your first analysis with the default parameter values to check for simple problems. + If successful, run a sequence of increasingly large analyses until you encounter a failure or you reach a blob_count of at least 2000, a max_blob_size of at least 2gb, a max_total_data_size of at least 1tb, and a register_operation_count of at least 100. + Always specify a generous timeout, possibly 1h or longer, to allow time for each analysis to run to completion. + Perform the analyses using a multi-node cluster of a similar size to your production cluster so that it can detect any problems that only arise when the repository is accessed by many nodes at once.

+

If the analysis fails, Elasticsearch detected that your repository behaved unexpectedly. + This usually means you are using a third-party storage system with an incorrect or incompatible implementation of the API it claims to support. + If so, this storage system is not suitable for use as a snapshot repository. + You will need to work with the supplier of your storage system to address the incompatibilities that Elasticsearch detects.

+

If the analysis is successful, the API returns details of the testing process, optionally including how long each operation took. + You can use this information to determine the performance of your storage system. + If any operation fails or returns an incorrect result, the API returns an error. + If the API returns an error, it may not have removed all the data it wrote to the repository. + The error will indicate the location of any leftover data and this path is also recorded in the Elasticsearch logs. + You should verify that this location has been cleaned up correctly. + If there is still leftover data at the specified location, you should manually remove it.

+

If the connection from your client to Elasticsearch is closed while the client is waiting for the result of the analysis, the test is cancelled. + Some clients are configured to close their connection if no response is received within a certain timeout. + An analysis takes a long time to complete so you might need to relax any such client-side timeouts. + On cancellation the analysis attempts to clean up the data it was writing, but it may not be able to remove it all. + The path to the leftover data is recorded in the Elasticsearch logs. + You should verify that this location has been cleaned up correctly. + If there is still leftover data at the specified location, you should manually remove it.

+

If the analysis is successful then it detected no incorrect behaviour, but this does not mean that correct behaviour is guaranteed. + The analysis attempts to detect common bugs but it does not offer 100% coverage. + Additionally, it does not test the following:

+
    +
  • Your repository must perform durable writes. Once a blob has been written it must remain in place until it is deleted, even after a power loss or similar disaster.
  • +
  • Your repository must not suffer from silent data corruption. Once a blob has been written, its contents must remain unchanged until it is deliberately modified or deleted.
  • +
  • Your repository must behave correctly even if connectivity from the cluster is disrupted. Reads and writes may fail in this case, but they must not return incorrect results.
  • +
+

IMPORTANT: An analysis writes a substantial amount of data to your repository and then reads it back again. + This consumes bandwidth on the network between the cluster and the repository, and storage space and I/O bandwidth on the repository itself. + You must ensure this load does not affect other users of these systems. + Analyses respect the repository settings max_snapshot_bytes_per_sec and max_restore_bytes_per_sec if available and the cluster setting indices.recovery.max_bytes_per_sec which you can use to limit the bandwidth they consume.

+

NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.

+

NOTE: Different versions of Elasticsearch may perform different checks for repository compatibility, with newer versions typically being stricter than older ones. + A storage system that passes repository analysis with one version of Elasticsearch may fail with a different version. + This indicates it behaves incorrectly in ways that the former version did not detect. + You must work with the supplier of your storage system to address the incompatibilities detected by the repository analysis API in any version of Elasticsearch.

+

NOTE: This API may not work correctly in a mixed-version cluster.

+

Implementation details

+

NOTE: This section of documentation describes how the repository analysis API works in this version of Elasticsearch, but you should expect the implementation to vary between versions. The request parameters and response format depend on details of the implementation so may also be different in newer versions.

+

The analysis comprises a number of blob-level tasks, as set by the blob_count parameter and a number of compare-and-exchange operations on linearizable registers, as set by the register_operation_count parameter. + These tasks are distributed over the data and master-eligible nodes in the cluster for execution.

+

For most blob-level tasks, the executing node first writes a blob to the repository and then instructs some of the other nodes in the cluster to attempt to read the data it just wrote. + The size of the blob is chosen randomly, according to the max_blob_size and max_total_data_size parameters. + If any of these reads fails then the repository does not implement the necessary read-after-write semantics that Elasticsearch requires.

+

For some blob-level tasks, the executing node will instruct some of its peers to attempt to read the data before the writing process completes. + These reads are permitted to fail, but must not return partial data. + If any read returns partial data then the repository does not implement the necessary atomicity semantics that Elasticsearch requires.

+

For some blob-level tasks, the executing node will overwrite the blob while its peers are reading it. + In this case the data read may come from either the original or the overwritten blob, but the read operation must not return partial data or a mix of data from the two blobs. + If any of these reads returns partial data or a mix of the two blobs then the repository does not implement the necessary atomicity semantics that Elasticsearch requires for overwrites.

+

The executing node will use a variety of different methods to write the blob. + For instance, where applicable, it will use both single-part and multi-part uploads. + Similarly, the reading nodes will use a variety of different methods to read the data back again. + For instance they may read the entire blob from start to end or may read only a subset of the data.

+

For some blob-level tasks, the executing node will cancel the write before it is complete. + In this case, it still instructs some of the other nodes in the cluster to attempt to read the blob but all of these reads must fail to find the blob.

+

Linearizable registers are special blobs that Elasticsearch manipulates using an atomic compare-and-exchange operation. + This operation ensures correct and strongly-consistent behavior even when the blob is accessed by multiple nodes at the same time. + The detailed implementation of the compare-and-exchange operation on linearizable registers varies by repository type. + Repository analysis verifies that that uncontended compare-and-exchange operations on a linearizable register blob always succeed. + Repository analysis also verifies that contended operations either succeed or report the contention but do not return incorrect results. + If an operation fails due to contention, Elasticsearch retries the operation until it succeeds. + Most of the compare-and-exchange operations performed by repository analysis atomically increment a counter which is represented as an 8-byte blob. + Some operations also verify the behavior on small blobs with sizes other than 8 bytes.

+ + + ``_ + + :param name: The name of the repository. + :param blob_count: The total number of blobs to write to the repository during + the test. For realistic experiments, you should set it to at least `2000`. + :param concurrency: The number of operations to run concurrently during the test. + :param detailed: Indicates whether to return detailed results, including timing + information for every operation performed during the analysis. If false, + it returns only a summary of the analysis. + :param early_read_node_count: The number of nodes on which to perform an early + read operation while writing each blob. Early read operations are only rarely + performed. + :param max_blob_size: The maximum size of a blob to be written during the test. + For realistic experiments, you should set it to at least `2gb`. + :param max_total_data_size: An upper limit on the total size of all the blobs + written during the test. For realistic experiments, you should set it to + at least `1tb`. + :param rare_action_probability: The probability of performing a rare action such + as an early read, an overwrite, or an aborted write on each blob. + :param rarely_abort_writes: Indicates whether to rarely cancel writes before + they complete. + :param read_node_count: The number of nodes on which to read a blob after writing. + :param register_operation_count: The minimum number of linearizable register + operations to perform in total. For realistic experiments, you should set + it to at least `100`. + :param seed: The seed for the pseudo-random number generator used to generate + the list of operations performed during the test. To repeat the same set + of operations in multiple experiments, use the same seed in each experiment. + Note that the operations are performed concurrently so might not always happen + in the same order on each run. + :param timeout: The period of time to wait for the test to complete. If no response + is received before the timeout expires, the test is cancelled and returns + an error. + """ + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}/_analyze' + __query: t.Dict[str, t.Any] = {} + if blob_count is not None: + __query["blob_count"] = blob_count + if concurrency is not None: + __query["concurrency"] = concurrency + if detailed is not None: + __query["detailed"] = detailed + if early_read_node_count is not None: + __query["early_read_node_count"] = early_read_node_count + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if max_blob_size is not None: + __query["max_blob_size"] = max_blob_size + if max_total_data_size is not None: + __query["max_total_data_size"] = max_total_data_size + if pretty is not None: + __query["pretty"] = pretty + if rare_action_probability is not None: + __query["rare_action_probability"] = rare_action_probability + if rarely_abort_writes is not None: + __query["rarely_abort_writes"] = rarely_abort_writes + if read_node_count is not None: + __query["read_node_count"] = read_node_count + if register_operation_count is not None: + __query["register_operation_count"] = register_operation_count + if seed is not None: + __query["seed"] = seed + if timeout is not None: + __query["timeout"] = timeout + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.repository_analyze", + path_parts=__path_parts, + ) + + @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) + def repository_verify_integrity( + self, + *, + name: t.Union[str, t.Sequence[str]], + blob_thread_pool_concurrency: t.Optional[int] = None, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + index_snapshot_verification_concurrency: t.Optional[int] = None, + index_verification_concurrency: t.Optional[int] = None, + max_bytes_per_sec: t.Optional[str] = None, + max_failed_shard_snapshots: t.Optional[int] = None, + meta_thread_pool_concurrency: t.Optional[int] = None, + pretty: t.Optional[bool] = None, + snapshot_verification_concurrency: t.Optional[int] = None, + verify_blob_contents: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Verify the repository integrity. + Verify the integrity of the contents of a snapshot repository.

+

This API enables you to perform a comprehensive check of the contents of a repository, looking for any anomalies in its data or metadata which might prevent you from restoring snapshots from the repository or which might cause future snapshot create or delete operations to fail.

+

If you suspect the integrity of the contents of one of your snapshot repositories, cease all write activity to this repository immediately, set its read_only option to true, and use this API to verify its integrity. + Until you do so:

+
    +
  • It may not be possible to restore some snapshots from this repository.
  • +
  • Searchable snapshots may report errors when searched or may have unassigned shards.
  • +
  • Taking snapshots into this repository may fail or may appear to succeed but have created a snapshot which cannot be restored.
  • +
  • Deleting snapshots from this repository may fail or may appear to succeed but leave the underlying data on disk.
  • +
  • Continuing to write to the repository while it is in an invalid state may causing additional damage to its contents.
  • +
+

If the API finds any problems with the integrity of the contents of your repository, Elasticsearch will not be able to repair the damage. + The only way to bring the repository back into a fully working state after its contents have been damaged is by restoring its contents from a repository backup which was taken before the damage occurred. + You must also identify what caused the damage and take action to prevent it from happening again.

+

If you cannot restore a repository backup, register a new repository and use this for all future snapshot operations. + In some cases it may be possible to recover some of the contents of a damaged repository, either by restoring as many of its snapshots as needed and taking new snapshots of the restored data, or by using the reindex API to copy data from any searchable snapshots mounted from the damaged repository.

+

Avoid all operations which write to the repository while the verify repository integrity API is running. + If something changes the repository contents while an integrity verification is running then Elasticsearch may incorrectly report having detected some anomalies in its contents due to the concurrent writes. + It may also incorrectly fail to report some anomalies that the concurrent writes prevented it from detecting.

+

NOTE: This API is intended for exploratory use by humans. You should expect the request parameters and the response format to vary in future versions.

+

NOTE: This API may not work correctly in a mixed-version cluster.

+ + + ``_ + + :param name: A repository name + :param blob_thread_pool_concurrency: Number of threads to use for reading blob + contents + :param index_snapshot_verification_concurrency: Number of snapshots to verify + concurrently within each index + :param index_verification_concurrency: Number of indices to verify concurrently + :param max_bytes_per_sec: Rate limit for individual blob verification + :param max_failed_shard_snapshots: Maximum permitted number of failed shard snapshots + :param meta_thread_pool_concurrency: Number of threads to use for reading metadata + :param snapshot_verification_concurrency: Number of snapshots to verify concurrently + :param verify_blob_contents: Whether to verify the contents of individual blobs + """ + if name in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'name'") + __path_parts: t.Dict[str, str] = {"repository": _quote(name)} + __path = f'/_snapshot/{__path_parts["repository"]}/_verify_integrity' + __query: t.Dict[str, t.Any] = {} + if blob_thread_pool_concurrency is not None: + __query["blob_thread_pool_concurrency"] = blob_thread_pool_concurrency + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if index_snapshot_verification_concurrency is not None: + __query["index_snapshot_verification_concurrency"] = ( + index_snapshot_verification_concurrency + ) + if index_verification_concurrency is not None: + __query["index_verification_concurrency"] = index_verification_concurrency + if max_bytes_per_sec is not None: + __query["max_bytes_per_sec"] = max_bytes_per_sec + if max_failed_shard_snapshots is not None: + __query["max_failed_shard_snapshots"] = max_failed_shard_snapshots + if meta_thread_pool_concurrency is not None: + __query["meta_thread_pool_concurrency"] = meta_thread_pool_concurrency + if pretty is not None: + __query["pretty"] = pretty + if snapshot_verification_concurrency is not None: + __query["snapshot_verification_concurrency"] = ( + snapshot_verification_concurrency + ) + if verify_blob_contents is not None: + __query["verify_blob_contents"] = verify_blob_contents + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + endpoint_id="snapshot.repository_verify_integrity", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_fields=( "feature_states", @@ -654,9 +976,22 @@ def restore( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Restores a snapshot. + .. raw:: html - ``_ +

Restore a snapshot. + Restore a snapshot of a cluster or data streams and indices.

+

You can restore a snapshot only to a running cluster with an elected master node. + The snapshot repository must be registered and available to the cluster. + The snapshot and cluster versions must be compatible.

+

To restore a snapshot, the cluster's global metadata must be writable. Ensure there are't any cluster blocks that prevent writes. The restore operation ignores index blocks.

+

Before you restore a data stream, ensure the cluster contains a matching index template with data streams enabled. To check, use the index management feature in Kibana or the get index template API:

+
GET _index_template/*?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream
+          
+

If no such template exists, you can create one or restore a cluster state that contains one. Without a matching index template, a data stream can't roll over or create backing indices.

+

If your snapshot contains data from App Search or Workplace Search, you must restore the Enterprise Search encryption key before you restore the snapshot.

+ + + ``_ :param repository: A repository name :param snapshot: A snapshot name @@ -747,9 +1082,20 @@ def status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns information about the status of a snapshot. + .. raw:: html + +

Get the snapshot status. + Get a detailed description of the current state for each shard participating in the snapshot. + Note that this API should be used only to obtain detailed shard-level information for ongoing snapshots. + If this detail is not needed or you want to obtain information about one or more existing snapshots, use the get snapshot API.

+

WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive. + The API requires a read from the repository for each shard in each snapshot. + For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards).

+

Depending on the latency of your storage, such requests can take an extremely long time to return results. + These requests can also tax machine resources and, when using cloud storage, incur high processing costs.

- ``_ + + ``_ :param repository: A repository name :param snapshot: A comma-separated list of snapshot names @@ -806,9 +1152,13 @@ def verify_repository( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Verifies a repository. + .. raw:: html + +

Verify a snapshot repository. + Check for common misconfigurations in a snapshot repository.

+ - ``_ + ``_ :param name: A repository name :param master_timeout: Explicit operation timeout for connection to master node diff --git a/elasticsearch/_sync/client/sql.py b/elasticsearch/_sync/client/sql.py index 3635bfc0b..ecdb49a22 100644 --- a/elasticsearch/_sync/client/sql.py +++ b/elasticsearch/_sync/client/sql.py @@ -39,9 +39,12 @@ def clear_cursor( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Clears the SQL cursor + .. raw:: html - ``_ +

Clear an SQL search cursor.

+ + + ``_ :param cursor: Cursor to clear. """ @@ -84,12 +87,21 @@ def delete_async( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes an async SQL search or a stored synchronous SQL search. If the search - is still running, the API cancels it. + .. raw:: html + +

Delete an async SQL search. + Delete an async SQL search or a stored synchronous SQL search. + If the search is still running, the API cancels it.

+

If the Elasticsearch security features are enabled, only the following users can use this API to delete a search:

+
    +
  • Users with the cancel_task cluster privilege.
  • +
  • The user who first submitted the search.
  • +
- ``_ - :param id: Identifier for the search. + ``_ + + :param id: The identifier for the search. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -131,21 +143,26 @@ def get_async( ] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current status and available results for an async SQL search or stored - synchronous SQL search - - ``_ - - :param id: Identifier for the search. - :param delimiter: Separator for CSV results. The API only supports this parameter - for CSV responses. - :param format: Format for the response. You must specify a format using this - parameter or the Accept HTTP header. If you specify both, the API uses this - parameter. - :param keep_alive: Retention period for the search and its results. Defaults + .. raw:: html + +

Get async SQL search results. + Get the current status and available results for an async SQL search or stored synchronous SQL search.

+

If the Elasticsearch security features are enabled, only the user who first submitted the SQL search can retrieve the search using this API.

+ + + ``_ + + :param id: The identifier for the search. + :param delimiter: The separator for CSV results. The API supports this parameter + only for CSV responses. + :param format: The format for the response. You must specify a format using this + parameter or the `Accept` HTTP header. If you specify both, the API uses + this parameter. + :param keep_alive: The retention period for the search and its results. It defaults to the `keep_alive` period for the original SQL search. - :param wait_for_completion_timeout: Period to wait for complete results. Defaults - to no timeout, meaning the request waits for complete search results. + :param wait_for_completion_timeout: The period to wait for complete results. + It defaults to no timeout, meaning the request waits for complete search + results. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -189,12 +206,15 @@ def get_async_status( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Returns the current status of an async SQL search or a stored synchronous SQL - search + .. raw:: html + +

Get the async SQL search status. + Get the current status of an async SQL search or a stored synchronous SQL search.

+ - ``_ + ``_ - :param id: Identifier for the search. + :param id: The identifier for the search. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -221,6 +241,7 @@ def get_async_status( @_rewrite_parameters( body_fields=( + "allow_partial_search_results", "catalog", "columnar", "cursor", @@ -243,6 +264,7 @@ def get_async_status( def query( self, *, + allow_partial_search_results: t.Optional[bool] = None, catalog: t.Optional[str] = None, columnar: t.Optional[bool] = None, cursor: t.Optional[str] = None, @@ -251,7 +273,11 @@ def query( field_multi_value_leniency: t.Optional[bool] = None, filter: t.Optional[t.Mapping[str, t.Any]] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, - format: t.Optional[str] = None, + format: t.Optional[ + t.Union[ + str, t.Literal["cbor", "csv", "json", "smile", "tsv", "txt", "yaml"] + ] + ] = None, human: t.Optional[bool] = None, index_using_frozen: t.Optional[bool] = None, keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, @@ -269,40 +295,53 @@ def query( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Executes a SQL request - - ``_ - - :param catalog: Default catalog (cluster) for queries. If unspecified, the queries - execute on the data in the local cluster only. - :param columnar: If true, the results in a columnar fashion: one row represents - all the values of a certain column from the current page of results. - :param cursor: Cursor used to retrieve a set of paginated results. If you specify - a cursor, the API only uses the `columnar` and `time_zone` request body parameters. - It ignores other request body parameters. - :param fetch_size: The maximum number of rows (or entries) to return in one response - :param field_multi_value_leniency: Throw an exception when encountering multiple - values for a field (default) or be lenient and return the first value from - the list (without any guarantees of what that will be - typically the first - in natural ascending order). - :param filter: Elasticsearch query DSL for additional filtering. - :param format: Format for the response. - :param index_using_frozen: If true, the search can run on frozen indices. Defaults - to false. - :param keep_alive: Retention period for an async or saved synchronous search. - :param keep_on_completion: If true, Elasticsearch stores synchronous searches - if you also specify the wait_for_completion_timeout parameter. If false, - Elasticsearch only stores async searches that don’t finish before the wait_for_completion_timeout. - :param page_timeout: The timeout before a pagination request fails. - :param params: Values for parameters in the query. - :param query: SQL query to run. + .. raw:: html + +

Get SQL search results. + Run an SQL request.

+ + + ``_ + + :param allow_partial_search_results: If `true`, the response has partial results + when there are shard request timeouts or shard failures. If `false`, the + API returns an error with no partial results. + :param catalog: The default catalog (cluster) for queries. If unspecified, the + queries execute on the data in the local cluster only. + :param columnar: If `true`, the results are in a columnar fashion: one row represents + all the values of a certain column from the current page of results. The + API supports this parameter only for CBOR, JSON, SMILE, and YAML responses. + :param cursor: The cursor used to retrieve a set of paginated results. If you + specify a cursor, the API only uses the `columnar` and `time_zone` request + body parameters. It ignores other request body parameters. + :param fetch_size: The maximum number of rows (or entries) to return in one response. + :param field_multi_value_leniency: If `false`, the API returns an exception when + encountering multiple values for a field. If `true`, the API is lenient and + returns the first value from the array with no guarantee of consistent results. + :param filter: The Elasticsearch query DSL for additional filtering. + :param format: The format for the response. You can also specify a format using + the `Accept` HTTP header. If you specify both this parameter and the `Accept` + HTTP header, this parameter takes precedence. + :param index_using_frozen: If `true`, the search can run on frozen indices. + :param keep_alive: The retention period for an async or saved synchronous search. + :param keep_on_completion: If `true`, Elasticsearch stores synchronous searches + if you also specify the `wait_for_completion_timeout` parameter. If `false`, + Elasticsearch only stores async searches that don't finish before the `wait_for_completion_timeout`. + :param page_timeout: The minimum retention period for the scroll cursor. After + this time period, a pagination request might fail because the scroll cursor + is no longer available. Subsequent scroll requests prolong the lifetime of + the scroll cursor by the duration of `page_timeout` in the scroll request. + :param params: The values for parameters in the query. + :param query: The SQL query to run. :param request_timeout: The timeout before the request fails. - :param runtime_mappings: Defines one or more runtime fields in the search request. - These fields take precedence over mapped fields with the same name. - :param time_zone: ISO-8601 time zone ID for the search. - :param wait_for_completion_timeout: Period to wait for complete results. Defaults - to no timeout, meaning the request waits for complete search results. If - the search doesn’t finish within this period, the search becomes async. + :param runtime_mappings: One or more runtime fields for the search request. These + fields take precedence over mapped fields with the same name. + :param time_zone: The ISO-8601 time zone ID for the search. + :param wait_for_completion_timeout: The period to wait for complete results. + It defaults to no timeout, meaning the request waits for complete search + results. If the search doesn't finish within this period, the search becomes + async. To save a synchronous search, you must specify this parameter and + the `keep_on_completion` parameter. """ __path_parts: t.Dict[str, str] = {} __path = "/_sql" @@ -319,6 +358,8 @@ def query( if pretty is not None: __query["pretty"] = pretty if not __body: + if allow_partial_search_results is not None: + __body["allow_partial_search_results"] = allow_partial_search_results if catalog is not None: __body["catalog"] = catalog if columnar is not None: @@ -379,14 +420,19 @@ def translate( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Translates SQL into Elasticsearch queries + .. raw:: html + +

Translate SQL into Elasticsearch queries. + Translate an SQL search into a search API request containing Query DSL. + It accepts the same request body parameters as the SQL search API, excluding cursor.

+ - ``_ + ``_ - :param query: SQL query to run. + :param query: The SQL query to run. :param fetch_size: The maximum number of rows (or entries) to return in one response. - :param filter: Elasticsearch query DSL for additional filtering. - :param time_zone: ISO-8601 time zone ID for the search. + :param filter: The Elasticsearch query DSL for additional filtering. + :param time_zone: The ISO-8601 time zone ID for the search. """ if query is None and body is None: raise ValueError("Empty value passed for parameter 'query'") diff --git a/elasticsearch/_sync/client/ssl.py b/elasticsearch/_sync/client/ssl.py index 19892748e..d65003825 100644 --- a/elasticsearch/_sync/client/ssl.py +++ b/elasticsearch/_sync/client/ssl.py @@ -35,10 +35,24 @@ def certificates( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves information about the X.509 certificates used to encrypt communications - in the cluster. + .. raw:: html - ``_ +

Get SSL certificates.

+

Get information about the X.509 certificates that are used to encrypt communications in the cluster. + The API returns a list that includes certificates from all TLS contexts including:

+
    +
  • Settings for transport and HTTP interfaces
  • +
  • TLS settings that are used within authentication realms
  • +
  • TLS settings for remote monitoring exporters
  • +
+

The list includes certificates that are used for configuring trust, such as those configured in the xpack.security.transport.ssl.truststore and xpack.security.transport.ssl.certificate_authorities settings. + It also includes certificates that are used for configuring server identity, such as xpack.security.http.ssl.keystore and xpack.security.http.ssl.certificate settings.

+

The list does not include certificates that are sourced from the default SSL context of the Java Runtime Environment (JRE), even if those certificates are in use within Elasticsearch.

+

NOTE: When a PKCS#11 token is configured as the truststore of the JRE, the API returns all the certificates that are included in the PKCS#11 token irrespective of whether these are used in the Elasticsearch TLS configuration.

+

If Elasticsearch is configured to use a keystore or truststore, the API output includes all certificates in that store, even though some of the certificates might not be in active use within the cluster.

+ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_ssl/certificates" diff --git a/elasticsearch/_sync/client/synonyms.py b/elasticsearch/_sync/client/synonyms.py index 9e2b66ee6..e58ab5ee4 100644 --- a/elasticsearch/_sync/client/synonyms.py +++ b/elasticsearch/_sync/client/synonyms.py @@ -36,11 +36,26 @@ def delete_synonym( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a synonym set + .. raw:: html - ``_ +

Delete a synonym set.

+

You can only delete a synonyms set that is not in use by any index analyzer.

+

Synonyms sets can be used in synonym graph token filters and synonym token filters. + These synonym filters can be used as part of search analyzers.

+

Analyzers need to be loaded when an index is restored (such as when a node starts, or the index becomes open). + Even if the analyzer is not used on any field mapping, it still needs to be loaded on the index recovery phase.

+

If any analyzers cannot be loaded, the index becomes unavailable and the cluster status becomes red or yellow as index shards are not available. + To prevent that, synonyms sets that are used in analyzers can't be deleted. + A delete request in this case will return a 400 response code.

+

To remove a synonyms set, you must first remove all indices that contain analyzers using it. + You can migrate an index by creating a new index that does not contain the token filter with the synonyms set, and use the reindex API in order to copy over the index data. + Once finished, you can delete the index. + When the synonyms set is not used in analyzers, you will be able to delete it.

- :param id: The id of the synonyms set to be deleted + + ``_ + + :param id: The synonyms set identifier to delete. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -77,12 +92,16 @@ def delete_synonym_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deletes a synonym rule in a synonym set + .. raw:: html + +

Delete a synonym rule. + Delete a synonym rule from a synonym set.

+ - ``_ + ``_ - :param set_id: The id of the synonym set to be updated - :param rule_id: The id of the synonym rule to be deleted + :param set_id: The ID of the synonym set to update. + :param rule_id: The ID of the synonym rule to delete. """ if set_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'set_id'") @@ -127,13 +146,16 @@ def get_synonym( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a synonym set + .. raw:: html - ``_ +

Get a synonym set.

- :param id: "The id of the synonyms set to be retrieved - :param from_: Starting offset for query rules to be retrieved - :param size: specifies a max number of query rules to retrieve + + ``_ + + :param id: The synonyms set identifier to retrieve. + :param from_: The starting offset for query rules to retrieve. + :param size: The max number of query rules to retrieve. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -174,12 +196,16 @@ def get_synonym_rule( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a synonym rule from a synonym set + .. raw:: html + +

Get a synonym rule. + Get a synonym rule from a synonym set.

- ``_ - :param set_id: The id of the synonym set to retrieve the synonym rule from - :param rule_id: The id of the synonym rule to retrieve + ``_ + + :param set_id: The ID of the synonym set to retrieve the synonym rule from. + :param rule_id: The ID of the synonym rule to retrieve. """ if set_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'set_id'") @@ -223,12 +249,16 @@ def get_synonyms_sets( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a summary of all defined synonym sets + .. raw:: html + +

Get all synonym sets. + Get a summary of all defined synonym sets.

- ``_ - :param from_: Starting offset - :param size: specifies a max number of results to get + ``_ + + :param from_: The starting offset for synonyms sets to retrieve. + :param size: The maximum number of synonyms sets to retrieve. """ __path_parts: t.Dict[str, str] = {} __path = "/_synonyms" @@ -272,12 +302,19 @@ def put_synonym( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a synonym set. + .. raw:: html + +

Create or update a synonym set. + Synonyms sets are limited to a maximum of 10,000 synonym rules per set. + If you need to manage more synonym rules, you can create multiple synonym sets.

+

When an existing synonyms set is updated, the search analyzers that use the synonyms set are reloaded automatically for all indices. + This is equivalent to invoking the reload search analyzers API for all indices that use the synonyms set.

- ``_ - :param id: The id of the synonyms set to be created or updated - :param synonyms_set: The synonym set information to update + ``_ + + :param id: The ID of the synonyms set to be created or updated. + :param synonyms_set: The synonym rules definitions for the synonyms set. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -325,13 +362,20 @@ def put_synonym_rule( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates or updates a synonym rule in a synonym set + .. raw:: html + +

Create or update a synonym rule. + Create or update a synonym rule in a synonym set.

+

If any of the synonym rules included is invalid, the API returns an error.

+

When you update a synonym rule, all analyzers using the synonyms set will be reloaded automatically to reflect the new rule.

+ - ``_ + ``_ - :param set_id: The id of the synonym set to be updated with the synonym rule - :param rule_id: The id of the synonym rule to be updated or created - :param synonyms: + :param set_id: The ID of the synonym set. + :param rule_id: The ID of the synonym rule to be updated or created. + :param synonyms: The synonym rule information definition, which must be in Solr + format. """ if set_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'set_id'") diff --git a/elasticsearch/_sync/client/tasks.py b/elasticsearch/_sync/client/tasks.py index a0c4a742d..5e5e7d85b 100644 --- a/elasticsearch/_sync/client/tasks.py +++ b/elasticsearch/_sync/client/tasks.py @@ -20,12 +20,19 @@ from elastic_transport import ObjectApiResponse from ._base import NamespacedClient -from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters +from .utils import ( + SKIP_IN_PATH, + Stability, + _quote, + _rewrite_parameters, + _stability_warning, +) class TasksClient(NamespacedClient): @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def cancel( self, *, @@ -40,17 +47,29 @@ def cancel( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Cancels a task, if it can be cancelled through an API. + .. raw:: html - ``_ +

Cancel a task.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

A task may continue to run for some time after it has been cancelled because it may not be able to safely stop its current activity straight away. + It is also possible that Elasticsearch must complete its work on other tasks before it can process the cancellation. + The get task information API will continue to list these cancelled tasks until they complete. + The cancelled flag in the response indicates that the cancellation command has been processed and the task will stop as soon as possible.

+

To troubleshoot why a cancelled task does not complete promptly, use the get task information API with the ?detailed parameter to identify the other tasks the system is running. + You can also use the node hot threads API to obtain detailed information about the work the system is doing instead of completing the cancelled task.

- :param task_id: ID of the task. - :param actions: Comma-separated list or wildcard expression of actions used to - limit the request. - :param nodes: Comma-separated list of node IDs or names used to limit the request. - :param parent_task_id: Parent task ID used to limit the tasks. - :param wait_for_completion: Should the request block until the cancellation of - the task and its descendant tasks is completed. Defaults to false + + ``_ + + :param task_id: The task identifier. + :param actions: A comma-separated list or wildcard expression of actions that + is used to limit the request. + :param nodes: A comma-separated list of node IDs or names that is used to limit + the request. + :param parent_task_id: A parent task ID that is used to limit the tasks. + :param wait_for_completion: If true, the request blocks until all found tasks + are complete. """ __path_parts: t.Dict[str, str] if task_id not in SKIP_IN_PATH: @@ -87,6 +106,7 @@ def cancel( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def get( self, *, @@ -99,14 +119,20 @@ def get( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Get task information. Returns information about the tasks currently executing - in the cluster. + .. raw:: html + +

Get task information. + Get information about a task currently running in the cluster.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

If the task identifier is not found, a 404 response code indicates that there are no resources that match the request.

- ``_ - :param task_id: ID of the task. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + ``_ + + :param task_id: The task identifier. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. :param wait_for_completion: If `true`, the request blocks until the task has completed. """ @@ -138,6 +164,7 @@ def get( ) @_rewrite_parameters() + @_stability_warning(Stability.EXPERIMENTAL) def list( self, *, @@ -150,32 +177,89 @@ def list( ] = None, human: t.Optional[bool] = None, master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, - node_id: t.Optional[t.Sequence[str]] = None, + nodes: t.Optional[t.Union[str, t.Sequence[str]]] = None, parent_task_id: t.Optional[str] = None, pretty: t.Optional[bool] = None, timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - The task management API returns information about tasks currently executing on - one or more nodes in the cluster. + .. raw:: html + +

Get all tasks. + Get information about the tasks currently running on one or more nodes in the cluster.

+

WARNING: The task management API is new and should still be considered a beta feature. + The API may change in ways that are not backwards compatible.

+

Identifying running tasks

+

The X-Opaque-Id header, when provided on the HTTP request header, is going to be returned as a header in the response as well as in the headers field for in the task information. + This enables you to track certain calls or associate certain tasks with the client that started them. + For example:

+
curl -i -H "X-Opaque-Id: 123456" "http://localhost:9200/_tasks?group_by=parents"
+          
+

The API returns the following result:

+
HTTP/1.1 200 OK
+          X-Opaque-Id: 123456
+          content-type: application/json; charset=UTF-8
+          content-length: 831
 
-        ``_
+          {
+            "tasks" : {
+              "u5lcZHqcQhu-rUoFaqDphA:45" : {
+                "node" : "u5lcZHqcQhu-rUoFaqDphA",
+                "id" : 45,
+                "type" : "transport",
+                "action" : "cluster:monitor/tasks/lists",
+                "start_time_in_millis" : 1513823752749,
+                "running_time_in_nanos" : 293139,
+                "cancellable" : false,
+                "headers" : {
+                  "X-Opaque-Id" : "123456"
+                },
+                "children" : [
+                  {
+                    "node" : "u5lcZHqcQhu-rUoFaqDphA",
+                    "id" : 46,
+                    "type" : "direct",
+                    "action" : "cluster:monitor/tasks/lists[n]",
+                    "start_time_in_millis" : 1513823752750,
+                    "running_time_in_nanos" : 92133,
+                    "cancellable" : false,
+                    "parent_task_id" : "u5lcZHqcQhu-rUoFaqDphA:45",
+                    "headers" : {
+                      "X-Opaque-Id" : "123456"
+                    }
+                  }
+                ]
+              }
+            }
+           }
+          
+

In this example, X-Opaque-Id: 123456 is the ID as a part of the response header. + The X-Opaque-Id in the task headers is the ID for the task that was initiated by the REST request. + The X-Opaque-Id in the children headers is the child task of the task that was initiated by the REST request.

- :param actions: Comma-separated list or wildcard expression of actions used to - limit the request. + + ``_ + + :param actions: A comma-separated list or wildcard expression of actions used + to limit the request. For example, you can use `cluser:*` to retrieve all + cluster-related tasks. :param detailed: If `true`, the response includes detailed information about - shard recoveries. - :param group_by: Key used to group tasks in the response. - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. - :param node_id: Comma-separated list of node IDs or names used to limit returned - information. - :param parent_task_id: Parent task ID used to limit returned information. To - return all tasks, omit this parameter or use a value of `-1`. - :param timeout: Period to wait for a response. If no response is received before - the timeout expires, the request fails and returns an error. + the running tasks. This information is useful to distinguish tasks from each + other but is more costly to run. + :param group_by: A key that is used to group tasks in the response. The task + lists can be grouped either by nodes or by parent tasks. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param nodes: A comma-separated list of node IDs or names that is used to limit + the returned information. + :param parent_task_id: A parent task identifier that is used to limit returned + information. To return all tasks, omit this parameter or use a value of `-1`. + If the parent task is not found, the API does not return a 404 response code. + :param timeout: The period to wait for each node to respond. If a node does not + respond before its timeout expires, the response does not include its information. + However, timed out nodes are included in the `node_failures` property. :param wait_for_completion: If `true`, the request blocks until the operation is complete. """ @@ -196,8 +280,8 @@ def list( __query["human"] = human if master_timeout is not None: __query["master_timeout"] = master_timeout - if node_id is not None: - __query["node_id"] = node_id + if nodes is not None: + __query["nodes"] = nodes if parent_task_id is not None: __query["parent_task_id"] = parent_task_id if pretty is not None: diff --git a/elasticsearch/_sync/client/text_structure.py b/elasticsearch/_sync/client/text_structure.py index 48f02393a..b5c7b67d2 100644 --- a/elasticsearch/_sync/client/text_structure.py +++ b/elasticsearch/_sync/client/text_structure.py @@ -25,6 +25,370 @@ class TextStructureClient(NamespacedClient): + @_rewrite_parameters() + def find_field_structure( + self, + *, + field: str, + index: str, + column_names: t.Optional[str] = None, + delimiter: t.Optional[str] = None, + documents_to_sample: t.Optional[int] = None, + ecs_compatibility: t.Optional[t.Union[str, t.Literal["disabled", "v1"]]] = None, + error_trace: t.Optional[bool] = None, + explain: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + format: t.Optional[ + t.Union[ + str, t.Literal["delimited", "ndjson", "semi_structured_text", "xml"] + ] + ] = None, + grok_pattern: t.Optional[str] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + quote: t.Optional[str] = None, + should_trim_fields: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + timestamp_field: t.Optional[str] = None, + timestamp_format: t.Optional[str] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Find the structure of a text field. + Find the structure of a text field in an Elasticsearch index.

+

This API provides a starting point for extracting further information from log messages already ingested into Elasticsearch. + For example, if you have ingested data into a very simple index that has just @timestamp and message fields, you can use this API to see what common structure exists in the message field.

+

The response from the API contains:

+
    +
  • Sample messages.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.
  • +
  • Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+

If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. + It helps determine why the returned structure was chosen.

+ + + ``_ + + :param field: The field that should be analyzed. + :param index: The name of the index that contains the analyzed field. + :param column_names: If `format` is set to `delimited`, you can specify the column + names in a comma-separated list. If this parameter is not specified, the + structure finder uses the column names from the header row of the text. If + the text does not have a header row, columns are named "column1", "column2", + "column3", for example. + :param delimiter: If you have set `format` to `delimited`, you can specify the + character used to delimit the values in each row. Only a single character + is supported; the delimiter cannot have multiple characters. By default, + the API considers the following possibilities: comma, tab, semi-colon, and + pipe (`|`). In this default scenario, all rows must have the same number + of fields for the delimited format to be detected. If you specify a delimiter, + up to 10% of the rows can have a different number of columns than the first + row. + :param documents_to_sample: The number of documents to include in the structural + analysis. The minimum value is 2. + :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns. + Use this parameter to specify whether to use ECS Grok patterns instead of + legacy ones when the structure finder creates a Grok pattern. This setting + primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` + matches the input. If the structure finder identifies a common structure + but has no idea of the meaning then generic field names such as `path`, `ipaddress`, + `field1`, and `field2` are used in the `grok_pattern` output. The intention + in that situation is that a user who knows the meanings will rename the fields + before using them. + :param explain: If `true`, the response includes a field named `explanation`, + which is an array of strings that indicate how the structure finder produced + its result. + :param format: The high level structure of the text. By default, the API chooses + the format. In this default scenario, all rows must have the same number + of fields for a delimited format to be detected. If the format is set to + delimited and the delimiter is not set, however, the API tolerates up to + 5% of rows that have a different number of columns than the first row. + :param grok_pattern: If the format is `semi_structured_text`, you can specify + a Grok pattern that is used to extract fields from every message in the text. + The name of the timestamp field in the Grok pattern must match what is specified + in the `timestamp_field` parameter. If that parameter is not specified, the + name of the timestamp field in the Grok pattern must match "timestamp". If + `grok_pattern` is not specified, the structure finder creates a Grok pattern. + :param quote: If the format is `delimited`, you can specify the character used + to quote the values in each row if they contain newlines or the delimiter + character. Only a single character is supported. If this parameter is not + specified, the default value is a double quote (`"`). If your delimited text + format does not use quoting, a workaround is to set this argument to a character + that does not appear anywhere in the sample. + :param should_trim_fields: If the format is `delimited`, you can specify whether + values between delimiters should have whitespace trimmed from them. If this + parameter is not specified and the delimiter is pipe (`|`), the default value + is true. Otherwise, the default value is `false`. + :param timeout: The maximum amount of time that the structure analysis can take. + If the analysis is still running when the timeout expires, it will be stopped. + :param timestamp_field: The name of the field that contains the primary timestamp + of each record in the text. In particular, if the text was ingested into + an index, this is the field that would be used to populate the `@timestamp` + field. If the format is `semi_structured_text`, this field must match the + name of the appropriate extraction in the `grok_pattern`. Therefore, for + semi-structured text, it is best not to specify this parameter unless `grok_pattern` + is also specified. For structured text, if you specify this parameter, the + field must exist within the text. If this parameter is not specified, the + structure finder makes a decision about which field (if any) is the primary + timestamp field. For structured text, it is not compulsory to have a timestamp + in the text. + :param timestamp_format: The Java time format of the timestamp field in the text. + Only a subset of Java time format letter groups are supported: * `a` * `d` + * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` + * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter + groups (fractional seconds) of length one to nine are supported providing + they occur after `ss` and are separated from the `ss` by a period (`.`), + comma (`,`), or colon (`:`). Spacing and punctuation is also permitted with + the exception a question mark (`?`), newline, and carriage return, together + with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS + 'in' yyyy` is a valid override format. One valuable use case for this parameter + is when the format is semi-structured text, there are multiple timestamp + formats in the text, and you know which format corresponds to the primary + timestamp, but you do not want to specify the full `grok_pattern`. Another + is when the timestamp format is one that the structure finder does not consider + by default. If this parameter is not specified, the structure finder chooses + the best format from a built-in set. If the special value `null` is specified, + the structure finder will not look for a primary timestamp in the text. When + the format is semi-structured text, this will result in the structure finder + treating the text as single-line messages. + """ + if field is None: + raise ValueError("Empty value passed for parameter 'field'") + if index is None: + raise ValueError("Empty value passed for parameter 'index'") + __path_parts: t.Dict[str, str] = {} + __path = "/_text_structure/find_field_structure" + __query: t.Dict[str, t.Any] = {} + if field is not None: + __query["field"] = field + if index is not None: + __query["index"] = index + if column_names is not None: + __query["column_names"] = column_names + if delimiter is not None: + __query["delimiter"] = delimiter + if documents_to_sample is not None: + __query["documents_to_sample"] = documents_to_sample + if ecs_compatibility is not None: + __query["ecs_compatibility"] = ecs_compatibility + if error_trace is not None: + __query["error_trace"] = error_trace + if explain is not None: + __query["explain"] = explain + if filter_path is not None: + __query["filter_path"] = filter_path + if format is not None: + __query["format"] = format + if grok_pattern is not None: + __query["grok_pattern"] = grok_pattern + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if quote is not None: + __query["quote"] = quote + if should_trim_fields is not None: + __query["should_trim_fields"] = should_trim_fields + if timeout is not None: + __query["timeout"] = timeout + if timestamp_field is not None: + __query["timestamp_field"] = timestamp_field + if timestamp_format is not None: + __query["timestamp_format"] = timestamp_format + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="text_structure.find_field_structure", + path_parts=__path_parts, + ) + + @_rewrite_parameters( + body_fields=("messages",), + ) + def find_message_structure( + self, + *, + messages: t.Optional[t.Sequence[str]] = None, + column_names: t.Optional[str] = None, + delimiter: t.Optional[str] = None, + ecs_compatibility: t.Optional[t.Union[str, t.Literal["disabled", "v1"]]] = None, + error_trace: t.Optional[bool] = None, + explain: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + format: t.Optional[ + t.Union[ + str, t.Literal["delimited", "ndjson", "semi_structured_text", "xml"] + ] + ] = None, + grok_pattern: t.Optional[str] = None, + human: t.Optional[bool] = None, + pretty: t.Optional[bool] = None, + quote: t.Optional[str] = None, + should_trim_fields: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + timestamp_field: t.Optional[str] = None, + timestamp_format: t.Optional[str] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Find the structure of text messages. + Find the structure of a list of text messages. + The messages must contain data that is suitable to be ingested into Elasticsearch.

+

This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + Use this API rather than the find text structure API if your input text has already been split up into separate messages by some other process.

+

The response from the API contains:

+
    +
  • Sample messages.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text. + Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

+

If the structure finder produces unexpected results, specify the explain query parameter and an explanation will appear in the response. + It helps determine why the returned structure was chosen.

+ + + ``_ + + :param messages: The list of messages you want to analyze. + :param column_names: If the format is `delimited`, you can specify the column + names in a comma-separated list. If this parameter is not specified, the + structure finder uses the column names from the header row of the text. If + the text does not have a header role, columns are named "column1", "column2", + "column3", for example. + :param delimiter: If you the format is `delimited`, you can specify the character + used to delimit the values in each row. Only a single character is supported; + the delimiter cannot have multiple characters. By default, the API considers + the following possibilities: comma, tab, semi-colon, and pipe (`|`). In this + default scenario, all rows must have the same number of fields for the delimited + format to be detected. If you specify a delimiter, up to 10% of the rows + can have a different number of columns than the first row. + :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns. + Use this parameter to specify whether to use ECS Grok patterns instead of + legacy ones when the structure finder creates a Grok pattern. This setting + primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` + matches the input. If the structure finder identifies a common structure + but has no idea of meaning then generic field names such as `path`, `ipaddress`, + `field1`, and `field2` are used in the `grok_pattern` output, with the intention + that a user who knows the meanings rename these fields before using it. + :param explain: If this parameter is set to true, the response includes a field + named `explanation`, which is an array of strings that indicate how the structure + finder produced its result. + :param format: The high level structure of the text. By default, the API chooses + the format. In this default scenario, all rows must have the same number + of fields for a delimited format to be detected. If the format is `delimited` + and the delimiter is not set, however, the API tolerates up to 5% of rows + that have a different number of columns than the first row. + :param grok_pattern: If the format is `semi_structured_text`, you can specify + a Grok pattern that is used to extract fields from every message in the text. + The name of the timestamp field in the Grok pattern must match what is specified + in the `timestamp_field` parameter. If that parameter is not specified, the + name of the timestamp field in the Grok pattern must match "timestamp". If + `grok_pattern` is not specified, the structure finder creates a Grok pattern. + :param quote: If the format is `delimited`, you can specify the character used + to quote the values in each row if they contain newlines or the delimiter + character. Only a single character is supported. If this parameter is not + specified, the default value is a double quote (`"`). If your delimited text + format does not use quoting, a workaround is to set this argument to a character + that does not appear anywhere in the sample. + :param should_trim_fields: If the format is `delimited`, you can specify whether + values between delimiters should have whitespace trimmed from them. If this + parameter is not specified and the delimiter is pipe (`|`), the default value + is true. Otherwise, the default value is `false`. + :param timeout: The maximum amount of time that the structure analysis can take. + If the analysis is still running when the timeout expires, it will be stopped. + :param timestamp_field: The name of the field that contains the primary timestamp + of each record in the text. In particular, if the text was ingested into + an index, this is the field that would be used to populate the `@timestamp` + field. If the format is `semi_structured_text`, this field must match the + name of the appropriate extraction in the `grok_pattern`. Therefore, for + semi-structured text, it is best not to specify this parameter unless `grok_pattern` + is also specified. For structured text, if you specify this parameter, the + field must exist within the text. If this parameter is not specified, the + structure finder makes a decision about which field (if any) is the primary + timestamp field. For structured text, it is not compulsory to have a timestamp + in the text. + :param timestamp_format: The Java time format of the timestamp field in the text. + Only a subset of Java time format letter groups are supported: * `a` * `d` + * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` + * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter + groups (fractional seconds) of length one to nine are supported providing + they occur after `ss` and are separated from the `ss` by a period (`.`), + comma (`,`), or colon (`:`). Spacing and punctuation is also permitted with + the exception a question mark (`?`), newline, and carriage return, together + with literal text enclosed in single quotes. For example, `MM/dd HH.mm.ss,SSSSSS + 'in' yyyy` is a valid override format. One valuable use case for this parameter + is when the format is semi-structured text, there are multiple timestamp + formats in the text, and you know which format corresponds to the primary + timestamp, but you do not want to specify the full `grok_pattern`. Another + is when the timestamp format is one that the structure finder does not consider + by default. If this parameter is not specified, the structure finder chooses + the best format from a built-in set. If the special value `null` is specified, + the structure finder will not look for a primary timestamp in the text. When + the format is semi-structured text, this will result in the structure finder + treating the text as single-line messages. + """ + if messages is None and body is None: + raise ValueError("Empty value passed for parameter 'messages'") + __path_parts: t.Dict[str, str] = {} + __path = "/_text_structure/find_message_structure" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if column_names is not None: + __query["column_names"] = column_names + if delimiter is not None: + __query["delimiter"] = delimiter + if ecs_compatibility is not None: + __query["ecs_compatibility"] = ecs_compatibility + if error_trace is not None: + __query["error_trace"] = error_trace + if explain is not None: + __query["explain"] = explain + if filter_path is not None: + __query["filter_path"] = filter_path + if format is not None: + __query["format"] = format + if grok_pattern is not None: + __query["grok_pattern"] = grok_pattern + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if quote is not None: + __query["quote"] = quote + if should_trim_fields is not None: + __query["should_trim_fields"] = should_trim_fields + if timeout is not None: + __query["timeout"] = timeout + if timestamp_field is not None: + __query["timestamp_field"] = timestamp_field + if timestamp_format is not None: + __query["timestamp_format"] = timestamp_format + if not __body: + if messages is not None: + __body["messages"] = messages + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="text_structure.find_message_structure", + path_parts=__path_parts, + ) + @_rewrite_parameters( body_name="text_files", ) @@ -50,47 +414,73 @@ def find_structure( timestamp_format: t.Optional[str] = None, ) -> ObjectApiResponse[t.Any]: """ - Finds the structure of a text file. The text file must contain data that is suitable - to be ingested into Elasticsearch. + .. raw:: html + +

Find the structure of a text file. + The text file must contain data that is suitable to be ingested into Elasticsearch.

+

This API provides a starting point for ingesting data into Elasticsearch in a format that is suitable for subsequent use with other Elastic Stack functionality. + Unlike other Elasticsearch endpoints, the data that is posted to this endpoint does not need to be UTF-8 encoded and in JSON format. + It must, however, be text; binary text formats are not currently supported. + The size is limited to the Elasticsearch HTTP receive buffer size, which defaults to 100 Mb.

+

The response from the API contains:

+
    +
  • A couple of messages from the beginning of the text.
  • +
  • Statistics that reveal the most common values for all fields detected within the text and basic numeric statistics for numeric fields.
  • +
  • Information about the structure of the text, which is useful when you write ingest configurations to index it or similarly formatted text.
  • +
  • Appropriate mappings for an Elasticsearch index, which you could use to ingest the text.
  • +
+

All this information can be calculated by the structure finder with no guidance. + However, you can optionally override some of the decisions about the text structure by specifying one or more query parameters.

- ``_ + + ``_ :param text_files: - :param charset: The text’s character set. It must be a character set that is - supported by the JVM that Elasticsearch uses. For example, UTF-8, UTF-16LE, - windows-1252, or EUC-JP. If this parameter is not specified, the structure + :param charset: The text's character set. It must be a character set that is + supported by the JVM that Elasticsearch uses. For example, `UTF-8`, `UTF-16LE`, + `windows-1252`, or `EUC-JP`. If this parameter is not specified, the structure finder chooses an appropriate character set. - :param column_names: If you have set format to delimited, you can specify the + :param column_names: If you have set format to `delimited`, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named "column1", "column2", - "column3", etc. - :param delimiter: If you have set format to delimited, you can specify the character - used to delimit the values in each row. Only a single character is supported; - the delimiter cannot have multiple characters. By default, the API considers - the following possibilities: comma, tab, semi-colon, and pipe (|). In this - default scenario, all rows must have the same number of fields for the delimited - format to be detected. If you specify a delimiter, up to 10% of the rows - can have a different number of columns than the first row. - :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns - (disabled or v1, default: disabled). - :param explain: If this parameter is set to true, the response includes a field + "column3", for example. + :param delimiter: If you have set `format` to `delimited`, you can specify the + character used to delimit the values in each row. Only a single character + is supported; the delimiter cannot have multiple characters. By default, + the API considers the following possibilities: comma, tab, semi-colon, and + pipe (`|`). In this default scenario, all rows must have the same number + of fields for the delimited format to be detected. If you specify a delimiter, + up to 10% of the rows can have a different number of columns than the first + row. + :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns. + Use this parameter to specify whether to use ECS Grok patterns instead of + legacy ones when the structure finder creates a Grok pattern. Valid values + are `disabled` and `v1`. This setting primarily has an impact when a whole + message Grok pattern such as `%{CATALINALOG}` matches the input. If the structure + finder identifies a common structure but has no idea of meaning then generic + field names such as `path`, `ipaddress`, `field1`, and `field2` are used + in the `grok_pattern` output, with the intention that a user who knows the + meanings rename these fields before using it. + :param explain: If this parameter is set to `true`, the response includes a field named explanation, which is an array of strings that indicate how the structure - finder produced its result. - :param format: The high level structure of the text. Valid values are ndjson, - xml, delimited, and semi_structured_text. By default, the API chooses the - format. In this default scenario, all rows must have the same number of fields - for a delimited format to be detected. If the format is set to delimited - and the delimiter is not set, however, the API tolerates up to 5% of rows - that have a different number of columns than the first row. - :param grok_pattern: If you have set format to semi_structured_text, you can - specify a Grok pattern that is used to extract fields from every message + finder produced its result. If the structure finder produces unexpected results + for some text, use this query parameter to help you determine why the returned + structure was chosen. + :param format: The high level structure of the text. Valid values are `ndjson`, + `xml`, `delimited`, and `semi_structured_text`. By default, the API chooses + the format. In this default scenario, all rows must have the same number + of fields for a delimited format to be detected. If the format is set to + `delimited` and the delimiter is not set, however, the API tolerates up to + 5% of rows that have a different number of columns than the first row. + :param grok_pattern: If you have set `format` to `semi_structured_text`, you + can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match - what is specified in the timestamp_field parameter. If that parameter is + what is specified in the `timestamp_field` parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match - "timestamp". If grok_pattern is not specified, the structure finder creates + "timestamp". If `grok_pattern` is not specified, the structure finder creates a Grok pattern. - :param has_header_row: If you have set format to delimited, you can use this + :param has_header_row: If you have set `format` to `delimited`, you can use this parameter to indicate whether the column names are in the first row of the text. If this parameter is not specified, the structure finder guesses based on the similarity of the first row of the text to other rows. @@ -100,26 +490,58 @@ def find_structure( that this may lead to very long processing times if the way to group lines into messages is misdetected. :param lines_to_sample: The number of lines to include in the structural analysis, - starting from the beginning of the text. The minimum is 2; If the value of + starting from the beginning of the text. The minimum is 2. If the value of this parameter is greater than the number of lines in the text, the analysis proceeds (as long as there are at least two lines in the text) for all of - the lines. - :param quote: If you have set format to delimited, you can specify the character + the lines. NOTE: The number of lines and the variation of the lines affects + the speed of the analysis. For example, if you upload text where the first + 1000 lines are all variations on the same message, the analysis will find + more commonality than would be seen with a bigger sample. If possible, however, + it is more efficient to upload sample text with more variety in the first + 1000 lines than to request analysis of 100000 lines to achieve some variety. + :param quote: If you have set `format` to `delimited`, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not - specified, the default value is a double quote ("). If your delimited text + specified, the default value is a double quote (`"`). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample. - :param should_trim_fields: If you have set format to delimited, you can specify + :param should_trim_fields: If you have set `format` to `delimited`, you can specify whether values between delimiters should have whitespace trimmed from them. - If this parameter is not specified and the delimiter is pipe (|), the default - value is true. Otherwise, the default value is false. - :param timeout: Sets the maximum amount of time that the structure analysis make - take. If the analysis is still running when the timeout expires then it will - be aborted. - :param timestamp_field: Optional parameter to specify the timestamp field in - the file + If this parameter is not specified and the delimiter is pipe (`|`), the default + value is `true`. Otherwise, the default value is `false`. + :param timeout: The maximum amount of time that the structure analysis can take. + If the analysis is still running when the timeout expires then it will be + stopped. + :param timestamp_field: The name of the field that contains the primary timestamp + of each record in the text. In particular, if the text were ingested into + an index, this is the field that would be used to populate the `@timestamp` + field. If the `format` is `semi_structured_text`, this field must match the + name of the appropriate extraction in the `grok_pattern`. Therefore, for + semi-structured text, it is best not to specify this parameter unless `grok_pattern` + is also specified. For structured text, if you specify this parameter, the + field must exist within the text. If this parameter is not specified, the + structure finder makes a decision about which field (if any) is the primary + timestamp field. For structured text, it is not compulsory to have a timestamp + in the text. :param timestamp_format: The Java time format of the timestamp field in the text. + Only a subset of Java time format letter groups are supported: * `a` * `d` + * `dd` * `EEE` * `EEEE` * `H` * `HH` * `h` * `M` * `MM` * `MMM` * `MMMM` + * `mm` * `ss` * `XX` * `XXX` * `yy` * `yyyy` * `zzz` Additionally `S` letter + groups (fractional seconds) of length one to nine are supported providing + they occur after `ss` and separated from the `ss` by a `.`, `,` or `:`. Spacing + and punctuation is also permitted with the exception of `?`, newline and + carriage return, together with literal text enclosed in single quotes. For + example, `MM/dd HH.mm.ss,SSSSSS 'in' yyyy` is a valid override format. One + valuable use case for this parameter is when the format is semi-structured + text, there are multiple timestamp formats in the text, and you know which + format corresponds to the primary timestamp, but you do not want to specify + the full `grok_pattern`. Another is when the timestamp format is one that + the structure finder does not consider by default. If this parameter is not + specified, the structure finder chooses the best format from a built-in set. + If the special value `null` is specified the structure finder will not look + for a primary timestamp in the text. When the format is semi-structured text + this will result in the structure finder treating the text as single-line + messages. """ if text_files is None and body is None: raise ValueError( @@ -191,14 +613,21 @@ def test_grok_pattern( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Tests a Grok pattern on some text. + .. raw:: html + +

Test a Grok pattern. + Test a Grok pattern on one or more lines of text. + The API indicates whether the lines match the pattern together with the offsets and lengths of the matched substrings.

+ - ``_ + ``_ - :param grok_pattern: Grok pattern to run on the text. - :param text: Lines of text to run the Grok pattern on. - :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns - (disabled or v1, default: disabled). + :param grok_pattern: The Grok pattern to run on the text. + :param text: The lines of text to run the Grok pattern on. + :param ecs_compatibility: The mode of compatibility with ECS compliant Grok patterns. + Use this parameter to specify whether to use ECS Grok patterns instead of + legacy ones when the structure finder creates a Grok pattern. Valid values + are `disabled` and `v1`. """ if grok_pattern is None and body is None: raise ValueError("Empty value passed for parameter 'grok_pattern'") diff --git a/elasticsearch/_sync/client/transform.py b/elasticsearch/_sync/client/transform.py index 49613f26f..1cf4632c6 100644 --- a/elasticsearch/_sync/client/transform.py +++ b/elasticsearch/_sync/client/transform.py @@ -39,9 +39,13 @@ def delete_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Delete a transform. Deletes a transform. + .. raw:: html - ``_ +

Delete a transform. + Deletes a transform.

+ + + ``_ :param transform_id: Identifier for the transform. :param delete_dest_index: If this value is true, the destination index is deleted @@ -99,9 +103,13 @@ def get_transform( size: t.Optional[int] = None, ) -> ObjectApiResponse[t.Any]: """ - Get transforms. Retrieves configuration information for transforms. + .. raw:: html + +

Get transforms. + Retrieves configuration information for transforms.

+ - ``_ + ``_ :param transform_id: Identifier for the transform. It can be a transform identifier or a wildcard expression. You can get information for all transforms by using @@ -168,9 +176,13 @@ def get_transform_stats( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Get transform stats. Retrieves usage information for transforms. + .. raw:: html - ``_ +

Get transform stats. + Retrieves usage information for transforms.

+ + + ``_ :param transform_id: Identifier for the transform. It can be a transform identifier or a wildcard expression. You can get information for all transforms by using @@ -249,14 +261,16 @@ def preview_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Preview a transform. Generates a preview of the results that you will get when - you create a transform with the same configuration. It returns a maximum of 100 - results. The calculations are based on all the current data in the source index. - It also generates a list of mappings and settings for the destination index. - These values are determined based on the field types of the source index and - the transform aggregations. + .. raw:: html + +

Preview a transform. + Generates a preview of the results that you will get when you create a transform with the same configuration.

+

It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also + generates a list of mappings and settings for the destination index. These values are determined based on the field + types of the source index and the transform aggregations.

+ - ``_ + ``_ :param transform_id: Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform configuration details in @@ -371,29 +385,29 @@ def put_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Create a transform. Creates a transform. A transform copies data from source - indices, transforms it, and persists it into an entity-centric destination index. - You can also think of the destination index as a two-dimensional tabular data - structure (known as a data frame). The ID for each document in the data frame - is generated from a hash of the entity, so there is a unique row per entity. - You must choose either the latest or pivot method for your transform; you cannot - use both in a single transform. If you choose to use the pivot method for your - transform, the entities are defined by the set of `group_by` fields in the pivot - object. If you choose to use the latest method, the entities are defined by the - `unique_key` field values in the latest object. You must have `create_index`, - `index`, and `read` privileges on the destination index and `read` and `view_index_metadata` - privileges on the source indices. When Elasticsearch security features are enabled, - the transform remembers which roles the user that created it had at the time - of creation and uses those same roles. If those roles do not have the required - privileges on the source and destination indices, the transform fails when it - attempts unauthorized operations. NOTE: You must use Kibana or this API to create - a transform. Do not add a transform directly into any `.transform-internal*` - indices using the Elasticsearch index API. If Elasticsearch security features - are enabled, do not give users any privileges on `.transform-internal*` indices. - If you used transforms prior to 7.5, also do not give users any privileges on - `.data-frame-internal*` indices. - - ``_ + .. raw:: html + +

Create a transform. + Creates a transform.

+

A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as + a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a + unique row per entity.

+

You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If + you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in + the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values + in the latest object.

+

You must have create_index, index, and read privileges on the destination index and read and + view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the + transform remembers which roles the user that created it had at the time of creation and uses those same roles. If + those roles do not have the required privileges on the source and destination indices, the transform fails when it + attempts unauthorized operations.

+

NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any + .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do + not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not + give users any privileges on .data-frame-internal* indices.

+ + + ``_ :param transform_id: Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -491,11 +505,15 @@ def reset_transform( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Reset a transform. Resets a transform. Before you can reset it, you must stop - it; alternatively, use the `force` query parameter. If the destination index - was created by the transform, it is deleted. + .. raw:: html - ``_ +

Reset a transform. + Resets a transform. + Before you can reset it, you must stop it; alternatively, use the force query parameter. + If the destination index was created by the transform, it is deleted.

+ + + ``_ :param transform_id: Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. @@ -541,13 +559,17 @@ def schedule_now_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Schedule a transform to start now. Instantly runs a transform to process data. - If you _schedule_now a transform, it will process the new data instantly, without - waiting for the configured frequency interval. After _schedule_now API is called, - the transform will be processed again at now + frequency unless _schedule_now - API is called again in the meantime. + .. raw:: html + +

Schedule a transform to start now. + Instantly runs a transform to process data.

+

If you _schedule_now a transform, it will process the new data instantly, + without waiting for the configured frequency interval. After _schedule_now API is called, + the transform will be processed again at now + frequency unless _schedule_now API + is called again in the meantime.

+ - ``_ + ``_ :param transform_id: Identifier for the transform. :param timeout: Controls the time to wait for the scheduling to take place @@ -592,26 +614,26 @@ def start_transform( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Start a transform. Starts a transform. When you start a transform, it creates - the destination index if it does not already exist. The `number_of_shards` is - set to `1` and the `auto_expand_replicas` is set to `0-1`. If it is a pivot transform, - it deduces the mapping definitions for the destination index from the source - indices and the transform aggregations. If fields in the destination index are - derived from scripts (as in the case of `scripted_metric` or `bucket_script` - aggregations), the transform uses dynamic mappings unless an index template exists. - If it is a latest transform, it does not deduce mapping definitions; it uses - dynamic mappings. To use explicit mappings, create the destination index before - you start the transform. Alternatively, you can create an index template, though - it does not affect the deduced mappings in a pivot transform. When the transform - starts, a series of validations occur to ensure its success. If you deferred - validation when you created the transform, they occur when you start the transform—​with - the exception of privilege checks. When Elasticsearch security features are enabled, - the transform remembers which roles the user that created it had at the time - of creation and uses those same roles. If those roles do not have the required - privileges on the source and destination indices, the transform fails when it - attempts unauthorized operations. - - ``_ + .. raw:: html + +

Start a transform. + Starts a transform.

+

When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is + set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping + definitions for the destination index from the source indices and the transform aggregations. If fields in the + destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), + the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce + mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you + start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings + in a pivot transform.

+

When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you + created the transform, they occur when you start the transform—​with the exception of privilege checks. When + Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the + time of creation and uses those same roles. If those roles do not have the required privileges on the source and + destination indices, the transform fails when it attempts unauthorized operations.

+ + + ``_ :param transform_id: Identifier for the transform. :param from_: Restricts the set of transformed entities to those changed after @@ -663,9 +685,13 @@ def stop_transform( wait_for_completion: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stop transforms. Stops one or more transforms. + .. raw:: html - ``_ +

Stop transforms. + Stops one or more transforms.

+ + + ``_ :param transform_id: Identifier for the transform. To stop multiple transforms, use a comma-separated list or a wildcard expression. To stop all transforms, @@ -756,16 +782,18 @@ def update_transform( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Update a transform. Updates certain properties of a transform. All updated properties - except `description` do not take effect until after the transform starts the - next checkpoint, thus there is data consistency in each checkpoint. To use this - API, you must have `read` and `view_index_metadata` privileges for the source - indices. You must also have `index` and `read` privileges for the destination - index. When Elasticsearch security features are enabled, the transform remembers - which roles the user who updated it had at the time of update and runs with those - privileges. + .. raw:: html + +

Update a transform. + Updates certain properties of a transform.

+

All updated properties except description do not take effect until after the transform starts the next checkpoint, + thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata + privileges for the source indices. You must also have index and read privileges for the destination index. When + Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the + time of update and runs with those privileges.

+ - ``_ + ``_ :param transform_id: Identifier for the transform. :param defer_validation: When true, deferrable validations are not run. This @@ -844,15 +872,23 @@ def upgrade_transforms( timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, ) -> ObjectApiResponse[t.Any]: """ - Upgrades all transforms. This API identifies transforms that have a legacy configuration - format and upgrades them to the latest version. It also cleans up the internal - data structures that store the transform state and checkpoints. The upgrade does - not affect the source and destination indices. The upgrade also does not affect - the roles that transforms use when Elasticsearch security features are enabled; - the role used to read source data and write to the destination index remains - unchanged. - - ``_ + .. raw:: html + +

Upgrade all transforms. + Transforms are compatible across minor versions and between supported major versions. + However, over time, the format of transform configuration information may change. + This API identifies transforms that have a legacy configuration format and upgrades them to the latest version. + It also cleans up the internal data structures that store the transform state and checkpoints. + The upgrade does not affect the source and destination indices. + The upgrade also does not affect the roles that transforms use when Elasticsearch security features are enabled; the role used to read source data and write to the destination index remains unchanged.

+

If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. + Resolve the issue then re-run the process again. + A summary is returned when the upgrade is finished.

+

To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. + You may want to perform a recent cluster backup prior to the upgrade.

+ + + ``_ :param dry_run: When true, the request checks for updates but does not run them. :param timeout: Period to wait for a response. If no response is received before diff --git a/elasticsearch/_sync/client/utils.py b/elasticsearch/_sync/client/utils.py index 1d1a983ac..51afe1c78 100644 --- a/elasticsearch/_sync/client/utils.py +++ b/elasticsearch/_sync/client/utils.py @@ -20,6 +20,7 @@ import urllib.parse import warnings from datetime import date, datetime +from enum import Enum, auto from functools import wraps from typing import ( TYPE_CHECKING, @@ -57,6 +58,7 @@ from ..._version import __versionstr__ from ...compat import to_bytes, to_str, warn_stacklevel +from ...exceptions import GeneralAvailabilityWarning if TYPE_CHECKING: from ._base import NamespacedClient @@ -70,6 +72,13 @@ # Default User-Agent used by the client USER_AGENT = create_user_agent("elasticsearch-py", __versionstr__) + +class Stability(Enum): + STABLE = auto() + BETA = auto() + EXPERIMENTAL = auto() + + _TYPE_HOSTS = Union[ str, Sequence[Union[str, Mapping[str, Union[str, int]], NodeConfig]] ] @@ -125,7 +134,6 @@ def client_node_configs( def apply_node_options(node_config: NodeConfig) -> NodeConfig: """Needs special handling of headers since .replace() wipes out existing headers""" - nonlocal node_options headers = node_config.headers.copy() # type: ignore[attr-defined] headers_to_add = node_options.pop("headers", ()) @@ -223,7 +231,7 @@ def host_mapping_to_node_config(host: Mapping[str, Union[str, int]]) -> NodeConf ) options["path_prefix"] = options.pop("url_prefix") - return NodeConfig(**options) # type: ignore + return NodeConfig(**options) # type: ignore[arg-type] def cloud_id_to_node_configs(cloud_id: str) -> List[NodeConfig]: @@ -334,8 +342,6 @@ def _rewrite_parameters( def wrapper(api: F) -> F: @wraps(api) def wrapped(*args: Any, **kwargs: Any) -> Any: - nonlocal api, body_name, body_fields - # Let's give a nicer error message when users pass positional arguments. if len(args) >= 2: raise TypeError( @@ -450,6 +456,37 @@ def wrapped(*args: Any, **kwargs: Any) -> Any: return wrapper +def _stability_warning( + stability: Stability, + version: Optional[str] = None, + message: Optional[str] = None, +) -> Callable[[F], F]: + def wrapper(api: F) -> F: + @wraps(api) + def wrapped(*args: Any, **kwargs: Any) -> Any: + if stability == Stability.BETA: + warnings.warn( + "This API is in beta and is subject to change. " + "The design and code is less mature than official GA features and is being provided as-is with no warranties. " + "Beta features are not subject to the support SLA of official GA features.", + category=GeneralAvailabilityWarning, + stacklevel=warn_stacklevel(), + ) + elif stability == Stability.EXPERIMENTAL: + warnings.warn( + "This API is in technical preview and may be changed or removed in a future release. " + "Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.", + category=GeneralAvailabilityWarning, + stacklevel=warn_stacklevel(), + ) + + return api(*args, **kwargs) + + return wrapped # type: ignore[return-value] + + return wrapper + + def is_requests_http_auth(http_auth: Any) -> bool: """Detect if an http_auth value is a custom Requests auth object""" try: diff --git a/elasticsearch/_sync/client/watcher.py b/elasticsearch/_sync/client/watcher.py index dfb71a1be..3c54dd219 100644 --- a/elasticsearch/_sync/client/watcher.py +++ b/elasticsearch/_sync/client/watcher.py @@ -37,12 +37,22 @@ def ack_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Acknowledges a watch, manually throttling the execution of the watch's actions. + .. raw:: html - ``_ +

Acknowledge a watch. + Acknowledging a watch enables you to manually throttle the execution of the watch's actions.

+

The acknowledgement state of an action is stored in the status.actions.<id>.ack.state structure.

+

IMPORTANT: If the specified watch is currently being executed, this API will return an error + The reason for this behavior is to prevent overwriting the watch status from a watch execution.

+

Acknowledging an action throttles further executions of that action until its ack.state is reset to awaits_successful_execution. + This happens when the condition of the watch is not met (the condition evaluates to false).

- :param watch_id: Watch ID - :param action_id: A comma-separated list of the action ids to be acked + + ``_ + + :param watch_id: The watch identifier. + :param action_id: A comma-separated list of the action identifiers to acknowledge. + If you omit this parameter, all of the actions of the watch are acknowledged. """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") @@ -88,11 +98,15 @@ def activate_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Activates a currently inactive watch. + .. raw:: html + +

Activate a watch. + A watch can be either active or inactive.

- ``_ - :param watch_id: Watch ID + ``_ + + :param watch_id: The watch identifier. """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") @@ -128,11 +142,15 @@ def deactivate_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Deactivates a currently active watch. + .. raw:: html + +

Deactivate a watch. + A watch can be either active or inactive.

+ - ``_ + ``_ - :param watch_id: Watch ID + :param watch_id: The watch identifier. """ if watch_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'watch_id'") @@ -168,11 +186,19 @@ def delete_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Removes a watch from Watcher. + .. raw:: html - ``_ +

Delete a watch. + When the watch is removed, the document representing the watch in the .watches index is gone and it will never be run again.

+

Deleting a watch does not delete any watch execution records related to this watch from the watch history.

+

IMPORTANT: Deleting a watch must be done by using only this API. + Do not delete the watch directly from the .watches index using the Elasticsearch delete document API + When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the .watches index.

- :param id: Watch ID + + ``_ + + :param id: The watch identifier. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -237,17 +263,23 @@ def execute_watch( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - This API can be used to force execution of the watch outside of its triggering - logic or to simulate the watch execution for debugging purposes. For testing - and debugging purposes, you also have fine-grained control on how the watch runs. - You can execute the watch without executing all of its actions or alternatively - by simulating them. You can also force execution by ignoring the watch condition - and control whether a watch record would be written to the watch history after - execution. + .. raw:: html + +

Run a watch. + This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.

+

For testing and debugging purposes, you also have fine-grained control on how the watch runs. + You can run the watch without running all of its actions or alternatively by simulating them. + You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.

+

You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. + This serves as great tool for testing and debugging your watches prior to adding them to Watcher.

+

When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches. + If your user is allowed to read index a, but not index b, then the exact same set of rules will apply during execution of a watch.

+

When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.

- ``_ - :param id: Identifier for the watch. + ``_ + + :param id: The watch identifier. :param action_modes: Determines how to handle the watch actions as part of the watch execution. :param alternative_input: When present, the watch uses this object as a payload @@ -258,12 +290,12 @@ def execute_watch( :param record_execution: When set to `true`, the watch record representing the watch execution result is persisted to the `.watcher-history` index for the current time. In addition, the status of the watch is updated, possibly throttling - subsequent executions. This can also be specified as an HTTP parameter. + subsequent runs. This can also be specified as an HTTP parameter. :param simulated_actions: :param trigger_data: This structure is parsed as the data of the trigger event - that will be used during the watch execution + that will be used during the watch execution. :param watch: When present, this watch is used instead of the one specified in - the request. This watch is not persisted to the index and record_execution + the request. This watch is not persisted to the index and `record_execution` cannot be set. """ __path_parts: t.Dict[str, str] @@ -315,6 +347,53 @@ def execute_watch( path_parts=__path_parts, ) + @_rewrite_parameters() + def get_settings( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Get Watcher index settings. + Get settings for the Watcher internal index (.watches). + Only a subset of settings are shown, for example index.auto_expand_replicas and index.number_of_replicas.

+ + + ``_ + + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_watcher/settings" + __query: t.Dict[str, t.Any] = {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + __headers = {"accept": "application/json"} + return self.perform_request( # type: ignore[return-value] + "GET", + __path, + params=__query, + headers=__headers, + endpoint_id="watcher.get_settings", + path_parts=__path_parts, + ) + @_rewrite_parameters() def get_watch( self, @@ -326,11 +405,14 @@ def get_watch( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves a watch by its ID. + .. raw:: html + +

Get a watch.

+ - ``_ + ``_ - :param id: Watch ID + :param id: The watch identifier. """ if id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'id'") @@ -362,6 +444,7 @@ def get_watch( "input", "metadata", "throttle_period", + "throttle_period_in_millis", "transform", "trigger", ), @@ -381,30 +464,51 @@ def put_watch( input: t.Optional[t.Mapping[str, t.Any]] = None, metadata: t.Optional[t.Mapping[str, t.Any]] = None, pretty: t.Optional[bool] = None, - throttle_period: t.Optional[str] = None, + throttle_period: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + throttle_period_in_millis: t.Optional[t.Any] = None, transform: t.Optional[t.Mapping[str, t.Any]] = None, trigger: t.Optional[t.Mapping[str, t.Any]] = None, version: t.Optional[int] = None, body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Creates a new watch, or updates an existing one. - - ``_ - - :param id: Watch ID - :param actions: - :param active: Specify whether the watch is in/active by default - :param condition: + .. raw:: html + +

Create or update a watch. + When a watch is registered, a new document that represents the watch is added to the .watches index and its trigger is immediately registered with the relevant trigger engine. + Typically for the schedule trigger, the scheduler is the trigger engine.

+

IMPORTANT: You must use Kibana or this API to create a watch. + Do not add a watch directly to the .watches index by using the Elasticsearch index API. + If Elasticsearch security features are enabled, do not give users write privileges on the .watches index.

+

When you add a watch you can also define its initial active state by setting the active parameter.

+

When Elasticsearch security features are enabled, your watch can index or search only on indices for which the user that stored the watch has privileges. + If the user is able to read index a, but not index b, the same will apply when the watch runs.

+ + + ``_ + + :param id: The identifier for the watch. + :param actions: The list of actions that will be run if the condition matches. + :param active: The initial state of the watch. The default value is `true`, which + means the watch is active by default. + :param condition: The condition that defines if the actions should be run. :param if_primary_term: only update the watch if the last operation that has changed the watch has the specified primary term :param if_seq_no: only update the watch if the last operation that has changed the watch has the specified sequence number - :param input: - :param metadata: - :param throttle_period: - :param transform: - :param trigger: + :param input: The input that defines the input that loads the data for the watch. + :param metadata: Metadata JSON that will be copied into the history entries. + :param throttle_period: The minimum time between actions being run. The default + is 5 seconds. This default can be changed in the config file with the setting + `xpack.watcher.throttle.period.default_period`. If both this value and the + `throttle_period_in_millis` parameter are specified, Watcher uses the last + parameter included in the request. + :param throttle_period_in_millis: Minimum time in milliseconds between actions + being run. Defaults to 5000. If both this value and the throttle_period parameter + are specified, Watcher uses the last parameter included in the request. + :param transform: The transform that processes the watch payload to prepare it + for the watch actions. + :param trigger: The trigger that defines when the watch should run. :param version: Explicit version number for concurrency control """ if id in SKIP_IN_PATH: @@ -440,6 +544,8 @@ def put_watch( __body["metadata"] = metadata if throttle_period is not None: __body["throttle_period"] = throttle_period + if throttle_period_in_millis is not None: + __body["throttle_period_in_millis"] = throttle_period_in_millis if transform is not None: __body["transform"] = transform if trigger is not None: @@ -485,16 +591,21 @@ def query_watches( body: t.Optional[t.Dict[str, t.Any]] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves stored watches. + .. raw:: html - ``_ +

Query watches. + Get all registered watches in a paginated manner and optionally filter watches by a query.

+

Note that only the _id and metadata.* fields are queryable or sortable.

- :param from_: The offset from the first result to fetch. Needs to be non-negative. - :param query: Optional, query filter watches to be returned. - :param search_after: Optional search After to do pagination using last hit’s - sort values. - :param size: The number of hits to return. Needs to be non-negative. - :param sort: Optional sort definition. + + ``_ + + :param from_: The offset from the first result to fetch. It must be non-negative. + :param query: A query that filters the watches to be returned. + :param search_after: Retrieve the next page of hits using a set of sort values + from the previous page. + :param size: The number of hits to return. It must be non-negative. + :param sort: One or more fields used to sort the search results. """ __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_query/watches" @@ -555,9 +666,13 @@ def start( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Starts Watcher if it is not already running. + .. raw:: html + +

Start the watch service. + Start the Watcher service if it is not already running.

- ``_ + + ``_ """ __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_start" @@ -612,9 +727,14 @@ def stats( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Retrieves the current Watcher metrics. + .. raw:: html + +

Get Watcher statistics. + This API always returns basic metrics. + You retrieve more metrics by using the metric parameter.

+ - ``_ + ``_ :param metric: Defines which additional metrics are included in the response. :param emit_stacktraces: Defines whether stack traces are generated for each @@ -655,12 +775,21 @@ def stop( error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Stops Watcher if it is running. + .. raw:: html - ``_ +

Stop the watch service. + Stop the Watcher service if it is running.

+ + + ``_ + + :param master_timeout: The period to wait for the master node. If the master + node is not available before the timeout expires, the request fails and returns + an error. To indicate that the request should never timeout, set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_watcher/_stop" @@ -671,6 +800,8 @@ def stop( __query["filter_path"] = filter_path if human is not None: __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json"} @@ -682,3 +813,74 @@ def stop( endpoint_id="watcher.stop", path_parts=__path_parts, ) + + @_rewrite_parameters( + body_fields=("index_auto_expand_replicas", "index_number_of_replicas"), + parameter_aliases={ + "index.auto_expand_replicas": "index_auto_expand_replicas", + "index.number_of_replicas": "index_number_of_replicas", + }, + ) + def update_settings( + self, + *, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + index_auto_expand_replicas: t.Optional[str] = None, + index_number_of_replicas: t.Optional[int] = None, + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + pretty: t.Optional[bool] = None, + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + .. raw:: html + +

Update Watcher index settings. + Update settings for the Watcher internal index (.watches). + Only a subset of settings can be modified. + This includes index.auto_expand_replicas and index.number_of_replicas.

+ + + ``_ + + :param index_auto_expand_replicas: + :param index_number_of_replicas: + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. + :param timeout: The period to wait for a response. If no response is received + before the timeout expires, the request fails and returns an error. + """ + __path_parts: t.Dict[str, str] = {} + __path = "/_watcher/settings" + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if master_timeout is not None: + __query["master_timeout"] = master_timeout + if pretty is not None: + __query["pretty"] = pretty + if timeout is not None: + __query["timeout"] = timeout + if not __body: + if index_auto_expand_replicas is not None: + __body["index.auto_expand_replicas"] = index_auto_expand_replicas + if index_number_of_replicas is not None: + __body["index.number_of_replicas"] = index_number_of_replicas + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "PUT", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="watcher.update_settings", + path_parts=__path_parts, + ) diff --git a/elasticsearch/_sync/client/xpack.py b/elasticsearch/_sync/client/xpack.py index 8ff48f904..d52c8dd69 100644 --- a/elasticsearch/_sync/client/xpack.py +++ b/elasticsearch/_sync/client/xpack.py @@ -34,16 +34,27 @@ def info( self, *, accept_enterprise: t.Optional[bool] = None, - categories: t.Optional[t.Sequence[str]] = None, + categories: t.Optional[ + t.Sequence[t.Union[str, t.Literal["build", "features", "license"]]] + ] = None, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - Provides general information about the installed X-Pack features. + .. raw:: html - ``_ +

Get information. + The information provided by the API includes:

+
    +
  • Build information including the build number and timestamp.
  • +
  • License information about the currently installed license.
  • +
  • Feature information for the features that are currently enabled and available under the current license.
  • +
+ + + ``_ :param accept_enterprise: If this param is used it must be set to true :param categories: A comma-separated list of the information categories to include @@ -85,14 +96,19 @@ def usage( pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ - This API provides information about which features are currently enabled and - available under the current license and some usage statistics. + .. raw:: html + +

Get usage information. + Get information about the features that are currently enabled and available under the current license. + The API also provides some usage statistics.

+ - ``_ + ``_ - :param master_timeout: Period to wait for a connection to the master node. If - no response is received before the timeout expires, the request fails and - returns an error. + :param master_timeout: The period to wait for a connection to the master node. + If no response is received before the timeout expires, the request fails + and returns an error. To indicate that the request should never timeout, + set it to `-1`. """ __path_parts: t.Dict[str, str] = {} __path = "/_xpack/usage" diff --git a/elasticsearch/_version.py b/elasticsearch/_version.py index cf59dc4a8..00e2789aa 100644 --- a/elasticsearch/_version.py +++ b/elasticsearch/_version.py @@ -15,4 +15,4 @@ # specific language governing permissions and limitations # under the License. -__versionstr__ = "8.15.1" +__versionstr__ = "8.17.2" diff --git a/elasticsearch/client.py b/elasticsearch/client.py index 9ea6f3667..926ed5fe3 100644 --- a/elasticsearch/client.py +++ b/elasticsearch/client.py @@ -57,6 +57,7 @@ ) from ._sync.client.security import SecurityClient as SecurityClient # noqa: F401 from ._sync.client.shutdown import ShutdownClient as ShutdownClient # noqa: F401 +from ._sync.client.simulate import SimulateClient as SimulateClient # noqa: F401 from ._sync.client.slm import SlmClient as SlmClient # noqa: F401 from ._sync.client.snapshot import SnapshotClient as SnapshotClient # noqa: F401 from ._sync.client.sql import SqlClient as SqlClient # noqa: F401 @@ -72,6 +73,8 @@ from ._utils import fixup_module_metadata # This file exists for backwards compatibility. +# We can't remove it as we use it for the Sphinx docs which show the full page, and we'd +# rather show `elasticsearch.client.FooClient` than `elasticsearch._sync.client.FooClient`. warnings.warn( "Importing from the 'elasticsearch.client' module is deprecated. " "Instead use 'elasticsearch' module for importing the client.", @@ -107,6 +110,7 @@ "SearchableSnapshotsClient", "SecurityClient", "ShutdownClient", + "SimulateClient", "SlmClient", "SnapshotClient", "SqlClient", diff --git a/elasticsearch/exceptions.py b/elasticsearch/exceptions.py index f58706774..dc410ae30 100644 --- a/elasticsearch/exceptions.py +++ b/elasticsearch/exceptions.py @@ -115,6 +115,10 @@ class ElasticsearchWarning(TransportWarning): """ +class GeneralAvailabilityWarning(TransportWarning): + """Warning that is raised when a feature is not yet GA.""" + + # Aliases for backwards compatibility ElasticsearchDeprecationWarning = ElasticsearchWarning RequestError = BadRequestError diff --git a/elasticsearch/helpers/actions.py b/elasticsearch/helpers/actions.py index 1d6b0a27e..d1a43a8dc 100644 --- a/elasticsearch/helpers/actions.py +++ b/elasticsearch/helpers/actions.py @@ -374,6 +374,7 @@ def streaming_bulk( max_backoff: float = 600, yield_ok: bool = True, ignore_status: Union[int, Collection[int]] = (), + retry_on_status: Union[int, Collection[int]] = (429,), span_name: str = "helpers.streaming_bulk", *args: Any, **kwargs: Any, @@ -386,10 +387,11 @@ def streaming_bulk( entire input is consumed and sent. If you specify ``max_retries`` it will also retry any documents that were - rejected with a ``429`` status code. To do this it will wait (**by calling - time.sleep which will block**) for ``initial_backoff`` seconds and then, - every subsequent rejection for the same chunk, for double the time every - time up to ``max_backoff`` seconds. + rejected with a ``429`` status code. Use ``retry_on_status`` to + configure which status codes will be retried. To do this it will wait + (**by calling time.sleep which will block**) for ``initial_backoff`` seconds + and then, every subsequent rejection for the same chunk, for double the time + every time up to ``max_backoff`` seconds. :arg client: instance of :class:`~elasticsearch.Elasticsearch` to use :arg actions: iterable containing the actions to be executed @@ -402,8 +404,11 @@ def streaming_bulk( :arg expand_action_callback: callback executed on each action passed in, should return a tuple containing the action line and the data line (`None` if data line should be omitted). + :arg retry_on_status: HTTP status code that will trigger a retry. + (if `None` is specified only status 429 will retry). :arg max_retries: maximum number of times a document will be retried when - ``429`` is received, set to 0 (default) for no retries on ``429`` + retry_on_status (defaulting to ``429``) is received, + set to 0 (default) for no retries :arg initial_backoff: number of seconds we should wait before the first retry. Any subsequent retries will be powers of ``initial_backoff * 2**retry_number`` @@ -415,6 +420,9 @@ def streaming_bulk( client = client.options() client._client_meta = (("h", "bp"),) + if isinstance(retry_on_status, int): + retry_on_status = (retry_on_status,) + serializer = client.transport.serializers.get_serializer("application/json") bulk_data: List[ @@ -458,11 +466,11 @@ def streaming_bulk( ): if not ok: action, info = info.popitem() - # retry if retries enabled, we get 429, and we are not - # in the last attempt + # retry if retries enabled, we are not in the last attempt, + # and status in retry_on_status (defaulting to 429) if ( max_retries - and info["status"] == 429 + and info["status"] in retry_on_status and (attempt + 1) <= max_retries ): # _process_bulk_chunk expects bytes so we need to @@ -475,8 +483,9 @@ def streaming_bulk( yield ok, info except ApiError as e: - # suppress 429 errors since we will retry them - if attempt == max_retries or e.status_code != 429: + # suppress any status in retry_on_status (429 by default) + # since we will retry them + if attempt == max_retries or e.status_code not in retry_on_status: raise else: if not to_retry: @@ -584,7 +593,7 @@ def parallel_bulk( class BlockingPool(ThreadPool): def _setup_queues(self) -> None: - super()._setup_queues() # type: ignore + super()._setup_queues() # type: ignore[misc] # The queue must be at least the size of the number of threads to # prevent hanging when inserting sentinel values during teardown. self._inqueue: Queue[ diff --git a/elasticsearch/helpers/errors.py b/elasticsearch/helpers/errors.py index 359fe87b1..4814ca581 100644 --- a/elasticsearch/helpers/errors.py +++ b/elasticsearch/helpers/errors.py @@ -15,18 +15,26 @@ # specific language governing permissions and limitations # under the License. -from typing import Any, Dict, List +from typing import Any, Dict, List, Tuple, Type class BulkIndexError(Exception): - def __init__(self, message: Any, errors: List[Dict[str, Any]]): + def __init__(self, message: str, errors: List[Dict[str, Any]]): super().__init__(message) self.errors: List[Dict[str, Any]] = errors + def __reduce__( + self, + ) -> Tuple[Type["BulkIndexError"], Tuple[str, List[Dict[str, Any]]]]: + return (self.__class__, (self.args[0], self.errors)) + class ScanError(Exception): scroll_id: str - def __init__(self, scroll_id: str, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + def __init__(self, scroll_id: str, *args: Any) -> None: + super().__init__(*args) self.scroll_id = scroll_id + + def __reduce__(self) -> Tuple[Type["ScanError"], Tuple[str, str]]: + return (self.__class__, (self.scroll_id,) + self.args) diff --git a/elasticsearch/helpers/vectorstore/_async/strategies.py b/elasticsearch/helpers/vectorstore/_async/strategies.py index a7f813f43..10524e243 100644 --- a/elasticsearch/helpers/vectorstore/_async/strategies.py +++ b/elasticsearch/helpers/vectorstore/_async/strategies.py @@ -283,10 +283,9 @@ def _hybrid( ) -> Dict[str, Any]: # Add a query to the knn query. # RRF is used to even the score from the knn query and text query - # RRF has two optional parameters: {'rank_constant':int, 'window_size':int} + # RRF has two optional parameters: {'rank_constant':int, 'rank_window_size':int} # https://www.elastic.co/guide/en/elasticsearch/reference/current/rrf.html - query_body = { - "knn": knn, + standard_query = { "query": { "bool": { "must": [ @@ -300,14 +299,36 @@ def _hybrid( ], "filter": filter, } - }, + } } - if isinstance(self.rrf, Dict): - query_body["rank"] = {"rrf": self.rrf} - elif isinstance(self.rrf, bool) and self.rrf is True: - query_body["rank"] = {"rrf": {}} - + if self.rrf is False: + query_body = { + "knn": knn, + **standard_query, + } + else: + rrf_options = {} + if isinstance(self.rrf, Dict): + if "rank_constant" in self.rrf: + rrf_options["rank_constant"] = self.rrf["rank_constant"] + if "window_size" in self.rrf: + # 'window_size' was renamed to 'rank_window_size', but we support + # the older name for backwards compatibility + rrf_options["rank_window_size"] = self.rrf["window_size"] + if "rank_window_size" in self.rrf: + rrf_options["rank_window_size"] = self.rrf["rank_window_size"] + query_body = { + "retriever": { + "rrf": { + "retrievers": [ + {"standard": standard_query}, + {"knn": knn}, + ], + **rrf_options, + }, + }, + } return query_body def needs_inference(self) -> bool: diff --git a/elasticsearch/helpers/vectorstore/_sync/strategies.py b/elasticsearch/helpers/vectorstore/_sync/strategies.py index 928d34143..99c9baec2 100644 --- a/elasticsearch/helpers/vectorstore/_sync/strategies.py +++ b/elasticsearch/helpers/vectorstore/_sync/strategies.py @@ -283,10 +283,9 @@ def _hybrid( ) -> Dict[str, Any]: # Add a query to the knn query. # RRF is used to even the score from the knn query and text query - # RRF has two optional parameters: {'rank_constant':int, 'window_size':int} + # RRF has two optional parameters: {'rank_constant':int, 'rank_window_size':int} # https://www.elastic.co/guide/en/elasticsearch/reference/current/rrf.html - query_body = { - "knn": knn, + standard_query = { "query": { "bool": { "must": [ @@ -300,14 +299,36 @@ def _hybrid( ], "filter": filter, } - }, + } } - if isinstance(self.rrf, Dict): - query_body["rank"] = {"rrf": self.rrf} - elif isinstance(self.rrf, bool) and self.rrf is True: - query_body["rank"] = {"rrf": {}} - + if self.rrf is False: + query_body = { + "knn": knn, + **standard_query, + } + else: + rrf_options = {} + if isinstance(self.rrf, Dict): + if "rank_constant" in self.rrf: + rrf_options["rank_constant"] = self.rrf["rank_constant"] + if "window_size" in self.rrf: + # 'window_size' was renamed to 'rank_window_size', but we support + # the older name for backwards compatibility + rrf_options["rank_window_size"] = self.rrf["window_size"] + if "rank_window_size" in self.rrf: + rrf_options["rank_window_size"] = self.rrf["rank_window_size"] + query_body = { + "retriever": { + "rrf": { + "retrievers": [ + {"standard": standard_query}, + {"knn": knn}, + ], + **rrf_options, + }, + }, + } return query_body def needs_inference(self) -> bool: diff --git a/elasticsearch/helpers/vectorstore/_sync/vectorstore.py b/elasticsearch/helpers/vectorstore/_sync/vectorstore.py index 3c4a0d51a..6a6a5ee2a 100644 --- a/elasticsearch/helpers/vectorstore/_sync/vectorstore.py +++ b/elasticsearch/helpers/vectorstore/_sync/vectorstore.py @@ -22,7 +22,10 @@ from elasticsearch import Elasticsearch from elasticsearch._version import __versionstr__ as lib_version from elasticsearch.helpers import BulkIndexError, bulk -from elasticsearch.helpers.vectorstore import EmbeddingService, RetrievalStrategy +from elasticsearch.helpers.vectorstore import ( + EmbeddingService, + RetrievalStrategy, +) from elasticsearch.helpers.vectorstore._utils import maximal_marginal_relevance logger = logging.getLogger(__name__) diff --git a/noxfile.py b/noxfile.py index 600120bb3..f07edbd8d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -45,14 +45,14 @@ def pytest_argv(): ] -@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"]) +@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]) def test(session): session.install(".[dev]", env=INSTALL_ENV, silent=False) - session.run(*pytest_argv()) + session.run(*pytest_argv(), *session.posargs) -@nox.session(python=["3.8", "3.12"]) +@nox.session(python=["3.8", "3.13"]) def test_otel(session): session.install( ".[dev]", @@ -67,7 +67,7 @@ def test_otel(session): @nox.session() def format(session): - session.install("black~=24.0", "isort", "flynt", "unasync>=0.6.0") + session.install("black~=25.0", "isort~=6.0", "flynt", "unasync>=0.6.0", "jinja2") session.run("python", "utils/run-unasync.py") session.run("isort", "--profile=black", *SOURCE_FILES) @@ -75,8 +75,6 @@ def format(session): session.run("black", *SOURCE_FILES) session.run("python", "utils/license-headers.py", "fix", *SOURCE_FILES) - lint(session) - @nox.session() def lint(session): @@ -96,30 +94,28 @@ def lint(session): session.install(".[async,requests,orjson,pyarrow,vectorstore_mmr]", env=INSTALL_ENV) - # Run mypy on the package and then the type examples separately for - # the two different mypy use-cases, ourselves and our users. - session.run("mypy", "--strict", "--show-error-codes", "elasticsearch/") + # Run mypy on the package, the type examples and the DSL examples session.run( "mypy", "--strict", + "--implicit-reexport", + "--explicit-package-bases", "--show-error-codes", - "test_elasticsearch/test_types/sync_types.py", - ) - session.run( - "mypy", - "--strict", - "--show-error-codes", - "test_elasticsearch/test_types/async_types.py", + "--enable-error-code=ignore-without-code", + "elasticsearch/", + "test_elasticsearch/test_types/", ) # Make sure we don't require aiohttp to be installed for users to # receive type hint information from mypy. session.run("python", "-m", "pip", "uninstall", "--yes", "aiohttp") - session.run("mypy", "--strict", "--show-error-codes", "elasticsearch/") session.run( "mypy", "--strict", + "--implicit-reexport", + "--explicit-package-bases", "--show-error-codes", + "elasticsearch/", "test_elasticsearch/test_types/sync_types.py", ) @@ -127,4 +123,6 @@ def lint(session): @nox.session() def docs(session): session.install(".[docs]") - session.run("sphinx-build", "docs/sphinx/", "docs/sphinx/_build", "-b", "html") + session.run( + "sphinx-build", "-W", "docs/sphinx/", "docs/sphinx/_build", "-b", "html" + ) diff --git a/pyproject.toml b/pyproject.toml index 1a2563680..b5f03e1d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] @@ -41,7 +42,7 @@ keywords = [ ] dynamic = ["version"] dependencies = [ - "elastic-transport>=8.13,<9", + "elastic-transport>=8.15.1,<9", ] [project.optional-dependencies] diff --git a/test_elasticsearch/test_async/test_server/conftest.py b/test_elasticsearch/test_async/test_server/conftest.py index fc475bc75..623646e7d 100644 --- a/test_elasticsearch/test_async/test_server/conftest.py +++ b/test_elasticsearch/test_async/test_server/conftest.py @@ -26,7 +26,7 @@ @pytest_asyncio.fixture(scope="function") -async def async_client(elasticsearch_url): +async def async_client_factory(elasticsearch_url): if not hasattr(elasticsearch, "AsyncElasticsearch"): pytest.skip("test requires 'AsyncElasticsearch' and aiohttp to be installed") @@ -36,11 +36,17 @@ async def async_client(elasticsearch_url): # event loops (one per test!) client = None try: - client = elasticsearch.AsyncElasticsearch( - elasticsearch_url, request_timeout=3, ca_certs=CA_CERTS - ) + client = elasticsearch.AsyncElasticsearch(elasticsearch_url, ca_certs=CA_CERTS) yield client finally: if client: - wipe_cluster(client) await client.close() + + +@pytest.fixture(scope="function") +def async_client(async_client_factory): + try: + yield async_client_factory + finally: + # Wipe the cluster clean after every test execution. + wipe_cluster(async_client_factory) diff --git a/test_elasticsearch/test_async/test_server/test_helpers.py b/test_elasticsearch/test_async/test_server/test_helpers.py index 746dc1028..0bb781304 100644 --- a/test_elasticsearch/test_async/test_server/test_helpers.py +++ b/test_elasticsearch/test_async/test_server/test_helpers.py @@ -293,6 +293,45 @@ async def streaming_bulk(): await streaming_bulk() assert 4 == failing_client._called + async def test_connection_timeout_is_retried_with_retry_status_callback( + self, async_client + ): + failing_client = FailingBulkClient( + async_client, + fail_with=ApiError( + message="Connection timed out!", + body={}, + meta=ApiResponseMeta( + status=522, headers={}, http_version="1.1", duration=0, node=None + ), + ), + ) + docs = [ + {"_index": "i", "_id": 47, "f": "v"}, + {"_index": "i", "_id": 45, "f": "v"}, + {"_index": "i", "_id": 42, "f": "v"}, + ] + + results = [ + x + async for x in helpers.async_streaming_bulk( + failing_client, + docs, + raise_on_exception=False, + raise_on_error=False, + chunk_size=1, + retry_on_status=522, + max_retries=1, + initial_backoff=0, + ) + ] + assert 3 == len(results) + assert [True, True, True] == [r[0] for r in results] + await async_client.indices.refresh(index="i") + res = await async_client.search(index="i") + assert {"value": 3, "relation": "eq"} == res["hits"]["total"] + assert 4 == failing_client._called + class TestBulk: async def test_bulk_works_with_single_item(self, async_client): diff --git a/test_elasticsearch/test_async/test_server/test_rest_api_spec.py b/test_elasticsearch/test_async/test_server/test_rest_api_spec.py index eee2364f6..c48262b61 100644 --- a/test_elasticsearch/test_async/test_server/test_rest_api_spec.py +++ b/test_elasticsearch/test_async/test_server/test_rest_api_spec.py @@ -130,7 +130,9 @@ async def run_do(self, action): headers.pop("Authorization") method, args = list(action.items())[0] - args["headers"] = headers + + if headers: + args["headers"] = headers # locate api endpoint for m in method.split("."): @@ -239,15 +241,17 @@ async def _feature_enabled(self, name): @pytest_asyncio.fixture(scope="function") -def async_runner(async_client): - return AsyncYamlRunner(async_client) +def async_runner(async_client_factory): + return AsyncYamlRunner(async_client_factory) if RUN_ASYNC_REST_API_TESTS: @pytest.mark.parametrize("test_spec", YAML_TEST_SPECS) async def test_rest_api_spec(test_spec, async_runner): - if test_spec.get("skip", False): - pytest.skip("Manually skipped in 'SKIP_TESTS'") + if test_spec.get("fail", False): + pytest.xfail("Manually marked as failing in 'FAILING_TESTS'") + elif test_spec.get("skip", False): + pytest.xfail("Manually skipped") async_runner.use_spec(test_spec) await async_runner.run() diff --git a/test_elasticsearch/test_async/test_transport.py b/test_elasticsearch/test_async/test_transport.py index 76a71f50b..70d67765f 100644 --- a/test_elasticsearch/test_async/test_transport.py +++ b/test_elasticsearch/test_async/test_transport.py @@ -527,7 +527,8 @@ async def test_sniff_on_node_failure_triggers(self, extra_key, extra_value): assert request_failed_in_error assert len(client.transport.node_pool) == 3 - async def test_sniff_after_n_seconds(self, event_loop): + async def test_sniff_after_n_seconds(self): + event_loop = asyncio.get_running_loop() client = AsyncElasticsearch( # noqa: F821 [NodeConfig("http", "localhost", 9200, _extras={"data": CLUSTER_NODES})], node_class=DummyNode, @@ -581,7 +582,8 @@ async def test_sniffing_disabled_on_elastic_cloud(self, kwargs): == "Sniffing should not be enabled when connecting to Elastic Cloud" ) - async def test_sniff_on_start_close_unlocks_async_calls(self, event_loop): + async def test_sniff_on_start_close_unlocks_async_calls(self): + event_loop = asyncio.get_running_loop() client = AsyncElasticsearch( # noqa: F821 [ NodeConfig( diff --git a/test_elasticsearch/test_client/test_deprecated_options.py b/test_elasticsearch/test_client/test_deprecated_options.py index 810e75cf4..3b4e0b9ed 100644 --- a/test_elasticsearch/test_client/test_deprecated_options.py +++ b/test_elasticsearch/test_client/test_deprecated_options.py @@ -21,6 +21,23 @@ from elasticsearch import Elasticsearch, JsonSerializer +EXPECTED_SERIALIZERS = { + "application/vnd.mapbox-vector-tile", + "application/x-ndjson", + "application/json", + "text/*", + "application/vnd.elasticsearch+json", + "application/vnd.elasticsearch+x-ndjson", +} + + +try: + import pyarrow as pa + + EXPECTED_SERIALIZERS.add("application/vnd.apache.arrow.stream") +except ImportError: + pa = None + def test_sniff_on_connection_fail(): with warnings.catch_warnings(record=True) as w: @@ -129,15 +146,7 @@ class CustomSerializer(JsonSerializer): client.transport.serializers.get_serializer("application/json"), CustomSerializer, ) - assert set(client.transport.serializers.serializers.keys()) == { - "application/vnd.mapbox-vector-tile", - "application/x-ndjson", - "application/json", - "text/*", - "application/vnd.apache.arrow.stream", - "application/vnd.elasticsearch+json", - "application/vnd.elasticsearch+x-ndjson", - } + assert set(client.transport.serializers.serializers.keys()) == EXPECTED_SERIALIZERS client = Elasticsearch( "http://localhost:9200", @@ -150,13 +159,5 @@ class CustomSerializer(JsonSerializer): client.transport.serializers.get_serializer("application/json"), CustomSerializer, ) - assert set(client.transport.serializers.serializers.keys()) == { - "application/vnd.mapbox-vector-tile", - "application/x-ndjson", - "application/json", - "text/*", - "application/vnd.apache.arrow.stream", - "application/vnd.elasticsearch+json", - "application/vnd.elasticsearch+x-ndjson", - "application/cbor", - } + expected = EXPECTED_SERIALIZERS | {"application/cbor"} + assert set(client.transport.serializers.serializers.keys()) == expected diff --git a/test_elasticsearch/test_client/test_serializers.py b/test_elasticsearch/test_client/test_serializers.py index 9d13386ed..986160b92 100644 --- a/test_elasticsearch/test_client/test_serializers.py +++ b/test_elasticsearch/test_client/test_serializers.py @@ -20,6 +20,23 @@ from elasticsearch import Elasticsearch from test_elasticsearch.test_cases import DummyTransportTestCase +EXPECTED_SERIALIZERS = { + "application/json", + "text/*", + "application/x-ndjson", + "application/vnd.mapbox-vector-tile", + "application/vnd.elasticsearch+json", + "application/vnd.elasticsearch+x-ndjson", +} + + +try: + import pyarrow as pa + + EXPECTED_SERIALIZERS.add("application/vnd.apache.arrow.stream") +except ImportError: + pa = None + class TestSerializers(DummyTransportTestCase): def test_compat_mode_on_by_default(self): @@ -90,16 +107,8 @@ class CustomSerializer: "https://localhost:9200", serializers={f"application/{mime_subtype}": ser} ) serializers = client.transport.serializers.serializers - assert set(serializers.keys()) == { - "application/json", - "text/*", - "application/x-ndjson", - "application/vnd.apache.arrow.stream", - "application/vnd.mapbox-vector-tile", - "application/vnd.elasticsearch+json", - "application/vnd.elasticsearch+x-ndjson", - } + assert set(serializers.keys()) == EXPECTED_SERIALIZERS assert serializers[f"application/{mime_subtype}"] is ser assert serializers[f"application/vnd.elasticsearch+{mime_subtype}"] is ser @@ -118,16 +127,7 @@ class CustomSerializer: }, ) serializers = client.transport.serializers.serializers - assert set(serializers.keys()) == { - "application/json", - "text/*", - "application/x-ndjson", - "application/vnd.apache.arrow.stream", - "application/vnd.mapbox-vector-tile", - "application/vnd.elasticsearch+json", - "application/vnd.elasticsearch+x-ndjson", - } - + assert set(serializers.keys()) == EXPECTED_SERIALIZERS assert serializers[f"application/{mime_subtype}"] is ser1 assert serializers[f"application/vnd.elasticsearch+{mime_subtype}"] is ser2 @@ -138,15 +138,6 @@ class CustomSerializer: ser = CustomSerializer() client = Elasticsearch("https://localhost:9200", serializer=ser) serializers = client.transport.serializers.serializers - assert set(serializers.keys()) == { - "application/json", - "text/*", - "application/x-ndjson", - "application/vnd.apache.arrow.stream", - "application/vnd.mapbox-vector-tile", - "application/vnd.elasticsearch+json", - "application/vnd.elasticsearch+x-ndjson", - } - + assert set(serializers.keys()) == EXPECTED_SERIALIZERS assert serializers["application/json"] is ser assert serializers["application/vnd.elasticsearch+json"] is ser diff --git a/test_elasticsearch/test_client/test_utils.py b/test_elasticsearch/test_client/test_utils.py index e53145bfd..e4713ff1c 100644 --- a/test_elasticsearch/test_client/test_utils.py +++ b/test_elasticsearch/test_client/test_utils.py @@ -16,7 +16,12 @@ # under the License. -from elasticsearch._sync.client.utils import _quote +import warnings + +import pytest + +from elasticsearch._sync.client.utils import Stability, _quote, _stability_warning +from elasticsearch.exceptions import GeneralAvailabilityWarning def test_handles_ascii(): @@ -36,3 +41,39 @@ def test_handles_unicode(): def test_handles_unicode2(): string = "中*文," assert "%E4%B8%AD*%E6%96%87," == _quote(string) + + +class TestStabilityWarning: + def test_default(self): + + @_stability_warning(stability=Stability.STABLE) + def func_default(*args, **kwargs): + pass + + with warnings.catch_warnings(): + warnings.simplefilter("error") + func_default() + + def test_beta(self, recwarn): + + @_stability_warning(stability=Stability.BETA) + def func_beta(*args, **kwargs): + pass + + with pytest.warns( + GeneralAvailabilityWarning, + match="This API is in beta and is subject to change.", + ): + func_beta() + + def test_experimental(self, recwarn): + + @_stability_warning(stability=Stability.EXPERIMENTAL) + def func_experimental(*args, **kwargs): + pass + + with pytest.warns( + GeneralAvailabilityWarning, + match="This API is in technical preview and may be changed or removed in a future release.", + ): + func_experimental() diff --git a/test_elasticsearch/test_helpers.py b/test_elasticsearch/test_helpers.py index c9284afc5..e30635f44 100644 --- a/test_elasticsearch/test_helpers.py +++ b/test_elasticsearch/test_helpers.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. +import pickle import threading import time from unittest import mock @@ -182,3 +183,19 @@ class TestExpandActions: @pytest.mark.parametrize("action", ["whatever", b"whatever"]) def test_string_actions_are_marked_as_simple_inserts(self, action): assert ({"index": {}}, b"whatever") == helpers.expand_action(action) + + +def test_serialize_bulk_index_error(): + error = helpers.BulkIndexError("message", [{"error": 1}]) + pickled = pickle.loads(pickle.dumps(error)) + assert pickled.__class__ == helpers.BulkIndexError + assert pickled.errors == error.errors + assert pickled.args == error.args + + +def test_serialize_scan_error(): + error = helpers.ScanError("scroll_id", "shard_message") + pickled = pickle.loads(pickle.dumps(error)) + assert pickled.__class__ == helpers.ScanError + assert pickled.scroll_id == error.scroll_id + assert pickled.args == error.args diff --git a/test_elasticsearch/test_serializer.py b/test_elasticsearch/test_serializer.py index 02723e8f4..21c6b94b5 100644 --- a/test_elasticsearch/test_serializer.py +++ b/test_elasticsearch/test_serializer.py @@ -19,9 +19,15 @@ from datetime import datetime from decimal import Decimal -import pyarrow as pa import pytest +try: + import pyarrow as pa + + from elasticsearch.serializer import PyArrowSerializer +except ImportError: + pa = None + try: import numpy as np import pandas as pd @@ -32,12 +38,7 @@ from elasticsearch import Elasticsearch from elasticsearch.exceptions import SerializationError -from elasticsearch.serializer import ( - JSONSerializer, - OrjsonSerializer, - PyArrowSerializer, - TextSerializer, -) +from elasticsearch.serializer import JSONSerializer, OrjsonSerializer, TextSerializer requires_numpy_and_pandas = pytest.mark.skipif( np is None or pd is None, reason="Test requires numpy and pandas to be available" @@ -163,6 +164,7 @@ def test_serializes_pandas_category(json_serializer): assert b'{"d":[1,2,3]}' == json_serializer.dumps({"d": cat}) +@pytest.mark.skipif(pa is None, reason="Test requires pyarrow to be available") def test_pyarrow_loads(): data = [ pa.array([1, 2, 3, 4]), diff --git a/test_elasticsearch/test_server/test_helpers.py b/test_elasticsearch/test_server/test_helpers.py index 011803bc9..6ed43e2af 100644 --- a/test_elasticsearch/test_server/test_helpers.py +++ b/test_elasticsearch/test_server/test_helpers.py @@ -288,6 +288,45 @@ def streaming_bulk(): assert 4 == failing_client._called +def test_connection_timeout_is_retried_with_retry_status_callback(sync_client): + failing_client = FailingBulkClient( + sync_client, + fail_with=ApiError( + message="Connection timed out!", + body={}, + meta=ApiResponseMeta( + status=522, headers={}, http_version="1.1", duration=0, node=None + ), + ), + ) + docs = [ + {"_index": "i", "_id": 47, "f": "v"}, + {"_index": "i", "_id": 45, "f": "v"}, + {"_index": "i", "_id": 42, "f": "v"}, + ] + + results = list( + helpers.streaming_bulk( + failing_client, + docs, + index="i", + raise_on_exception=False, + raise_on_error=False, + chunk_size=1, + retry_on_status=522, + max_retries=1, + initial_backoff=0, + ) + ) + assert 3 == len(results) + print(results) + assert [True, True, True] == [r[0] for r in results] + sync_client.indices.refresh(index="i") + res = sync_client.search(index="i") + assert {"value": 3, "relation": "eq"} == res["hits"]["total"] + assert 4 == failing_client._called + + def test_bulk_works_with_single_item(sync_client): docs = [{"answer": 42, "_id": 1}] success, failed = helpers.bulk(sync_client, docs, index="test-index", refresh=True) diff --git a/test_elasticsearch/test_server/test_rest_api_spec.py b/test_elasticsearch/test_server/test_rest_api_spec.py index 6ede3b753..23d8c360f 100644 --- a/test_elasticsearch/test_server/test_rest_api_spec.py +++ b/test_elasticsearch/test_server/test_rest_api_spec.py @@ -32,12 +32,10 @@ import urllib3 import yaml -from elasticsearch import ApiError, Elasticsearch, ElasticsearchWarning, RequestError +from elasticsearch import ApiError, ElasticsearchWarning, RequestError from elasticsearch._sync.client.utils import _base64_auth_header from elasticsearch.compat import string_types -from ..utils import CA_CERTS, es_url, parse_version - # some params had to be changed in python, keep track of them so we can rename # those in the tests accordingly PARAMS_RENAMES = {"from": "from_"} @@ -70,66 +68,40 @@ } # broken YAML tests on some releases -SKIP_TESTS = { - # Warning about date_histogram.interval deprecation is raised randomly - "search/aggregation/250_moving_fn[1]", - # body: null - "indices/simulate_index_template/10_basic[2]", - # No ML node with sufficient capacity / random ML failing - "ml/start_stop_datafeed", - "ml/post_data", - "ml/jobs_crud", - "ml/datafeeds_crud", - "ml/set_upgrade_mode", - "ml/reset_job[2]", - "ml/jobs_get_stats", - "ml/get_datafeed_stats", - "ml/get_trained_model_stats", - "ml/delete_job_force", - "ml/jobs_get_result_overall_buckets", - "ml/bucket_correlation_agg[0]", - "ml/job_groups", - "transform/transforms_stats_continuous[0]", - # Fails bad request instead of 404? - "ml/inference_crud", - # rollup/security_tests time out? - "rollup/security_tests", - # Our TLS certs are custom - "ssl/10_basic[0]", - # Our user is custom - "users/10_basic[3]", - # License warning not sent? - "license/30_enterprise_license[0]", - # Shards/snapshots aren't right? - "searchable_snapshots/10_usage[1]", - # flaky data streams? - "data_stream/10_basic[1]", - "data_stream/80_resolve_index_data_streams[1]", - # bad formatting? - "cat/allocation/10_basic", - "runtime_fields/10_keyword[8]", - # service account number not right? - "service_accounts/10_basic[1]", - # doesn't use 'contains' properly? - "xpack/10_basic[0]", - "privileges/40_get_user_privs[0]", - "privileges/40_get_user_privs[1]", - "features/get_features/10_basic[0]", - "features/reset_features/10_basic[0]", - # bad use of 'is_false'? - "indices/get_alias/10_basic[22]", - # unique usage of 'set' - "indices/stats/50_disk_usage[0]", - "indices/stats/60_field_usage[0]", - # actual Elasticsearch failure? - "transform/transforms_stats", - "transform/transforms_cat_apis", - "transform/transforms_update", +FAILING_TESTS = { + # ping has a custom implementation in Python and returns a boolean + "ping/ping", + # Not investigated yet + "cat/aliases", + "cat/fielddata", + "cluster/delete_voting_config_exclusions", + "cluster/voting_config_exclusions", + "entsearch/10_basic", + "indices/clone", + "indices/data_stream_mappings[0]", + "indices/data_streams_options[0]", + "indices/resolve_cluster", + "indices/settings", + "indices/split", + "indices/simulate_template_stack", + "logstash/10_basic", + "machine_learning/30_trained_model_stack", + "machine_learning/jobs_crud", + "scroll/10_basic", + "security/10_api_key_basic", + "security/130_user_profile", + "transform/10_basic", +} +SKIPPED_TESTS = { + # Timeouts + # https://github.com/elastic/elasticsearch-serverless-python/issues/63 + "cluster/cluster_info[0]", + "inference/10_basic[0]", + "machine_learning/20_trained_model[0]", } XPACK_FEATURES = None -ES_VERSION = None RUN_ASYNC_REST_API_TESTS = os.environ.get("PYTHON_CONNECTION_CLASS") == "requests" FALSEY_VALUES = ("", None, False, 0, 0.0) @@ -173,16 +145,6 @@ def teardown(self): self.section("teardown") self.run_code(self._teardown_code) - def es_version(self): - global ES_VERSION - if ES_VERSION is None: - version_string = (self.client.info())["version"]["number"] - if "." not in version_string: - return () - version = version_string.strip().split(".") - ES_VERSION = tuple(int(v) if v.isdigit() else 999 for v in version) - return ES_VERSION - def section(self, name): print(("=" * 10) + " " + name + " " + ("=" * 10)) @@ -320,8 +282,6 @@ def run_catch(self, catch, exception): self.last_response = exception.body def run_skip(self, skip): - global IMPLEMENTED_FEATURES - if "features" in skip: features = skip["features"] if not isinstance(features, (tuple, list)): @@ -331,16 +291,6 @@ def run_skip(self, skip): continue pytest.skip(f"feature '{feature}' is not supported") - if "version" in skip: - version, reason = skip["version"], skip["reason"] - if version == "all": - pytest.skip(reason) - min_version, _, max_version = version.partition("-") - min_version = parse_version(min_version.strip()) or (0,) - max_version = parse_version(max_version.strip()) or (999,) - if min_version <= (self.es_version()) <= max_version: - pytest.skip(reason) - def run_gt(self, action): for key, value in action.items(): value = self._resolve(value) @@ -487,7 +437,7 @@ def _lookup(self, path): return value def _feature_enabled(self, name): - global XPACK_FEATURES, IMPLEMENTED_FEATURES + global XPACK_FEATURES if XPACK_FEATURES is None: try: xinfo = self.client.xpack.info() @@ -516,8 +466,9 @@ def _skip_intentional_type_errors(self, e: Exception): @pytest.fixture(scope="function") -def sync_runner(sync_client): - return YamlRunner(sync_client) +def sync_runner(sync_client_factory): + # sync_client_factory does not wipe the cluster between tests + return YamlRunner(sync_client_factory) # Source: https://stackoverflow.com/a/37958106/5763213 @@ -545,63 +496,37 @@ def remove_implicit_resolver(cls, tag_to_remove): # Try loading the REST API test specs from the Elastic Artifacts API try: # Construct the HTTP and Elasticsearch client - http = urllib3.PoolManager(retries=10) - client = Elasticsearch(es_url(), request_timeout=3, ca_certs=CA_CERTS) - - # Make a request to Elasticsearch for the build hash, we'll be looking for - # an artifact with this same hash to download test specs for. - client_info = client.info() - version_number = client_info["version"]["number"] - build_hash = client_info["version"]["build_hash"] - - # Now talk to the artifacts API with the 'STACK_VERSION' environment variable - resp = http.request( - "GET", - f"https://artifacts-api.elastic.co/v1/versions/{version_number}", + http = urllib3.PoolManager(retries=urllib3.Retry(total=10)) + + yaml_tests_url = ( + "https://api.github.com/repos/elastic/elasticsearch-clients-tests/zipball/main" ) - resp = json.loads(resp.data.decode("utf-8")) - - # Look through every build and see if one matches the commit hash - # we're looking for. If not it's okay, we'll just use the latest and - # hope for the best! - builds = resp["version"]["builds"] - for build in builds: - if build["projects"]["elasticsearch"]["commit_hash"] == build_hash: - break - else: - build = builds[0] # Use the latest - - # Now we're looking for the 'rest-api-spec--sources.jar' file - # to download and extract in-memory. - packages = build["projects"]["elasticsearch"]["packages"] - for package in packages: - if re.match(r"rest-resources-zip-.*\.zip", package): - package_url = packages[package]["url"] - break - else: - raise RuntimeError( - f"Could not find the package 'rest-resources-zip-*.zip' in build {build!r}" - ) # Download the zip and start reading YAML from the files in memory - package_zip = zipfile.ZipFile(io.BytesIO(http.request("GET", package_url).data)) + package_zip = zipfile.ZipFile(io.BytesIO(http.request("GET", yaml_tests_url).data)) + for yaml_file in package_zip.namelist(): - if not re.match(r"^rest-api-spec/test/.*\.ya?ml$", yaml_file): + if not re.match(r"^.*\/tests\/.*\.ya?ml$", yaml_file): continue yaml_tests = list( yaml.load_all(package_zip.read(yaml_file), Loader=NoDatesSafeLoader) ) - # Each file may have a "test" named 'setup' or 'teardown', - # these sets of steps should be run at the beginning and end - # of every other test within the file so we do one pass to capture those. - setup_steps = teardown_steps = None + # Each file has a `requires` section with `serverless` and `stack` + # boolean entries indicating whether the test should run with + # serverless, stack or both. Additionally, each file may have a section + # named 'setup' or 'teardown', these sets of steps should be run at the + # beginning and end of every other test within the file so we do one + # pass to capture those. + requires = setup_steps = teardown_steps = None test_numbers_and_steps = [] test_number = 0 for yaml_test in yaml_tests: test_name, test_step = yaml_test.popitem() - if test_name == "setup": + if test_name == "requires": + requires = test_step + elif test_name == "setup": setup_steps = test_step elif test_name == "teardown": teardown_steps = test_step @@ -609,14 +534,17 @@ def remove_implicit_resolver(cls, tag_to_remove): test_numbers_and_steps.append((test_number, test_step)) test_number += 1 + if not requires["stack"]: + continue + # Now we combine setup, teardown, and test_steps into # a set of pytest.param() instances for test_number, test_step in test_numbers_and_steps: - # Build the id from the name of the YAML file and - # the number within that file. Most important step - # is to remove most of the file path prefixes and - # the .yml suffix. - pytest_test_name = yaml_file.rpartition(".")[0].replace(".", "/") + # Build the id from the name of the YAML file and the number within + # that file. Most important step is to remove most of the file path + # prefixes and the .yml suffix. + test_path = "/".join(yaml_file.split("/")[2:]) + pytest_test_name = test_path.rpartition(".")[0].replace(".", "/") for prefix in ("rest-api-spec/", "test/", "free/", "platinum/"): if pytest_test_name.startswith(prefix): pytest_test_name = pytest_test_name[len(prefix) :] @@ -628,7 +556,9 @@ def remove_implicit_resolver(cls, tag_to_remove): "teardown": teardown_steps, } # Skip either 'test_name' or 'test_name[x]' - if pytest_test_name in SKIP_TESTS or pytest_param_id in SKIP_TESTS: + if pytest_test_name in FAILING_TESTS or pytest_param_id in FAILING_TESTS: + pytest_param["fail"] = True + elif pytest_test_name in SKIPPED_TESTS or pytest_param_id in SKIPPED_TESTS: pytest_param["skip"] = True YAML_TEST_SPECS.append(pytest.param(pytest_param, id=pytest_param_id)) @@ -645,12 +575,13 @@ def _pytest_param_sort_key(param: pytest.param) -> Tuple[Union[str, int], ...]: # Sort the tests by ID so they're grouped together nicely. YAML_TEST_SPECS = sorted(YAML_TEST_SPECS, key=_pytest_param_sort_key) - if not RUN_ASYNC_REST_API_TESTS: @pytest.mark.parametrize("test_spec", YAML_TEST_SPECS) def test_rest_api_spec(test_spec, sync_runner): - if test_spec.get("skip", False): - pytest.skip("Manually skipped in 'SKIP_TESTS'") + if test_spec.get("fail", False): + pytest.xfail("Manually marked as failing in 'FAILING_TESTS'") + elif test_spec.get("skip", False): + pytest.skip("Manually marked as skipped") sync_runner.use_spec(test_spec) sync_runner.run() diff --git a/test_elasticsearch/test_server/test_vectorstore/__init__.py b/test_elasticsearch/test_server/test_vectorstore/__init__.py index 87710976a..1b480978c 100644 --- a/test_elasticsearch/test_server/test_vectorstore/__init__.py +++ b/test_elasticsearch/test_server/test_vectorstore/__init__.py @@ -69,7 +69,7 @@ def embed_documents(self, texts: List[str]) -> List[List[float]]: if text not in self.known_texts: self.known_texts.append(text) vector = [float(1.0)] * (self.dimensionality - 1) + [ - float(self.known_texts.index(text)) + float(self.known_texts.index(text) + 1) ] out_vectors.append(vector) return out_vectors diff --git a/test_elasticsearch/test_server/test_vectorstore/test_vectorstore.py b/test_elasticsearch/test_server/test_vectorstore/test_vectorstore.py index 820746acd..3e17442eb 100644 --- a/test_elasticsearch/test_server/test_vectorstore/test_vectorstore.py +++ b/test_elasticsearch/test_server/test_vectorstore/test_vectorstore.py @@ -33,6 +33,7 @@ VectorStore, ) from elasticsearch.helpers.vectorstore._sync._utils import model_is_deployed +from test_elasticsearch.utils import es_version from . import ConsistentFakeEmbeddings, FakeEmbeddings @@ -72,7 +73,7 @@ def assert_query(query_body: dict, query: Optional[str]) -> dict: "filter": [], "k": 1, "num_candidates": 50, - "query_vector": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0], + "query_vector": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0], } } return query_body @@ -80,7 +81,7 @@ def assert_query(query_body: dict, query: Optional[str]) -> dict: store = VectorStore( index=index, retrieval_strategy=DenseVectorStrategy(), - embedding_service=FakeEmbeddings(), + embedding_service=ConsistentFakeEmbeddings(), client=sync_client, ) @@ -97,7 +98,7 @@ def test_search_without_metadata_async( store = VectorStore( index=index, retrieval_strategy=DenseVectorStrategy(), - embedding_service=FakeEmbeddings(), + embedding_service=ConsistentFakeEmbeddings(), client=sync_client, ) @@ -337,6 +338,9 @@ def test_search_knn_with_hybrid_search( self, sync_client: Elasticsearch, index: str ) -> None: """Test end to end construction and search with metadata.""" + if es_version(sync_client) < (8, 14): + pytest.skip("This test requires Elasticsearch 8.14 or newer") + store = VectorStore( index=index, retrieval_strategy=DenseVectorStrategy(hybrid=True), @@ -349,20 +353,48 @@ def test_search_knn_with_hybrid_search( def assert_query(query_body: dict, query: Optional[str]) -> dict: assert query_body == { - "knn": { - "field": "vector_field", - "filter": [], - "k": 1, - "num_candidates": 50, - "query_vector": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0], - }, - "query": { - "bool": { - "filter": [], - "must": [{"match": {"text_field": {"query": "foo"}}}], + "retriever": { + "rrf": { + "retrievers": [ + { + "standard": { + "query": { + "bool": { + "filter": [], + "must": [ + { + "match": { + "text_field": {"query": "foo"} + } + } + ], + } + }, + }, + }, + { + "knn": { + "field": "vector_field", + "filter": [], + "k": 1, + "num_candidates": 50, + "query_vector": [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 0.0, + ], + }, + }, + ], } - }, - "rank": {"rrf": {}}, + } } return query_body @@ -373,6 +405,9 @@ def test_search_knn_with_hybrid_search_rrf( self, sync_client: Elasticsearch, index: str ) -> None: """Test end to end construction and rrf hybrid search with metadata.""" + if es_version(sync_client) < (8, 14): + pytest.skip("This test requires Elasticsearch 8.14 or newer") + texts = ["foo", "bar", "baz"] def assert_query( @@ -380,48 +415,67 @@ def assert_query( query: Optional[str], expected_rrf: Union[dict, bool], ) -> dict: - cmp_query_body = { - "knn": { - "field": "vector_field", - "filter": [], - "k": 3, - "num_candidates": 50, - "query_vector": [ - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, - 0.0, - ], - }, + standard_query = { "query": { "bool": { "filter": [], "must": [{"match": {"text_field": {"query": "foo"}}}], } - }, + } + } + knn_query = { + "field": "vector_field", + "filter": [], + "k": 3, + "num_candidates": 50, + "query_vector": [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 0.0, + ], } - if isinstance(expected_rrf, dict): - cmp_query_body["rank"] = {"rrf": expected_rrf} - elif isinstance(expected_rrf, bool) and expected_rrf is True: - cmp_query_body["rank"] = {"rrf": {}} + if expected_rrf is not False: + cmp_query_body = { + "retriever": { + "rrf": { + "retrievers": [ + {"standard": standard_query}, + {"knn": knn_query}, + ], + } + } + } + if isinstance(expected_rrf, dict): + cmp_query_body["retriever"]["rrf"].update(expected_rrf) + else: + cmp_query_body = { + "knn": knn_query, + **standard_query, + } assert query_body == cmp_query_body return query_body # 1. check query_body is okay - rrf_test_cases: List[Union[dict, bool]] = [ - True, - False, - {"rank_constant": 1, "window_size": 5}, - ] + if es_version(sync_client) >= (8, 14): + rrf_test_cases: List[Union[dict, bool]] = [ + True, + False, + {"rank_constant": 1, "rank_window_size": 5}, + ] + else: + # for 8.13.x and older there is no retriever query, so we can only + # run hybrid searches with rrf=False + rrf_test_cases: List[Union[dict, bool]] = [False] for rrf_test_case in rrf_test_cases: store = VectorStore( index=index, @@ -441,21 +495,47 @@ def assert_query( # 2. check query result is okay es_output = store.client.search( index=index, - query={ - "bool": { - "filter": [], - "must": [{"match": {"text_field": {"query": "foo"}}}], + retriever={ + "rrf": { + "retrievers": [ + { + "knn": { + "field": "vector_field", + "filter": [], + "k": 3, + "num_candidates": 50, + "query_vector": [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 0.0, + ], + }, + }, + { + "standard": { + "query": { + "bool": { + "filter": [], + "must": [ + {"match": {"text_field": {"query": "foo"}}} + ], + } + }, + }, + }, + ], + "rank_constant": 1, + "rank_window_size": 5, } }, - knn={ - "field": "vector_field", - "filter": [], - "k": 3, - "num_candidates": 50, - "query_vector": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0], - }, size=3, - rank={"rrf": {"rank_constant": 1, "window_size": 5}}, ) assert [o["_source"]["text_field"] for o in output] == [ @@ -950,6 +1030,11 @@ def test_metadata_mapping(self, sync_client: Elasticsearch, index: str) -> None: "type": "dense_vector", "dims": 10, "index": True, + "index_options": { + "ef_construction": 100, + "m": 16, + "type": "int8_hnsw", + }, "similarity": "cosine", } diff --git a/test_elasticsearch/utils.py b/test_elasticsearch/utils.py index abff98a55..cfcb5259c 100644 --- a/test_elasticsearch/utils.py +++ b/test_elasticsearch/utils.py @@ -22,11 +22,8 @@ from typing import Optional, Tuple from elasticsearch import ( - AuthorizationException, ConnectionError, Elasticsearch, - NotFoundError, - RequestError, ) SOURCE_DIR = Path(__file__).absolute().parent.parent @@ -119,40 +116,15 @@ def wipe_cluster(client): except ImportError: pass - is_xpack = True - if is_xpack: - wipe_rollup_jobs(client) - wait_for_pending_tasks(client, filter="xpack/rollup/job") - wipe_slm_policies(client) - - # Searchable snapshot indices start in 7.8+ - if es_version(client) >= (7, 8): - wipe_searchable_snapshot_indices(client) - wipe_snapshots(client) - if is_xpack: - wipe_data_streams(client) + wipe_data_streams(client) wipe_indices(client) - if is_xpack: - wipe_xpack_templates(client) - else: - client.indices.delete_template(name="*") - client.indices.delete_index_template(name="*") - client.cluster.delete_component_template(name="*") + client.indices.delete_template(name="*") + client.indices.delete_index_template(name="*") wipe_cluster_settings(client) - if is_xpack: - wipe_ilm_policies(client) - wipe_auto_follow_patterns(client) - wipe_tasks(client) - wipe_node_shutdown_metadata(client) - wait_for_pending_datafeeds_and_jobs(client) - wipe_calendars(client) - wipe_filters(client) - wipe_transforms(client) - wait_for_cluster_state_updates_to_finish(client) if close_after_wipe: client.close() @@ -170,16 +142,6 @@ def wipe_cluster_settings(client): client.cluster.put_settings(body=new_settings) -def wipe_rollup_jobs(client): - rollup_jobs = client.rollup.get_jobs(id="_all").get("jobs", ()) - for job in rollup_jobs: - job_id = job["config"]["id"] - client.options(ignore_status=404).rollup.stop_job( - id=job_id, wait_for_completion=True - ) - client.options(ignore_status=404).rollup.delete_job(id=job_id) - - def wipe_snapshots(client): """Deletes all the snapshots and repositories from the cluster""" in_progress_snapshots = [] @@ -217,240 +179,15 @@ def wipe_data_streams(client): def wipe_indices(client): indices = client.cat.indices().strip().splitlines() if len(indices) > 0: - index_names = [i.split(" ")[2] for i in indices] + index_names = [i.split()[2] for i in indices] client.options(ignore_status=404).indices.delete( index=",".join(index_names), expand_wildcards="all", ) -def wipe_searchable_snapshot_indices(client): - cluster_metadata = client.cluster.state( - metric="metadata", - filter_path="metadata.indices.*.settings.index.store.snapshot", - ) - if cluster_metadata: - for index in cluster_metadata["metadata"]["indices"].keys(): - client.indices.delete(index=index) - - -def wipe_xpack_templates(client): - templates = [ - x.strip() for x in client.cat.templates(h="name").split("\n") if x.strip() - ] - for template in templates: - if is_xpack_template(template): - continue - try: - client.indices.delete_template(name=template) - except NotFoundError as e: - if f"index_template [{template}] missing" in str(e): - client.indices.delete_index_template(name=template) - - # Delete component templates, need to retry because sometimes - # indices aren't cleaned up in time before we issue the delete. - templates = client.cluster.get_component_template()["component_templates"] - templates_to_delete = [ - template for template in templates if not is_xpack_template(template["name"]) - ] - for _ in range(3): - for template in list(templates_to_delete): - try: - client.cluster.delete_component_template( - name=template["name"], - ) - except RequestError: - pass - else: - templates_to_delete.remove(template) - - if not templates_to_delete: - break - time.sleep(0.01) - - -def wipe_ilm_policies(client): - for policy in client.ilm.get_lifecycle(): - if ( - policy - not in { - "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", - ".deprecation-indexing-ilm-policy", - ".monitoring-8-ilm-policy", - } - and "-history-ilm-polcy" not in policy - ): - client.ilm.delete_lifecycle(name=policy) - - -def wipe_slm_policies(client): - policies = client.slm.get_lifecycle() - for policy in policies: - if policy not in {"cloud-snapshot-policy"}: - client.slm.delete_lifecycle(policy_id=policy) - - -def wipe_auto_follow_patterns(client): - for pattern in client.ccr.get_auto_follow_pattern()["patterns"]: - client.ccr.delete_auto_follow_pattern(name=pattern["name"]) - - -def wipe_node_shutdown_metadata(client): - try: - shutdown_status = client.shutdown.get_node() - # If response contains these two keys the feature flag isn't enabled - # on this cluster so skip this step now. - if "_nodes" in shutdown_status and "cluster_name" in shutdown_status: - return - - for shutdown_node in shutdown_status.get("nodes", []): - node_id = shutdown_node["node_id"] - client.shutdown.delete_node(node_id=node_id) - - # Elastic Cloud doesn't allow this so we skip. - except AuthorizationException: - pass - - -def wipe_tasks(client): - tasks = client.tasks.list() - for node_name, node in tasks.get("node", {}).items(): - for task_id in node.get("tasks", ()): - client.tasks.cancel(task_id=task_id, wait_for_completion=True) - - -def wait_for_pending_tasks(client, filter, timeout=30): - end_time = time.time() + timeout - while time.time() < end_time: - tasks = client.cat.tasks(detailed=True).split("\n") - if not any(filter in task for task in tasks): - break - - -def wait_for_pending_datafeeds_and_jobs(client: Elasticsearch, timeout=30): - end_time = time.time() + timeout - while time.time() < end_time: - resp = client.ml.get_datafeeds(datafeed_id="*", allow_no_match=True) - if resp["count"] == 0: - break - for datafeed in resp["datafeeds"]: - client.options(ignore_status=404).ml.delete_datafeed( - datafeed_id=datafeed["datafeed_id"] - ) - - end_time = time.time() + timeout - while time.time() < end_time: - resp = client.ml.get_jobs(job_id="*", allow_no_match=True) - if resp["count"] == 0: - break - for job in resp["jobs"]: - client.options(ignore_status=404).ml.close_job(job_id=job["job_id"]) - client.options(ignore_status=404).ml.delete_job(job_id=job["job_id"]) - - end_time = time.time() + timeout - while time.time() < end_time: - resp = client.ml.get_data_frame_analytics(id="*") - if resp["count"] == 0: - break - for job in resp["data_frame_analytics"]: - client.options(ignore_status=404).ml.stop_data_frame_analytics(id=job["id"]) - client.options(ignore_status=404).ml.delete_data_frame_analytics( - id=job["id"] - ) - - -def wipe_filters(client: Elasticsearch, timeout=30): - end_time = time.time() + timeout - while time.time() < end_time: - resp = client.ml.get_filters(filter_id="*") - if resp["count"] == 0: - break - for filter in resp["filters"]: - client.options(ignore_status=404).ml.delete_filter( - filter_id=filter["filter_id"] - ) - - -def wipe_calendars(client: Elasticsearch, timeout=30): - end_time = time.time() + timeout - while time.time() < end_time: - resp = client.ml.get_calendars(calendar_id="*") - if resp["count"] == 0: - break - for calendar in resp["calendars"]: - client.options(ignore_status=404).ml.delete_calendar( - calendar_id=calendar["calendar_id"] - ) - - -def wipe_transforms(client: Elasticsearch, timeout=30): - end_time = time.time() + timeout - while time.time() < end_time: - resp = client.transform.get_transform(transform_id="*") - if resp["count"] == 0: - break - for trasnform in resp["transforms"]: - client.options(ignore_status=404).transform.stop_transform( - transform_id=trasnform["id"] - ) - client.options(ignore_status=404).transform.delete_transform( - transform_id=trasnform["id"] - ) - - def wait_for_cluster_state_updates_to_finish(client, timeout=30): end_time = time.time() + timeout while time.time() < end_time: if not client.cluster.pending_tasks().get("tasks", ()): break - - -def is_xpack_template(name): - if name.startswith(".monitoring-"): - return True - elif name.startswith(".watch") or name.startswith(".triggered_watches"): - return True - elif name.startswith(".data-frame-"): - return True - elif name.startswith(".ml-"): - return True - elif name.startswith(".transform-"): - return True - elif name.startswith(".deprecation-"): - return True - if name in { - ".watches", - "security_audit_log", - ".slm-history", - ".async-search", - "saml-service-provider", - "logs", - "logs-settings", - "logs-mappings", - "metrics", - "metrics-settings", - "metrics-mappings", - "synthetics", - "synthetics-settings", - "synthetics-mappings", - ".snapshot-blob-cache", - "ilm-history", - "logstash-index-template", - "security-index-template", - "data-streams-mappings", - }: - return True - return False diff --git a/utils/build-dists.py b/utils/build-dists.py index ec8083103..d67d6053a 100644 --- a/utils/build-dists.py +++ b/utils/build-dists.py @@ -42,7 +42,6 @@ def set_tmp_dir(): def run(*argv, expect_exit_code=0): - global tmp_dir try: prev_dir = os.getcwd() if tmp_dir is None: diff --git a/utils/generate-docs-examples/package-lock.json b/utils/generate-docs-examples/package-lock.json index 3148aba96..7c255e572 100644 --- a/utils/generate-docs-examples/package-lock.json +++ b/utils/generate-docs-examples/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "Apache-2.0", "dependencies": { - "@elastic/request-converter": "~8.15.2", + "@elastic/request-converter": "^8.15.2", "minimist": "^1.2.6", "node-fetch": "^2.6.7", "ora": "^5.4.1", @@ -17,12 +17,12 @@ } }, "node_modules/@elastic/request-converter": { - "version": "8.15.4", - "resolved": "https://registry.npmjs.org/@elastic/request-converter/-/request-converter-8.15.4.tgz", - "integrity": "sha512-iZDQpZpygV+AVOweaDzTsMJBfa2hwwduPXNNzk/yTXgC9qtjmns/AjehtLStKXs274+u3fg+BFxVt6NcMwUAAg==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/@elastic/request-converter/-/request-converter-8.18.0.tgz", + "integrity": "sha512-xEIB17voGulAfBThFqqtk8Osc+dNHiCqN9GW0Nf6PunNdvmAT5YvMb6u4NNI+NPAxNu90ak396g+ThjH9VRGIw==", "license": "Apache-2.0", "dependencies": { - "child-process-promise": "^2.2.1", + "base64url": "^3.0.1", "commander": "^12.1.0", "find-my-way-ts": "^0.1.2", "handlebars": "^4.7.8", @@ -82,6 +82,15 @@ ], "license": "MIT" }, + "node_modules/base64url": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", + "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -143,17 +152,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/child-process-promise": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/child-process-promise/-/child-process-promise-2.2.1.tgz", - "integrity": "sha512-Fi4aNdqBsr0mv+jgWxcZ/7rAIC2mgihrptyVI4foh/rrjY/3BNjfP9+oaiFx/fzim+1ZyCNBae0DlyfQhSugog==", - "license": "MIT", - "dependencies": { - "cross-spawn": "^4.0.2", - "node-version": "^1.0.0", - "promise-polyfill": "^6.0.1" - } - }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -220,16 +218,6 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "license": "MIT" }, - "node_modules/cross-spawn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==", - "license": "MIT", - "dependencies": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - } - }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -363,12 +351,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC" - }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", @@ -385,16 +367,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "license": "ISC", - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -451,15 +423,6 @@ } } }, - "node_modules/node-version": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/node-version/-/node-version-1.2.0.tgz", - "integrity": "sha512-ma6oU4Sk0qOoKEAymVoTvk8EdXEobdS7m/mAGhDJ8Rouugho48crHBORAmy5BoOcv8wraPM6xumapQp5hl4iIQ==", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -531,18 +494,6 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/promise-polyfill": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.1.0.tgz", - "integrity": "sha512-g0LWaH0gFsxovsU7R5LrrhHhWAWiHRnh1GPrhXnPgYsDkIqjRYUYSZEsej/wtleDrz5xVSIDbeKfidztp2XHFQ==", - "license": "MIT" - }, - "node_modules/pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", - "license": "ISC" - }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", @@ -704,18 +655,6 @@ "webidl-conversions": "^3.0.0" } }, - "node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -727,12 +666,6 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "license": "ISC" - }, - "node_modules/yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", - "license": "ISC" } } }