pax_global_header 0000666 0000000 0000000 00000000064 15176617013 0014521 g ustar 00root root 0000000 0000000 52 comment=76e23a37d0cea34c7a580781fd6bf2b678139fb4
python-elasticsearch-9.4.0/ 0000775 0000000 0000000 00000000000 15176617013 0015664 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/.buildkite/ 0000775 0000000 0000000 00000000000 15176617013 0017716 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/.buildkite/Dockerfile 0000664 0000000 0000000 00000001411 15176617013 0021705 0 ustar 00root root 0000000 0000000 ARG PYTHON_VERSION=3.14
FROM python:${PYTHON_VERSION}
# Default UID/GID to 1000
# it can be overridden at build time
ARG BUILDER_UID=1000
ARG BUILDER_GID=1000
ENV BUILDER_USER elastic
ENV BUILDER_GROUP elastic
ENV PATH="${PATH}:/var/lib/elastic/.local/bin"
# Create user
RUN groupadd --system -g ${BUILDER_GID} ${BUILDER_GROUP} \
&& useradd --system --shell /bin/bash -u ${BUILDER_UID} -g ${BUILDER_GROUP} -d /var/lib/elastic -m elastic 1>/dev/null 2>/dev/null \
&& mkdir -p /code/elasticsearch-py && mkdir /code/elasticsearch-py/build \
&& chown -R ${BUILDER_USER}:${BUILDER_GROUP} /code/
WORKDIR /code/elasticsearch-py
USER ${BUILDER_USER}:${BUILDER_GROUP}
RUN python -m pip install --disable-pip-version-check nox
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
python-elasticsearch-9.4.0/.buildkite/certs/ 0000775 0000000 0000000 00000000000 15176617013 0021036 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/.buildkite/certs/README.md 0000664 0000000 0000000 00000001670 15176617013 0022321 0 ustar 00root root 0000000 0000000 # 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.
python-elasticsearch-9.4.0/.buildkite/certs/ca.crt 0000664 0000000 0000000 00000001250 15176617013 0022131 0 ustar 00root root 0000000 0000000 -----BEGIN CERTIFICATE-----
MIIByTCCAW+gAwIBAgIUIYClYWXiTsB8aMrEEMrzdrk5rOswCgYIKoZIzj0EAwIw
QDEXMBUGA1UECgwOdHJ1c3RtZSB2MS4yLjAxJTAjBgNVBAsMHFRlc3RpbmcgQ0Eg
I2JpdzFXYzEwbHBxQ0ZRTDUwIBcNMDAwMTAxMDAwMDAwWhgPMzAwMDAxMDEwMDAw
MDBaMEAxFzAVBgNVBAoMDnRydXN0bWUgdjEuMi4wMSUwIwYDVQQLDBxUZXN0aW5n
IENBICNiaXcxV2MxMGxwcUNGUUw1MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE
SN7++A76LmOR0tKKra1M6VVzGUljjL9fVPxOEIblOOJJhA7mKLQguNzEHjucNV23
LcDzMX/M/oUBGdYZBbAv4qNFMEMwHQYDVR0OBBYEFCrGGcO9v0UAWSsD93P/x2MT
NiJbMBIGA1UdEwEB/wQIMAYBAf8CAQkwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49
BAMCA0gAMEUCIQDGyO21zIAwmARtoc2atVmmqZdPVkegHkCKCFY4P+KeEAIgKMCz
aU8LPCVyA+ZF9K+tcqkNK5h/5s7wlQ5DSeKSuE8=
-----END CERTIFICATE-----
python-elasticsearch-9.4.0/.buildkite/certs/testnode.crt 0000664 0000000 0000000 00000001456 15176617013 0023403 0 ustar 00root root 0000000 0000000 -----BEGIN CERTIFICATE-----
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-----
python-elasticsearch-9.4.0/.buildkite/certs/testnode.key 0000664 0000000 0000000 00000000343 15176617013 0023375 0 ustar 00root root 0000000 0000000 -----BEGIN EC PRIVATE KEY-----
MHcCAQEEIN+K8+F47YchiH+7gA8KBG8u35PWcOJN+Fszv8TPEEpdoAoGCCqGSM49
AwEHoUQDQgAEqelGnUWdGT9xdinhJCFDn9AfBjk1+eQfdUTvzy1EG9usGXFphxjz
idBwMvRdhGPqydcw1J3weZrKMHov4rqGjA==
-----END EC PRIVATE KEY-----
python-elasticsearch-9.4.0/.buildkite/functions/ 0000775 0000000 0000000 00000000000 15176617013 0021726 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/.buildkite/functions/cleanup.sh 0000775 0000000 0000000 00000003647 15176617013 0023726 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
#
# Shared cleanup routines between different steps
#
# Please source .buildkite/functions/imports.sh as a whole not just this file
#
# Version 1.0.0
# - Initial version after refactor
function cleanup_volume {
if [[ "$(docker volume ls -q -f name=$1)" ]]; then
echo -e "\033[34;1mINFO:\033[0m Removing volume $1\033[0m"
(docker volume rm "$1") || true
fi
}
function container_running {
if [[ "$(docker ps -q -f name=$1)" ]]; then
return 0;
else return 1;
fi
}
function cleanup_node {
if container_running "$1"; then
echo -e "\033[34;1mINFO:\033[0m Removing container $1\033[0m"
(docker container rm --force --volumes "$1") || true
fi
if [[ -n "$1" ]]; then
echo -e "\033[34;1mINFO:\033[0m Removing volume $1-${suffix}-data\033[0m"
cleanup_volume "$1-${suffix}-data"
fi
}
function cleanup_network {
if [[ "$(docker network ls -q -f name=$1)" ]]; then
echo -e "\033[34;1mINFO:\033[0m Removing network $1\033[0m"
(docker network rm "$1") || true
fi
}
function cleanup_trap {
status=$?
set +x
if [[ "$DETACH" != "true" ]]; then
echo -e "\033[34;1mINFO:\033[0m clean the network if not detached (start and exit)\033[0m"
cleanup_all_in_network "$1"
fi
# status is 0 or SIGINT
if [[ "$status" == "0" || "$status" == "130" ]]; then
echo -e "\n\033[32;1mSUCCESS run-tests\033[0m"
exit 0
else
echo -e "\n\033[31;1mFAILURE during run-tests\033[0m"
exit ${status}
fi
};
function cleanup_all_in_network {
if [[ -z "$(docker network ls -q -f name="^$1\$")" ]]; then
echo -e "\033[34;1mINFO:\033[0m $1 is already deleted\033[0m"
return 0
fi
containers=$(docker network inspect -f '{{ range $key, $value := .Containers }}{{ printf "%s\n" .Name}}{{ end }}' $1)
while read -r container; do
cleanup_node "$container"
done <<< "$containers"
cleanup_network $1
echo -e "\033[32;1mSUCCESS:\033[0m Cleaned up and exiting\033[0m"
};
python-elasticsearch-9.4.0/.buildkite/functions/imports.sh 0000775 0000000 0000000 00000003460 15176617013 0023765 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
#
# Sets up all the common variables and imports relevant functions
#
# Version 1.0.1
# - Initial version after refactor
# - Validate STACK_VERSION asap
function require_stack_version() {
if [[ -z $STACK_VERSION ]]; then
echo -e "\033[31;1mERROR:\033[0m Required environment variable [STACK_VERSION] not set\033[0m"
exit 1
fi
}
require_stack_version
if [[ -z $es_node_name ]]; then
# only set these once
set -euo pipefail
export TEST_SUITE=${TEST_SUITE-platinum}
export RUNSCRIPTS=${RUNSCRIPTS-}
export DETACH=${DETACH-false}
export CLEANUP=${CLEANUP-false}
export es_node_name=instance
export elastic_password=changeme
export elasticsearch_image=elasticsearch
export elasticsearch_url=https://elastic:${elastic_password}@${es_node_name}:9200
if [[ $TEST_SUITE != "platinum" ]]; then
export elasticsearch_url=http://${es_node_name}:9200
fi
export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost}
export elasticsearch_container="${elasticsearch_image}:${STACK_VERSION}"
export suffix=rest-test
export moniker=$(echo "$elasticsearch_container" | tr -C "[:alnum:]" '-')
export network_name=${moniker}${suffix}
export ssl_cert="${script_path}/certs/testnode.crt"
export ssl_key="${script_path}/certs/testnode.key"
export ssl_ca="${script_path}/certs/ca.crt"
fi
export script_path=$(dirname $(realpath $0))
source $script_path/functions/cleanup.sh
source $script_path/functions/wait-for-container.sh
trap "cleanup_trap ${network_name}" EXIT
if [[ "$CLEANUP" == "true" ]]; then
cleanup_all_in_network $network_name
exit 0
fi
echo -e "\033[34;1mINFO:\033[0m Creating network $network_name if it does not exist already \033[0m"
docker network inspect "$network_name" > /dev/null 2>&1 || docker network create "$network_name"
python-elasticsearch-9.4.0/.buildkite/functions/wait-for-container.sh 0000775 0000000 0000000 00000002474 15176617013 0026004 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
#
# Exposes a routine scripts can call to wait for a container if that container set up a health command
#
# Please source .buildkite/functions/imports.sh as a whole not just this file
#
# Version 1.0.1
# - Initial version after refactor
# - Make sure wait_for_contiainer is silent
function wait_for_container {
set +x
until ! container_running "$1" || (container_running "$1" && [[ "$(docker inspect -f "{{.State.Health.Status}}" ${1})" != "starting" ]]); do
echo ""
docker inspect -f "{{range .State.Health.Log}}{{.Output}}{{end}}" ${1}
echo -e "\033[34;1mINFO:\033[0m waiting for node $1 to be up\033[0m"
sleep 2;
done;
# Always show logs if the container is running, this is very useful both on CI as well as while developing
if container_running $1; then
docker logs $1
fi
if ! container_running $1 || [[ "$(docker inspect -f "{{.State.Health.Status}}" ${1})" != "healthy" ]]; then
cleanup_all_in_network $2
echo
echo -e "\033[31;1mERROR:\033[0m Failed to start $1 in detached mode beyond health checks\033[0m"
echo -e "\033[31;1mERROR:\033[0m dumped the docker log before shutting the node down\033[0m"
return 1
else
echo
echo -e "\033[32;1mSUCCESS:\033[0m Detached and healthy: ${1} on docker network: ${network_name}\033[0m"
return 0
fi
}
python-elasticsearch-9.4.0/.buildkite/pipeline.yml 0000664 0000000 0000000 00000001613 15176617013 0022247 0 ustar 00root root 0000000 0000000 steps:
- 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: "9.4.0-SNAPSHOT"
PYTHON_CONNECTION_CLASS: "{{ matrix.connection }}"
NOX_SESSION: "{{ matrix.nox_session }}"
matrix:
setup:
python:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
connection:
- "urllib3"
- "requests"
nox_session:
- "test"
adjustments:
- with:
python: "3.10"
connection: "urllib3"
nox_session: "test_otel"
- with:
python: "3.14"
connection: "urllib3"
nox_session: "test_otel"
command: ./.buildkite/run-tests
python-elasticsearch-9.4.0/.buildkite/pull-requests.json 0000664 0000000 0000000 00000000374 15176617013 0023442 0 ustar 00root root 0000000 0000000 {
"jobs": [
{
"enabled": true,
"pipeline_slug": "elasticsearch-py-integration-tests",
"allow_org_users": true
},
{
"enabled": true,
"pipeline_slug": "docs-build-pr",
"allow_org_users": true
}
]
}
python-elasticsearch-9.4.0/.buildkite/run-elasticsearch.sh 0000775 0000000 0000000 00000012721 15176617013 0023674 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
#
# Launch one or more Elasticsearch nodes via the Docker image,
# to form a cluster suitable for running the REST API tests.
#
# Export the STACK_VERSION variable, eg. '8.0.0-SNAPSHOT'.
# Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'.
# Export the NUMBER_OF_NODES variable to start more than 1 node
# Version 1.6.0
# - Initial version of the run-elasticsearch.sh script
# - Deleting the volume should not dependent on the container still running
# - Fixed `ES_JAVA_OPTS` config
# - Moved to STACK_VERSION and TEST_VERSION
# - Refactored into functions and imports
# - Support NUMBER_OF_NODES
# - Added 5 retries on docker pull for fixing transient network errors
# - Added flags to make local CCR configurations work
# - Added action.destructive_requires_name=false as the default will be true in v8
# - Added ingest.geoip.downloader.enabled=false as it causes false positives in testing
# - Moved ELASTIC_PASSWORD and xpack.security.enabled to the base arguments for "Security On by default"
# - Use https only when TEST_SUITE is "platinum", when "free" use http
script_path=$(dirname $(realpath $0))
source $script_path/functions/imports.sh
set -euo pipefail
echo -e "\033[34;1mINFO:\033[0m Take down node if called twice with the same arguments (DETACH=true) or on seperate terminals \033[0m"
cleanup_node $es_node_name
master_node_name=${es_node_name}
cluster_name=${moniker}${suffix}
BUILDKITE=${BUILDKITE-false}
# Set vm.max_map_count kernel setting to 262144 if we're in CI
if [[ "$BUILDKITE" == "true" ]]; then
sudo sysctl -w vm.max_map_count=262144
fi
declare -a volumes
environment=($(cat <<-END
--env ELASTIC_PASSWORD=$elastic_password
--env xpack.security.enabled=true
--env node.name=$es_node_name
--env cluster.name=$cluster_name
--env cluster.initial_master_nodes=$master_node_name
--env discovery.seed_hosts=$master_node_name
--env cluster.routing.allocation.disk.threshold_enabled=false
--env bootstrap.memory_lock=true
--env node.attr.testattr=test
--env path.repo=/tmp
--env repositories.url.allowed_urls=http://snapshot.test*
--env action.destructive_requires_name=false
--env ingest.geoip.downloader.enabled=false
--env cluster.deprecation_indexing.enabled=false
END
))
if [[ "$TEST_SUITE" == "platinum" ]]; then
environment+=($(cat <<-END
--env xpack.license.self_generated.type=trial
--env xpack.security.http.ssl.enabled=true
--env xpack.security.http.ssl.verification_mode=certificate
--env xpack.security.http.ssl.key=certs/testnode.key
--env xpack.security.http.ssl.certificate=certs/testnode.crt
--env xpack.security.http.ssl.certificate_authorities=certs/ca.crt
--env xpack.security.transport.ssl.enabled=true
--env xpack.security.transport.ssl.verification_mode=certificate
--env xpack.security.transport.ssl.key=certs/testnode.key
--env xpack.security.transport.ssl.certificate=certs/testnode.crt
--env xpack.security.transport.ssl.certificate_authorities=certs/ca.crt
END
))
volumes+=($(cat <<-END
--volume $ssl_cert:/usr/share/elasticsearch/config/certs/testnode.crt
--volume $ssl_key:/usr/share/elasticsearch/config/certs/testnode.key
--volume $ssl_ca:/usr/share/elasticsearch/config/certs/ca.crt
END
))
else
environment+=($(cat <<-END
--env xpack.security.http.ssl.enabled=false
END
))
fi
cert_validation_flags=""
if [[ "$TEST_SUITE" == "platinum" ]]; then
cert_validation_flags="--insecure --cacert /usr/share/elasticsearch/config/certs/ca.crt --resolve ${es_node_name}:443:127.0.0.1"
fi
# Pull the container, retry on failures up to 5 times with
# short delays between each attempt. Fixes most transient network errors.
docker_pull_attempts=0
until [ "$docker_pull_attempts" -ge 5 ]
do
docker pull docker.elastic.co/elasticsearch/"$elasticsearch_container" && break
docker_pull_attempts=$((docker_pull_attempts+1))
echo "Failed to pull image, retrying in 10 seconds (retry $docker_pull_attempts/5)..."
sleep 10
done
NUMBER_OF_NODES=${NUMBER_OF_NODES-1}
http_port=9200
for (( i=0; i<$NUMBER_OF_NODES; i++, http_port++ )); do
node_name=${es_node_name}$i
node_url=${external_elasticsearch_url/9200/${http_port}}$i
if [[ "$i" == "0" ]]; then node_name=$es_node_name; fi
environment+=($(cat <<-END
--env node.name=$node_name
END
))
echo "$i: $http_port $node_url "
volume_name=${node_name}-${suffix}-data
volumes+=($(cat <<-END
--volume $volume_name:/usr/share/elasticsearch/data${i}
END
))
# make sure we detach for all but the last node if DETACH=false (default) so all nodes are started
local_detach="true"
if [[ "$i" == "$((NUMBER_OF_NODES-1))" ]]; then local_detach=$DETACH; fi
echo -e "\033[34;1mINFO:\033[0m Starting container $node_name \033[0m"
set -x
docker run \
-u "$(id -u)" \
--name "$node_name" \
--network "$network_name" \
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g -da:org.elasticsearch.xpack.ccr.index.engine.FollowingEngineAssertions" \
"${environment[@]}" \
"${volumes[@]}" \
--publish "$http_port":9200 \
--ulimit nofile=65536:65536 \
--ulimit memlock=-1:-1 \
--detach="$local_detach" \
--health-cmd="curl $cert_validation_flags --fail $elasticsearch_url/_cluster/health || exit 1" \
--health-interval=2s \
--health-retries=40 \
--health-timeout=2s \
--rm \
docker.elastic.co/elasticsearch/"$elasticsearch_container";
set +x
if wait_for_container "$es_node_name" "$network_name"; then
echo -e "\033[32;1mSUCCESS:\033[0m Running on: $node_url\033[0m"
fi
done
python-elasticsearch-9.4.0/.buildkite/run-nox.sh 0000775 0000000 0000000 00000000157 15176617013 0021666 0 ustar 00root root 0000000 0000000 #!/bin/bash
if [[ -z "$NOX_SESSION" ]]; then
NOX_SESSION=test-${PYTHON_VERSION%-dev}
fi
nox -s $NOX_SESSION
python-elasticsearch-9.4.0/.buildkite/run-repository.sh 0000775 0000000 0000000 00000004366 15176617013 0023307 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
# Called by entry point `run-test` use this script to add your repository specific test commands
# Once called Elasticsearch is up and running and the following parameters are available to this script
# ELASTICSEARCH_VERSION -- version e.g Major.Minor.Patch(-Prelease)
# ELASTICSEARCH_CONTAINER -- the docker moniker as a reference to know which docker image distribution is used
# ELASTICSEARCH_URL -- The url at which elasticsearch is reachable
# NETWORK_NAME -- The docker network name
# NODE_NAME -- The docker container name also used as Elasticsearch node name
# When run in CI the test-matrix is used to define additional variables
# TEST_SUITE -- either `oss` or `xpack`, defaults to `oss` in `run-tests`
set -e
echo -e "\033[34;1mINFO:\033[0m URL ${ELASTICSEARCH_URL}\033[0m"
echo -e "\033[34;1mINFO:\033[0m VERSION ${ELASTICSEARCH_VERSION}\033[0m"
echo -e "\033[34;1mINFO:\033[0m CONTAINER ${ELASTICSEARCH_CONTAINER}\033[0m"
echo -e "\033[34;1mINFO:\033[0m TEST_SUITE ${TEST_SUITE}\033[0m"
echo -e "\033[34;1mINFO:\033[0m NOX_SESSION ${NOX_SESSION}\033[0m"
echo -e "\033[34;1mINFO:\033[0m PYTHON_VERSION ${PYTHON_VERSION}\033[0m"
echo -e "\033[34;1mINFO:\033[0m PYTHON_CONNECTION_CLASS ${PYTHON_CONNECTION_CLASS}\033[0m"
echo -e "\033[34;1mINFO:\033[0m ES_YAML_TESTS_BRANCH ${ES_YAML_TESTS_BRANCH}\033[0m"
echo -e "\033[1m>>>>> Build [elastic/elasticsearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
docker build \
--file .buildkite/Dockerfile \
--tag elastic/elasticsearch-py \
--build-arg "PYTHON_VERSION=${PYTHON_VERSION}" \
--build-arg "BUILDER_UID=$(id -u)" \
--build-arg "BUILDER_GID=$(id -g)" \
.
echo -e "\033[1m>>>>> Run [elastic/elasticsearch-py container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
mkdir -p junit
docker run \
-u "$(id -u):$(id -g)" \
--network=${network_name} \
--env "STACK_VERSION=${STACK_VERSION}" \
--env "ELASTICSEARCH_URL=${elasticsearch_url}" \
--env "TEST_SUITE=${TEST_SUITE}" \
--env "PYTHON_CONNECTION_CLASS=${PYTHON_CONNECTION_CLASS}" \
--env "ES_YAML_TESTS_BRANCH=${ES_YAML_TESTS_BRANCH}" \
--env "TEST_TYPE=server" \
--env "FORCE_COLOR=1" \
--name elasticsearch-py \
--rm \
elastic/elasticsearch-py \
nox -s ${NOX_SESSION}-${PYTHON_VERSION}
python-elasticsearch-9.4.0/.buildkite/run-tests 0000775 0000000 0000000 00000002157 15176617013 0021615 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
#
# Version 1.1
# - Moved to .ci folder and seperated out `run-repository.sh`
# - Add `$RUNSCRIPTS` env var for running Elasticsearch dependent products
# Default environment variables
export STACK_VERSION="${STACK_VERSION:=8.0.0-SNAPSHOT}"
export TEST_SUITE="${TEST_SUITE:=platinum}"
export PYTHON_VERSION="${PYTHON_VERSION:=3.14}"
export PYTHON_CONNECTION_CLASS="${PYTHON_CONNECTION_CLASS:=urllib3}"
export ES_YAML_TESTS_BRANCH="${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
if [[ ! -n "$ES_YAML_TESTS_BRANCH" ]]; then
export ES_YAML_TESTS_BRANCH="${BUILDKITE_BRANCH}"
fi
script_path=$(dirname $(realpath $0))
source $script_path/functions/imports.sh
set -euo pipefail
echo "--- :elasticsearch: Starting Elasticsearch"
DETACH=true bash $script_path/run-elasticsearch.sh
if [[ -n "$RUNSCRIPTS" ]]; then
for RUNSCRIPT in ${RUNSCRIPTS//,/ }; do
echo -e "\033[1m>>>>> Running run-$RUNSCRIPT.sh >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
CONTAINER_NAME=${RUNSCRIPT} \
DETACH=true \
bash $script_path/run-${RUNSCRIPT}.sh
done
fi
echo "+++ :python: Client tests"
bash $script_path/run-repository.sh
python-elasticsearch-9.4.0/.coveragerc 0000664 0000000 0000000 00000000422 15176617013 0020003 0 ustar 00root root 0000000 0000000 [run]
omit =
*/python?.?/*
*/lib-python/?.?/*.py
*/lib_pypy/*
*/site-packages/*
*.egg/*
elasticsearch/_async/client/
elasticsearch/_sync/client/
test_elasticsearch/*
[report]
show_missing = True
exclude_lines=
raise NotImplementedError*
python-elasticsearch-9.4.0/.dockerignore 0000664 0000000 0000000 00000000045 15176617013 0020337 0 ustar 00root root 0000000 0000000 docs
example
venv
.tox
.nox
.*_cache
python-elasticsearch-9.4.0/.github/ 0000775 0000000 0000000 00000000000 15176617013 0017224 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000002110 15176617013 0021723 0 ustar 00root root 0000000 0000000
**Describe the feature**:
**Elasticsearch version** (`bin/elasticsearch --version`):
**`elasticsearch-py` version (`elasticsearch.__versionstr__`)**:
Please make sure the major version matches the Elasticsearch server you are running.
**Description of the problem including expected versus actual behavior**:
**Steps to reproduce**:
python-elasticsearch-9.4.0/.github/make.sh 0000775 0000000 0000000 00000013722 15176617013 0020505 0 ustar 00root root 0000000 0000000 #!/usr/bin/env bash
# ------------------------------------------------------- #
#
# Skeleton for common build entry script for all elastic
# clients. Needs to be adapted to individual client usage.
#
# Must be called: ./.github/make.sh
#
# Version: 1.1.0
#
# Targets:
# ---------------------------
# assemble : build client artefacts with version
# bump : bump client internals to version
# bumpmatrix : bump stack version in test matrix to version
# codegen : generate endpoints
# docsgen : generate documentation
# examplegen : generate the doc examples
# clean : clean workspace
#
# ------------------------------------------------------- #
# ------------------------------------------------------- #
# Bootstrap
# ------------------------------------------------------- #
script_path=$(dirname "$(realpath "$0")")
repo=$(realpath "$script_path/../")
# shellcheck disable=SC1090
CMD=$1
TASK=$1
TASK_ARGS=()
VERSION=$2
STACK_VERSION=$VERSION
set -euo pipefail
product="elastic/elasticsearch-py"
output_folder=".github/output"
codegen_folder=".github/output"
OUTPUT_DIR="$repo/${output_folder}"
REPO_BINDING="${OUTPUT_DIR}:/sln/${output_folder}"
WORKFLOW="${WORKFLOW-staging}"
mkdir -p "$OUTPUT_DIR"
echo -e "\033[34;1mINFO:\033[0m PRODUCT ${product}\033[0m"
echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m"
echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m"
# ------------------------------------------------------- #
# Parse Command
# ------------------------------------------------------- #
case $CMD in
clean)
echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m"
rm -rf "$output_folder"
echo -e "\033[32;1mdone.\033[0m"
exit 0
;;
assemble)
if [ -v $VERSION ]; then
echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m"
exit 1
fi
echo -e "\033[36;1mTARGET: assemble artefact $VERSION\033[0m"
TASK=release
TASK_ARGS=("$VERSION" "$output_folder")
;;
codegen)
VERSION=$(git rev-parse --abbrev-ref HEAD)
echo -e "\033[36;1mTARGET: codegen API $VERSION\033[0m"
TASK=codegen
# VERSION is BRANCH here for now
TASK_ARGS=("$VERSION" "$codegen_folder")
;;
docsgen)
if [ -v $VERSION ]; then
echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m"
exit 1
fi
echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m"
TASK=codegen
# VERSION is BRANCH here for now
TASK_ARGS=("$VERSION" "$codegen_folder")
;;
examplesgen)
echo -e "\033[36;1mTARGET: generate examples\033[0m"
TASK=codegen
# VERSION is BRANCH here for now
TASK_ARGS=("$VERSION" "$codegen_folder")
;;
bump)
if [ -v $VERSION ]; then
echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m"
exit 1
fi
echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m"
TASK=bump
# VERSION is BRANCH here for now
TASK_ARGS=("$VERSION")
;;
bumpmatrix)
if [ -v $VERSION ]; then
echo -e "\033[31;1mTARGET: bumpmatrix -> missing version parameter\033[0m"
exit 1
fi
echo -e "\033[36;1mTARGET: bump stack in test matrix to version $VERSION\033[0m"
TASK=bumpmatrix
TASK_ARGS=("$VERSION")
;;
*)
echo -e "\nUsage:\n\t $CMD is not supported right now\n"
exit 1
esac
# ------------------------------------------------------- #
# Build Container
# ------------------------------------------------------- #
echo -e "\033[34;1mINFO: building $product container\033[0m"
docker build \
--build-arg BUILDER_UID="$(id -u)" \
--file $repo/.buildkite/Dockerfile \
--tag ${product} \
.
# ------------------------------------------------------- #
# Run the Container
# ------------------------------------------------------- #
echo -e "\033[34;1mINFO: running $product container\033[0m"
if [[ "$CMD" == "assemble" ]]; then
# Build dists into .github/output
docker run \
-u "$(id -u)" \
--rm -v $repo/.github/output:/code/elasticsearch-py/dist \
$product \
/bin/bash -c "pip install build; python /code/elasticsearch-py/utils/build-dists.py $VERSION"
# Verify that there are dists in .github/output
if compgen -G ".github/output/*" > /dev/null; then
# Tarball everything up in .github/output
if [[ "$WORKFLOW" == 'snapshot' ]]; then
cd $repo/.github/output && tar -czvf elasticsearch-py-$VERSION-SNAPSHOT.tar.gz * && cd -
else
cd $repo/.github/output && tar -czvf elasticsearch-py-$VERSION.tar.gz * && cd -
fi
echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m"
exit 0
else
echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m"
exit 1
fi
fi
if [[ "$CMD" == "bump" ]]; then
docker run \
--rm -v $repo:/code/elasticsearch-py \
$product \
/bin/bash -c "python /code/elasticsearch-py/utils/bump-version.py $VERSION"
exit 0
fi
if [[ "$CMD" == "bumpmatrix" ]]; then
TEST_CONFIG_FILE=.buildkite/pipeline.yml
sed -E -i.bak 's/[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT/'$VERSION'/g' $TEST_CONFIG_FILE
rm ${TEST_CONFIG_FILE}.bak
exit 0
fi
if [[ "$CMD" == "codegen" ]]; then
docker run \
--rm -v $repo:/code/elasticsearch-py \
$product \
/bin/bash -c "cd /code && python -m pip install nox && \
git clone https://$CLIENTS_GITHUB_TOKEN@github.com/elastic/elastic-client-generator-python.git && \
cd /code/elastic-client-generator-python && GIT_BRANCH=$VERSION python -m nox -s generate-es && \
cd /code/elasticsearch-py && python -m nox -s format"
exit 0
fi
if [[ "$CMD" == "docsgen" ]]; then
echo "TODO"
fi
if [[ "$CMD" == "examplesgen" ]]; then
echo "TODO"
fi
echo "Must be called with '.github/make.sh [command]"
exit 1
python-elasticsearch-9.4.0/.github/workflows/ 0000775 0000000 0000000 00000000000 15176617013 0021261 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/.github/workflows/backport.yml 0000664 0000000 0000000 00000001300 15176617013 0023603 0 ustar 00root root 0000000 0000000 name: Backport
on:
pull_request_target:
types:
- closed
- labeled
jobs:
backport:
name: Backport
runs-on: ubuntu-latest
# Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
github.event.pull_request.merged
&& (
github.event.action == 'closed'
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport')
)
)
steps:
- uses: tibdex/backport@9565281eda0731b1d20c4025c43339fb0a23812e # v2.0.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
python-elasticsearch-9.4.0/.github/workflows/ci.yml 0000664 0000000 0000000 00000003143 15176617013 0022400 0 ustar 00root root 0000000 0000000 ---
name: CI
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
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@v5
- 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.10", "3.11", "3.12", "3.13", "3.14"]
nox-session: [""]
runs-on: ["ubuntu-latest"]
runs-on: ${{ matrix.runs-on }}
name: test-${{ matrix.python-version }}
continue-on-error: false
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Set Up Python - ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install nox
- name: Run Tests
shell: bash
run: .buildkite/run-nox.sh
env:
PYTHON_VERSION: ${{ matrix.python-version }}
NOX_SESSION: ${{ matrix.nox-session }}
python-elasticsearch-9.4.0/.github/workflows/docs-build.yml 0000664 0000000 0000000 00000000456 15176617013 0024036 0 ustar 00root root 0000000 0000000 name: docs-build
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
merge_group: ~
permissions:
contents: read
pull-requests: read
jobs:
build:
uses: elastic/docs-actions/.github/workflows/docs-build.yml@v1
with:
enable-vale-linting: true
python-elasticsearch-9.4.0/.github/workflows/docs-deploy.yml 0000664 0000000 0000000 00000000503 15176617013 0024224 0 ustar 00root root 0000000 0000000 name: docs-deploy
on:
workflow_run:
workflows: [docs-build]
types: [completed]
permissions:
contents: read
deployments: write
id-token: write
pull-requests: write
actions: read
jobs:
deploy:
uses: elastic/docs-actions/.github/workflows/docs-deploy.yml@v1
with:
enable-vale-linting: true
python-elasticsearch-9.4.0/.github/workflows/docs-preview-cleanup.yml 0000664 0000000 0000000 00000000355 15176617013 0026043 0 ustar 00root root 0000000 0000000 name: docs-preview-cleanup
on:
pull_request_target:
types: [closed]
permissions:
contents: none
deployments: write
id-token: write
jobs:
cleanup:
uses: elastic/docs-actions/.github/workflows/docs-preview-cleanup.yml@v1
python-elasticsearch-9.4.0/.gitignore 0000664 0000000 0000000 00000004267 15176617013 0017665 0 ustar 00root root 0000000 0000000 # Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
node_modules
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/sphinx/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# Pycharm project settings
.idea
# elasticsearch files
test_elasticsearch/cover
test_elasticsearch/local.py
.buildkite/output
junit/
# sample code for GitHub issues
issues/
python-elasticsearch-9.4.0/.readthedocs.yml 0000664 0000000 0000000 00000000774 15176617013 0020762 0 ustar 00root root 0000000 0000000 version: 2
build:
os: ubuntu-22.04
tools:
# To work around https://github.com/aio-libs/aiohttp/issues/7675, we need
# 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"
python:
install:
- path: .
extra_requirements:
- "docs"
sphinx:
configuration: docs/sphinx/conf.py
fail_on_warning: true
python-elasticsearch-9.4.0/CHANGELOG.md 0000664 0000000 0000000 00000000140 15176617013 0017470 0 ustar 00root root 0000000 0000000 See: https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/release-notes.html
python-elasticsearch-9.4.0/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000000063 15176617013 0020462 0 ustar 00root root 0000000 0000000 See: https://www.elastic.co/community/codeofconduct python-elasticsearch-9.4.0/CONTRIBUTING.md 0000664 0000000 0000000 00000006744 15176617013 0020130 0 ustar 00root root 0000000 0000000 # Contributing to the Python Elasticsearch Client
If you have a bugfix or new feature that you would like to contribute to
elasticsearch-py, please find or open an issue about it first. Talk about what
you would like to do. It may be that somebody is already working on it, or that
there are particular issues that you should know about before implementing the
change.
We enjoy working with contributors to get their code accepted. There are many
approaches to fixing a problem and it is important to find the best approach
before writing too much code.
## Running Elasticsearch locally
We've provided a script to start an Elasticsearch cluster of a certain version
found at `.buildkite/run-elasticsearch.sh`.
There are several environment variables that control integration tests:
- `PYTHON_VERSION`: Version of Python to use, defaults to `3.14`
- `PYTHON_CONNECTION_CLASS`: Connection class to use, defaults to `Urllib3HttpConnection`
- `STACK_VERSION`: Version of Elasticsearch to use. These should be
the same as tags of `docker.elastic.co/elasticsearch/elasticsearch`
such as `8.0.0-SNAPSHOT`, `7.x-SNAPSHOT`, etc. Defaults to the
same `*-SNAPSHOT` version as the branch.
**NOTE: You don't need to run the live integration tests for all changes. If
you don't have Elasticsearch running locally the integration tests will be skipped.**
## API Code Generation
All API methods for the `Elasticsearch` and `AsyncElasticsearch` client instances
(like `search()`) are automatically generated from the
[Elasticsearch specification](https://github.com/elastic/elasticsearch-specification)
and [rest-api-spec](https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/api).
Any changes to these methods should instead be submitted to the Elasticsearch specification project and will be imported the next time
the clients API is generated. The generator itself is currently a private project.
## Contributing Code Changes
The process for contributing to any of the Elasticsearch repositories is similar.
1. Please make sure you have signed the [Contributor License
Agreement](http://www.elastic.co/contributor-agreement/). We are not
asking you to assign copyright to us, but to give us the right to distribute
your code without restriction. We ask this of all contributors in order to
assure our users of the origin and continuing existence of the code. You only
need to sign the CLA once.
2. Run the linter and test suite to ensure your changes do not break existing code:
```
# Install Nox for task management
$ python -m pip install nox
# Auto-format and lint your changes
$ nox -rs format
# Run the test suite
$ nox -rs test
```
3. Rebase your changes.
Update your local repository with the most recent code from the main
elasticsearch-py repository, and rebase your branch on top of the latest `main`
branch. We prefer your changes to be squashed into a single commit for easier
backporting.
4. Submit a pull request. Push your local changes to your forked copy of the
repository and submit a pull request. In the pull request, describe what your
changes do and mention the number of the issue where discussion has taken
place, eg “Closes #123″. Please consider adding or modifying tests related to
your changes.
Then sit back and wait. There will probably be a discussion about the pull
request and, if any changes are needed, we would love to work with you to get
your pull request merged into elasticsearch-py.
python-elasticsearch-9.4.0/LICENSE 0000664 0000000 0000000 00000023637 15176617013 0016704 0 ustar 00root root 0000000 0000000
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
python-elasticsearch-9.4.0/NOTICE 0000664 0000000 0000000 00000000075 15176617013 0016572 0 ustar 00root root 0000000 0000000 Elasticsearch Python Client
Copyright 2022 Elasticsearch B.V. python-elasticsearch-9.4.0/README.md 0000664 0000000 0000000 00000012662 15176617013 0017152 0 ustar 00root root 0000000 0000000
# Elasticsearch Python Client
*The official Python client for Elasticsearch.*
## Features
* Translating basic Python data types to and from JSON
* Configurable automatic discovery of cluster nodes
* Persistent connections
* Load balancing (with pluggable selection strategy) across available nodes
* Failed connection penalization (time based - failed connections won't be
retried until a timeout is reached)
* Support for TLS and HTTP authentication
* Thread safety across requests
* Pluggable architecture
* Helper functions for idiomatically using APIs together
## Installation
[Download the latest version of Elasticsearch](https://www.elastic.co/downloads/elasticsearch)
or
[sign-up](https://cloud.elastic.co/registration?elektra=en-ess-sign-up-page)
for a free trial of Elastic Cloud.
Refer to the [Installation section](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_installation)
of the getting started documentation.
## Connecting
Refer to the [Connecting section](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_connecting)
of the getting started documentation.
## Usage
-----
* [Creating an index](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_creating_an_index)
* [Indexing a document](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_indexing_documents)
* [Getting documents](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_getting_documents)
* [Searching documents](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_searching_documents)
* [Updating documents](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_updating_documents)
* [Deleting documents](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_deleting_documents)
* [Deleting an index](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html#_deleting_an_index)
## Compatibility
Language clients are _forward compatible:_ each client version works with equivalent and later minor versions of Elasticsearch without breaking.
Compatibility does not imply full feature parity. New Elasticsearch features are supported only in equivalent client versions. For example, an 8.12 client fully supports Elasticsearch 8.12 features and works with 8.13 without breaking; however, it does not support new Elasticsearch 8.13 features. An 8.13 client fully supports Elasticsearch 8.13 features.
| Elasticsearch version | elasticsearch-py branch |
| --- | --- |
| main | main |
| 9.x | 9.x |
| 9.x | 8.x |
| 8.x | 8.x |
Elasticsearch language clients are also _backward compatible_ across minor versions — with default distributions and without guarantees.
> [!TIP]
> To upgrade to a new major version, first upgrade Elasticsearch, then upgrade the Python Elasticsearch client.
If you need to work with multiple client versions, note that older versions are also released as `elasticsearch7` and `elasticsearch8`.
## Documentation
Documentation for the client is [available on elastic.co] and [Read the Docs].
[available on elastic.co]: https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/index.html
[Read the Docs]: https://elasticsearch-py.readthedocs.io
## Try Elasticsearch and Kibana locally
If you want to try Elasticsearch and Kibana locally, you can run the following command:
```bash
curl -fsSL https://elastic.co/start-local | sh
```
This will run Elasticsearch at [http://localhost:9200](http://localhost:9200) and Kibana at [http://localhost:5601](http://localhost:5601).
More information is available [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/run-elasticsearch-locally.html).
## Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md)
## License
This software is licensed under the [Apache License 2.0](./LICENSE). See [NOTICE](./NOTICE).
python-elasticsearch-9.4.0/catalog-info.yaml 0000664 0000000 0000000 00000003370 15176617013 0021116 0 ustar 00root root 0000000 0000000 ---
# yaml-language-server: $schema=https://json.schemastore.org/catalog-info.json
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: elasticsearch-py
spec:
type: library
owner: group:devtools-team
lifecycle: production
dependsOn:
- "resource:elasticsearch-py"
---
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: elasticsearch-py
description: elasticsearch-py integration tests
spec:
type: buildkite-pipeline
owner: group:devtools-team
system: buildkite
implementation:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: elasticsearch-py integration tests
spec:
repository: elastic/elasticsearch-py
pipeline_file: .buildkite/pipeline.yml
env:
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
SLACK_NOTIFICATIONS_CHANNEL: '#devtools-notify-python'
teams:
devtools-team:
access_level: MANAGE_BUILD_AND_READ
everyone:
access_level: READ_ONLY
cancel_intermediate_builds: true
cancel_intermediate_builds_branch_filter: '!main'
schedules:
main:
branch: 'main'
cronline: '0 10 * * *'
message: 'Daily run for main branch'
Daily 9.3:
branch: '9.3'
cronline: '0 10 * * *'
message: 'Daily run for 9.3 branch'
Daily 9.2:
branch: '9.2'
cronline: '0 10 * * *'
message: 'Daily run for 9.2 branch'
Daily 8.19:
branch: '8.19'
cronline: '0 10 * * *'
message: 'Daily run for 8.19 branch'
python-elasticsearch-9.4.0/docs/ 0000775 0000000 0000000 00000000000 15176617013 0016614 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/docs/docset.yml 0000664 0000000 0000000 00000000322 15176617013 0020615 0 ustar 00root root 0000000 0000000 project: 'Python client'
products:
- id: elasticsearch-client
cross_links:
- apm-agent-python
- docs-content
- elasticsearch
toc:
- toc: reference
- toc: release-notes
subs:
es: "Elasticsearch"
python-elasticsearch-9.4.0/docs/examples/ 0000775 0000000 0000000 00000000000 15176617013 0020432 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/docs/examples/00272f75a6afea91f8554ef7cda0c1f2.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-cache.asciidoc:75
[source, python]
----
resp = client.security.clear_cached_realms(
realms="default_file,ldap1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/004743b9c9f61588926ccf734696b713.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026164 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/forcemerge.asciidoc:216
[source, python]
----
resp = client.indices.forcemerge(
index=".ds-my-data-stream-2099.03.07-000001",
max_num_segments="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/004a17b42ab5155bb61da797a006fa9f.asciidoc 0000664 0000000 0000000 00000000646 15176617013 0026473 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/pinned-query.asciidoc:13
[source, python]
----
resp = client.search(
query={
"pinned": {
"ids": [
"1",
"4",
"100"
],
"organic": {
"match": {
"description": "iphone"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/006e0e16c9f1da58c0bfe57377f7fc38.asciidoc 0000664 0000000 0000000 00000000741 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stemmer-tokenfilter.asciidoc:85
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "whitespace",
"filter": [
"stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/007179b5e241da650562a5f0a5007823.asciidoc 0000664 0000000 0000000 00000001543 15176617013 0026112 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:193
[source, python]
----
resp = client.watcher.put_watch(
id="cluster_health_watch",
trigger={
"schedule": {
"interval": "10s"
}
},
input={
"http": {
"request": {
"host": "localhost",
"port": 9200,
"path": "/_cluster/health"
}
}
},
condition={
"compare": {
"ctx.payload.status": {
"eq": "red"
}
}
},
actions={
"send_email": {
"email": {
"to": "username@example.org",
"subject": "Cluster Status Warning",
"body": "Cluster status is RED"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/008ed823c89e703c447ac89c6b689833.asciidoc 0000664 0000000 0000000 00000000263 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// migration/apis/feature-migration.asciidoc:158
[source, python]
----
resp = client.migration.post_feature_upgrade()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0091fc75271b1fbbd4269622a4881e8b.asciidoc 0000664 0000000 0000000 00000000464 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/common-script-uses.asciidoc:107
[source, python]
----
resp = client.search(
index="my-index",
query={
"match": {
"http.clientip": "40.135.0.0"
}
},
fields=[
"http.clientip"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/00ad41bde67beac991534ae0e04b1296.asciidoc 0000664 0000000 0000000 00000000375 15176617013 0026555 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/00b3b6d76a368ae71277ea24af318693.asciidoc 0000664 0000000 0000000 00000000235 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shard-stores.asciidoc:140
[source, python]
----
resp = client.indices.shard_stores()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/00c05aa931fc985985e3e21c93cf43ff.asciidoc 0000664 0000000 0000000 00000000477 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:443
[source, python]
----
resp = client.render_search_template(
source="{ \"query\": {{#toJson}}my_query{{/toJson}} }",
params={
"my_query": {
"match_all": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/00d65f7b9daa1c6b18eedd8ace206bae.asciidoc 0000664 0000000 0000000 00000000426 15176617013 0027140 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/asciifolding-tokenfilter.asciidoc:21
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"asciifolding"
],
text="açaí à la carte",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/00e0c964c79fcc1876ab957da2ffce82.asciidoc 0000664 0000000 0000000 00000003712 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1204
[source, python]
----
resp = client.indices.create(
index="italian_example",
settings={
"analysis": {
"filter": {
"italian_elision": {
"type": "elision",
"articles": [
"c",
"l",
"all",
"dall",
"dell",
"nell",
"sull",
"coll",
"pell",
"gl",
"agl",
"dagl",
"degl",
"negl",
"sugl",
"un",
"m",
"t",
"s",
"v",
"d"
],
"articles_case": True
},
"italian_stop": {
"type": "stop",
"stopwords": "_italian_"
},
"italian_keywords": {
"type": "keyword_marker",
"keywords": [
"esempio"
]
},
"italian_stemmer": {
"type": "stemmer",
"language": "light_italian"
}
},
"analyzer": {
"rebuilt_italian": {
"tokenizer": "standard",
"filter": [
"italian_elision",
"lowercase",
"italian_stop",
"italian_keywords",
"italian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc 0000664 0000000 0000000 00000000675 15176617013 0027003 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-elasticsearch.asciidoc:204
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="my-e5-model",
inference_config={
"service": "elasticsearch",
"service_settings": {
"num_allocations": 1,
"num_threads": 1,
"model_id": ".multilingual-e5-small"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/010d5e901a2690fa7b2396edbe6cd463.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/common-log-format-example.asciidoc:161
[source, python]
----
resp = client.indices.put_index_template(
name="my-data-stream-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
priority=500,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/015e6e6132b6d6d44bddb06bc3b316ed.asciidoc 0000664 0000000 0000000 00000002132 15176617013 0026626 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/0163af36c8472ac0c5160c8b716f5b26.asciidoc 0000664 0000000 0000000 00000000646 15176617013 0026344 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filter-aggregation.asciidoc:58
[source, python]
----
resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
query={
"term": {
"type": "t-shirt"
}
},
aggs={
"avg_price": {
"avg": {
"field": "price"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0165d22da5f2fc7678392b31d8eb5566.asciidoc 0000664 0000000 0000000 00000000651 15176617013 0026363 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/016f3147dae9ff2c3e831257ae470361.asciidoc 0000664 0000000 0000000 00000000437 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:54
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"add": {
"index": "logs-*",
"alias": "logs"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/019e329ed5a930aef825266822e7377a.asciidoc 0000664 0000000 0000000 00000001263 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/asciifolding-tokenfilter.asciidoc:118
[source, python]
----
resp = client.indices.create(
index="asciifold_example",
settings={
"analysis": {
"analyzer": {
"standard_asciifolding": {
"tokenizer": "standard",
"filter": [
"my_ascii_folding"
]
}
},
"filter": {
"my_ascii_folding": {
"type": "asciifolding",
"preserve_original": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/01ae196538fac197eedbbf458a4ef31b.asciidoc 0000664 0000000 0000000 00000001315 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/keyword.asciidoc:260
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"kwd": {
"type": "keyword",
"ignore_above": 3
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"kwd": [
"foo",
"foo",
"bang",
"bar",
"baz"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/01b23f09d2b7f140faf649eadbbf3ac3.asciidoc 0000664 0000000 0000000 00000001521 15176617013 0026767 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/index-templates.asciidoc:86
[source, python]
----
resp = client.cluster.put_component_template(
name="component_template1",
template={
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
},
)
print(resp)
resp1 = client.cluster.put_component_template(
name="runtime_component_template",
template={
"mappings": {
"runtime": {
"day_of_week": {
"type": "keyword",
"script": {
"source": "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))"
}
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/01bc0f2ed30eb3dd23511d01ce0ac6e1.asciidoc 0000664 0000000 0000000 00000000324 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/start-transform.asciidoc:85
[source, python]
----
resp = client.transform.start_transform(
transform_id="ecommerce_transform",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/01cd0ea360282a2c591a366679d7187d.asciidoc 0000664 0000000 0000000 00000000371 15176617013 0026267 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/01da9e0620e48270617fc248e6415cac.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0026340 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations.asciidoc:36
[source, python]
----
resp = client.search(
index="my-index-000001",
aggs={
"my-agg-name": {
"terms": {
"field": "my-field"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/01dc7bdc223bd651574ed2d3954a5b1c.asciidoc 0000664 0000000 0000000 00000000274 15176617013 0026555 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/execute-watch.asciidoc:153
[source, python]
----
resp = client.watcher.execute_watch(
id="my_watch",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/01f50acf7998b24969f451e922d145eb.asciidoc 0000664 0000000 0000000 00000002111 15176617013 0026362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:184
[source, python]
----
resp = client.indices.create(
index="basque_example",
settings={
"analysis": {
"filter": {
"basque_stop": {
"type": "stop",
"stopwords": "_basque_"
},
"basque_keywords": {
"type": "keyword_marker",
"keywords": [
"Adibidez"
]
},
"basque_stemmer": {
"type": "stemmer",
"language": "basque"
}
},
"analyzer": {
"rebuilt_basque": {
"tokenizer": "standard",
"filter": [
"lowercase",
"basque_stop",
"basque_keywords",
"basque_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/020c95db88ef356093f03be84893ddf9.asciidoc 0000664 0000000 0000000 00000000272 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/get-follow-stats.asciidoc:41
[source, python]
----
resp = client.ccr.follow_stats(
index="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/020de6b6cb960a76297452725a38889f.asciidoc 0000664 0000000 0000000 00000000612 15176617013 0026231 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/has-child-query.asciidoc:53
[source, python]
----
resp = client.search(
query={
"has_child": {
"type": "child",
"query": {
"match_all": {}
},
"max_children": 10,
"min_children": 2,
"score_mode": "min"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0246f73cc2ed3dfec577119e8cd15404.asciidoc 0000664 0000000 0000000 00000000546 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:183
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"name": {
"properties": {
"last": {
"type": "text"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/025155da86802ebf4c3aeee5aab692f9.asciidoc 0000664 0000000 0000000 00000001173 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/tophits-aggregation.asciidoc:254
[source, python]
----
resp = client.indices.create(
index="sales",
mappings={
"properties": {
"tags": {
"type": "keyword"
},
"comments": {
"type": "nested",
"properties": {
"username": {
"type": "keyword"
},
"comment": {
"type": "text"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/02520ac7816b2c4cf8fb413fd16122f2.asciidoc 0000664 0000000 0000000 00000000332 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/flush-job.asciidoc:81
[source, python]
----
resp = client.ml.flush_job(
job_id="low_request_rate",
calc_interim=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0264e994a7e68561e2ca6be0f0d90ee9.asciidoc 0000664 0000000 0000000 00000001143 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:571
[source, python]
----
resp = client.search(
aggs={
"JapaneseCars": {
"terms": {
"field": "make",
"include": [
"mazda",
"honda"
]
}
},
"ActiveCarManufacturers": {
"terms": {
"field": "make",
"exclude": [
"rover",
"jensen"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0280247e0cf2e561c548f22c9fb31163.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026254 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-tokens.asciidoc:205
[source, python]
----
resp = client.security.invalidate_token(
username="myuser",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/02853293a5b7cd9cc7a886eb413bbeb6.asciidoc 0000664 0000000 0000000 00000001160 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/mapping-charfilter.asciidoc:26
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
char_filter=[
{
"type": "mapping",
"mappings": [
"٠ => 0",
"١ => 1",
"٢ => 2",
"٣ => 3",
"٤ => 4",
"٥ => 5",
"٦ => 6",
"٧ => 7",
"٨ => 8",
"٩ => 9"
]
}
],
text="My license plate is ٢٥٠١٥",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/029de2f5383a42e1ac4ca1565bd2a130.asciidoc 0000664 0000000 0000000 00000000674 15176617013 0026466 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/index-prefixes.asciidoc:41
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"full_name": {
"type": "text",
"index_prefixes": {
"min_chars": 1,
"max_chars": 10
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/02b00f21e9d23d82276ace0dd154d779.asciidoc 0000664 0000000 0000000 00000000437 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/routing-field.asciidoc:62
[source, python]
----
resp = client.search(
index="my-index-000001",
routing="user1,user2",
query={
"match": {
"title": "document"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/02b6aa3e5652839f03de3a655854b897.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:466
[source, python]
----
resp = client.search(
index="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/02c48d461536709c3fc8a0e8147c3787.asciidoc 0000664 0000000 0000000 00000000730 15176617013 0026224 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/pipeline.asciidoc:54
[source, python]
----
resp = client.ingest.put_pipeline(
id="pipelineB",
description="outer pipeline",
processors=[
{
"pipeline": {
"name": "pipelineA"
}
},
{
"set": {
"field": "outer_pipeline_set",
"value": "outer"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/02f65c6bab8f40bf3ce18160623d1870.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0026422 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-index-template-v1.asciidoc:41
[source, python]
----
resp = client.indices.get_template(
name="template_1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/02fad6b80bb29c2a7e6840db2fc67b18.asciidoc 0000664 0000000 0000000 00000001247 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/wildcard.asciidoc:78
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_wildcard": {
"type": "wildcard"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"my_wildcard": "This string can be quite lengthy"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"wildcard": {
"my_wildcard": {
"value": "*quite*lengthy"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/0308cbd85281f95fc458042afe3f587d.asciidoc 0000664 0000000 0000000 00000000274 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:85
[source, python]
----
resp = client.get(
index="my-index-000001",
id="0",
source="*.id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/032eac56b798bea29390e102538f4a26.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026340 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/refresh.asciidoc:109
[source, python]
----
resp = client.indices.refresh(
index="my-index-000001,my-index-000002",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/033838729cfb5d1a28d04f69ee78d924.asciidoc 0000664 0000000 0000000 00000001717 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:299
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "Polygon",
"orientation": "LEFT",
"coordinates": [
[
[
-177,
10
],
[
176,
15
],
[
172,
0
],
[
176,
-15
],
[
-177,
-10
],
[
-177,
10
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0350410d11579f4e876c798ce1eaef5b.asciidoc 0000664 0000000 0000000 00000001615 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:565
[source, python]
----
resp = client.index(
index="my-index-000001",
id="5",
refresh=True,
document={
"query": {
"bool": {
"should": [
{
"match": {
"message": {
"query": "Japanese art",
"_name": "query1"
}
}
},
{
"match": {
"message": {
"query": "Holand culture",
"_name": "query2"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0350ff5ebb8207c004eb771088339cb4.asciidoc 0000664 0000000 0000000 00000002000 15176617013 0026331 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rrf.asciidoc:127
[source, python]
----
resp = client.search(
index="example-index",
retriever={
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"term": {
"text": "blue shoes sale"
}
}
}
},
{
"standard": {
"query": {
"sparse_vector": {
"field": "ml.tokens",
"inference_id": "my_elser_model",
"query": "What blue shoes are on sale?"
}
}
}
}
],
"rank_window_size": 50,
"rank_constant": 20
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/03582fc93683e573062bcfda45e01d69.asciidoc 0000664 0000000 0000000 00000001443 15176617013 0026361 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/custom-analyzer.asciidoc:59
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"type": "custom",
"tokenizer": "standard",
"char_filter": [
"html_strip"
],
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_custom_analyzer",
text="Is this déjà vu?",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/035a7a919eb6513b4769a3727b7d6447.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/testing.asciidoc:9
[source, python]
----
resp = client.indices.analyze(
analyzer="whitespace",
text="The quick brown fox.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/03891265df2111a38e0b6b24c1b967e1.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026254 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-service-accounts.asciidoc:320
[source, python]
----
resp = client.security.get_service_accounts()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/03b1d76fa0b773d5b7d74ecb7e1e1a80.asciidoc 0000664 0000000 0000000 00000000533 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:152
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="my_snapshot_2099.05.06",
indices="my-index,logs-my_app-default",
rename_pattern="(.+)",
rename_replacement="restored-$1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/03c4b815bf1e6a8c5cfcc6ddf94bc093.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0027012 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/apis/sql-search-api.asciidoc:17
[source, python]
----
resp = client.sql.query(
format="txt",
query="SELECT * FROM library ORDER BY page_count DESC LIMIT 5",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/04412d11783dac25b5fd2ec5407078a3.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-api-key-id-api.asciidoc:93
[source, python]
----
resp = client.connector.update_api_key_id(
connector_id="my-connector",
api_key_id="my-api-key-id",
api_key_secret_id="my-connector-secret-id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/044b2f99e7438e408685b258db17f863.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026247 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:141
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n process where process.name == \"regsvr32.exe\"\n ",
size=50,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/046b2249bbc49e77848c114cee940f17.asciidoc 0000664 0000000 0000000 00000003416 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/text-expansion-query.asciidoc:164
[source, python]
----
resp = client.search(
index="my-index",
retriever={
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"multi_match": {
"query": "How is the weather in Jamaica?",
"fields": [
"title",
"description"
]
}
}
}
},
{
"standard": {
"query": {
"text_expansion": {
"ml.inference.title_expanded.predicted_value": {
"model_id": ".elser_model_2",
"model_text": "How is the weather in Jamaica?"
}
}
}
}
},
{
"standard": {
"query": {
"text_expansion": {
"ml.inference.description_expanded.predicted_value": {
"model_id": ".elser_model_2",
"model_text": "How is the weather in Jamaica?"
}
}
}
}
}
],
"window_size": 10,
"rank_constant": 20
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0470d7101637568b9d3d1239f06325a7.asciidoc 0000664 0000000 0000000 00000001540 15176617013 0026047 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/update-desired-nodes.asciidoc:21
[source, python]
----
resp = client.perform_request(
"PUT",
"/_internal/desired_nodes/<history_id>/<version>",
headers={"Content-Type": "application/json"},
body={
"nodes": [
{
"settings": {
"node.name": "instance-000187",
"node.external_id": "instance-000187",
"node.roles": [
"data_hot",
"master"
],
"node.attr.data": "hot",
"node.attr.logical_availability_zone": "zone-0"
},
"processors": 8,
"memory": "58gb",
"storage": "2tb"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/047266b0d20fdb62ebc72d51952c8f6d.asciidoc 0000664 0000000 0000000 00000000623 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:344
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "Will Smith",
"type": "cross_fields",
"fields": [
"first_name",
"last_name"
],
"operator": "and"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/048652b6abfe195da8ea8cef10ee01b1.asciidoc 0000664 0000000 0000000 00000000324 15176617013 0026716 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/reset-transform.asciidoc:67
[source, python]
----
resp = client.transform.reset_transform(
transform_id="ecommerce_transform",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/04d586a536061ec1045d0bb2dc3d1a5f.asciidoc 0000664 0000000 0000000 00000001073 15176617013 0026462 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/set.asciidoc:39
[source, python]
----
resp = client.ingest.put_pipeline(
id="set_os",
description="sets the value of host.os.name from the field os",
processors=[
{
"set": {
"field": "host.os.name",
"value": "{{{os}}}"
}
}
],
)
print(resp)
resp1 = client.ingest.simulate(
id="set_os",
docs=[
{
"_source": {
"os": "Ubuntu"
}
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/04d6ce0c903bd468afbecd3aa1c4a78a.asciidoc 0000664 0000000 0000000 00000001155 15176617013 0027053 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/put-pipeline.asciidoc:126
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline-id",
description="My optional pipeline description",
processors=[
{
"set": {
"description": "My optional processor description",
"field": "my-keyword-field",
"value": "foo"
}
}
],
meta={
"reason": "set my-keyword-field to foo",
"serialization": {
"class": "MyPipeline",
"id": 10
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/04de2e3a9c00c2056b07bf9cf9e63a99.asciidoc 0000664 0000000 0000000 00000001023 15176617013 0026566 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-google-vertex-ai.asciidoc:133
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="google_vertex_ai_embeddings",
inference_config={
"service": "googlevertexai",
"service_settings": {
"service_account_json": "",
"model_id": "",
"location": "",
"project_id": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/04f5dd677c777bcb15d7d5fa63275fc8.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026607 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/health.asciidoc:48
[source, python]
----
resp = client.cluster.health(
wait_for_status="yellow",
timeout="50s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0502284d4685c478eb68761f979f4303.asciidoc 0000664 0000000 0000000 00000001513 15176617013 0026101 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:321
[source, python]
----
resp = client.ml.evaluate_data_frame(
index="house_price_predictions",
query={
"bool": {
"filter": [
{
"term": {
"ml.is_training": False
}
}
]
}
},
evaluation={
"regression": {
"actual_field": "price",
"predicted_field": "ml.price_prediction",
"metrics": {
"r_squared": {},
"mse": {},
"msle": {
"offset": 10
},
"huber": {
"delta": 1.5
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/050b3947025fee403232b8e6e9112dab.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0026333 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:256
[source, python]
----
resp = client.sql.query(
format="yaml",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/05148cc541f447486d9daf15ab77292b.asciidoc 0000664 0000000 0000000 00000002556 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/ilm.asciidoc:31
[source, python]
----
resp = client.ilm.put_lifecycle(
name="logs",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50gb"
}
}
},
"warm": {
"min_age": "30d",
"actions": {
"shrink": {
"number_of_shards": 1
},
"forcemerge": {
"max_num_segments": 1
}
}
},
"cold": {
"min_age": "60d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"frozen": {
"min_age": "90d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"delete": {
"min_age": "735d",
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0518c673094fb18ecb491a3b78af4695.asciidoc 0000664 0000000 0000000 00000000743 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-allocate.asciidoc:89
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"allocate": {
"include": {
"box_type": "hot,warm"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/05284c8ea91769c09c8db47db8a6629a.asciidoc 0000664 0000000 0000000 00000000241 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/repositories.asciidoc:57
[source, python]
----
resp = client.cat.repositories(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/053497b6960f80fd7b005b7c6d54358f.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-delete.asciidoc:40
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"delete": {
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/05500e77aef581d92f6c605f7a48f7df.asciidoc 0000664 0000000 0000000 00000001523 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:199
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "polygon",
"coordinates": [
[
[
1000,
-1001
],
[
1001,
-1001
],
[
1001,
-1000
],
[
1000,
-1000
],
[
1000,
-1001
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/059e04aaf093379401f665c33ac796dc.asciidoc 0000664 0000000 0000000 00000000704 15176617013 0026356 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc:163
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "keyword_marker",
"keywords": [
"jumping"
]
},
"stemmer"
],
text="fox running and jumping",
explain=True,
attributes="keyword",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/05a09078fe1016e900e445ad4039cf97.asciidoc 0000664 0000000 0000000 00000002731 15176617013 0026273 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/esql/esql-getting-started-enrich-policy.asciidoc:8
[source, python]
----
resp = client.indices.create(
index="clientips",
mappings={
"properties": {
"client_ip": {
"type": "keyword"
},
"env": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="clientips",
operations=[
{
"index": {}
},
{
"client_ip": "172.21.0.5",
"env": "Development"
},
{
"index": {}
},
{
"client_ip": "172.21.2.113",
"env": "QA"
},
{
"index": {}
},
{
"client_ip": "172.21.2.162",
"env": "QA"
},
{
"index": {}
},
{
"client_ip": "172.21.3.15",
"env": "Production"
},
{
"index": {}
},
{
"client_ip": "172.21.3.16",
"env": "Production"
}
],
)
print(resp1)
resp2 = client.enrich.put_policy(
name="clientip_policy",
match={
"indices": "clientips",
"match_field": "client_ip",
"enrich_fields": [
"env"
]
},
)
print(resp2)
resp3 = client.enrich.execute_policy(
name="clientip_policy",
wait_for_completion=False,
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/05ba0fdd0215e313ecea8a2f8f5a43b4.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026676 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-a-data-stream.asciidoc:360
[source, python]
----
resp = client.indices.get_data_stream(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/05bee3adf46b9d6a2fef96c51bf958da.asciidoc 0000664 0000000 0000000 00000000761 15176617013 0027112 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/document-level-security.asciidoc:46
[source, python]
----
resp = client.security.put_role(
name="click_role",
indices=[
{
"names": [
"events-*"
],
"privileges": [
"read"
],
"query": {
"match": {
"category": "click"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/05e637284bc3bedd46e0b7c26ad983c4.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:249
[source, python]
----
resp = client.ingest.put_pipeline(
id="alibabacloud_ai_search_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "alibabacloud_ai_search_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/05f4a4b284f68f7fb13603d7cd854083.asciidoc 0000664 0000000 0000000 00000000521 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:332
[source, python]
----
resp = client.indices.put_settings(
index="logs-my_app-default",
settings={
"index": {
"lifecycle": {
"name": "new-lifecycle-policy"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/05f6049c677a156bdf9b83e71a3b87ed.asciidoc 0000664 0000000 0000000 00000000231 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/ssl.asciidoc:90
[source, python]
----
resp = client.ssl.certificates()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0601b5cb5328c9ebff30f4be1b210f93.asciidoc 0000664 0000000 0000000 00000000355 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-status-api.asciidoc:333
[source, python]
----
resp = client.snapshot.status(
repository="my_repository",
snapshot="snapshot_2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/060a56477e39f272fc5a9cfe47443cf1.asciidoc 0000664 0000000 0000000 00000001317 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/simplepattern-tokenizer.asciidoc:39
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "simple_pattern",
"pattern": "[0123456789]{3}"
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="fd-786-335-514-x",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/0620a10ff15a2bb3eb489afc24ff0131.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:342
[source, python]
----
resp = client.search(
index="my-index-000001",
size="surprise_me",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/06454a8e85e2d3479c90390bb955eb39.asciidoc 0000664 0000000 0000000 00000000377 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-api.asciidoc:589
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="snapshot*,-snapshot_3",
sort="name",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/066e0bdcdfa3b8afa5d1e5777f73fccb.asciidoc 0000664 0000000 0000000 00000000520 15176617013 0027147 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/rollover-index.asciidoc:333
[source, python]
----
resp = client.indices.rollover(
alias="my-alias",
conditions={
"max_age": "7d",
"max_docs": 1000,
"max_primary_shard_size": "50gb",
"max_primary_shard_docs": "2000"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/069030e5f43d8f8ce3e3eca40205027e.asciidoc 0000664 0000000 0000000 00000002353 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/properties.asciidoc:17
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"manager": {
"properties": {
"age": {
"type": "integer"
},
"name": {
"type": "text"
}
}
},
"employees": {
"type": "nested",
"properties": {
"age": {
"type": "integer"
},
"name": {
"type": "text"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"region": "US",
"manager": {
"name": "Alice White",
"age": 30
},
"employees": [
{
"name": "John Smith",
"age": 34
},
{
"name": "Peter Brown",
"age": 26
}
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/06a761823a694850a6efe5d5bf61478c.asciidoc 0000664 0000000 0000000 00000000643 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/match-enrich-policy-type-ex.asciidoc:44
[source, python]
----
resp = client.enrich.put_policy(
name="users-policy",
match={
"indices": "users",
"match_field": "email",
"enrich_fields": [
"first_name",
"last_name",
"city",
"zip",
"state"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/06b5d3d56c4d4e3b61ae42ea26401c40.asciidoc 0000664 0000000 0000000 00000000772 15176617013 0026470 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/multi-search.asciidoc:16
[source, python]
----
resp = client.msearch(
index="my-index-000001",
searches=[
{},
{
"query": {
"match": {
"message": "this is a test"
}
}
},
{
"index": "my-index-000002"
},
{
"query": {
"match_all": {}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/06c0db0f42223761e32fa418066b275f.asciidoc 0000664 0000000 0000000 00000000676 15176617013 0026262 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/snapshot/corrupt-repository.asciidoc:97
[source, python]
----
resp = client.snapshot.create_repository(
name="my-repo",
repository={
"type": "s3",
"settings": {
"bucket": "repo-bucket",
"client": "elastic-internal-71bcd3",
"base_path": "myrepo",
"readonly": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/06d65e3505dcb306977185e8545cf4a8.asciidoc 0000664 0000000 0000000 00000000437 15176617013 0026314 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/increase-cluster-shard-limit.asciidoc:172
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.total_shards_per_node": 400
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0709a38613d2de90d418ce12b36af30e.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:113
[source, python]
----
resp = client.cluster.reroute()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/070cf72783cfe534a04f2f64e4016052.asciidoc 0000664 0000000 0000000 00000000650 15176617013 0026263 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/subobjects.asciidoc:92
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"subobjects": False
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="metric_1",
document={
"time": "100ms",
"time.min": "10ms",
"time.max": "900ms"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/0718a0b4f4905a8c90c1ff93de557e56.asciidoc 0000664 0000000 0000000 00000000551 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/extendedstats-aggregation.asciidoc:70
[source, python]
----
resp = client.search(
index="exams",
size=0,
aggs={
"grades_stats": {
"extended_stats": {
"field": "grade",
"sigma": 3
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0721c8adec544d5ecea3fcc410e45feb.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0027056 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/activate-user-profile.asciidoc:104
[source, python]
----
resp = client.security.activate_user_profile(
grant_type="password",
username="jacknich",
password="l0ng-r4nd0m-p@ssw0rd",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0722b302b2b3275a988d858044f99d5d.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026216 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/0737ebaea33631f001fb3f4226948492.asciidoc 0000664 0000000 0000000 00000000653 15176617013 0026266 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/geoip.asciidoc:237
[source, python]
----
resp = client.indices.create(
index="my_ip_locations",
mappings={
"properties": {
"geoip": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/073864d3f52f8f79aafdaa85a88ac46a.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-cache.asciidoc:82
[source, python]
----
resp = client.security.clear_cached_realms(
realms="*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/074e4602d1ca54412380a40867d078bc.asciidoc 0000664 0000000 0000000 00000001142 15176617013 0026171 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/slowlog.asciidoc:180
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index.indexing.slowlog.threshold.index.warn": "10s",
"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.reformat": True,
"index.indexing.slowlog.include.user": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0755471d7dce4785d2e7ed0c10182ea3.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/get-transform-stats.asciidoc:336
[source, python]
----
resp = client.transform.get_transform_stats(
transform_id="ecommerce-customer-transform",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/07a5fdeb7805cec1d28ba288b28f5ff5.asciidoc 0000664 0000000 0000000 00000000332 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/stop-job.asciidoc:81
[source, python]
----
resp = client.rollup.stop_job(
id="sensor",
wait_for_completion=True,
timeout="10s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/07ba3eaa931f2cf110052e3544db51f8.asciidoc 0000664 0000000 0000000 00000000633 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:884
[source, python]
----
resp = client.reindex(
max_docs=10,
source={
"index": "my-index-000001",
"query": {
"function_score": {
"random_score": {},
"min_score": 0.9
}
}
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/07c07f6d497b1a3012aa4320f830e09e.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026333 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/post-forget-follower.asciidoc:139
[source, python]
----
resp = client.ccr.forget_follower(
index="leader_index",
follower_cluster="follower_cluster",
follower_index="follower_index",
follower_index_uuid="vYpnaWPRQB6mNspmoCeYyA",
leader_remote_cluster="leader_cluster",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/07dadb9b0a774bd8e7f3527cf8a44afc.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0027024 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/semantic-query.asciidoc:17
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"semantic": {
"field": "inference_field",
"query": "Best surfing places"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/07de76cb0e7f11c7533788faf8c093c3.asciidoc 0000664 0000000 0000000 00000000577 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:205
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"title": {
"type": "text"
},
"labels": {
"type": "flattened"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/07ec38b97601286ec106986a84e1e5f7.asciidoc 0000664 0000000 0000000 00000000736 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-set-query.asciidoc:49
[source, python]
----
resp = client.indices.create(
index="job-candidates",
mappings={
"properties": {
"name": {
"type": "keyword"
},
"programming_languages": {
"type": "keyword"
},
"required_matches": {
"type": "long"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/080c34d8151d02b760571e3a2899fa97.asciidoc 0000664 0000000 0000000 00000001624 15176617013 0026217 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc:91
[source, python]
----
resp = client.indices.create(
index="test",
settings={
"analysis": {
"filter": {
"email": {
"type": "pattern_capture",
"preserve_original": True,
"patterns": [
"([^@]+)",
"(\\p{L}+)",
"(\\d+)",
"@(.+)"
]
}
},
"analyzer": {
"email": {
"tokenizer": "uax_url_email",
"filter": [
"email",
"lowercase",
"unique"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/082e78c7a2061a7c4a52b494e5ede0e8.asciidoc 0000664 0000000 0000000 00000001543 15176617013 0026515 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/083b92e8ea264e49bf9fd40fc6a3094b.asciidoc 0000664 0000000 0000000 00000001121 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-elasticsearch.asciidoc:264
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="my-e5-model",
inference_config={
"service": "elasticsearch",
"service_settings": {
"adaptive_allocations": {
"enabled": True,
"min_number_of_allocations": 3,
"max_number_of_allocations": 10
},
"num_threads": 1,
"model_id": ".multilingual-e5-small"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/083e514297c09e91211f0d168aef1b0b.asciidoc 0000664 0000000 0000000 00000000721 15176617013 0026336 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/bi-directional-disaster-recovery.asciidoc:256
[source, python]
----
resp = client.update_by_query(
index="logs-generic-default",
query={
"match": {
"event.sequence": "97"
}
},
script={
"source": "ctx._source.event.original = params.new_event",
"lang": "painless",
"params": {
"new_event": "FOOBAR"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/086ec4c5d86bbf80fb80162e94037689.asciidoc 0000664 0000000 0000000 00000002735 15176617013 0026402 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/weighted-tokens-query.asciidoc:21
[source, python]
----
resp = client.search(
query={
"weighted_tokens": {
"query_expansion_field": {
"tokens": {
"2161": 0.4679,
"2621": 0.307,
"2782": 0.1299,
"2851": 0.1056,
"3088": 0.3041,
"3376": 0.1038,
"3467": 0.4873,
"3684": 0.8958,
"4380": 0.334,
"4542": 0.4636,
"4633": 2.2805,
"4785": 1.2628,
"4860": 1.0655,
"5133": 1.0709,
"7139": 1.0016,
"7224": 0.2486,
"7387": 0.0985,
"7394": 0.0542,
"8915": 0.369,
"9156": 2.8947,
"10505": 0.2771,
"11464": 0.3996,
"13525": 0.0088,
"14178": 0.8161,
"16893": 0.1376,
"17851": 1.5348,
"19939": 0.6012
},
"pruning_config": {
"tokens_freq_ratio_threshold": 5,
"tokens_weight_threshold": 0.4,
"only_score_pruned_tokens": False
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0881397074d261ccc2db514daf116c31.asciidoc 0000664 0000000 0000000 00000000341 15176617013 0026330 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:128
[source, python]
----
resp = client.security.get_api_key(
id="VuaCfGcBCdbkQm-e5aOx",
with_limited_by=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/08a76b3f5a8394d8f9084113334a260a.asciidoc 0000664 0000000 0000000 00000000560 15176617013 0026211 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/boxplot-aggregation.asciidoc:149
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_boxplot": {
"boxplot": {
"field": "load_time",
"compression": 200
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/08c9af9dd519c011deedd406f3061836.asciidoc 0000664 0000000 0000000 00000002604 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/preview-datafeed.asciidoc:157
[source, python]
----
resp = client.ml.preview_datafeed(
datafeed_config={
"indices": [
"kibana_sample_data_ecommerce"
],
"query": {
"bool": {
"filter": [
{
"term": {
"_index": "kibana_sample_data_ecommerce"
}
}
]
}
},
"scroll_size": 1000
},
job_config={
"description": "Find customers spending an unusually high amount in an hour",
"analysis_config": {
"bucket_span": "1h",
"detectors": [
{
"detector_description": "High total sales",
"function": "high_sum",
"field_name": "taxful_total_price",
"over_field_name": "customer_full_name.keyword"
}
],
"influencers": [
"customer_full_name.keyword",
"category.keyword"
]
},
"analysis_limits": {
"model_memory_limit": "10mb"
},
"data_description": {
"time_field": "order_date",
"time_format": "epoch_ms"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/08e08feb514b24006e13f258d617d873.asciidoc 0000664 0000000 0000000 00000000251 15176617013 0026267 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:234
[source, python]
----
resp = client.get_script(
id="calculate-score",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/08e79ca9fdcdfebb2c6a79e6837e649d.asciidoc 0000664 0000000 0000000 00000000556 15176617013 0027056 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cardinality-aggregation.asciidoc:229
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"tag_cardinality": {
"cardinality": {
"field": "tag",
"missing": "N/A"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/08f20902821a4f7a73ce7b959c5bdbdc.asciidoc 0000664 0000000 0000000 00000000672 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/regexp-query.asciidoc:23
[source, python]
----
resp = client.search(
query={
"regexp": {
"user.id": {
"value": "k.*y",
"flags": "ALL",
"case_insensitive": True,
"max_determinized_states": 10000,
"rewrite": "constant_score_blended"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/091200b658023db31dffc2f08a85a9cc.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026471 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/total-shards-per-node.asciidoc:174
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"routing.allocation.total_shards_per_node": -1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0957bbd535f58c97b12ffba90813d64c.asciidoc 0000664 0000000 0000000 00000000364 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:367
[source, python]
----
resp = client.indices.create(
index="analyze_sample",
settings={
"index.analyze.max_token_count": 20000
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/095d60b2cfc5004c97efc49f27287262.asciidoc 0000664 0000000 0000000 00000000572 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:198
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sales_over_time": {
"date_histogram": {
"field": "date",
"fixed_interval": "30d"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/095e3f21941a9cc75f398389a075152d.asciidoc 0000664 0000000 0000000 00000001175 15176617013 0026235 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/infer-trained-model.asciidoc:1150
[source, python]
----
resp = client.ml.infer_trained_model(
model_id="cross-encoder__ms-marco-tinybert-l-2-v2",
docs=[
{
"text_field": "Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers."
},
{
"text_field": "New York City is famous for the Metropolitan Museum of Art."
}
],
inference_config={
"text_similarity": {
"text": "How many people live in Berlin?"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09769561f082b50558fb7d8707719963.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026027 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-stats.asciidoc:2588
[source, python]
----
resp = client.nodes.stats(
metric="ingest",
filter_path="nodes.*.ingest",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/099006ab11b52ea99693401dceee8bad.asciidoc 0000664 0000000 0000000 00000000432 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:220
[source, python]
----
resp = client.put_script(
id="calculate-score",
script={
"lang": "painless",
"source": "Math.log(_score * 2) + params['my_modifier']"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09944369863fd8666d5301d717317276.asciidoc 0000664 0000000 0000000 00000000724 15176617013 0025747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/condition-tokenfilter.asciidoc:22
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "condition",
"filter": [
"lowercase"
],
"script": {
"source": "token.getTerm().length() < 5"
}
}
],
text="THE QUICK BROWN FOX",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09a44b619a99f6bf3f01bd5e258fd22d.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026601 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/keyword-tokenizer.asciidoc:15
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
text="New York",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09a478fe32a7b7d814083ffa5297bcdf.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/fuzzy-query.asciidoc:29
[source, python]
----
resp = client.search(
query={
"fuzzy": {
"user.id": {
"value": "ki"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09bdf9a7e22733d668476724042a406c.asciidoc 0000664 0000000 0000000 00000000673 15176617013 0026225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-tutorial.asciidoc:131
[source, python]
----
resp = client.indices.put_index_template(
name="timeseries_template",
index_patterns=[
"timeseries"
],
data_stream={},
template={
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "timeseries_policy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09cb1b18bf4033b4afafb25bd3dab12c.asciidoc 0000664 0000000 0000000 00000000734 15176617013 0027034 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rule-query.asciidoc:71
[source, python]
----
resp = client.search(
query={
"rule": {
"match_criteria": {
"user_query": "pugs"
},
"ruleset_ids": [
"my-ruleset"
],
"organic": {
"match": {
"description": "puggles"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09ce0ec993c494ac01f01ef9815fcc4b.asciidoc 0000664 0000000 0000000 00000000667 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/grok-syntax.asciidoc:150
[source, python]
----
resp = client.indices.put_mapping(
index="my-index",
runtime={
"http.clientip": {
"type": "ip",
"script": "\n String clientip=grok('%{COMMONAPACHELOG}').extract(doc[\"message\"].value)?.clientip;\n if (clientip != null) emit(clientip);\n "
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09d617863a103c82fb4101e6165ea7fe.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-all-query.asciidoc:11
[source, python]
----
resp = client.search(
query={
"match_all": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/09e6e06ba562f4b9bac59455e9151a80.asciidoc 0000664 0000000 0000000 00000000700 15176617013 0026432 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:523
[source, python]
----
resp = client.ml.evaluate_data_frame(
index="animal_classification",
evaluation={
"classification": {
"actual_field": "animal_class",
"metrics": {
"auc_roc": {
"class_name": "dog"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a3003fa5af850e415634b50b1029859.asciidoc 0000664 0000000 0000000 00000000472 15176617013 0026172 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/bi-directional-disaster-recovery.asciidoc:237
[source, python]
----
resp = client.search(
index="logs-generic-default*",
filter_path="hits.hits._index",
query={
"match": {
"event.sequence": "97"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a3186bf20b5359393406fc0cb433313.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0026165 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:433
[source, python]
----
resp = client.sql.query(
format="json",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
columnar=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a46ac2968a574ce145f197f10d30152.asciidoc 0000664 0000000 0000000 00000001720 15176617013 0026261 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/getting-started.asciidoc:9
[source, python]
----
resp = client.bulk(
index="library",
refresh=True,
operations=[
{
"index": {
"_id": "Leviathan Wakes"
}
},
{
"name": "Leviathan Wakes",
"author": "James S.A. Corey",
"release_date": "2011-06-02",
"page_count": 561
},
{
"index": {
"_id": "Hyperion"
}
},
{
"name": "Hyperion",
"author": "Dan Simmons",
"release_date": "1989-05-26",
"page_count": 482
},
{
"index": {
"_id": "Dune"
}
},
{
"name": "Dune",
"author": "Frank Herbert",
"release_date": "1965-06-01",
"page_count": 604
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a46cc8fe93e372909660a63dc52ae3b.asciidoc 0000664 0000000 0000000 00000000431 15176617013 0026511 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/rollover-index.asciidoc:315
[source, python]
----
resp = client.indices.create(
index="",
aliases={
"my-alias": {
"is_write_index": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a650401134f07e40216f0d0d1a66a32.asciidoc 0000664 0000000 0000000 00000000236 15176617013 0026144 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/allocation.asciidoc:126
[source, python]
----
resp = client.cat.allocation(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a6d56a66a2652ac6de68f8bd544a175.asciidoc 0000664 0000000 0000000 00000001117 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:115
[source, python]
----
resp = client.search(
index="index1",
query={
"query_string": {
"query": "running with scissors",
"fields": [
"comment",
"comment.english"
]
}
},
highlight={
"order": "score",
"fields": {
"comment": {
"matched_fields": [
"comment.english"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a701bdc7b6786026f40c0be8ebfc753.asciidoc 0000664 0000000 0000000 00000001131 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/ecommerce-tutorial.asciidoc:439
[source, python]
----
resp = client.transform.preview_transform(
source={
"index": "kibana_sample_data_ecommerce",
"query": {
"bool": {
"filter": {
"term": {
"currency": "EUR"
}
}
}
}
},
latest={
"unique_key": [
"geoip.country_iso_code",
"geoip.region_name"
],
"sort": "order_date"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a758d9dec74d9e942cf41a06499234f.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026455 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:287
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"counter": 1,
"tags": [
"red"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a84c5b7c0793be745b13eaf13e94422.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026423 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/total-shards-per-node.asciidoc:78
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"routing.allocation.total_shards_per_node": "2"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0a9173f3b22716c78653976dc4799eae.asciidoc 0000664 0000000 0000000 00000001040 15176617013 0026313 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:131
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"product": {
"terms": {
"field": "product"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ac295efdabd59e7b1f1a4577535d942.asciidoc 0000664 0000000 0000000 00000000475 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:161
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n sequence\n [ process where process.name == \"regsvr32.exe\" ]\n [ file where stringContains(file.name, \"scrobj.dll\") ]\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ac9e7dd7e4acba51888256326ed5ffe.asciidoc 0000664 0000000 0000000 00000000446 15176617013 0026752 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-api.asciidoc:287
[source, python]
----
resp = client.search(
index="my-index-000001",
track_total_hits=True,
query={
"match": {
"user.id": "elkbee"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ad86b582aff1235f37ccb2cc90adad5.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026772 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:151
[source, python]
----
resp = client.indices.open(
index=".ds-my-data-stream-2099.03.07-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ad8edd10542ec2c4d5d8700d7e2ba97.asciidoc 0000664 0000000 0000000 00000001065 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-amazon-bedrock.asciidoc:162
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="amazon_bedrock_embeddings",
inference_config={
"service": "amazonbedrock",
"service_settings": {
"access_key": "",
"secret_key": "",
"region": "us-east-1",
"provider": "amazontitan",
"model": "amazon.titan-embed-text-v2:0"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0adbce828234ca221e3d03b184296407.asciidoc 0000664 0000000 0000000 00000000676 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/common-script-uses.asciidoc:84
[source, python]
----
resp = client.indices.put_mapping(
index="my-index",
runtime={
"http.clientip": {
"type": "ip",
"script": "\n String clientip=grok('%{COMMONAPACHELOG}').extract(doc[\"message\"].value)?.clientip;\n if (clientip != null) emit(clientip); \n "
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ade87c8cb0e3c188d2e3dce279d5cc2.asciidoc 0000664 0000000 0000000 00000001211 15176617013 0027006 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-filtering-api.asciidoc:122
[source, python]
----
resp = client.connector.update_filtering(
connector_id="my-g-drive-connector",
rules=[
{
"field": "file_extension",
"id": "exclude-txt-files",
"order": 0,
"policy": "exclude",
"rule": "equals",
"value": "txt"
},
{
"field": "_",
"id": "DEFAULT",
"order": 1,
"policy": "include",
"rule": "regex",
"value": ".*"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0aff04881be21eea45375ec4f4f50e66.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026564 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-api-keys.asciidoc:89
[source, python]
----
resp = client.security.create_api_key(
name="my-api-key",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0b1c5486f96bfa5db8db854c0178dbe5.asciidoc 0000664 0000000 0000000 00000000671 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/remote-clusters-connect.asciidoc:44
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"cluster_one": {
"seeds": [
"127.0.0.1:{remote-interface-default-port}"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0b47b0bef81b9b5eecfb3775695bd6ad.asciidoc 0000664 0000000 0000000 00000000476 15176617013 0027027 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// monitoring/production.asciidoc:96
[source, python]
----
resp = client.security.put_user(
username="remote_monitor",
password="changeme",
roles=[
"remote_monitoring_agent"
],
full_name="Internal Agent For Remote Monitoring",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0b4e50f1b5a0537cbb1a41276bb51c54.asciidoc 0000664 0000000 0000000 00000001103 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-api.asciidoc:167
[source, python]
----
resp = client.search(
index="my-index-000001",
runtime_mappings={
"day_of_week": {
"type": "keyword",
"script": {
"source": "emit(doc['@timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ENGLISH))"
}
}
},
aggs={
"day_of_week": {
"terms": {
"field": "day_of_week"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0b615ff4ef5a8847ee8109b2fd11619a.asciidoc 0000664 0000000 0000000 00000001002 15176617013 0026511 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:243
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"script_score": {
"query": {
"match": {
"message": "some message"
}
},
"script": {
"id": "calculate-score",
"params": {
"my_modifier": 2
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0b913fb9e010d877c0be015519cfddc6.asciidoc 0000664 0000000 0000000 00000002114 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/index-mgmt.asciidoc:177
[source, python]
----
resp = client.index(
index="my-index-000001",
document={
"@timestamp": "2019-05-18T15:57:27.541Z",
"ip": "225.44.217.191",
"extension": "jpg",
"response": "200",
"geo": {
"coordinates": {
"lat": 38.53146222,
"lon": -121.7864906
}
},
"url": "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/charles-fullerton.jpg"
},
)
print(resp)
resp1 = client.index(
index="my-index-000002",
document={
"@timestamp": "2019-05-20T03:44:20.844Z",
"ip": "198.247.165.49",
"extension": "php",
"response": "200",
"geo": {
"coordinates": {
"lat": 37.13189556,
"lon": -76.4929875
}
},
"memory": 241720,
"url": "https://theacademyofperformingartsandscience.org/people/type:astronauts/name:laurel-b-clark/profile"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/0b987b4101e016653a32d7b092d47e4c.asciidoc 0000664 0000000 0000000 00000001512 15176617013 0026255 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/object.asciidoc:46
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"region": {
"type": "keyword"
},
"manager": {
"properties": {
"age": {
"type": "integer"
},
"name": {
"properties": {
"first": {
"type": "text"
},
"last": {
"type": "text"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0bc6155e0c88062a4d8490da49db3aa8.asciidoc 0000664 0000000 0000000 00000003447 15176617013 0026512 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/0bcd380315ef4691b8c79df6ca53a85f.asciidoc 0000664 0000000 0000000 00000000554 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:397
[source, python]
----
resp = client.search(
sort=[
{
"price": {
"unmapped_type": "long"
}
}
],
query={
"term": {
"product": "chocolate"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0bee07a581c5776e068f6f4efad5a399.asciidoc 0000664 0000000 0000000 00000000567 15176617013 0026623 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/0c05c66cfe3a2169b1ec1aba77e26db2.asciidoc 0000664 0000000 0000000 00000000437 15176617013 0026713 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rank-feature-query.asciidoc:274
[source, python]
----
resp = client.search(
index="test",
query={
"rank_feature": {
"field": "pagerank",
"saturation": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c2ca704a39dda8b3a7c5806ec6c6cf8.asciidoc 0000664 0000000 0000000 00000000673 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1377
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
runtime={
"http.client_ip": {
"type": "ip",
"script": "\n String clientip=grok('%{COMMONAPACHELOG}').extract(doc[\"message\"].value)?.clientip;\n if (clientip != null) emit(clientip); \n "
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c2d9ac7e3f28d4d802e21cbbbcfeb34.asciidoc 0000664 0000000 0000000 00000000305 15176617013 0027052 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/recovery.asciidoc:118
[source, python]
----
resp = client.cat.recovery(
v=True,
h="i,s,t,ty,st,shost,thost,f,fp,b,bp",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c464965126cc09e6812716a145991d4.asciidoc 0000664 0000000 0000000 00000000250 15176617013 0026055 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-info.asciidoc:306
[source, python]
----
resp = client.nodes.info(
node_id="ingest",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c52af573c9401a2a687e86a4beb182b.asciidoc 0000664 0000000 0000000 00000000616 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/attachment.asciidoc:214
[source, python]
----
resp = client.ingest.put_pipeline(
id="cbor-attachment",
description="Extract attachment information",
processors=[
{
"attachment": {
"field": "data",
"remove_binary": True
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c688eecf4ebdffdbe1deae0983c3ed8.asciidoc 0000664 0000000 0000000 00000001404 15176617013 0027325 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/cumulative-cardinality-aggregation.asciidoc:46
[source, python]
----
resp = client.search(
index="user_hits",
size=0,
aggs={
"users_per_day": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "day"
},
"aggs": {
"distinct_users": {
"cardinality": {
"field": "user_id"
}
},
"total_new_users": {
"cumulative_cardinality": {
"buckets_path": "distinct_users"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c6f9c9da75293fae69659ac1d6329de.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026621 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-tokens.asciidoc:181
[source, python]
----
resp = client.security.invalidate_token(
refresh_token="vLBPvmAB6KvwvJZr27cS",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c6fc67c2dd1c1771cd866ce471d74e1.asciidoc 0000664 0000000 0000000 00000001220 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:212
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping4",
roles=[
"superuser"
],
enabled=True,
rules={
"any": [
{
"field": {
"username": "esadmin"
}
},
{
"field": {
"groups": [
"cn=admins,dc=example,dc=com",
"cn=other,dc=example,dc=com"
]
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c7c40cd17985c3dd32aeaadbafc4fce.asciidoc 0000664 0000000 0000000 00000000603 15176617013 0027213 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:926
[source, python]
----
resp = client.render_search_template(
source={
"query": {
"match": {
"message": "{{^name_exists}}Hello World{{/name_exists}}"
}
}
},
params={
"name_exists": False
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c892d328b73d38396aaef6d9cbcd36b.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026663 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete.asciidoc:88
[source, python]
----
resp = client.delete(
index="my-index-000001",
id="1",
routing="shard-1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0c8be7aec84ea86b243904f5d4162f5a.asciidoc 0000664 0000000 0000000 00000000562 15176617013 0026576 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/0ca6aae1ab2f0be6127beea8a245374e.asciidoc 0000664 0000000 0000000 00000000655 15176617013 0026767 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:1004
[source, python]
----
resp = client.async_search.submit(
index="my-index-000001,cluster*:my-index-000001,-cluster_three:*",
query={
"match": {
"user.id": "kimchy"
}
},
source=[
"user.id",
"message",
"http.response.status_code"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0cee58617e75f493c5049d77be1c49f3.asciidoc 0000664 0000000 0000000 00000000721 15176617013 0026460 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/fuzzy-query.asciidoc:46
[source, python]
----
resp = client.search(
query={
"fuzzy": {
"user.id": {
"value": "ki",
"fuzziness": "AUTO",
"max_expansions": 50,
"prefix_length": 0,
"transpositions": True,
"rewrite": "constant_score_blended"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0cf29da4b9f0503bd1a79bdc883aadbc.asciidoc 0000664 0000000 0000000 00000001201 15176617013 0027050 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/avg-aggregation.asciidoc:45
[source, python]
----
resp = client.search(
index="exams",
size="0",
runtime_mappings={
"grade.corrected": {
"type": "double",
"script": {
"source": "emit(Math.min(100, doc['grade'].value * params.correction))",
"params": {
"correction": 1.2
}
}
}
},
aggs={
"avg_corrected_grade": {
"avg": {
"field": "grade.corrected"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0d0f7ece06f21e624d21b09804732f61.asciidoc 0000664 0000000 0000000 00000000526 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/avg-aggregation.asciidoc:92
[source, python]
----
resp = client.search(
index="exams",
size="0",
aggs={
"grade_avg": {
"avg": {
"field": "grade",
"missing": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0d30077cd34e93377a3a86f2ebd69415.asciidoc 0000664 0000000 0000000 00000000612 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/create-connector-api.asciidoc:118
[source, python]
----
resp = client.connector.put(
connector_id="my-connector",
index_name="search-google-drive",
name="My Connector",
description="My Connector to sync data to Elastic index from Google Drive",
service_type="google_drive",
language="en",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0d49474511b236bc89e768c8ee91adf1.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/simple-query-string-query.asciidoc:24
[source, python]
----
resp = client.search(
query={
"simple_query_string": {
"query": "\"fried eggs\" +(eggplant | potato) -frittata",
"fields": [
"title^5",
"body"
],
"default_operator": "and"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0d54ddad2bf6f76aa5c35f53ba77748a.asciidoc 0000664 0000000 0000000 00000000432 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/porterstem-tokenfilter.asciidoc:28
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"porter_stem"
],
text="the foxes jumping quickly",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0d59af9dc556dc526b9394051efa800a.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/ignore-missing-component-templates.asciidoc:91
[source, python]
----
resp = client.indices.rollover(
alias="logs-foo-bar",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0d689ac6e78be5d438f9b5d441be2b44.asciidoc 0000664 0000000 0000000 00000003635 15176617013 0026616 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/0d8063b484a18f8672fb5ed8712c5c97.asciidoc 0000664 0000000 0000000 00000000776 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template.asciidoc:305
[source, python]
----
resp = client.indices.put_index_template(
name="template_1",
index_patterns=[
"foo",
"bar"
],
template={
"settings": {
"number_of_shards": 3
}
},
meta={
"description": "set number of shards to three",
"serialization": {
"class": "MyIndexTemplate",
"id": 17
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0d94d76b7f00d0459d1f8c962c144dcd.asciidoc 0000664 0000000 0000000 00000002153 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:314
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping8",
roles=[
"superuser"
],
enabled=True,
rules={
"all": [
{
"any": [
{
"field": {
"dn": "*,ou=admin,dc=example,dc=com"
}
},
{
"field": {
"username": [
"es-admin",
"es-system"
]
}
}
]
},
{
"field": {
"groups": "cn=people,dc=example,dc=com"
}
},
{
"except": {
"field": {
"metadata.terminated_date": None
}
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0da477cb8a7883539ce3ae7ac1e9c5cb.asciidoc 0000664 0000000 0000000 00000000603 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/histogram-aggregation.asciidoc:89
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"prices": {
"histogram": {
"field": "price",
"interval": 50,
"min_doc_count": 1
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0da747e9d98bae157d3520ff1b489ad4.asciidoc 0000664 0000000 0000000 00000000547 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-s3.asciidoc:45
[source, python]
----
resp = client.snapshot.create_repository(
name="my_s3_repository",
repository={
"type": "s3",
"settings": {
"bucket": "my-bucket",
"client": "my-alternate-client"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0db06c3cba57cf442ac7fab89966e1e1.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0026722 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:76
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"my_id": "1",
"text": "This is a question",
"my_join_field": "question"
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"my_id": "2",
"text": "This is another question",
"my_join_field": "question"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/0dd30ffe2f900dde86cc9bb601d5e68e.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0027015 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/nodes.asciidoc:387
[source, python]
----
resp = client.cat.nodes(
v=True,
h="id,ip,port,v,m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ddf705317d9c5095b4a1419a2e3bace.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-app-privileges.asciidoc:101
[source, python]
----
resp = client.security.get_privileges()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0dfa9733c94bc43c6f14c7b6984c98fb.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/component-templates.asciidoc:113
[source, python]
----
resp = client.cat.component_templates(
name="my-template-*",
v=True,
s="name",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0dfde6a9d953822fd4b3aa0121ddd8fb.asciidoc 0000664 0000000 0000000 00000000767 15176617013 0027014 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search-application/apis/search-application-render-query.asciidoc:119
[source, python]
----
resp = client.search_application.render_query(
name="my-app",
params={
"query_string": "my first query",
"text_fields": [
{
"name": "title",
"boost": 5
},
{
"name": "description",
"boost": 1
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0e0d8f652d7d29371b5ea7c7544385eb.asciidoc 0000664 0000000 0000000 00000001057 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:538
[source, python]
----
resp = client.search(
index="amazon-bedrock-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "amazon_bedrock_embeddings",
"model_text": "Calculate fuel cost"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0e118857b815b62118a30c042f079db1.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026176 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:262
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "quick brown f",
"type": "phrase_prefix",
"fields": [
"subject",
"message"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0e31b8ad176b31028becf9500989bcbd.asciidoc 0000664 0000000 0000000 00000001025 15176617013 0026560 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/0e3b4a48a3450cd99c95ec46d4701b58.asciidoc 0000664 0000000 0000000 00000001602 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filter-aggregation.asciidoc:167
[source, python]
----
resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
aggs={
"hats": {
"filter": {
"term": {
"type": "hat"
}
},
"aggs": {
"avg_price": {
"avg": {
"field": "price"
}
}
}
},
"t_shirts": {
"filter": {
"term": {
"type": "t-shirt"
}
},
"aggs": {
"avg_price": {
"avg": {
"field": "price"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0e5d25c7bb738c42d471020d678e2966.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026277 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/start-trained-model-deployment.asciidoc:206
[source, python]
----
resp = client.ml.start_trained_model_deployment(
model_id="my_model",
deployment_id="my_model_for_ingest",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0e71a18d1aac61720cdc6b3f91fe643f.asciidoc 0000664 0000000 0000000 00000000502 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/simple-query-string-query.asciidoc:153
[source, python]
----
resp = client.search(
query={
"simple_query_string": {
"fields": [
"content"
],
"query": "foo bar -baz"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0e84bb54b8a9a5387f252eeffeb1098e.asciidoc 0000664 0000000 0000000 00000001376 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/getting-started.asciidoc:84
[source, python]
----
resp = client.watcher.put_watch(
id="log_error_watch",
trigger={
"schedule": {
"interval": "10s"
}
},
input={
"search": {
"request": {
"indices": [
"logs"
],
"body": {
"query": {
"match": {
"message": "error"
}
}
}
}
}
},
condition={
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ea146b178561bc8b9002bed8a35641f.asciidoc 0000664 0000000 0000000 00000000340 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/get-autoscaling-policy.asciidoc:75
[source, python]
----
resp = client.autoscaling.get_autoscaling_policy(
name="my_autoscaling_policy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ea2167ce7c87d311b20c4f8c698a8d0.asciidoc 0000664 0000000 0000000 00000001533 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/point-in-time-api.asciidoc:196
[source, python]
----
resp = client.search(
slice={
"id": 0,
"max": 2
},
query={
"match": {
"message": "foo"
}
},
pit={
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=="
},
)
print(resp)
resp1 = client.search(
slice={
"id": 1,
"max": 2
},
pit={
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=="
},
query={
"match": {
"message": "foo"
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/0eae571e9e1c40a40cb4b1c9530a8987.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026477 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/migrate-to-data-tiers.asciidoc:160
[source, python]
----
resp = client.ilm.migrate_to_data_tiers(
legacy_template_to_delete="global-template",
node_attribute="custom_attribute_name",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0eb2c1284a9829224913a860190580d8.asciidoc 0000664 0000000 0000000 00000000770 15176617013 0026054 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/fingerprint-tokenfilter.asciidoc:76
[source, python]
----
resp = client.indices.create(
index="fingerprint_example",
settings={
"analysis": {
"analyzer": {
"whitespace_fingerprint": {
"tokenizer": "whitespace",
"filter": [
"fingerprint"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0ec2178fb0103862b47cc20bc5885972.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0026265 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/register-fs-repo.asciidoc:127
[source, python]
----
resp = client.snapshot.create_repository(
name="my_fs_backup",
repository={
"type": "fs",
"settings": {
"location": "my_fs_backup_location",
"readonly": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0eccea755bd4f6dd47579a9022690546.asciidoc 0000664 0000000 0000000 00000000650 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/remote-clusters-migration.asciidoc:133
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"my_remote": {
"mode": "proxy",
"proxy_address": "my.remote.cluster.com:9443"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0f028f71f04c1d569fab402869565a84.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026277 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/0f2e5e006b663a88ee99b130ab1b4844.asciidoc 0000664 0000000 0000000 00000001201 15176617013 0026416 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:572
[source, python]
----
resp = client.search(
sort=[
{
"_geo_distance": {
"pin.location": [
[
-70,
40
],
[
-71,
42
]
],
"order": "asc",
"unit": "km"
}
}
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0f3a78296825d507dda6771f7ceb9d61.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/allocation_filtering.asciidoc:22
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.exclude._ip": "10.0.0.1"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0f4583c56cfe5bd59eeb35bfba02957c.asciidoc 0000664 0000000 0000000 00000000772 15176617013 0026747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rank-eval.asciidoc:318
[source, python]
----
resp = client.rank_eval(
index="my-index-000001",
requests=[
{
"id": "JFK query",
"request": {
"query": {
"match_all": {}
}
},
"ratings": []
}
],
metric={
"recall": {
"k": 20,
"relevant_rating_threshold": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0f547926ebf092e19fc5fb433e9ac8c1.asciidoc 0000664 0000000 0000000 00000001015 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/porterstem-tokenfilter.asciidoc:97
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "whitespace",
"filter": [
"lowercase",
"porter_stem"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0f7aa40ad26d59a9268630b980a3d594.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026360 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/simulate-template.asciidoc:61
[source, python]
----
resp = client.indices.simulate_template(
name="template_1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0fa220ee3fb267020382f74aa70eb1e9.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026466 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/state.asciidoc:157
[source, python]
----
resp = client.cluster.state(
metric="_all",
index="foo,bar",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0fb472645116d58ddef89ca976d15a01.asciidoc 0000664 0000000 0000000 00000002743 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:471
[source, python]
----
resp = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {}
},
{
"@timestamp": 1516729294000,
"model_number": "QVKC92Q",
"measures": {
"voltage": 5.2
}
},
{
"index": {}
},
{
"@timestamp": 1516642894000,
"model_number": "QVKC92Q",
"measures": {
"voltage": 5.8
}
},
{
"index": {}
},
{
"@timestamp": 1516556494000,
"model_number": "QVKC92Q",
"measures": {
"voltage": 5.1
}
},
{
"index": {}
},
{
"@timestamp": 1516470094000,
"model_number": "QVKC92Q",
"measures": {
"voltage": 5.6
}
},
{
"index": {}
},
{
"@timestamp": 1516383694000,
"model_number": "HG537PU",
"measures": {
"voltage": 4.2
}
},
{
"index": {}
},
{
"@timestamp": 1516297294000,
"model_number": "HG537PU",
"measures": {
"voltage": 4
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0fb7705ddbf1fc2b65d2de2e00fe5769.asciidoc 0000664 0000000 0000000 00000001404 15176617013 0026730 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/scripted-metric-aggregation.asciidoc:63
[source, python]
----
resp = client.search(
index="ledger",
size="0",
aggs={
"profit": {
"scripted_metric": {
"init_script": {
"id": "my_init_script"
},
"map_script": {
"id": "my_map_script"
},
"combine_script": {
"id": "my_combine_script"
},
"params": {
"field": "amount"
},
"reduce_script": {
"id": "my_reduce_script"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0fbca60a487f5f22a4d51d73b2434cc4.asciidoc 0000664 0000000 0000000 00000000644 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:37
[source, python]
----
resp = client.indices.create(
index="elser-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "sparse_vector"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0fc4b589df5388da784c6d981e769e31.asciidoc 0000664 0000000 0000000 00000001036 15176617013 0026473 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template-v1.asciidoc:155
[source, python]
----
resp = client.indices.put_template(
name="template_1",
index_patterns=[
"te*"
],
settings={
"number_of_shards": 1
},
aliases={
"alias1": {},
"alias2": {
"filter": {
"term": {
"user.id": "kimchy"
}
},
"routing": "shard-1"
},
"{index}-alias": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0fd08e14ad651827be53897a6bdaf0b8.asciidoc 0000664 0000000 0000000 00000000377 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-bool-prefix-query.asciidoc:13
[source, python]
----
resp = client.search(
query={
"match_bool_prefix": {
"message": "quick brown f"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/0fe74ccd098c742619805a7c0bd0fae6.asciidoc 0000664 0000000 0000000 00000000342 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/schedule-now-transform.asciidoc:58
[source, python]
----
resp = client.transform.schedule_now_transform(
transform_id="ecommerce_transform",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/100d4e33158069f3caa32e8bfa0eb3d0.asciidoc 0000664 0000000 0000000 00000000517 15176617013 0026544 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:175
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic": "runtime",
"properties": {
"@timestamp": {
"type": "date"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/102c7de25d13c87cf28839ada9f63c95.asciidoc 0000664 0000000 0000000 00000001074 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:213
[source, python]
----
resp = client.index(
index="index",
id="1",
document={
"my_date": "2016-05-11T16:30:55.328Z"
},
)
print(resp)
resp1 = client.search(
index="index",
query={
"constant_score": {
"filter": {
"range": {
"my_date": {
"gte": "now-1h",
"lte": "now"
}
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/103296e16b4233926ad1f07360385606.asciidoc 0000664 0000000 0000000 00000002415 15176617013 0025763 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1794
[source, python]
----
resp = client.indices.create(
index="turkish_example",
settings={
"analysis": {
"filter": {
"turkish_stop": {
"type": "stop",
"stopwords": "_turkish_"
},
"turkish_lowercase": {
"type": "lowercase",
"language": "turkish"
},
"turkish_keywords": {
"type": "keyword_marker",
"keywords": [
"örnek"
]
},
"turkish_stemmer": {
"type": "stemmer",
"language": "turkish"
}
},
"analyzer": {
"rebuilt_turkish": {
"tokenizer": "standard",
"filter": [
"apostrophe",
"turkish_lowercase",
"turkish_stop",
"turkish_keywords",
"turkish_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1070e59ba144cdf309fd9b2591612b95.asciidoc 0000664 0000000 0000000 00000000525 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/refresh.asciidoc:98
[source, python]
----
resp = client.index(
index="test",
id="3",
document={
"test": "test"
},
)
print(resp)
resp1 = client.index(
index="test",
id="4",
refresh=False,
document={
"test": "test"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/10796a4efa3c2a5e9e50b6bdeb08bbb9.asciidoc 0000664 0000000 0000000 00000001530 15176617013 0027002 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/update-desired-nodes.asciidoc:80
[source, python]
----
resp = client.perform_request(
"PUT",
"/_internal/desired_nodes/Ywkh3INLQcuPT49f6kcppA/100",
headers={"Content-Type": "application/json"},
body={
"nodes": [
{
"settings": {
"node.name": "instance-000187",
"node.external_id": "instance-000187",
"node.roles": [
"data_hot",
"master"
],
"node.attr.data": "hot",
"node.attr.logical_availability_zone": "zone-0"
},
"processors": 8,
"memory": "58gb",
"storage": "2tb"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/109db8ff7b715aca98de8ef1ab7e44ab.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0027077 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/post-resume-follow.asciidoc:43
[source, python]
----
resp = client.ccr.resume_follow(
index="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/10a16abe990288253ea25a1b1712fe3d.asciidoc 0000664 0000000 0000000 00000000652 15176617013 0026411 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-user.asciidoc:232
[source, python]
----
resp = client.perform_request(
"POST",
"/_security/_query/user",
params={
"with_profile_uid": "true"
},
headers={"Content-Type": "application/json"},
body={
"query": {
"prefix": {
"roles": "other"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/10b924bf6298aa6157ed00ce12f8edc1.asciidoc 0000664 0000000 0000000 00000002140 15176617013 0026555 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/execute-watch.asciidoc:369
[source, python]
----
resp = client.watcher.execute_watch(
ignore_condition=True,
watch={
"trigger": {
"schedule": {
"interval": "10s"
}
},
"input": {
"search": {
"request": {
"indices": [
"logs"
],
"body": {
"query": {
"match": {
"message": "error"
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"log_error": {
"logging": {
"text": "Found {{ctx.payload.hits.total}} errors in the logs"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/10d8b17e73d31dcd907de67327ed78a2.asciidoc 0000664 0000000 0000000 00000002651 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:578
[source, python]
----
resp = client.indices.create(
index="dutch_example",
settings={
"analysis": {
"filter": {
"dutch_stop": {
"type": "stop",
"stopwords": "_dutch_"
},
"dutch_keywords": {
"type": "keyword_marker",
"keywords": [
"voorbeeld"
]
},
"dutch_stemmer": {
"type": "stemmer",
"language": "dutch"
},
"dutch_override": {
"type": "stemmer_override",
"rules": [
"fiets=>fiets",
"bromfiets=>bromfiets",
"ei=>eier",
"kind=>kinder"
]
}
},
"analyzer": {
"rebuilt_dutch": {
"tokenizer": "standard",
"filter": [
"lowercase",
"dutch_stop",
"dutch_keywords",
"dutch_override",
"dutch_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/10d9da8a3b7061479be908c8c5c76cfb.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026575 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:223
[source, python]
----
resp = client.security.get_api_key(
realm_name="native1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/10de9fd4a38755020a07c4ec964d44c9.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/oidc-guide.asciidoc:431
[source, python]
----
resp = client.security.put_role_mapping(
name="oidc-example",
roles=[
"example_role"
],
enabled=True,
rules={
"field": {
"realm.name": "oidc1"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/10e4c1f246ada8c6b500d8ea6c1e335f.asciidoc 0000664 0000000 0000000 00000000745 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/shingle-tokenfilter.asciidoc:298
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"standard_shingle": {
"tokenizer": "standard",
"filter": [
"shingle"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/10f0c8fed98455c460c374b50ffbb204.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-migrate-data-stream-from-ilm-to-dsl.asciidoc:301
[source, python]
----
resp = client.indices.rollover(
alias="dsl-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/10f7a2c0a952ba3bc3d20b7d5f310f41.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search-application/apis/list-search-applications.asciidoc:99
[source, python]
----
resp = client.search_application.list()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/111c31db1fd29baeaa9964eafaea6789.asciidoc 0000664 0000000 0000000 00000000577 15176617013 0027017 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/run-as-privilege.asciidoc:184
[source, python]
----
resp = client.security.put_user(
username="analyst_user",
refresh=True,
password="l0nger-r4nd0mer-p@ssw0rd",
roles=[
"my_analyst_role"
],
full_name="Monday Jaffe",
metadata={
"innovation": 8
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/111c69ca94162c1523b799a5c14723dd.asciidoc 0000664 0000000 0000000 00000000370 15176617013 0026263 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/term-query.asciidoc:118
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"full_text": "Quick Brown Foxes!"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1147a02afa087278e51fa365fb9e06b7.asciidoc 0000664 0000000 0000000 00000000234 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// api-conventions.asciidoc:355
[source, python]
----
resp = client.search(
size="1000",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/114d470e752efa9672ca68d7290fada8.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/add-alias.asciidoc:16
[source, python]
----
resp = client.indices.put_alias(
index="my-data-stream",
name="my-alias",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1153bd92ca18356db927054958cd95c6.asciidoc 0000664 0000000 0000000 00000000610 15176617013 0026301 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/function-score-query.asciidoc:269
[source, python]
----
resp = client.search(
query={
"function_score": {
"field_value_factor": {
"field": "my-int",
"factor": 1.2,
"modifier": "sqrt",
"missing": 1
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/115529722ba30b0b0d51a7ff87e59198.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-roles.asciidoc:64
[source, python]
----
resp = client.security.get_role(
name="my_admin_role",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/118f249a3b26c33416f641b33f2b74f8.asciidoc 0000664 0000000 0000000 00000001273 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pattern-tokenizer.asciidoc:128
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "pattern",
"pattern": ","
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="comma,separated,values",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/11be807bdeaeecc8174dec88e0851ea7.asciidoc 0000664 0000000 0000000 00000000446 15176617013 0027021 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/11c395d1649733bcab853fe31ec393b2.asciidoc 0000664 0000000 0000000 00000000224 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/get-license.asciidoc:62
[source, python]
----
resp = client.license.get()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/11c43c4aa5435f8a99dcc0d1f03c648f.asciidoc 0000664 0000000 0000000 00000000510 15176617013 0026557 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/max-aggregation.asciidoc:99
[source, python]
----
resp = client.search(
index="sales",
aggs={
"grade_max": {
"max": {
"field": "grade",
"missing": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/11d9043d3050a7175069dec7e0adc963.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/regexp-syntax.asciidoc:50
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"my_field": "a\\b"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/11e772ff5dbb73408ae30a1a367a0d9b.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/delete-pipeline.asciidoc:97
[source, python]
----
resp = client.ingest.delete_pipeline(
id="*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/11e8d6e14686efabb8634b6522c05cb5.asciidoc 0000664 0000000 0000000 00000000727 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:467
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"pre_tags": [
"",
""
],
"post_tags": [
" ",
""
],
"fields": {
"body": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/120fcf9f55128d6a81d5e87a9c235bbd.asciidoc 0000664 0000000 0000000 00000000576 15176617013 0026607 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/1233be1d4c9c7ca54126f1a0693b26de.asciidoc 0000664 0000000 0000000 00000001263 15176617013 0026475 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:104
[source, python]
----
resp = client.index(
index="my-index-000001",
id="3",
routing="1",
refresh=True,
document={
"my_id": "3",
"text": "This is an answer",
"my_join_field": {
"name": "answer",
"parent": "1"
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="4",
routing="1",
refresh=True,
document={
"my_id": "4",
"text": "This is another answer",
"my_join_field": {
"name": "answer",
"parent": "1"
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/123693835b3b85b9a2fa6fd1d3ad89c7.asciidoc 0000664 0000000 0000000 00000000604 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/routing-field.asciidoc:20
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
routing="user1",
refresh=True,
document={
"title": "This is a document"
},
)
print(resp)
resp1 = client.get(
index="my-index-000001",
id="1",
routing="user1",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/12433d2b637d002e8d5c9a1adce69d3b.asciidoc 0000664 0000000 0000000 00000000261 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:106
[source, python]
----
resp = client.indices.create(
index="publications",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1252fa45847edba5ec2b2f33da70ec5b.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026712 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:125
[source, python]
----
resp = client.cluster.state(
filter_path="routing_table.indices.**.state",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1259a9c151730e42de35bb2d1ba700c6.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026374 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-mapping.asciidoc:76
[source, python]
----
resp = client.indices.get_mapping(
index="my-index-000001,my-index-000002",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/128283698535116931dca9d16a16dca2.asciidoc 0000664 0000000 0000000 00000000240 15176617013 0026204 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-roles.asciidoc:99
[source, python]
----
resp = client.security.get_role()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1295f51b9e5d4ba9987b02478146b50b.asciidoc 0000664 0000000 0000000 00000000637 15176617013 0026310 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/high-jvm-memory-pressure.asciidoc:76
[source, python]
----
resp = client.indices.put_settings(
settings={
"index.max_result_window": 5000
},
)
print(resp)
resp1 = client.cluster.put_settings(
persistent={
"search.max_buckets": 20000,
"search.allow_expensive_queries": False
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/12adea5d76f73d94d80d42f53f67563f.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026532 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/12cb446446211f95f651e196a1f059b4.asciidoc 0000664 0000000 0000000 00000000375 15176617013 0026215 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:302
[source, python]
----
resp = client.snapshot.create(
repository="my_repository",
snapshot="my_snapshot",
wait_for_completion=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/12d5ff4b8d3d832b32a7e7e2a520d0bb.asciidoc 0000664 0000000 0000000 00000000417 15176617013 0026633 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-calendar-event.asciidoc:162
[source, python]
----
resp = client.ml.get_calendar_events(
calendar_id="planned-outages",
start="1635638400000",
end="1635724800000",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/12e9e758f7f18a6cbf27e9d0aea57a19.asciidoc 0000664 0000000 0000000 00000000547 15176617013 0026700 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/12ec704d62ffedcb03787e6aba69d382.asciidoc 0000664 0000000 0000000 00000000700 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/shingle-tokenfilter.asciidoc:374
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "stop",
"stopwords": [
"a"
]
},
{
"type": "shingle",
"filler_token": "+"
}
],
text="fox jumps a lazy dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/12facf3617a41551ce2f0c4d005cb1c7.asciidoc 0000664 0000000 0000000 00000001016 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:82
[source, python]
----
resp = client.indices.create(
index="movies",
mappings={
"properties": {
"name_and_plot": {
"type": "text"
},
"name": {
"type": "text",
"copy_to": "name_and_plot"
},
"plot": {
"type": "text",
"copy_to": "name_and_plot"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1302e24b0476e0e9af7a2c890edf9f62.asciidoc 0000664 0000000 0000000 00000000447 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-api.asciidoc:406
[source, python]
----
resp = client.search(
index="my-index-000001",
track_total_hits=False,
query={
"match": {
"user.id": "elkbee"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1313c540fef7e7c18a066f07789673fc.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026372 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:673
[source, python]
----
resp = client.sql.get_async(
id="FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=",
keep_alive="5d",
wait_for_completion_timeout="2s",
format="json",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/132ea3d5a0ffb6b5203e356e8329f679.asciidoc 0000664 0000000 0000000 00000001143 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:315
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/134384b8c63cfbd8d762fb01757bb3f9.asciidoc 0000664 0000000 0000000 00000000716 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/constant-keyword.asciidoc:40
[source, python]
----
resp = client.index(
index="logs-debug",
document={
"date": "2019-12-12",
"message": "Starting up Elasticsearch",
"level": "debug"
},
)
print(resp)
resp1 = client.index(
index="logs-debug",
document={
"date": "2019-12-12",
"message": "Starting up Elasticsearch"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/135819da3a4bde684357c57a49ad8e85.asciidoc 0000664 0000000 0000000 00000000244 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// migration/apis/deprecation.asciidoc:67
[source, python]
----
resp = client.migration.deprecations()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13670d1534125831c2059eebd86d840c.asciidoc 0000664 0000000 0000000 00000002146 15176617013 0026206 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:283
[source, python]
----
resp = client.indices.create(
index="brazilian_example",
settings={
"analysis": {
"filter": {
"brazilian_stop": {
"type": "stop",
"stopwords": "_brazilian_"
},
"brazilian_keywords": {
"type": "keyword_marker",
"keywords": [
"exemplo"
]
},
"brazilian_stemmer": {
"type": "stemmer",
"language": "brazilian"
}
},
"analyzer": {
"rebuilt_brazilian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"brazilian_stop",
"brazilian_keywords",
"brazilian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/136ae86b8d497dda799cf1cb583df929.asciidoc 0000664 0000000 0000000 00000001312 15176617013 0026625 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-field-mapping.asciidoc:80
[source, python]
----
resp = client.indices.create(
index="publications",
mappings={
"properties": {
"id": {
"type": "text"
},
"title": {
"type": "text"
},
"abstract": {
"type": "text"
},
"author": {
"properties": {
"id": {
"type": "text"
},
"name": {
"type": "text"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/137709a0a0dc38d6094291c9fc75b804.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026272 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:348
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"counter": 1,
"tags": [
"production"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/137c62a4443bdd7d5b95a15022a9dc30.asciidoc 0000664 0000000 0000000 00000002241 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:86
[source, python]
----
resp = client.indices.create(
index="arabic_example",
settings={
"analysis": {
"filter": {
"arabic_stop": {
"type": "stop",
"stopwords": "_arabic_"
},
"arabic_keywords": {
"type": "keyword_marker",
"keywords": [
"مثال"
]
},
"arabic_stemmer": {
"type": "stemmer",
"language": "arabic"
}
},
"analyzer": {
"rebuilt_arabic": {
"tokenizer": "standard",
"filter": [
"lowercase",
"decimal_digit",
"arabic_stop",
"arabic_normalization",
"arabic_keywords",
"arabic_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/138f7703c47ddf63633fdf5ca9bc7fa4.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:391
[source, python]
----
resp = client.index(
index="my-index-000001",
id="2",
routing="user1",
document={
"counter": 1,
"tags": [
"env2"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13917f7cfb6a382c293275ff71134ec4.asciidoc 0000664 0000000 0000000 00000000724 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:947
[source, python]
----
resp = client.render_search_template(
source={
"query": {
"match": {
"message": "Hello {{#name_exists}}{{query_string}}{{/name_exists}}{{^name_exists}}World{{/name_exists}}"
}
}
},
params={
"query_string": "Kimchy",
"name_exists": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13b02da42d3afe7f0b649e1c98ac9549.asciidoc 0000664 0000000 0000000 00000001314 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keep-types-tokenfilter.asciidoc:185
[source, python]
----
resp = client.indices.create(
index="keep_types_example",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"extract_alpha"
]
}
},
"filter": {
"extract_alpha": {
"type": "keep_types",
"types": [
""
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13cc51ca3a783cdbb1f1d353eaedbf23.asciidoc 0000664 0000000 0000000 00000000373 15176617013 0027044 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/troubleshooting.asciidoc:114
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.xpack.security.authc": "debug"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13d90ba227131aefbf4fcfd5992e662a.asciidoc 0000664 0000000 0000000 00000001703 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/bool-query.asciidoc:159
[source, python]
----
resp = client.search(
query={
"bool": {
"should": [
{
"match": {
"name.first": {
"query": "shay",
"_name": "first"
}
}
},
{
"match": {
"name.last": {
"query": "banon",
"_name": "last"
}
}
}
],
"filter": {
"terms": {
"name.last": [
"banon",
"kimchy"
],
"_name": "test"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13d91782399ba1f291e103c18b5338cc.asciidoc 0000664 0000000 0000000 00000001024 15176617013 0026264 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/13df08eefc9ba98e311793bbca74133b.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-user-profile.asciidoc:115
[source, python]
----
resp = client.security.get_user_profile(
uid="u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
data="app1.key1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13e3fefbf55f672926aa389d76fc8bea.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026753 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/securing-communications/change-passwords-native-users.asciidoc:42
[source, python]
----
resp = client.security.change_password(
username="user1",
password="new-test-password",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13ebcb01ebf1b5d2b5c52739db47e30c.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026677 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/recovery.asciidoc:185
[source, python]
----
resp = client.indices.recovery(
index="index1,index2",
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc 0000664 0000000 0000000 00000000477 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/post-inference.asciidoc:202
[source, python]
----
resp = client.inference.inference(
task_type="sparse_embedding",
inference_id="my-elser-model",
input="The sky above the port was the color of television tuned to a dead channel.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/13fe12cdb73bc89f07a83f1e6b127511.asciidoc 0000664 0000000 0000000 00000001042 15176617013 0026477 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:208
[source, python]
----
resp = client.indices.create(
index="google-vertex-ai-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 768,
"element_type": "float",
"similarity": "dot_product"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/141ef0ebaa3b0772892b79b9bb85efb0.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026650 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/14254a0e725044faedf9370ead76f6ce.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-api.asciidoc:465
[source, python]
----
resp = client.search(
q="user.id:elkbee",
size="0",
terminate_after="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/142de21c40e84e2e2d8d832e5b3b36db.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/migrate-to-data-tiers-routing-guide.asciidoc:175
[source, python]
----
resp = client.ilm.migrate_to_data_tiers()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1445ca2e813ed1c25504107b4b11760e.asciidoc 0000664 0000000 0000000 00000000430 15176617013 0026234 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/getting-started.asciidoc:205
[source, python]
----
resp = client.ccr.follow(
index="server-metrics-follower",
wait_for_active_shards="1",
remote_cluster="leader",
leader_index="server-metrics",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1452829804551d2d6acedd4e73b29637.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026275 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/ignore-missing-component-templates.asciidoc:62
[source, python]
----
resp = client.indices.create_data_stream(
name="logs-foo-bar",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/146bd22fd0e7be2345619e8f11d3a4cb.asciidoc 0000664 0000000 0000000 00000000372 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/hotspotting.asciidoc:253
[source, python]
----
resp = client.cat.tasks(
v=True,
s="time:desc",
h="type,action,running_time,node,cancellable",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/147d341cb212dcc015c129a9c5dcf9c9.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026557 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/put-trained-models-aliases.asciidoc:87
[source, python]
----
resp = client.ml.put_trained_model_alias(
model_id="flight-delay-prediction-1574775339910",
model_alias="flight_delay_model",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/148edc235fcfbc263561f87f5533e688.asciidoc 0000664 0000000 0000000 00000001160 15176617013 0026453 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:196
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"percolate": {
"field": "query",
"documents": [
{
"message": "bonsai tree"
},
{
"message": "new tree"
},
{
"message": "the office"
},
{
"message": "office tree"
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/14936b96cfb8ff999a833f615ba75495.asciidoc 0000664 0000000 0000000 00000000734 15176617013 0026421 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:518
[source, python]
----
resp = client.search(
index="bicycles,other_cycles",
query={
"bool": {
"must": {
"match": {
"description": "dutch"
}
},
"filter": {
"term": {
"cycle_type": "bicycle"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/149a0eea54cdf6ea3052af6dba2d2a63.asciidoc 0000664 0000000 0000000 00000000640 15176617013 0026765 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-set-priority.asciidoc:29
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"set_priority": {
"priority": 50
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/14a1db30e13eb1d03cfd9710ca847ebb.asciidoc 0000664 0000000 0000000 00000001260 15176617013 0026676 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-new-data-stream.asciidoc:65
[source, python]
----
resp = client.bulk(
index="my-data-stream",
operations=[
{
"create": {}
},
{
"@timestamp": "2099-05-06T16:21:15.000Z",
"message": "192.0.2.42 - - [06/May/2099:16:21:15 +0000] \"GET /images/bg.jpg HTTP/1.0\" 200 24736"
},
{
"create": {}
},
{
"@timestamp": "2099-05-06T16:25:42.000Z",
"message": "192.0.2.255 - - [06/May/2099:16:25:42 +0000] \"GET /favicon.ico HTTP/1.0\" 200 3638"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/14a33c364873c2f930ca83d0a3005389.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026203 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:46
[source, python]
----
resp = client.cluster.allocation_explain(
index="my-index",
shard=0,
primary=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/14af7e2899e64f231068bded6aaf9ec5.asciidoc 0000664 0000000 0000000 00000000730 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/dynamic.asciidoc:27
[source, python]
----
resp = client.index(
index="my-index-000001",
id="2",
document={
"username": "marywhite",
"email": "mary@white.com",
"name": {
"first": "Mary",
"middle": "Alice",
"last": "White"
}
},
)
print(resp)
resp1 = client.indices.get_mapping(
index="my-index-000001",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/14afe65afee3d43f27aaaa5b37f26a31.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026773 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:164
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "Point",
"coordinates": [
-77.03653,
38.897676
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/14b81f96297952970b78a3216e059596.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026023 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/async-search.asciidoc:159
[source, python]
----
resp = client.async_search.get(
id="FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/14f124294a4a0e3a657d1468c36161cd.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026257 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/aggregate-metric-double.asciidoc:205
[source, python]
----
resp = client.search(
index="stats-index",
query={
"term": {
"agg_metric": {
"value": 702.3
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/14f2dab0583c5a9fcc39931d33194872.asciidoc 0000664 0000000 0000000 00000000266 15176617013 0026361 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:296
[source, python]
----
resp = client.search(
index="sample_weblogs_by_clientip",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/150b5fee5678bf8cdf0932da73eada80.asciidoc 0000664 0000000 0000000 00000001173 15176617013 0026737 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-stats.asciidoc:2556
[source, python]
----
resp = client.nodes.stats(
metric="indices",
index_metric="fielddata",
fields="field1,field2",
)
print(resp)
resp1 = client.nodes.stats(
metric="indices",
index_metric="fielddata",
level="indices",
fields="field1,field2",
)
print(resp1)
resp2 = client.nodes.stats(
metric="indices",
index_metric="fielddata",
level="shards",
fields="field1,field2",
)
print(resp2)
resp3 = client.nodes.stats(
metric="indices",
index_metric="fielddata",
fields="field*",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/151d2b11807ec684b0c01aa89189a801.asciidoc 0000664 0000000 0000000 00000000566 15176617013 0026257 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:474
[source, python]
----
resp = client.search(
query={
"query_string": {
"fields": [
"title",
"content"
],
"query": "this that thus",
"minimum_should_match": 2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1522a9297151d7046e6345b9b27539ca.asciidoc 0000664 0000000 0000000 00000000701 15176617013 0026133 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/154d703732daf5c5fcd0122e6a50213f.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:339
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
runtime={
"measures.start": {
"type": "long"
},
"measures.end": {
"type": "long"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/156bc64c94f9f3334fbce25165d2286a.asciidoc 0000664 0000000 0000000 00000000654 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/index-sorting.asciidoc:15
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index": {
"sort.field": "date",
"sort.order": "desc"
}
},
mappings={
"properties": {
"date": {
"type": "date"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1570976f7807b88dc8a046b833be057b.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/hotspotting.asciidoc:34
[source, python]
----
resp = client.cat.nodes(
v=True,
s="master,name",
h="name,master,node.role,heap.percent,disk.used_percent,cpu",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1572696b97822d3332be51700e09672f.asciidoc 0000664 0000000 0000000 00000000561 15176617013 0026063 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:130
[source, python]
----
resp = client.search(
index="range_index",
query={
"range": {
"time_frame": {
"gte": "2015-10-31",
"lte": "2015-11-01",
"relation": "within"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1598a0fec6b1ca78cadbaba65f465196.asciidoc 0000664 0000000 0000000 00000001417 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pattern-tokenizer.asciidoc:216
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "pattern",
"pattern": "\"((?:\\\\\"|[^\"]|\\\\\")+)\"",
"group": 1
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="\"value\", \"value with embedded \\\" quote\"",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/15a34bfe0ef8ef6333c8c7b55c011e5d.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:275
[source, python]
----
resp = client.indices.analyze(
filter=[
"lowercase"
],
text="BaR",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/15ac33d641b376d9494075eb1f0d4066.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026263 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/15c76cc8a038f686395053a240262929.asciidoc 0000664 0000000 0000000 00000000744 15176617013 0026066 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/classic-tokenfilter.asciidoc:132
[source, python]
----
resp = client.indices.create(
index="classic_example",
settings={
"analysis": {
"analyzer": {
"classic_analyzer": {
"tokenizer": "classic",
"filter": [
"classic"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/15d4be58359542775f4aff88e6d8adb5.asciidoc 0000664 0000000 0000000 00000000576 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:135
[source, python]
----
resp = client.ingest.simulate(
id="my-pipeline",
docs=[
{
"_source": {
"my-keyword-field": "FOO"
}
},
{
"_source": {
"my-keyword-field": "BAR"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/15d948d593d2624ac5e2b155052048f0.asciidoc 0000664 0000000 0000000 00000000453 15176617013 0026207 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/remove-duplicates-tokenfilter.asciidoc:24
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"keyword_repeat",
"stemmer"
],
text="jumping dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/15e90b82827c8512670820cf856a9c71.asciidoc 0000664 0000000 0000000 00000000706 15176617013 0026150 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/date-index-name.asciidoc:23
[source, python]
----
resp = client.ingest.put_pipeline(
id="monthlyindex",
description="monthly date-time index naming",
processors=[
{
"date_index_name": {
"field": "date1",
"index_name_prefix": "my-index-",
"date_rounding": "M"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/15f769bbd7b5fddeb3353ae726b71b14.asciidoc 0000664 0000000 0000000 00000003315 15176617013 0026654 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/1605be45a5711d1929d6ad2d1ae0f797.asciidoc 0000664 0000000 0000000 00000000341 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/discovery/voting.asciidoc:26
[source, python]
----
resp = client.cluster.state(
filter_path="metadata.cluster_coordination.last_committed_config",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/160de80948e0c7db49b1c311848a66a2.asciidoc 0000664 0000000 0000000 00000001652 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/getting-started.asciidoc:161
[source, python]
----
resp = client.watcher.put_watch(
id="log_error_watch",
trigger={
"schedule": {
"interval": "10s"
}
},
input={
"search": {
"request": {
"indices": [
"logs"
],
"body": {
"query": {
"match": {
"message": "error"
}
}
}
}
}
},
condition={
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
actions={
"log_error": {
"logging": {
"text": "Found {{ctx.payload.hits.total}} errors in the logs"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/160f39a50847bad0be4be1529a95e4ce.asciidoc 0000664 0000000 0000000 00000003517 15176617013 0026573 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1140
[source, python]
----
resp = client.indices.create(
index="irish_example",
settings={
"analysis": {
"filter": {
"irish_hyphenation": {
"type": "stop",
"stopwords": [
"h",
"n",
"t"
],
"ignore_case": True
},
"irish_elision": {
"type": "elision",
"articles": [
"d",
"m",
"b"
],
"articles_case": True
},
"irish_stop": {
"type": "stop",
"stopwords": "_irish_"
},
"irish_lowercase": {
"type": "lowercase",
"language": "irish"
},
"irish_keywords": {
"type": "keyword_marker",
"keywords": [
"sampla"
]
},
"irish_stemmer": {
"type": "stemmer",
"language": "irish"
}
},
"analyzer": {
"rebuilt_irish": {
"tokenizer": "standard",
"filter": [
"irish_hyphenation",
"irish_elision",
"irish_lowercase",
"irish_stop",
"irish_keywords",
"irish_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/16239fe9f0b0dcfd5ea64c08c6fed21d.asciidoc 0000664 0000000 0000000 00000001201 15176617013 0027004 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/reverse-nested-aggregation.asciidoc:22
[source, python]
----
resp = client.indices.create(
index="issues",
mappings={
"properties": {
"tags": {
"type": "keyword"
},
"comments": {
"type": "nested",
"properties": {
"username": {
"type": "keyword"
},
"comment": {
"type": "text"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/162b5b693b713f0bfab1209d59443c46.asciidoc 0000664 0000000 0000000 00000000502 15176617013 0026336 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/bool-query.asciidoc:133
[source, python]
----
resp = client.search(
query={
"constant_score": {
"filter": {
"term": {
"status": "active"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/16351d99d0608789d04a0bb11a537098.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026134 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/edgengram-tokenfilter.asciidoc:143
[source, python]
----
resp = client.indices.create(
index="edge_ngram_example",
settings={
"analysis": {
"analyzer": {
"standard_edge_ngram": {
"tokenizer": "standard",
"filter": [
"edge_ngram"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1637ef51d673b35cc8894ee80cd61c87.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/high-cpu-usage.asciidoc:28
[source, python]
----
resp = client.cat.nodes(
v=True,
s="cpu:desc",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1648dd31d0fef01e7504ebeb687f4f30.asciidoc 0000664 0000000 0000000 00000002333 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rank-feature-query.asciidoc:92
[source, python]
----
resp = client.index(
index="test",
id="1",
refresh=True,
document={
"url": "https://en.wikipedia.org/wiki/2016_Summer_Olympics",
"content": "Rio 2016",
"pagerank": 50.3,
"url_length": 42,
"topics": {
"sports": 50,
"brazil": 30
}
},
)
print(resp)
resp1 = client.index(
index="test",
id="2",
refresh=True,
document={
"url": "https://en.wikipedia.org/wiki/2016_Brazilian_Grand_Prix",
"content": "Formula One motor race held on 13 November 2016",
"pagerank": 50.3,
"url_length": 47,
"topics": {
"sports": 35,
"formula one": 65,
"brazil": 20
}
},
)
print(resp1)
resp2 = client.index(
index="test",
id="3",
refresh=True,
document={
"url": "https://en.wikipedia.org/wiki/Deadpool_(film)",
"content": "Deadpool is a 2016 American superhero film",
"pagerank": 50.3,
"url_length": 37,
"topics": {
"movies": 60,
"super hero": 65
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/16535685833419f0033545ffce4fdf00.asciidoc 0000664 0000000 0000000 00000001156 15176617013 0026221 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:372
[source, python]
----
resp = client.search(
index="index2",
query={
"query_string": {
"query": "running with scissors",
"fields": [
"comment",
"comment.english"
]
}
},
highlight={
"order": "score",
"fields": {
"comment.english": {
"type": "fvh",
"matched_fields": [
"comment"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1659420311d907d9fc024b96f4150216.asciidoc 0000664 0000000 0000000 00000000561 15176617013 0026045 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/length-tokenfilter.asciidoc:27
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "length",
"min": 0,
"max": 4
}
],
text="the quick brown fox jumps over the lazy dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/16634cfa7916cf4e8048a1d70e6240f2.asciidoc 0000664 0000000 0000000 00000002750 15176617013 0026356 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-client.asciidoc:427
[source, python]
----
resp = client.search_application.put(
name="my-example-app",
search_application={
"indices": [
"example-index"
],
"template": {
"script": {
"lang": "mustache",
"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": {},
"_es_aggs": {},
"_es_sort_fields": {},
"size": 10,
"from": 0
},
"dictionary": {}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/166bcfc6d5d39defec7ad6aa44d0914b.asciidoc 0000664 0000000 0000000 00000000464 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:80
[source, python]
----
resp = client.tasks.list()
print(resp)
resp1 = client.tasks.list(
nodes="nodeId1,nodeId2",
)
print(resp1)
resp2 = client.tasks.list(
nodes="nodeId1,nodeId2",
actions="cluster:*",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/16985e5b17d2da0955a14fbe02e8dfca.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:243
[source, python]
----
resp = client.termvectors(
index="my-index-000001",
id="1",
fields=[
"text"
],
offsets=True,
payloads=True,
positions=True,
term_statistics=True,
field_statistics=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/169b39bb889ecd47541bed3e48725488.asciidoc 0000664 0000000 0000000 00000000371 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:73
[source, python]
----
resp = client.search(
index="bug_reports",
query={
"term": {
"labels": "urgent"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/16a7ce08b4a6b3af269f27eecc71d664.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0026650 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/170c8a3fb81a4e93cd3034a3b5a43ac9.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0026552 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-shape-query.asciidoc:280
[source, python]
----
resp = client.index(
index="test",
id="1",
document={
"location": {
"coordinates": [
[
46.25,
20.14
],
[
47.49,
19.04
]
],
"type": "multipoint"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/172155ca4bf6dfcbd489453f50739396.asciidoc 0000664 0000000 0000000 00000000401 15176617013 0026363 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-api.asciidoc:408
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="snapshot*",
size="2",
sort="name",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17266cee5eaaddf08e5534bf580a1910.asciidoc 0000664 0000000 0000000 00000000227 15176617013 0026566 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/stats.asciidoc:90
[source, python]
----
resp = client.watcher.stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/172b18e435c400bed85227624de3acfd.asciidoc 0000664 0000000 0000000 00000001304 15176617013 0026475 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/run-as-privilege.asciidoc:143
[source, python]
----
resp = client.security.put_role(
name="my_analyst_role",
refresh=True,
cluster=[
"monitor"
],
indices=[
{
"names": [
"index1",
"index2"
],
"privileges": [
"manage"
]
}
],
applications=[
{
"application": "myapp",
"privileges": [
"read"
],
"resources": [
"*"
]
}
],
metadata={
"version": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/172d150e56a225155a62c7b18bf8da67.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026347 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:502
[source, python]
----
resp = client.sql.query(
format="txt",
query="SELECT YEAR(release_date) AS year FROM library WHERE page_count > 300 AND author = 'Frank Herbert' GROUP BY year HAVING COUNT(*) > 0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17316a81c9dbdd120b7754116bf0461c.asciidoc 0000664 0000000 0000000 00000001470 15176617013 0026333 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/1736545c8b5674f6d311f3277eb387f1.asciidoc 0000664 0000000 0000000 00000000401 15176617013 0026224 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-data-stream-retention.asciidoc:131
[source, python]
----
resp = client.indices.put_data_lifecycle(
name="my-data-stream",
data_retention="30d",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/173b190078621415a80e851eaf794e8a.asciidoc 0000664 0000000 0000000 00000001224 15176617013 0026213 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/standard-analyzer.asciidoc:154
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_english_analyzer": {
"type": "standard",
"max_token_length": 5,
"stopwords": "_english_"
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_english_analyzer",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/174b93c323aa8e9cc8ee2a3df5736810.asciidoc 0000664 0000000 0000000 00000002616 15176617013 0026521 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/17566e23c191f1004a2719f2c4242307.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026025 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/get-autoscaling-capacity.asciidoc:268
[source, python]
----
resp = client.autoscaling.get_autoscaling_capacity()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/178be73b74ba9f297429e32267084ac7.asciidoc 0000664 0000000 0000000 00000001202 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-or-query.asciidoc:10
[source, python]
----
resp = client.search(
query={
"span_or": {
"clauses": [
{
"span_term": {
"field": "value1"
}
},
{
"span_term": {
"field": "value2"
}
},
{
"span_term": {
"field": "value3"
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/178c920d5e8ec0071f77290fa059802c.asciidoc 0000664 0000000 0000000 00000000426 15176617013 0026300 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/update-settings.asciidoc:138
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"refresh_interval": "1s"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/179f0a3e84ff4bbac18787a018eabf89.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:482
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "Jon",
"type": "cross_fields",
"analyzer": "standard",
"fields": [
"first",
"last",
"*.edge"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17a1e308761afd3282f13d44d7be008a.asciidoc 0000664 0000000 0000000 00000000564 15176617013 0026421 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:699
[source, python]
----
resp = client.indices.create(
index="example",
mappings={
"properties": {
"comment": {
"type": "text",
"term_vector": "with_positions_offsets"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17b1647c8509543f2388c886f2584a20.asciidoc 0000664 0000000 0000000 00000001313 15176617013 0026070 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// reranking/semantic-reranking.asciidoc:107
[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": "elastic-rerank",
"inference_text": "How often does the moon hide the sun?",
"rank_window_size": 100,
"min_score": 0.5
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17c2b0a6b0305804ff3b7fd3b4a68df3.asciidoc 0000664 0000000 0000000 00000001310 15176617013 0026547 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/simulate-pipeline.asciidoc:223
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"description": "_description",
"processors": [
{
"set": {
"field": "field2",
"value": "_value"
}
}
]
},
docs=[
{
"_index": "index",
"_id": "id",
"_source": {
"foo": "bar"
}
},
{
"_index": "index",
"_id": "id",
"_source": {
"foo": "rab"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17dd67a66c49f7eb618dd17430e48dfa.asciidoc 0000664 0000000 0000000 00000000667 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:239
[source, python]
----
resp = client.search(
index="index",
query={
"constant_score": {
"filter": {
"range": {
"my_date": {
"gte": "now-1h/m",
"lte": "now/m"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17e6f3fac556f08a78f7a876e71acb89.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/allocation/delayed.asciidoc:40
[source, python]
----
resp = client.indices.put_settings(
index="_all",
settings={
"settings": {
"index.unassigned.node_left.delayed_timeout": "5m"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17f8a8990b0166befa3bc2b10fd28134.asciidoc 0000664 0000000 0000000 00000000476 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:40
[source, python]
----
resp = client.index(
index="my-index-000001",
id="match_value",
document={
"query": {
"match": {
"field": "value"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/17fb298fb1e47f7d946a772d68f4e2df.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:246
[source, python]
----
resp = client.delete_by_query(
index="my-data-stream",
query={
"match": {
"user.id": "vlb44hny"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/182df084f028479ecbe8d7648ddad892.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0026543 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/start-ilm.asciidoc:84
[source, python]
----
resp = client.ilm.get_status()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/186a7143d50e8c3ee01094e1a9ff0c0c.asciidoc 0000664 0000000 0000000 00000001613 15176617013 0026477 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:659
[source, python]
----
resp = client.indices.create(
index="passage_vectors",
mappings={
"properties": {
"full_text": {
"type": "text"
},
"creation_time": {
"type": "date"
},
"paragraph": {
"type": "nested",
"properties": {
"vector": {
"type": "dense_vector",
"dims": 2,
"index_options": {
"type": "hnsw"
}
},
"text": {
"type": "text",
"index": False
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/187733e50c60350f3f75921bea3b72c2.asciidoc 0000664 0000000 0000000 00000000573 15176617013 0026270 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:615
[source, python]
----
resp = client.search(
index="my-index-000001",
scroll="1m",
slice={
"field": "@timestamp",
"id": 0,
"max": 10
},
query={
"match": {
"message": "foo"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/187e8786e0a90f1f6278cf89b670de0a.asciidoc 0000664 0000000 0000000 00000002177 15176617013 0026470 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:891
[source, python]
----
resp = client.indices.create(
index="german_example",
settings={
"analysis": {
"filter": {
"german_stop": {
"type": "stop",
"stopwords": "_german_"
},
"german_keywords": {
"type": "keyword_marker",
"keywords": [
"Beispiel"
]
},
"german_stemmer": {
"type": "stemmer",
"language": "light_german"
}
},
"analyzer": {
"rebuilt_german": {
"tokenizer": "standard",
"filter": [
"lowercase",
"german_stop",
"german_keywords",
"german_normalization",
"german_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/188e6208cccb13027a5c1c95440841ee.asciidoc 0000664 0000000 0000000 00000002274 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filters-aggregation.asciidoc:13
[source, python]
----
resp = client.bulk(
index="logs",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"body": "warning: page could not be rendered"
},
{
"index": {
"_id": 2
}
},
{
"body": "authentication error"
},
{
"index": {
"_id": 3
}
},
{
"body": "warning: connection timed out"
}
],
)
print(resp)
resp1 = client.search(
index="logs",
size=0,
aggs={
"messages": {
"filters": {
"filters": {
"errors": {
"match": {
"body": "error"
}
},
"warnings": {
"match": {
"body": "warning"
}
}
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/189f0cd1ee2485cf11a2968f01d54e5b.asciidoc 0000664 0000000 0000000 00000001357 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/derivative-aggregation.asciidoc:235
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
},
"sales_deriv": {
"derivative": {
"buckets_path": "sales",
"unit": "day"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/18ddb7e7a4bcafd449df956e828ed7a8.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0027036 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:552
[source, python]
----
resp = client.tasks.cancel(
task_id="r1A2WoRbTwKZ516z6NEs5A:36619",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/190a21e32db2125ddaea0f634e126a84.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/clone-index.asciidoc:97
[source, python]
----
resp = client.indices.clone(
index="my_source_index",
target="my_target_index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/19174d872fd1e43cbfb7a96a33d13c96.asciidoc 0000664 0000000 0000000 00000003533 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cartesian-centroid-aggregation.asciidoc:183
[source, python]
----
resp = client.indices.create(
index="places",
mappings={
"properties": {
"geometry": {
"type": "shape"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="places",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"name": "NEMO Science Museum",
"geometry": "POINT(491.2350 5237.4081)"
},
{
"index": {
"_id": 2
}
},
{
"name": "Sportpark De Weeren",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
496.5305328369141,
5239.347642069457
],
[
496.6979026794433,
5239.172175893484
],
[
496.9425201416015,
5239.238958618537
],
[
496.7944622039794,
5239.420969150824
],
[
496.5305328369141,
5239.347642069457
]
]
]
}
}
],
)
print(resp1)
resp2 = client.search(
index="places",
size="0",
aggs={
"centroid": {
"cartesian_centroid": {
"field": "geometry"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/192fa1f6f51dfb640e9e15bb5cd7eebc.asciidoc 0000664 0000000 0000000 00000000256 15176617013 0027075 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/error-handling.asciidoc:148
[source, python]
----
resp = client.ilm.retry(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/193234bb5dc6451fd15b584fbefd2446.asciidoc 0000664 0000000 0000000 00000001173 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/role-templates.asciidoc:16
[source, python]
----
resp = client.security.put_role(
name="example1",
indices=[
{
"names": [
"my-index-000001"
],
"privileges": [
"read"
],
"query": {
"template": {
"source": {
"term": {
"acl.username": "{{_user.username}}"
}
}
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/193704020a19714dec390452a4e75e8d.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026202 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// quickstart/getting-started.asciidoc:54
[source, python]
----
resp = client.indices.create(
index="books",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/193d86b6cc34e12c2be806d27816a35c.asciidoc 0000664 0000000 0000000 00000001147 15176617013 0026432 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:363
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
params={
"size": 5,
"query_string": "mountain climbing",
"text_fields": [
{
"name": "title",
"boost": 10
},
{
"name": "description",
"boost": 2
},
{
"name": "state",
"boost": 1
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/194bbac15e709174ac85b681f3a3d137.asciidoc 0000664 0000000 0000000 00000001176 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template.asciidoc:195
[source, python]
----
resp = client.indices.put_index_template(
name="template_1",
index_patterns=[
"template*"
],
template={
"settings": {
"number_of_shards": 1
},
"aliases": {
"alias1": {},
"alias2": {
"filter": {
"term": {
"user.id": "kimchy"
}
},
"routing": "shard-1"
},
"{index}-alias": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/196aed02b11def364bab84e455c1a073.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0026544 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template.asciidoc:333
[source, python]
----
resp = client.indices.put_index_template(
name="template_1",
index_patterns=[
"logs-*"
],
data_stream={},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/199f5165d876267080046c907e93483f.asciidoc 0000664 0000000 0000000 00000000373 15176617013 0026031 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:153
[source, python]
----
resp = client.indices.analyze(
index="my-index-000001",
field="my-field",
text="this is a test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/19c00c6b29bc7dbc5e92b3668da2da93.asciidoc 0000664 0000000 0000000 00000000733 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/simulate-ingest.asciidoc:279
[source, python]
----
resp = client.simulate.ingest(
docs=[
{
"_index": "my-index",
"_id": "123",
"_source": {
"foo": "bar"
}
},
{
"_index": "my-index",
"_id": "456",
"_source": {
"foo": "rab"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/19ee488226d357d1576e7d3ae7a4693f.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/keyword-analyzer.asciidoc:14
[source, python]
----
resp = client.indices.analyze(
analyzer="keyword",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a1f3421717ff744ed83232729289bb0.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0026216 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// slm/apis/slm-delete.asciidoc:71
[source, python]
----
resp = client.slm.delete_lifecycle(
policy_id="daily-snapshots",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a2890b90f3699fc2a4f27f94b145be9.asciidoc 0000664 0000000 0000000 00000001003 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:487
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="nightly-cluster-state-snapshots",
schedule="0 30 2 * * ?",
name="",
repository="my_secure_repository",
config={
"include_global_state": True,
"indices": "-*"
},
retention={
"expire_after": "30d",
"min_count": 5,
"max_count": 50
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a3897cfb4f974c09d0d847baac8aa6d.asciidoc 0000664 0000000 0000000 00000000444 15176617013 0026743 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/hotspotting.asciidoc:196
[source, python]
----
resp = client.indices.stats(
level="shards",
human=True,
expand_wildcards="all",
filter_path="indices.*.total.indexing.index_total",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a3a4b8a4bfee4ab84ddd13d8835f560.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026725 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/start-dfanalytics.asciidoc:88
[source, python]
----
resp = client.ml.start_data_frame_analytics(
id="loganalytics",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a4f8beb6847678880ca113ee6fb75ca.asciidoc 0000664 0000000 0000000 00000000555 15176617013 0026612 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/completion-suggest.asciidoc:362
[source, python]
----
resp = client.search(
index="music",
pretty=True,
suggest={
"song-suggest": {
"regex": "n[ever|i]r",
"completion": {
"field": "suggest"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a56df055b94466ca76818e0858752c6.asciidoc 0000664 0000000 0000000 00000000650 15176617013 0026235 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:97
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="openai_embeddings",
inference_config={
"service": "openai",
"service_settings": {
"api_key": "",
"model_id": "text-embedding-ada-002"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a6dbe5df488c4a16e2f1101ba8a25d9.asciidoc 0000664 0000000 0000000 00000000357 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pattern-tokenizer.asciidoc:32
[source, python]
----
resp = client.indices.analyze(
tokenizer="pattern",
text="The foo_bar_size's default is 5.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a7483796087053ba55029d0dc2ab356.asciidoc 0000664 0000000 0000000 00000000534 15176617013 0026206 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/1a81fe0186369838531e116e85aa4ccd.asciidoc 0000664 0000000 0000000 00000001213 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/filter-search-results.asciidoc:29
[source, python]
----
resp = client.indices.create(
index="shirts",
mappings={
"properties": {
"brand": {
"type": "keyword"
},
"color": {
"type": "keyword"
},
"model": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.index(
index="shirts",
id="1",
refresh=True,
document={
"brand": "gucci",
"color": "red",
"model": "slim"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/1a8d92e93481c432a91f7c213099800a.asciidoc 0000664 0000000 0000000 00000000253 15176617013 0026210 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-api-key.asciidoc:295
[source, python]
----
resp = client.security.query_api_keys()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a9e03ce0355872a7db27fedc783fbec.asciidoc 0000664 0000000 0000000 00000000673 15176617013 0026743 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-google-vertex-ai.asciidoc:151
[source, python]
----
resp = client.inference.put(
task_type="rerank",
inference_id="google_vertex_ai_rerank",
inference_config={
"service": "googlevertexai",
"service_settings": {
"service_account_json": "",
"project_id": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1a9efb56adb2cd84faa9825a129381b9.asciidoc 0000664 0000000 0000000 00000000536 15176617013 0026660 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-search.asciidoc:222
[source, python]
----
resp = client.rollup.rollup_search(
index="sensor-1,sensor_rollup",
size=0,
aggregations={
"max_temperature": {
"max": {
"field": "temperature"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1aa91d3d48140d6367b6cabca8737b8f.asciidoc 0000664 0000000 0000000 00000001357 15176617013 0026575 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/bulk.asciidoc:642
[source, python]
----
resp = client.bulk(
operations=[
{
"update": {
"_id": "5",
"_index": "index1"
}
},
{
"doc": {
"my_field": "foo"
}
},
{
"update": {
"_id": "6",
"_index": "index1"
}
},
{
"doc": {
"my_field": "foo"
}
},
{
"create": {
"_id": "7",
"_index": "index1"
}
},
{
"my_field": "foo"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1aa96eeaf63fc967e166d1a2fcdccccc.asciidoc 0000664 0000000 0000000 00000001506 15176617013 0027234 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/subobjects.asciidoc:131
[source, python]
----
resp = client.indices.create(
index="my-index-000002",
mappings={
"properties": {
"metrics": {
"subobjects": False,
"properties": {
"time": {
"type": "object",
"properties": {
"min": {
"type": "long"
},
"max": {
"type": "long"
}
}
}
}
}
}
},
)
print(resp)
resp1 = client.indices.get_mapping(
index="my-index-000002",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/1adee74383e5594e45c937177d75aa2a.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/unsigned_long.asciidoc:93
[source, python]
----
resp = client.search(
index="my_index",
query={
"match_all": {}
},
sort={
"my_counter": "desc"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b076ceb1ead9f6897c2f351f0e45f74.asciidoc 0000664 0000000 0000000 00000001261 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-api-keys.asciidoc:226
[source, python]
----
resp = client.security.create_api_key(
name="my-restricted-api-key",
role_descriptors={
"my-restricted-role-descriptor": {
"indices": [
{
"names": [
"my-search-app"
],
"privileges": [
"read"
]
}
],
"restriction": {
"workflows": [
"search_application_query"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b0b29e5cd7550c648d0892378e93804.asciidoc 0000664 0000000 0000000 00000000370 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-calendar-job.asciidoc:42
[source, python]
----
resp = client.ml.delete_calendar_job(
calendar_id="planned-outages",
job_id="total-requests",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b0dc9d076bbb58c6a2953ef4323d2fc.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/ack-watch.asciidoc:196
[source, python]
----
resp = client.watcher.ack_watch(
watch_id="my_watch",
action_id="test_index",
)
print(resp)
resp1 = client.watcher.get_watch(
id="my_watch",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/1b0f40959a7a4d124372f2bd3f7eac85.asciidoc 0000664 0000000 0000000 00000001343 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/fingerprint-tokenfilter.asciidoc:117
[source, python]
----
resp = client.indices.create(
index="custom_fingerprint_example",
settings={
"analysis": {
"analyzer": {
"whitespace_": {
"tokenizer": "whitespace",
"filter": [
"fingerprint_plus_concat"
]
}
},
"filter": {
"fingerprint_plus_concat": {
"type": "fingerprint",
"max_output_size": 100,
"separator": "+"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b2ab75d3c8064fac6ecc63104396c02.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0026472 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/put-calendar-job.asciidoc:42
[source, python]
----
resp = client.ml.put_calendar_job(
calendar_id="planned-outages",
job_id="total-requests",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b3762712c14a19e8c2956b4f530d327.asciidoc 0000664 0000000 0000000 00000001273 15176617013 0026210 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/put-follow.asciidoc:114
[source, python]
----
resp = client.ccr.follow(
index="follower_index",
wait_for_active_shards="1",
remote_cluster="remote_cluster",
leader_index="leader_index",
settings={
"index.number_of_replicas": 0
},
max_read_request_operation_count=1024,
max_outstanding_read_requests=16,
max_read_request_size="1024k",
max_write_request_operation_count=32768,
max_write_request_size="16k",
max_outstanding_write_requests=8,
max_write_buffer_count=512,
max_write_buffer_size="512k",
max_retry_delay="10s",
read_poll_timeout="30s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b37e2237c9e3aaf84d56cc5c0bdb9ec.asciidoc 0000664 0000000 0000000 00000000673 15176617013 0027015 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/error-handling.asciidoc:19
[source, python]
----
resp = client.ilm.put_lifecycle(
name="shrink-index",
policy={
"phases": {
"warm": {
"min_age": "5d",
"actions": {
"shrink": {
"number_of_shards": 4
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b47d988b218ee595430ec91eba91d80.asciidoc 0000664 0000000 0000000 00000000711 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/ignore-missing-component-templates.asciidoc:47
[source, python]
----
resp = client.indices.put_index_template(
name="logs-foo",
index_patterns=[
"logs-foo-*"
],
data_stream={},
composed_of=[
"logs-foo_component1",
"logs-foo_component2"
],
ignore_missing_component_templates=[
"logs-foo_component2"
],
priority=500,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b5c8d6e61930a308008b5b1ace2aa07.asciidoc 0000664 0000000 0000000 00000001163 15176617013 0026461 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/properties.asciidoc:74
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"manager.name": "Alice White"
}
},
aggs={
"Employees": {
"nested": {
"path": "employees"
},
"aggs": {
"Employee Ages": {
"histogram": {
"field": "employees.age",
"interval": 5
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1b98b60d8e558fcccf9c550bdbf5b5c9.asciidoc 0000664 0000000 0000000 00000001074 15176617013 0027033 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/role-templates.asciidoc:75
[source, python]
----
resp = client.security.put_role(
name="example3",
indices=[
{
"names": [
"my-index-000001"
],
"privileges": [
"read"
],
"query": {
"template": {
"source": "{ \"terms\": { \"group.statuses\": {{#toJson}}_user.metadata.statuses{{/toJson}} }}"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ba7afe23a26fe9ac7856d8c5bc1059d.asciidoc 0000664 0000000 0000000 00000002135 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1502
[source, python]
----
resp = client.indices.create(
index="romanian_example",
settings={
"analysis": {
"filter": {
"romanian_stop": {
"type": "stop",
"stopwords": "_romanian_"
},
"romanian_keywords": {
"type": "keyword_marker",
"keywords": [
"exemplu"
]
},
"romanian_stemmer": {
"type": "stemmer",
"language": "romanian"
}
},
"analyzer": {
"rebuilt_romanian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"romanian_stop",
"romanian_keywords",
"romanian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1bceb160ed2bcd51ee040caf21acf780.asciidoc 0000664 0000000 0000000 00000003704 15176617013 0027037 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:391
[source, python]
----
resp = client.search_application.put(
name="my-search-app",
search_application={
"indices": [
"index1"
],
"template": {
"script": {
"lang": "mustache",
"source": "\n {\n \"retriever\": {\n \"rrf\": {\n \"retrievers\": [\n {{#text_fields}}\n {\n \"standard\": {\n \"query\": {\n \"match\": {\n \"{{.}}\": \"{{query_string}}\"\n }\n }\n }\n },\n {{/text_fields}}\n {{#elser_fields}}\n {\n \"standard\": {\n \"query\": {\n \"sparse_vector\": {\n \"field\": \"ml.inference.{{.}}_expanded.predicted_value\",\n \"inference_id\": \"\",\n \"query\": \"{{query_string}}\"\n }\n }\n }\n },\n {{/elser_fields}}\n ],\n \"rank_window_size\": {{rrf.rank_window_size}},\n \"rank_constant\": {{rrf.rank_constant}}\n }\n }\n }\n ",
"params": {
"elser_fields": [
"title",
"meta_description"
],
"text_fields": [
"title",
"meta_description"
],
"query_string": "",
"rrf": {
"rank_window_size": 100,
"rank_constant": 60
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1c142bc8cac8d9dcb4f60e22902d434f.asciidoc 0000664 0000000 0000000 00000000614 15176617013 0026640 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/string-stats-aggregation.asciidoc:65
[source, python]
----
resp = client.search(
index="my-index-000001",
size="0",
aggs={
"message_stats": {
"string_stats": {
"field": "message.keyword",
"show_distribution": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1c1f2a6a193d9e64c37242b2824b3031.asciidoc 0000664 0000000 0000000 00000002405 15176617013 0026250 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/tsds-reindex.asciidoc:44
[source, python]
----
resp = client.cluster.put_component_template(
name="source_template",
template={
"settings": {
"index": {
"number_of_replicas": 2,
"number_of_shards": 2,
"mode": "time_series",
"routing_path": [
"metricset"
]
}
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
},
"metricset": {
"type": "keyword",
"time_series_dimension": True
},
"k8s": {
"properties": {
"tx": {
"type": "long"
},
"rx": {
"type": "long"
}
}
}
}
}
},
)
print(resp)
resp1 = client.indices.put_index_template(
name="1",
index_patterns=[
"k8s*"
],
composed_of=[
"source_template"
],
data_stream={},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/1c330f0fc9eac19d0edeb8c4017b9b93.asciidoc 0000664 0000000 0000000 00000001014 15176617013 0026716 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:67
[source, python]
----
resp = client.ingest.put_pipeline(
id="hugging_face_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "hugging_face_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1c3e3c4f2d268f1826a9b417e1868a58.asciidoc 0000664 0000000 0000000 00000000525 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:317
[source, python]
----
resp = client.update(
index="my-index-000001",
id="1",
script={
"source": "ctx._source.tags.add(params['tag'])",
"lang": "painless",
"params": {
"tag": "blue"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1c87b5bf682bc1e8809a657529e14b07.asciidoc 0000664 0000000 0000000 00000002153 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-shape-query.asciidoc:189
[source, python]
----
resp = client.indices.create(
index="shapes",
mappings={
"properties": {
"location": {
"type": "geo_shape"
}
}
},
)
print(resp)
resp1 = client.index(
index="shapes",
id="deu",
document={
"location": {
"type": "envelope",
"coordinates": [
[
13,
53
],
[
14,
52
]
]
}
},
)
print(resp1)
resp2 = client.search(
index="example",
query={
"bool": {
"filter": {
"geo_shape": {
"location": {
"indexed_shape": {
"index": "shapes",
"id": "deu",
"path": "location"
}
}
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/1c8b6768c4eefc76fcb38708152f561b.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/delete-dfanalytics.asciidoc:57
[source, python]
----
resp = client.ml.delete_data_frame_analytics(
id="loganalytics",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1c9dac4183a3532c91dbd1a46907729b.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/docs/connectors-API-tutorial.asciidoc:459
[source, python]
----
resp = client.indices.delete(
index="music",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cab9da122778a95061831265c250cc1.asciidoc 0000664 0000000 0000000 00000001051 15176617013 0026246 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/valuecount-aggregation.asciidoc:49
[source, python]
----
resp = client.search(
index="sales",
size=0,
runtime_mappings={
"tags": {
"type": "keyword",
"script": "\n emit(doc['type'].value);\n if (doc['promoted'].value) {\n emit('hot');\n }\n "
}
},
aggs={
"tags_count": {
"value_count": {
"field": "tags"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cadbcf2cfeb312f73b7f098291356ac.asciidoc 0000664 0000000 0000000 00000000365 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:345
[source, python]
----
resp = client.index(
index="example",
document={
"location": "MULTIPOINT (102.0 2.0, 103.0 2.0)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cb3b45335ab1b9697c358104d44ea39.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/using-ip-filtering.asciidoc:158
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"xpack.security.transport.filter.enabled": False
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cbecd19be22979aefb45b4f160e77ea.asciidoc 0000664 0000000 0000000 00000001025 15176617013 0027012 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:171
[source, python]
----
resp = client.ingest.put_pipeline(
id="google_vertex_ai_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "google_vertex_ai_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cca4bb2f0ea7e43181be8bd965149d4.asciidoc 0000664 0000000 0000000 00000000372 15176617013 0026645 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1296
[source, python]
----
resp = client.eql.get(
id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
wait_for_completion_timeout="2s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cd3b9d65576a9212eef898eb3105758.asciidoc 0000664 0000000 0000000 00000000357 15176617013 0026401 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/restart-cluster.asciidoc:35
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.enable": "primaries"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cea60c47d5c0e150b4c8fff4cd75ffe.asciidoc 0000664 0000000 0000000 00000001407 15176617013 0027073 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/script.asciidoc:112
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"script": {
"description": "Set index based on `lang` field and `dataset` param",
"lang": "painless",
"source": "\n ctx['_index'] = ctx['lang'] + '-' + params['dataset'];\n ",
"params": {
"dataset": "catalog"
}
}
}
]
},
docs=[
{
"_index": "generic-index",
"_source": {
"lang": "fr"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ceaa211756e2db3d48c6bc4b1a861b0.asciidoc 0000664 0000000 0000000 00000000551 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:944
[source, python]
----
resp = client.eql.search(
index="my-index*",
max_samples_per_key=2,
size=20,
query="\n sample\n [any where uptime > 0] by host,os\n [any where port > 100] by host,op_sys\n [any where bool == true] by host,os\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cecd4d87a92427175157d41859df2af.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0026441 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/allocation-explain.asciidoc:16
[source, python]
----
resp = client.cluster.allocation_explain(
index="my-index-000001",
shard=0,
primary=False,
current_node="my-node",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1cfa04e9654c1484e3d4c75bf439400a.asciidoc 0000664 0000000 0000000 00000002630 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:226
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "polygon",
"coordinates": [
[
[
1000,
-1001
],
[
1001,
-1001
],
[
1001,
-1000
],
[
1000,
-1000
],
[
1000,
-1001
]
],
[
[
1000.2,
-1001.2
],
[
1000.8,
-1001.2
],
[
1000.8,
-1001.8
],
[
1000.2,
-1001.8
],
[
1000.2,
-1001.2
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1d252d9217c61c2c1cbe7a92f77b078f.asciidoc 0000664 0000000 0000000 00000003463 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-api-key.asciidoc:613
[source, python]
----
resp = client.security.query_api_keys(
size=0,
query={
"bool": {
"must": {
"term": {
"invalidated": False
}
},
"should": [
{
"range": {
"expiration": {
"gte": "now"
}
}
},
{
"bool": {
"must_not": {
"exists": {
"field": "expiration"
}
}
}
}
],
"minimum_should_match": 1
}
},
aggs={
"keys_by_username": {
"composite": {
"sources": [
{
"usernames": {
"terms": {
"field": "username"
}
}
}
]
},
"aggs": {
"expires_soon": {
"filter": {
"range": {
"expiration": {
"lte": "now+30d/d"
}
}
},
"aggs": {
"key_names": {
"terms": {
"field": "name"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1d746272a7511bf91302a15b5c58ca0e.asciidoc 0000664 0000000 0000000 00000000666 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:707
[source, python]
----
resp = client.search(
index="passage_vectors",
fields=[
"full_text",
"creation_time"
],
source=False,
knn={
"query_vector": [
0.45,
45
],
"field": "paragraph.vector",
"k": 2,
"num_candidates": 2
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1d9b695a17cffd910c496c9b03c75d6f.asciidoc 0000664 0000000 0000000 00000001165 15176617013 0026614 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-migrate-data-stream-from-ilm-to-dsl.asciidoc:34
[source, python]
----
resp = client.ilm.put_lifecycle(
name="pre-dsl-ilm-policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50gb"
}
}
},
"delete": {
"min_age": "7d",
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc 0000664 0000000 0000000 00000001002 15176617013 0026710 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-azure-ai-studio.asciidoc:168
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="azure_ai_studio_embeddings",
inference_config={
"service": "azureaistudio",
"service_settings": {
"api_key": "",
"target": "",
"provider": "",
"endpoint_type": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1db086021e83205b6eab3b7765911cc2.asciidoc 0000664 0000000 0000000 00000000633 15176617013 0026333 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/parent-aggregation.asciidoc:16
[source, python]
----
resp = client.indices.create(
index="parent_example",
mappings={
"properties": {
"join": {
"type": "join",
"relations": {
"question": "answer"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1db715eb00832686ecddb6603684fc26.asciidoc 0000664 0000000 0000000 00000000251 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/enroll-kibana.asciidoc:34
[source, python]
----
resp = client.security.enroll_kibana()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1dbb8cf17fbc45c87c7d2f75f15f9778.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026703 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:102
[source, python]
----
resp = client.cluster.state(
filter_path="metadata.indices.*.stat*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e08e054c761353f99211cd18e8ca47b.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0026355 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-snapshot.asciidoc:49
[source, python]
----
resp = client.ml.delete_model_snapshot(
job_id="farequote",
snapshot_id="1491948163",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e0b85750d4e63ebbc927d4627c44bf8.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:604
[source, python]
----
resp = client.indices.forcemerge(
index="my-index-000001",
only_expunge_deletes=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e18a67caf8f06ff2710ec4a8b30f625.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:169
[source, python]
----
resp = client.cluster.state(
filter_path="metadata.indices.*.state,-metadata.indices.logstash-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e26353d546d733634187b8c3a7837a7.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026143 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connectors-api.asciidoc:110
[source, python]
----
resp = client.connector.list(
service_type="sharepoint_online",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e2c5cef7a3f254c71a33865eb4d7569.asciidoc 0000664 0000000 0000000 00000001054 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/distance-feature-query.asciidoc:98
[source, python]
----
resp = client.search(
index="items",
query={
"bool": {
"must": {
"match": {
"name": "chocolate"
}
},
"should": {
"distance_feature": {
"field": "production_date",
"pivot": "7d",
"origin": "now"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e3384bc255729b65a6f0fc8011ff733.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/segments.asciidoc:18
[source, python]
----
resp = client.indices.segments(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e3553a73da487017f7a95088b6aa957.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026277 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-roles-cache.asciidoc:62
[source, python]
----
resp = client.security.clear_cached_roles(
name="*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e4b17b830ead15087ccd96151a5ebde.asciidoc 0000664 0000000 0000000 00000001076 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/string-stats-aggregation.asciidoc:133
[source, python]
----
resp = client.search(
index="my-index-000001",
size=0,
runtime_mappings={
"message_and_context": {
"type": "keyword",
"script": "\n emit(doc['message.keyword'].value + ' ' + doc['context.keyword'].value)\n "
}
},
aggs={
"message_stats": {
"string_stats": {
"field": "message_and_context"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e547696f54582840040b1aa6661760c.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0026046 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:400
[source, python]
----
resp = client.indices.rollover(
alias="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e871f060dbe1a5c316ed205278804a8.asciidoc 0000664 0000000 0000000 00000001554 15176617013 0026345 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:338
[source, python]
----
resp = client.search(
aggs={
"countries": {
"terms": {
"field": "artist.country",
"order": {
"rock>playback_stats.avg": "desc"
}
},
"aggs": {
"rock": {
"filter": {
"term": {
"genre": "rock"
}
},
"aggs": {
"playback_stats": {
"stats": {
"field": "play_count"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e94a2bb95bc245bcfb87ac7d611cf49.asciidoc 0000664 0000000 0000000 00000000671 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:335
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_outlier": {
"percentiles": {
"field": "load_time",
"tdigest": {
"execution_hint": "high_accuracy"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1e9cab0b2727624e22e8cf4e7ca498ac.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:45
[source, python]
----
resp = client.cluster.health(
pretty=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ea24f67fbbb6293d53caf2fe0c4b984.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0026726 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/simple-analyzer.asciidoc:15
[source, python]
----
resp = client.indices.analyze(
analyzer="simple",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ead35c954963e83f89872048dabdbe9.asciidoc 0000664 0000000 0000000 00000000570 15176617013 0026544 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/1eb9c6ecb827ca69f7b17f7d2a26eae9.asciidoc 0000664 0000000 0000000 00000000640 15176617013 0027030 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:280
[source, python]
----
resp = client.render_search_template(
source={
"query": {
"term": {
"url.full": "{{#url}}{{host}}/{{page}}{{/url}}"
}
}
},
params={
"host": "http://example.com",
"page": "hello-world"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ec66f188f681598cb5d7df700b214e3.asciidoc 0000664 0000000 0000000 00000001465 15176617013 0026455 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc:365
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"my_custom_keyword_marker_filter",
"porter_stem"
]
}
},
"filter": {
"my_custom_keyword_marker_filter": {
"type": "keyword_marker",
"keywords_path": "analysis/example_word_list.txt"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ed26c7b445ab1c167bd9385e1f0066f.asciidoc 0000664 0000000 0000000 00000000370 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/apis/delete-async-sql-search-api.asciidoc:18
[source, python]
----
resp = client.sql.delete_async(
id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ed77bf308fa4ab328b36060e412f500.asciidoc 0000664 0000000 0000000 00000003222 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/histogram-aggregation.asciidoc:334
[source, python]
----
resp = client.indices.create(
index="metrics_index",
mappings={
"properties": {
"network": {
"properties": {
"name": {
"type": "keyword"
}
}
},
"latency_histo": {
"type": "histogram"
}
}
},
)
print(resp)
resp1 = client.index(
index="metrics_index",
id="1",
refresh=True,
document={
"network.name": "net-1",
"latency_histo": {
"values": [
1,
3,
8,
12,
15
],
"counts": [
3,
7,
23,
12,
6
]
}
},
)
print(resp1)
resp2 = client.index(
index="metrics_index",
id="2",
refresh=True,
document={
"network.name": "net-2",
"latency_histo": {
"values": [
1,
6,
8,
12,
14
],
"counts": [
8,
17,
8,
7,
6
]
}
},
)
print(resp2)
resp3 = client.search(
index="metrics_index",
size="0",
aggs={
"latency_buckets": {
"histogram": {
"field": "latency_histo",
"interval": 5
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/1eea46b08610972b79fdc4649748455d.asciidoc 0000664 0000000 0000000 00000001436 15176617013 0026321 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// vectors/vector-functions.asciidoc:82
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"script_score": {
"query": {
"bool": {
"filter": {
"term": {
"status": "published"
}
}
}
},
"script": {
"source": "cosineSimilarity(params.query_vector, 'my_dense_vector') + 1.0",
"params": {
"query_vector": [
4,
3.4,
-0.2
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ef5119db55a6f2b6fc0ab92f36e7f8e.asciidoc 0000664 0000000 0000000 00000000632 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:63
[source, python]
----
resp = client.search(
index="my-index-000001",
sort=[
{
"post_date": {
"format": "strict_date_optional_time_nanos"
}
}
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1f00e73c144603e97f6c14ab15fa1913.asciidoc 0000664 0000000 0000000 00000002332 15176617013 0026333 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:940
[source, python]
----
resp = client.indices.create(
index="greek_example",
settings={
"analysis": {
"filter": {
"greek_stop": {
"type": "stop",
"stopwords": "_greek_"
},
"greek_lowercase": {
"type": "lowercase",
"language": "greek"
},
"greek_keywords": {
"type": "keyword_marker",
"keywords": [
"παράδειγμα"
]
},
"greek_stemmer": {
"type": "stemmer",
"language": "greek"
}
},
"analyzer": {
"rebuilt_greek": {
"tokenizer": "standard",
"filter": [
"greek_lowercase",
"greek_stop",
"greek_keywords",
"greek_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1f13c7caef9c2fe0f73fce8795bbc9b0.asciidoc 0000664 0000000 0000000 00000001706 15176617013 0027107 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/testing.asciidoc:125
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"std_folded": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
mappings={
"properties": {
"my_text": {
"type": "text",
"analyzer": "std_folded"
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="std_folded",
text="Is this déjà vu?",
)
print(resp1)
resp2 = client.indices.analyze(
index="my-index-000001",
field="my_text",
text="Is this déjà vu?",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/1f3dd84ab11bae09d3f99b1b3536e239.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026564 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/create-snapshot-api.asciidoc:31
[source, python]
----
resp = client.snapshot.create(
repository="my_repository",
snapshot="my_snapshot",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1f507659757e2844cefced25848540a0.asciidoc 0000664 0000000 0000000 00000001034 15176617013 0026307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-distance-query.asciidoc:187
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "12km",
"pin.location": [
-70,
40
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1f673e1a0de2970dc648618d5425a994.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0026303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:273
[source, python]
----
resp = client.indices.refresh()
print(resp)
resp1 = client.search(
index="my-new-index-000001",
size="0",
filter_path="hits.total",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/1f6a190fa1aade1fb66680388f184ef9.asciidoc 0000664 0000000 0000000 00000000575 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/validate.asciidoc:272
[source, python]
----
resp = client.indices.validate_query(
index="my-index-000001",
rewrite=True,
all_shards=True,
query={
"match": {
"user.id": {
"query": "kimchy",
"fuzziness": "auto"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1f8a6d2cc57ed8997a52354aca371aac.asciidoc 0000664 0000000 0000000 00000001101 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/configuring-pki-realm.asciidoc:267
[source, python]
----
resp = client.security.put_role_mapping(
name="direct_pki_only",
roles=[
"role_for_pki1_direct"
],
rules={
"all": [
{
"field": {
"realm.name": "pki1"
}
},
{
"field": {
"metadata.pki_delegated_by_user": None
}
}
]
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1f900f7178e80051e75d4fd04467cf49.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/pipeline.asciidoc:79
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
pipeline="pipelineB",
document={
"field": "value"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1fb2c77c0988bc6545040b20e3afa7e9.asciidoc 0000664 0000000 0000000 00000003404 15176617013 0026510 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/1fddbd602a6acf896a393cdb500a2831.asciidoc 0000664 0000000 0000000 00000001212 15176617013 0026627 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/rate-aggregation.asciidoc:310
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"by_date": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"avg_number_of_sales_per_year": {
"rate": {
"field": "price",
"unit": "year",
"mode": "value_count"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1fe2ed1d65c4774755de44c9b9d6ed67.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026627 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:986
[source, python]
----
resp = client.nodes.stats(
metric="ingest",
filter_path="nodes.*.ingest",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ff12523efbd59c213c676937757c460.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-api-keys.asciidoc:116
[source, python]
----
resp = client.security.invalidate_api_key(
ids=[
"VuaCfGcBCdbkQm-e5aOx"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ff296e868635fd102239871a331331b.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026140 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cardinality-aggregation.asciidoc:47
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"type_count": {
"cardinality": {
"field": "type",
"precision_threshold": 100
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/1ff9b263b7c3e83278bb6a776a51590a.asciidoc 0000664 0000000 0000000 00000000537 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/histogram-aggregation.asciidoc:31
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"prices": {
"histogram": {
"field": "price",
"interval": 50
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/20005d8a6555b259b299d862cd218701.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026135 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-query.asciidoc:190
[source, python]
----
resp = client.search(
query={
"match": {
"message": {
"query": "this is a test",
"operator": "and"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2006f577a113bda40905cf7b405bf1cf.asciidoc 0000664 0000000 0000000 00000000713 15176617013 0026467 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:816
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"set": {
"description": "If 'url.scheme' is 'http', set 'url.insecure' to true",
"if": "ctx.url?.scheme =~ /^http[^s]/",
"field": "url.insecure",
"value": True
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2009f2d1ba0780a799a0fdce889c9739.asciidoc 0000664 0000000 0000000 00000003232 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:695
[source, python]
----
resp = client.bulk(
index="passage_vectors",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"full_text": "first paragraph another paragraph",
"creation_time": "2019-05-04",
"paragraph": [
{
"vector": [
0.45,
45
],
"text": "first paragraph",
"paragraph_id": "1"
},
{
"vector": [
0.8,
0.6
],
"text": "another paragraph",
"paragraph_id": "2"
}
]
},
{
"index": {
"_id": "2"
}
},
{
"full_text": "number one paragraph number two paragraph",
"creation_time": "2020-05-04",
"paragraph": [
{
"vector": [
1.2,
4.5
],
"text": "number one paragraph",
"paragraph_id": "1"
},
{
"vector": [
-1,
42
],
"text": "number two paragraph",
"paragraph_id": "2"
}
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/200f6d4cc7b9c300b8962a119e03873f.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026335 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-data-stream.asciidoc:286
[source, python]
----
resp = client.indices.get_data_stream(
name="my-data-stream*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/20162e1dac807a7604f58dad814d1bc5.asciidoc 0000664 0000000 0000000 00000001274 15176617013 0026477 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/hunspell-tokenfilter.asciidoc:199
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"en": {
"tokenizer": "standard",
"filter": [
"my_en_US_dict_stemmer"
]
}
},
"filter": {
"my_en_US_dict_stemmer": {
"type": "hunspell",
"locale": "en_US",
"dedup": False
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/20179a8889e949d6a8ee5fbf2ba35c96.asciidoc 0000664 0000000 0000000 00000001063 15176617013 0026550 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:408
[source, python]
----
resp = client.search(
index="google-vertex-ai-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "google_vertex_ai_embeddings",
"model_text": "Calculate fuel cost"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/203c3bb334384bdfb11ff1101ccfba25.asciidoc 0000664 0000000 0000000 00000000776 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/phrase-suggest.asciidoc:290
[source, python]
----
resp = client.search(
index="test",
suggest={
"text": "obel prize",
"simple_phrase": {
"phrase": {
"field": "title.trigram",
"size": 1,
"smoothing": {
"laplace": {
"alpha": 0.7
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/20407c847adb8393ce41dc656384afc4.asciidoc 0000664 0000000 0000000 00000001506 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:787
[source, python]
----
resp = client.search(
index="passage_vectors",
fields=[
"creation_time",
"full_text"
],
source=False,
knn={
"query_vector": [
0.45,
45
],
"field": "paragraph.vector",
"k": 2,
"num_candidates": 2,
"filter": {
"bool": {
"filter": [
{
"range": {
"creation_time": {
"gte": "2019-05-01",
"lte": "2019-05-05"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2051ffe025550ab6645bfd525eaed3c4.asciidoc 0000664 0000000 0000000 00000001076 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:246
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_bounding_box": {
"pin.location": {
"top_left": "POINT (-74.1 40.73)",
"bottom_right": "POINT (-71.12 40.01)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2063713516847eef5d1dbf4ca1e877b0.asciidoc 0000664 0000000 0000000 00000003515 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geohexgrid-aggregation.asciidoc:29
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"location": "POINT (4.912350 52.374081)",
"name": "NEMO Science Museum"
},
{
"index": {
"_id": 2
}
},
{
"location": "POINT (4.901618 52.369219)",
"name": "Museum Het Rembrandthuis"
},
{
"index": {
"_id": 3
}
},
{
"location": "POINT (4.914722 52.371667)",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {
"_id": 4
}
},
{
"location": "POINT (4.405200 51.222900)",
"name": "Letterenhuis"
},
{
"index": {
"_id": 5
}
},
{
"location": "POINT (2.336389 48.861111)",
"name": "Musée du Louvre"
},
{
"index": {
"_id": 6
}
},
{
"location": "POINT (2.327000 48.860000)",
"name": "Musée d'Orsay"
}
],
)
print(resp1)
resp2 = client.search(
index="museums",
size="0",
aggregations={
"large-grid": {
"geohex_grid": {
"field": "location",
"precision": 4
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/206c723296be8ef8d58aef3ee01f5ba2.asciidoc 0000664 0000000 0000000 00000001010 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline.asciidoc:176
[source, python]
----
resp = client.search(
aggs={
"my_date_histo": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "day"
},
"aggs": {
"the_deriv": {
"derivative": {
"buckets_path": "_count"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/206d57bf0cb022c8229894e7753eca83.asciidoc 0000664 0000000 0000000 00000001671 15176617013 0026363 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-shape-query.asciidoc:58
[source, python]
----
resp = client.search(
index="example",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_shape": {
"location": {
"shape": {
"type": "envelope",
"coordinates": [
[
13,
53
],
[
14,
52
]
]
},
"relation": "within"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2081739da0c69de8af6f5bf9e94433e6.asciidoc 0000664 0000000 0000000 00000000556 15176617013 0026545 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:376
[source, python]
----
resp = client.index(
index="example",
document={
"location": "MULTILINESTRING ((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0), (100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/208c2b41bd1659aae8f02fa3e3b7378a.asciidoc 0000664 0000000 0000000 00000001637 15176617013 0026566 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/copy-to.asciidoc:15
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"first_name": {
"type": "text",
"copy_to": "full_name"
},
"last_name": {
"type": "text",
"copy_to": "full_name"
},
"full_name": {
"type": "text"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"first_name": "John",
"last_name": "Smith"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"match": {
"full_name": {
"query": "John Smith",
"operator": "and"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/209a9190082498f0b7daa26f8834846b.asciidoc 0000664 0000000 0000000 00000000445 15176617013 0026230 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/norms.asciidoc:21
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"title": {
"type": "text",
"norms": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/20bc71cc5bbe04184e27827f3777a406.asciidoc 0000664 0000000 0000000 00000000372 15176617013 0026347 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:723
[source, python]
----
resp = client.search(
index="my-index-000001",
fields=[
"@timestamp",
"day_of_week"
],
source=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/20c595907b4afbf26bd60e816a6ddf6a.asciidoc 0000664 0000000 0000000 00000000426 15176617013 0026654 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:275
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
params={
"query_string": "kayaking"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/20e3b181114e00c943a27a9bbcf85f15.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-record.asciidoc:286
[source, python]
----
resp = client.ml.get_records(
job_id="low_request_rate",
sort="record_score",
desc=True,
start="1454944100000",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/20f62d0540bf6261549bd286416eae28.asciidoc 0000664 0000000 0000000 00000000642 15176617013 0026267 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/enrich/put-enrich-policy.asciidoc:30
[source, python]
----
resp = client.enrich.put_policy(
name="my-policy",
match={
"indices": "users",
"match_field": "email",
"enrich_fields": [
"first_name",
"last_name",
"city",
"zip",
"state"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2105f2d1d81977054a93163a175793ce.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026131 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-status-api.asciidoc:81
[source, python]
----
resp = client.snapshot.status()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2155c920d7d860f3ee7542f2211b4fec.asciidoc 0000664 0000000 0000000 00000000576 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/text-expansion-query.asciidoc:25
[source, python]
----
resp = client.search(
query={
"text_expansion": {
"": {
"model_id": "the model to produce the token weights",
"model_text": "the query string"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/21565b72da426776e445b1a166f6e104.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026210 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/has-child-query.asciidoc:31
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my-join-field": {
"type": "join",
"relations": {
"parent": "child"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/216848930c2d344fe0bed0daa70c35b9.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026477 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:620
[source, python]
----
resp = client.tasks.list(
detailed=True,
actions="*/delete/byquery",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/216a6573ab4ab023e5dcac4eaa08c3c8.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026700 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/register-repository.asciidoc:185
[source, python]
----
resp = client.snapshot.verify_repository(
name="my_unverified_backup",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/216e24f05cbb82c1718713fbab8623d2.asciidoc 0000664 0000000 0000000 00000001231 15176617013 0026411 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/geoip.asciidoc:136
[source, python]
----
resp = client.ingest.put_pipeline(
id="geoip",
description="Add ip geolocation info",
processors=[
{
"geoip": {
"field": "ip",
"target_field": "geo",
"database_file": "GeoLite2-Country.mmdb"
}
}
],
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="my_id",
pipeline="geoip",
document={
"ip": "89.160.20.128"
},
)
print(resp1)
resp2 = client.get(
index="my-index-000001",
id="my_id",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/21715c32c140feeab04b38ff6d6de111.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026545 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:143
[source, python]
----
resp = client.indices.get_mapping(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2185c9dfc62a59313df1702ec1c3513e.asciidoc 0000664 0000000 0000000 00000000714 15176617013 0026423 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:88
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_outlier": {
"percentiles": {
"field": "load_time",
"percents": [
95,
99,
99.9
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/218b9009f120e8ad33f710e019179562.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026117 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-repo-api.asciidoc:125
[source, python]
----
resp = client.snapshot.get_repository(
name="my_repository",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/21a226d91d8edd209f6a821064e83918.asciidoc 0000664 0000000 0000000 00000001166 15176617013 0026301 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/global-aggregation.asciidoc:18
[source, python]
----
resp = client.search(
index="sales",
size="0",
query={
"match": {
"type": "t-shirt"
}
},
aggs={
"all_products": {
"global": {},
"aggs": {
"avg_price": {
"avg": {
"field": "price"
}
}
}
},
"t_shirts": {
"avg": {
"field": "price"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/21bb03ca9123de3237c1c76934f9f172.asciidoc 0000664 0000000 0000000 00000001532 15176617013 0026342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filters-aggregation.asciidoc:138
[source, python]
----
resp = client.index(
index="logs",
id="4",
refresh=True,
document={
"body": "info: user Bob logged out"
},
)
print(resp)
resp1 = client.search(
index="logs",
size=0,
aggs={
"messages": {
"filters": {
"other_bucket_key": "other_messages",
"filters": {
"errors": {
"match": {
"body": "error"
}
},
"warnings": {
"match": {
"body": "warning"
}
}
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/21c1e6ee886140ce0cd67184dd19b981.asciidoc 0000664 0000000 0000000 00000000267 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/dangling-indices-list.asciidoc:19
[source, python]
----
resp = client.dangling_indices.list_dangling_indices()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/21cd01cb90d3ea1acd0ab22d7edd2c88.asciidoc 0000664 0000000 0000000 00000001003 15176617013 0027026 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:162
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="azure_ai_studio_embeddings",
inference_config={
"service": "azureaistudio",
"service_settings": {
"api_key": "",
"target": "",
"provider": "",
"endpoint_type": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/21d0ab6e420bfe7a1639db6af5b2e9c0.asciidoc 0000664 0000000 0000000 00000001470 15176617013 0026713 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/median-absolute-deviation-aggregation.asciidoc:116
[source, python]
----
resp = client.search(
index="reviews",
filter_path="aggregations",
size=0,
runtime_mappings={
"rating.out_of_ten": {
"type": "long",
"script": {
"source": "emit(doc['rating'].value * params.scaleFactor)",
"params": {
"scaleFactor": 2
}
}
}
},
aggs={
"review_average": {
"avg": {
"field": "rating.out_of_ten"
}
},
"review_variability": {
"median_absolute_deviation": {
"field": "rating.out_of_ten"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/21d41e8cbd107fbdf0901f885834dafc.asciidoc 0000664 0000000 0000000 00000001234 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/wildcard.asciidoc:139
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"card": {
"type": "wildcard"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"card": [
"king",
"ace",
"ace",
"jack"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/21d5fe55ca32b10b118224ea1a8a2e04.asciidoc 0000664 0000000 0000000 00000004776 15176617013 0026464 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/bucket-count-ks-test-aggregation.asciidoc:81
[source, python]
----
resp = client.search(
index="correlate_latency",
size="0",
filter_path="aggregations",
aggs={
"buckets": {
"terms": {
"field": "version",
"size": 2
},
"aggs": {
"latency_ranges": {
"range": {
"field": "latency",
"ranges": [
{
"to": 0
},
{
"from": 0,
"to": 105
},
{
"from": 105,
"to": 225
},
{
"from": 225,
"to": 445
},
{
"from": 445,
"to": 665
},
{
"from": 665,
"to": 885
},
{
"from": 885,
"to": 1115
},
{
"from": 1115,
"to": 1335
},
{
"from": 1335,
"to": 1555
},
{
"from": 1555,
"to": 1775
},
{
"from": 1775
}
]
}
},
"ks_test": {
"bucket_count_ks_test": {
"buckets_path": "latency_ranges>_count",
"alternative": [
"less",
"greater",
"two_sided"
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/21e95d29bc37deb5689a654aa323b4ba.asciidoc 0000664 0000000 0000000 00000000576 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/configuring-ldap-realm.asciidoc:138
[source, python]
----
resp = client.security.put_role_mapping(
name="admins",
roles=[
"monitoring",
"user"
],
rules={
"field": {
"groups": "cn=admins,dc=example,dc=com"
}
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/221e9b14567f950008459af77757750e.asciidoc 0000664 0000000 0000000 00000000757 15176617013 0026105 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:54
[source, python]
----
resp = client.watcher.put_watch(
id="cluster_health_watch",
trigger={
"schedule": {
"interval": "10s"
}
},
input={
"http": {
"request": {
"host": "localhost",
"port": 9200,
"path": "/_cluster/health"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2224143c45dfc83a2d10b98cd4f94bb5.asciidoc 0000664 0000000 0000000 00000001103 15176617013 0026474 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/nested-query.asciidoc:415
[source, python]
----
resp = client.search(
index="my-index",
query={
"bool": {
"must_not": [
{
"nested": {
"path": "comments",
"query": {
"term": {
"comments.author": "nik9000"
}
}
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/222e49c924ca8bac7b41bc952a39261c.asciidoc 0000664 0000000 0000000 00000001342 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/semantic-query.asciidoc:55
[source, python]
----
resp = client.search(
index="my-index",
size=3,
query={
"bool": {
"should": [
{
"match": {
"title": {
"query": "mountain lake",
"boost": 1
}
}
},
{
"semantic": {
"field": "title_semantic",
"query": "mountain lake",
"boost": 2
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/22334f4b24bb8977d3e1bf2ffdc29d3f.asciidoc 0000664 0000000 0000000 00000003235 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:315
[source, python]
----
resp = client.search(
query={
"nested": {
"path": "parent",
"query": {
"bool": {
"must": {
"range": {
"parent.age": {
"gte": 21
}
}
},
"filter": {
"nested": {
"path": "parent.child",
"query": {
"match": {
"parent.child.name": "matt"
}
}
}
}
}
}
}
},
sort=[
{
"parent.child.age": {
"mode": "min",
"order": "asc",
"nested": {
"path": "parent",
"filter": {
"range": {
"parent.age": {
"gte": 21
}
}
},
"nested": {
"path": "parent.child",
"filter": {
"match": {
"parent.child.name": "matt"
}
}
}
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2238ac4170275f6cfc2af49c3f014cbc.asciidoc 0000664 0000000 0000000 00000001216 15176617013 0026555 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/extendedstats-aggregation.asciidoc:108
[source, python]
----
resp = client.search(
index="exams",
size=0,
runtime_mappings={
"grade.corrected": {
"type": "double",
"script": {
"source": "emit(Math.min(100, doc['grade'].value * params.correction))",
"params": {
"correction": 1.2
}
}
}
},
aggs={
"grades_stats": {
"extended_stats": {
"field": "grade.corrected"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/22619a4111f66e1b7231693b8f8d069a.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026210 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/managing-watches.asciidoc:30
[source, python]
----
resp = client.watcher.query_watches(
size=100,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/22882d4eb8b99f44c8e0d3a2c893fc4b.asciidoc 0000664 0000000 0000000 00000001427 15176617013 0026614 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:408
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my-small": {
"type": "keyword",
"ignore_above": 2
},
"my-large": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"my-small": [
"ok",
"bad"
],
"my-large": "ok content"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
fields=[
"my-*"
],
source=False,
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/229b83cbcd8efa1b0288a728a2abacb4.asciidoc 0000664 0000000 0000000 00000002631 15176617013 0026774 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/point.asciidoc:21
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"location": {
"type": "point"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"text": "Point as an object using GeoJSON format",
"location": {
"type": "Point",
"coordinates": [
-71.34,
41.12
]
}
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"text": "Point as a WKT POINT primitive",
"location": "POINT (-71.34 41.12)"
},
)
print(resp2)
resp3 = client.index(
index="my-index-000001",
id="3",
document={
"text": "Point as an object with 'x' and 'y' keys",
"location": {
"x": -71.34,
"y": 41.12
}
},
)
print(resp3)
resp4 = client.index(
index="my-index-000001",
id="4",
document={
"text": "Point as an array",
"location": [
-71.34,
41.12
]
},
)
print(resp4)
resp5 = client.index(
index="my-index-000001",
id="5",
document={
"text": "Point as a string",
"location": "-71.34,41.12"
},
)
print(resp5)
----
python-elasticsearch-9.4.0/docs/examples/22b176a184517cf1b5801f5eb4f17f97.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026356 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-dsl.asciidoc:349
[source, python]
----
resp = client.indices.rollover(
alias="datastream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/22cb99d4e6ba3101a2d9f59764a90877.asciidoc 0000664 0000000 0000000 00000000357 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:177
[source, python]
----
resp = client.index(
index="example",
document={
"location": "POINT (-77.03653 38.897676)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/22d8e92b4100f8e4f52260ef8d3aa2b2.asciidoc 0000664 0000000 0000000 00000001051 15176617013 0026473 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/binary.asciidoc:12
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"name": {
"type": "text"
},
"blob": {
"type": "binary"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"name": "Some binary blob",
"blob": "U29tZSBiaW5hcnkgYmxvYg=="
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/22dd833336fa22c8a8f67bb754ffba9a.asciidoc 0000664 0000000 0000000 00000001053 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:278
[source, python]
----
resp = client.search(
index="azure-openai-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "azure_openai_embeddings",
"model_text": "Calculate fuel cost"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/22dde5fe7ac5d85d52115641a68b3c55.asciidoc 0000664 0000000 0000000 00000000617 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:202
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"lowercase",
{
"type": "stop",
"stopwords": [
"a",
"is",
"this"
]
}
],
text="this is a test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/22ef90a7fb057728d2115f0c6f551819.asciidoc 0000664 0000000 0000000 00000001450 15176617013 0026275 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-aggregation.asciidoc:250
[source, python]
----
resp = client.search(
index="sales",
aggs={
"price_ranges": {
"range": {
"field": "price",
"ranges": [
{
"to": 100
},
{
"from": 100,
"to": 200
},
{
"from": 200
}
]
},
"aggs": {
"price_stats": {
"stats": {
"field": "price"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/23074748d6c978176df5b04265e88938.asciidoc 0000664 0000000 0000000 00000000472 15176617013 0026115 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/increase-cluster-shard-limit.asciidoc:109
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
name="index.routing.allocation.include._tier_preference",
flat_settings=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2308c9948cbebd2092eec03b11281005.asciidoc 0000664 0000000 0000000 00000000526 15176617013 0026333 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/register-fs-repo.asciidoc:93
[source, python]
----
resp = client.snapshot.create_repository(
name="my_fs_backup",
repository={
"type": "fs",
"settings": {
"location": "E:\\Mount\\Backups\\My_fs_backup_location"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2310d84ebf113f2a3ed14cc53172ae4a.asciidoc 0000664 0000000 0000000 00000000577 15176617013 0026547 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/text-expansion-query.asciidoc:100
[source, python]
----
resp = client.search(
index="my-index",
query={
"text_expansion": {
"ml.tokens": {
"model_id": ".elser_model_2",
"model_text": "How is the weather in Jamaica?"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2342a56279106ea643026df657bf7f88.asciidoc 0000664 0000000 0000000 00000001017 15176617013 0026224 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/similarity.asciidoc:24
[source, python]
----
resp = client.indices.create(
index="index",
settings={
"index": {
"similarity": {
"my_similarity": {
"type": "DFR",
"basic_model": "g",
"after_effect": "l",
"normalization": "h2",
"normalization.h2.c": "3.0"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/234cec3ead32d7ed71afbe1edfea23df.asciidoc 0000664 0000000 0000000 00000000747 15176617013 0027306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/has-parent-query.asciidoc:122
[source, python]
----
resp = client.search(
query={
"has_parent": {
"parent_type": "parent",
"score": True,
"query": {
"function_score": {
"script_score": {
"script": "_score * doc['view_count'].value"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/236f50d89a07b83119af72e367e685da.asciidoc 0000664 0000000 0000000 00000001015 15176617013 0026363 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:298
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50gb",
"max_age": "30d",
"min_primary_shard_size": "1gb"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/239f615e0009c5cb1dc4e82ec4c0dab5.asciidoc 0000664 0000000 0000000 00000001273 15176617013 0026635 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:76
[source, python]
----
resp = client.watcher.put_watch(
id="cluster_health_watch",
trigger={
"schedule": {
"interval": "10s"
}
},
input={
"http": {
"request": {
"host": "localhost",
"port": 9200,
"path": "/_cluster/health",
"auth": {
"basic": {
"username": "elastic",
"password": "x-pack-test-password"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/23b062c157235246d7c347b9047b2435.asciidoc 0000664 0000000 0000000 00000000565 15176617013 0026046 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:119
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping1",
roles=[
"user"
],
enabled=True,
rules={
"field": {
"username": "*"
}
},
metadata={
"version": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/23c4ae62f7035f2796e0ac3c7c4c20a9.asciidoc 0000664 0000000 0000000 00000000703 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-migrate.asciidoc:57
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"migrate": {},
"allocate": {
"number_of_replicas": 1
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2408020186af569a76a30eccadaed0d5.asciidoc 0000664 0000000 0000000 00000001613 15176617013 0026551 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/script.asciidoc:48
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"script": {
"description": "Extract 'tags' from 'env' field",
"lang": "painless",
"source": "\n String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);\n ArrayList tags = new ArrayList();\n tags.add(envSplit[params['position']].trim());\n ctx['tags'] = tags;\n ",
"params": {
"delimiter": "-",
"position": 1
}
}
}
]
},
docs=[
{
"_source": {
"env": "es01-prod"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/24275847128b68da6e14233aa1259fb9.asciidoc 0000664 0000000 0000000 00000001770 15176617013 0026221 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/collapse-search-results.asciidoc:93
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"message": "GET /search"
}
},
collapse={
"field": "user.id",
"inner_hits": [
{
"name": "largest_responses",
"size": 3,
"sort": [
{
"http.response.bytes": {
"order": "desc"
}
}
]
},
{
"name": "most_recent",
"size": 3,
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
]
},
sort=[
"http.response.bytes"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/242a26ced0e5706e48dcda19a4003094.asciidoc 0000664 0000000 0000000 00000000746 15176617013 0026420 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:970
[source, python]
----
resp = client.reindex(
source={
"remote": {
"host": "http://otherhost:9200",
"username": "user",
"password": "pass"
},
"index": "my-index-000001",
"query": {
"match": {
"test": "data"
}
}
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/246763219ec06172f7aa57bba28d344a.asciidoc 0000664 0000000 0000000 00000005210 15176617013 0026341 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2493c25e1ef944bc4de0f726470bcdec.asciidoc 0000664 0000000 0000000 00000001257 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/frequent-item-sets-aggregation.asciidoc:144
[source, python]
----
resp = client.async_search.submit(
index="kibana_sample_data_ecommerce",
size=0,
aggs={
"my_agg": {
"frequent_item_sets": {
"minimum_set_size": 3,
"fields": [
{
"field": "category.keyword"
},
{
"field": "geoip.city_name",
"exclude": "other"
}
],
"size": 3
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/249bf48252c8cea47ef872541c8a884c.asciidoc 0000664 0000000 0000000 00000002703 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/grant-api-keys.asciidoc:133
[source, python]
----
resp = client.security.grant_api_key(
grant_type="password",
username="test_admin",
password="x-pack-test-password",
api_key={
"name": "my-api-key",
"expiration": "1d",
"role_descriptors": {
"role-a": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"index-a*"
],
"privileges": [
"read"
]
}
]
},
"role-b": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"index-b*"
],
"privileges": [
"all"
]
}
]
}
},
"metadata": {
"application": "my-application",
"environment": {
"level": 1,
"trusted": True,
"tags": [
"dev",
"staging"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/24a037008e0fc2550ecb6a5d36c04a93.asciidoc 0000664 0000000 0000000 00000001042 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:816
[source, python]
----
resp = client.search(
index="sales",
size="0",
runtime_mappings={
"date.day_of_week": {
"type": "keyword",
"script": "emit(doc['date'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))"
}
},
aggs={
"day_of_week": {
"terms": {
"field": "date.day_of_week"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/24ad3c234f69f55a3fbe2d488e70178a.asciidoc 0000664 0000000 0000000 00000001213 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:360
[source, python]
----
resp = client.ml.evaluate_data_frame(
index="student_performance_mathematics_reg",
query={
"term": {
"ml.is_training": {
"value": True
}
}
},
evaluation={
"regression": {
"actual_field": "G3",
"predicted_field": "ml.G3_prediction",
"metrics": {
"r_squared": {},
"mse": {},
"msle": {},
"huber": {}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/24aee6033bf77a68ced74e3fd9d34283.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-index-template-v1.asciidoc:85
[source, python]
----
resp = client.indices.get_template(
name="template_1,template_2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/24bdccb07bba7e7e6ff45d3d4cd83064.asciidoc 0000664 0000000 0000000 00000000631 15176617013 0027007 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:250
[source, python]
----
resp = client.update_by_query(
index="my-data-stream",
pipeline="my-pipeline",
)
print(resp)
resp1 = client.reindex(
source={
"index": "my-data-stream"
},
dest={
"index": "my-new-data-stream",
"op_type": "create",
"pipeline": "my-pipeline"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/24d66b2ebdf662d8b03e17214e65c825.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:375
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"xpack.profiling.templates.enabled": False
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/24d806d1803158dacd4dda73c4204d3e.asciidoc 0000664 0000000 0000000 00000000336 15176617013 0026475 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-rules/apis/get-query-rule.asciidoc:111
[source, python]
----
resp = client.query_rules.get_rule(
ruleset_id="my-ruleset",
rule_id="my-rule1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/24f4dfdf9922d5aa79151675b7767742.asciidoc 0000664 0000000 0000000 00000000464 15176617013 0026325 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:385
[source, python]
----
resp = client.search(
index="my-index-000001",
scroll="1m",
size=100,
query={
"match": {
"message": "foo"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/253140cb1e270e5ee23e15dbaeaaa0ea.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026745 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:29
[source, python]
----
resp = client.indices.data_streams_stats(
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25576b6773322f0929d4c635a940dba0.asciidoc 0000664 0000000 0000000 00000000640 15176617013 0026212 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:530
[source, python]
----
resp = client.search(
query={
"query_string": {
"fields": [
"title",
"content"
],
"query": "this OR that OR thus",
"type": "cross_fields",
"minimum_should_match": 2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/256eba7a77c8890a43afeda8ce8a3225.asciidoc 0000664 0000000 0000000 00000001076 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/semantic-search/generate-embeddings.asciidoc:54
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-text-embeddings-pipeline",
description="Text embedding pipeline",
processors=[
{
"inference": {
"model_id": "sentence-transformers__msmarco-minilm-l-12-v3",
"target_field": "my_embeddings",
"field_map": {
"my_text_field": "text_field"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25737fd456fd317cc4cc2db76b6cf28e.asciidoc 0000664 0000000 0000000 00000000422 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:150
[source, python]
----
resp = client.indices.create(
index="test-000001",
aliases={
"test-alias": {
"is_write_index": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2592e5361f7ea3b3dd1840f63d760dae.asciidoc 0000664 0000000 0000000 00000001554 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/mlt-query.asciidoc:67
[source, python]
----
resp = client.search(
query={
"more_like_this": {
"fields": [
"name.first",
"name.last"
],
"like": [
{
"_index": "marvel",
"doc": {
"name": {
"first": "Ben",
"last": "Grimm"
},
"_doc": "You got no idea what I'd... what I'd give to be invisible."
}
},
{
"_index": "marvel",
"_id": "2"
}
],
"min_term_freq": 1,
"max_query_terms": 12
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25981b7b3d55b87e1484586d57b695b1.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026241 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/concurrency-control.asciidoc:24
[source, python]
----
resp = client.index(
index="products",
id="1567",
document={
"product": "r2d2",
"details": "A resourceful astromech droid"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25a0dad6547d432f5a3d394528f1c138.asciidoc 0000664 0000000 0000000 00000000341 15176617013 0026343 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:401
[source, python]
----
resp = client.get(
index="my-index-000001",
id="2",
routing="user1",
stored_fields="tags,counter",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25ae1a698f867ba5139605cc952436c0.asciidoc 0000664 0000000 0000000 00000001343 15176617013 0026301 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/context-suggest.asciidoc:168
[source, python]
----
resp = client.search(
index="place",
pretty=True,
suggest={
"place_suggestion": {
"prefix": "tim",
"completion": {
"field": "suggest",
"size": 10,
"contexts": {
"place_type": [
{
"context": "cafe"
},
{
"context": "restaurants",
"boost": 2
}
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25c0e66a433a0cd596e0641b752ff6d7.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/shards.asciidoc:414
[source, python]
----
resp = client.cat.shards(
h="index,shard,prirep,state,unassigned.reason",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25cb9e1da00dfd971065ce182467434d.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/voting-exclusions.asciidoc:122
[source, python]
----
resp = client.cluster.delete_voting_config_exclusions()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25d40d3049e57e2bb70c2c5b88bd7b87.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/allocation/delayed.asciidoc:95
[source, python]
----
resp = client.indices.put_settings(
index="_all",
settings={
"settings": {
"index.unassigned.node_left.delayed_timeout": "0"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/25ecfe423548ac1d7cc86de4a18c48c6.asciidoc 0000664 0000000 0000000 00000001557 15176617013 0026670 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/pattern-replace-charfilter.asciidoc:54
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"char_filter": [
"my_char_filter"
]
}
},
"char_filter": {
"my_char_filter": {
"type": "pattern_replace",
"pattern": "(\\d+)-(?=\\d)",
"replacement": "$1_"
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="My credit card is 123-456-789",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/25ed47fcb890fcf8d8518ae067362d18.asciidoc 0000664 0000000 0000000 00000000731 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/median-absolute-deviation-aggregation.asciidoc:31
[source, python]
----
resp = client.search(
index="reviews",
size=0,
aggs={
"review_average": {
"avg": {
"field": "rating"
}
},
"review_variability": {
"median_absolute_deviation": {
"field": "rating"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/261480571394632db40e88fbb6c59c2f.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026277 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/delete-role-mappings.asciidoc:52
[source, python]
----
resp = client.security.delete_role_mapping(
name="mapping1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/26168987f799cdc4ee4151c85ba7afc5.asciidoc 0000664 0000000 0000000 00000000552 15176617013 0026545 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:213
[source, python]
----
resp = client.search(
index="my-index-000001",
filter_path="aggregations",
aggs={
"my-num-field-stats": {
"stats": {
"field": "my-num-field"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/262196e4323dfc1f8e6daf77d7ba3b6a.asciidoc 0000664 0000000 0000000 00000000544 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-gcs.asciidoc:217
[source, python]
----
resp = client.snapshot.create_repository(
name="my_gcs_repository",
repository={
"type": "gcs",
"settings": {
"bucket": "my_other_bucket",
"base_path": "dev"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2623eb122cc0299b42fc9eca6e7f5e56.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-builtin-privileges.asciidoc:64
[source, python]
----
resp = client.security.get_builtin_privileges()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/262a778d754add491fbc9c721ac25bf0.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026566 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/whitespace-analyzer.asciidoc:14
[source, python]
----
resp = client.indices.analyze(
analyzer="whitespace",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/26419320085434680142567d5fda9c35.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0025776 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/ipprefix-aggregation.asciidoc:340
[source, python]
----
resp = client.search(
index="network-traffic",
size=0,
aggs={
"ipv4-subnets": {
"ip_prefix": {
"field": "ipv4",
"prefix_length": 24,
"min_doc_count": 3
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2643b8c512cb3f3449259cdf498c6ab5.asciidoc 0000664 0000000 0000000 00000001507 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:525
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d"
}
}
},
{
"product": {
"terms": {
"field": "product"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2646710ece0c4c843aebeacd370d0396.asciidoc 0000664 0000000 0000000 00000000743 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:141
[source, python]
----
resp = client.indices.create(
index="my-byte-quantized-index",
mappings={
"properties": {
"my_vector": {
"type": "dense_vector",
"dims": 3,
"index": True,
"index_options": {
"type": "int8_hnsw"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/268151ed1f0e12586e66e614b61d7981.asciidoc 0000664 0000000 0000000 00000001132 15176617013 0026217 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-polygon-query.asciidoc:122
[source, python]
----
resp = client.search(
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_polygon": {
"person.location": {
"points": [
"drn5x1g8cu2y",
"30, -80",
"20, -90"
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/26abfc49c238c2b5d259983ac38dbcee.asciidoc 0000664 0000000 0000000 00000000555 15176617013 0026745 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/recipes/stemming.asciidoc:173
[source, python]
----
resp = client.search(
index="index",
query={
"simple_query_string": {
"fields": [
"body"
],
"quote_field_suffix": ".exact",
"query": "\"ski\""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/26bd8c027c82cd72c007c10fa66dc97f.asciidoc 0000664 0000000 0000000 00000000436 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:438
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="my_snapshot_2099.05.06",
indices="*",
include_global_state=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/26d3ab748a855eb383e992eb1ff79662.asciidoc 0000664 0000000 0000000 00000000355 15176617013 0026464 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/delete-async-eql-search-api.asciidoc:20
[source, python]
----
resp = client.eql.delete(
id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/26f237f9bf14e8b972cc33ff6aebefa2.asciidoc 0000664 0000000 0000000 00000000432 15176617013 0027023 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc:35
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"stemmer"
],
text="fox running and jumping",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/270549e6b062228312c4e7a54a2c2209.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026116 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/task-queue-backlog.asciidoc:55
[source, python]
----
resp = client.nodes.hot_threads()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2716453454dbf9c6dde2ea6850a62214.asciidoc 0000664 0000000 0000000 00000001221 15176617013 0026344 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/alias.asciidoc:12
[source, python]
----
resp = client.indices.create(
index="trips",
mappings={
"properties": {
"distance": {
"type": "long"
},
"route_length_miles": {
"type": "alias",
"path": "distance"
},
"transit_mode": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.search(
query={
"range": {
"route_length_miles": {
"gte": 39
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/271fe0b452b62189505ce4a1d6f8bde1.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:110
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_outlier": {
"percentiles": {
"field": "load_time",
"keyed": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2720e613d520ce352b62e990c2d283f7.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026261 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/remove-policy-from-index.asciidoc:93
[source, python]
----
resp = client.ilm.remove_policy(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/272e27bf1fcc4fe5dbd4092679dd0342.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0026570 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2731a8577ad734a732d784c5dcb1225d.asciidoc 0000664 0000000 0000000 00000002150 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1359
[source, python]
----
resp = client.indices.create(
index="norwegian_example",
settings={
"analysis": {
"filter": {
"norwegian_stop": {
"type": "stop",
"stopwords": "_norwegian_"
},
"norwegian_keywords": {
"type": "keyword_marker",
"keywords": [
"eksempel"
]
},
"norwegian_stemmer": {
"type": "stemmer",
"language": "norwegian"
}
},
"analyzer": {
"rebuilt_norwegian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"norwegian_stop",
"norwegian_keywords",
"norwegian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/27384266370152add76471dd0332a2f1.asciidoc 0000664 0000000 0000000 00000001412 15176617013 0026113 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/update-transform.asciidoc:263
[source, python]
----
resp = client.transform.update_transform(
transform_id="simple-kibana-ecomm-pivot",
source={
"index": "kibana_sample_data_ecommerce",
"query": {
"term": {
"geoip.continent_name": {
"value": "Asia"
}
}
}
},
description="Maximum priced ecommerce data by customer_id in Asia",
dest={
"index": "kibana_sample_data_ecommerce_transform_v2",
"pipeline": "add_timestamp_pipeline"
},
frequency="15m",
sync={
"time": {
"field": "order_date",
"delay": "120s"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2740b69e7246ac6d1ad249382f21d534.asciidoc 0000664 0000000 0000000 00000001047 15176617013 0026272 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/aggregate-metric-double.asciidoc:26
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"my-agg-metric-field": {
"type": "aggregate_metric_double",
"metrics": [
"min",
"max",
"sum",
"value_count"
],
"default_metric": "max"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/274feaaa727e0ddf61b3c0f093182839.asciidoc 0000664 0000000 0000000 00000001034 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:414
[source, python]
----
resp = client.search(
index="my-index-000001",
runtime_mappings={
"duration": {
"type": "long",
"script": {
"source": "\n emit(doc['measures.end'].value - doc['measures.start'].value);\n "
}
}
},
aggs={
"duration_stats": {
"stats": {
"field": "duration"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/275ec358d5d1e4b9ff06cb4ae7e47650.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-index-template.asciidoc:84
[source, python]
----
resp = client.indices.get_index_template(
name="temp*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/27600d6a78623b69689d4218618e4278.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026016 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/unsigned_long.asciidoc:47
[source, python]
----
resp = client.search(
index="my_index",
query={
"term": {
"my_counter": 18446744073709552000
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/276e5b71ff5c6879a9b819076ad82301.asciidoc 0000664 0000000 0000000 00000002501 15176617013 0026312 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// vectors/vector-functions.asciidoc:33
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_dense_vector": {
"type": "dense_vector",
"index": False,
"dims": 3
},
"my_byte_dense_vector": {
"type": "dense_vector",
"index": False,
"dims": 3,
"element_type": "byte"
},
"status": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"my_dense_vector": [
0.5,
10,
6
],
"my_byte_dense_vector": [
0,
10,
6
],
"status": "published"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"my_dense_vector": [
-0.5,
10,
10
],
"my_byte_dense_vector": [
0,
10,
10
],
"status": "published"
},
)
print(resp2)
resp3 = client.indices.refresh(
index="my-index-000001",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/277fefe2b623af61f8274f73efc97aed.asciidoc 0000664 0000000 0000000 00000001261 15176617013 0026757 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/dissect-syntax.asciidoc:115
[source, python]
----
resp = client.scripts_painless_execute(
script={
"source": "\n String response=dissect('%{clientip} %{ident} %{auth} [%{@timestamp}] \"%{verb} %{request} HTTP/%{httpversion}\" %{response} %{size}').extract(doc[\"message\"].value)?.response;\n if (response != null) emit(Integer.parseInt(response)); \n "
},
context="long_field",
context_setup={
"index": "my-index",
"document": {
"message": "247.37.0.0 - - [30/Apr/2020:14:31:22 -0500] \"GET /images/hm_nbg.jpg HTTP/1.0\" 304 0"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/278d5bfa1a01f91d5c84679ef1bca390.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/concurrency-control.asciidoc:61
[source, python]
----
resp = client.get(
index="products",
id="1567",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2793fa53b7d269852aa74f6bf57e34dc.asciidoc 0000664 0000000 0000000 00000001343 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/ngram-tokenfilter.asciidoc:208
[source, python]
----
resp = client.indices.create(
index="ngram_custom_example",
settings={
"index": {
"max_ngram_diff": 2
},
"analysis": {
"analyzer": {
"default": {
"tokenizer": "whitespace",
"filter": [
"3_5_grams"
]
}
},
"filter": {
"3_5_grams": {
"type": "ngram",
"min_gram": 3,
"max_gram": 5
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/279e2b29261971999923fdc658bba8ff.asciidoc 0000664 0000000 0000000 00000000627 15176617013 0026420 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:556
[source, python]
----
resp = client.search(
source={
"includes": [
"obj1.*",
"obj2.*"
],
"excludes": [
"*.description"
]
},
query={
"term": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/27f9f604e7a48799fa30529cbc0ff619.asciidoc 0000664 0000000 0000000 00000001345 15176617013 0026464 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc:173
[source, python]
----
resp = client.indices.create(
index="delimited_payload_example",
settings={
"analysis": {
"analyzer": {
"whitespace_plus_delimited": {
"tokenizer": "whitespace",
"filter": [
"plus_delimited"
]
}
},
"filter": {
"plus_delimited": {
"type": "delimited_payload",
"delimiter": "+",
"encoding": "int"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/282e9e845b606f29a5bba174ae4c4c4d.asciidoc 0000664 0000000 0000000 00000001340 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-security.asciidoc:40
[source, python]
----
resp = client.security.create_api_key(
name="my-restricted-api-key",
expiration="7d",
role_descriptors={
"my-restricted-role-descriptor": {
"indices": [
{
"names": [
"website-product-search"
],
"privileges": [
"read"
]
}
],
"restriction": {
"workflows": [
"search_application_query"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/28415647fced5f983b42f8435332a625.asciidoc 0000664 0000000 0000000 00000001035 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:157
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"lowercase": {
"field": "my-keyword-field"
}
}
]
},
docs=[
{
"_source": {
"my-keyword-field": "FOO"
}
},
{
"_source": {
"my-keyword-field": "BAR"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/28543836b62b5622a402e6f7731d68f0.asciidoc 0000664 0000000 0000000 00000000521 15176617013 0026133 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:421
[source, python]
----
resp = client.indices.downsample(
index=".ds-my-data-stream-2023.07.26-000001",
target_index=".ds-my-data-stream-2023.07.26-000001-downsample",
config={
"fixed_interval": "1h"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2856a5ceff1861aa9a78099f1c517fe7.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026541 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/troubleshooting.asciidoc:14
[source, python]
----
resp = client.indices.get_mapping(
index=".watches",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2864a24608b3ac59d21f604f8a31d131.asciidoc 0000664 0000000 0000000 00000000761 15176617013 0026260 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/jwt-realm.asciidoc:504
[source, python]
----
resp = client.security.put_role(
name="jwt_role1",
refresh=True,
cluster=[
"manage"
],
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
]
}
],
run_as=[
"user123_runas"
],
metadata={
"version": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2864d04bf99860ed5dbe1458f1ab5f78.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/put-autoscaling-policy.asciidoc:22
[source, python]
----
resp = client.autoscaling.put_autoscaling_policy(
name="",
policy={
"roles": [],
"deciders": {
"fixed": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2879d7bf4167194b102bf97117327164.asciidoc 0000664 0000000 0000000 00000000746 15176617013 0026072 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/htmlstrip-charfilter.asciidoc:64
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"char_filter": [
"html_strip"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2884eacac3ad05ff794f5296ec7427e7.asciidoc 0000664 0000000 0000000 00000000605 15176617013 0026616 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/knn-query.asciidoc:58
[source, python]
----
resp = client.search(
index="my-image-index",
size=3,
query={
"knn": {
"field": "image-vector",
"query_vector": [
-5,
9,
-12
],
"k": 10
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2891aa10ee9d474780adf94d5607f2db.asciidoc 0000664 0000000 0000000 00000000500 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:177
[source, python]
----
resp = client.search(
index="index_long,index_double",
sort=[
{
"field": {
"numeric_type": "double"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2897ccc2a3bf3d0cd89328ee4413fae5.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:605
[source, python]
----
resp = client.async_search.get(
id="FklQYndoTDJ2VEFlMEVBTzFJMGhJVFEaLVlKYndBWWZSMUdicUc4WVlEaFl4ZzoxNTU=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2898cf033b5bdefdbe3723af850b25c5.asciidoc 0000664 0000000 0000000 00000001300 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/collapse-search-results.asciidoc:53
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"message": "GET /search"
}
},
collapse={
"field": "user.id",
"inner_hits": {
"name": "most_recent",
"size": 5,
"sort": [
{
"@timestamp": "desc"
}
]
},
"max_concurrent_group_searches": 4
},
sort=[
{
"http.response.bytes": {
"order": "desc"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/28ac880057135e46b3b00c7f3976538c.asciidoc 0000664 0000000 0000000 00000000422 15176617013 0026214 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/allocation/filtering.asciidoc:122
[source, python]
----
resp = client.indices.put_settings(
index="test",
settings={
"index.routing.allocation.include._ip": "192.168.2.*"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/291110f4cac02f4610d0853f5800a70d.asciidoc 0000664 0000000 0000000 00000001027 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/weighted-avg-aggregation.asciidoc:214
[source, python]
----
resp = client.search(
index="exams",
size=0,
aggs={
"weighted_grade": {
"weighted_avg": {
"value": {
"field": "grade",
"missing": 2
},
"weight": {
"field": "weight",
"missing": 3
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2932e6f71e247cf52e11d2f38f114ddf.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:300
[source, python]
----
resp = client.reindex(
slices="5",
refresh=True,
source={
"index": "my-index-000001"
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/295b3aaeb223612afdd991744dc9c873.asciidoc 0000664 0000000 0000000 00000000621 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:489
[source, python]
----
resp = client.ingest.put_pipeline(
id="my_test_scores_pipeline",
description="Calculates the total test score",
processors=[
{
"script": {
"source": "ctx.total_score = (ctx.math_score + ctx.verbal_score)"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2968ffb8135f77ba3a9b876dd4918119.asciidoc 0000664 0000000 0000000 00000000607 15176617013 0026410 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:134
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "azure-ai-studio-embeddings",
"pipeline": "azure_ai_studio_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/29783e5de3a5f3c985cbf11094cf49a0.asciidoc 0000664 0000000 0000000 00000000576 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc:274
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"keyword_repeat",
"stemmer",
"remove_duplicates"
],
text="fox running and jumping",
explain=True,
attributes="keyword",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/29824032d7d64512d17458fdd687b1f6.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026234 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:144
[source, python]
----
resp = client.tasks.list(
parent_task_id="oTUltX4IQMOUUVeiohTt8A:123",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/29953082744b7a36e437b392a6391c81.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026062 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:699
[source, python]
----
resp = client.render_search_template(
id="my-search-template",
params={
"from": 20,
"size": 10
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/299900fb08da80fe455cf3f1bb7d62ee.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-field-mapping.asciidoc:102
[source, python]
----
resp = client.indices.get_field_mapping(
index="publications",
fields="title",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/29aeabacb1fdf5b083d5f091b6d1bd44.asciidoc 0000664 0000000 0000000 00000000443 15176617013 0027053 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/29d9df958de292cec50daaf31844b573.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-field-mapping.asciidoc:232
[source, python]
----
resp = client.indices.get_field_mapping(
index="my-index-000001,my-index-000002",
fields="message",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/29e002ab596bae58712eb048ac1768d1.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0026423 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/collapse-search-results.asciidoc:189
[source, python]
----
resp = client.index(
index="my-index-000001",
routing="xyz",
document={
"@timestamp": "2099-11-15T13:12:00",
"message": "You know for search!",
"user.id": "xyz"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a1eece9a59ac1773edcf0a932c26de0.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0027000 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/oidc-logout-api.asciidoc:53
[source, python]
----
resp = client.security.oidc_logout(
token="dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
refresh_token="vLBPvmAB6KvwvJZr27cS",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a21674c40f9b182a8944769d20b2357.asciidoc 0000664 0000000 0000000 00000001477 15176617013 0026145 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2a247e36a86a373bcbf478ac9a588f44.asciidoc 0000664 0000000 0000000 00000000552 15176617013 0026527 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/index_.asciidoc:328
[source, python]
----
resp = client.index(
index="my-index-000001",
routing="kimchy",
document={
"@timestamp": "2099-11-15T13:12:00",
"message": "GET /search HTTP/1.1 200 1070000",
"user": {
"id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a287d213a812b98d8353c563a058cfc.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026347 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/boxplot-aggregation.asciidoc:31
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_boxplot": {
"boxplot": {
"field": "load_time"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a44d254e6e32abe97515fd2eb34705d.asciidoc 0000664 0000000 0000000 00000000435 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:643
[source, python]
----
resp = client.sql.get_async(
id="FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=",
wait_for_completion_timeout="2s",
format="json",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a47d11c6e19c9da5104e738359ea8a8.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026432 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/migrate-to-data-tiers-routing-guide.asciidoc:208
[source, python]
----
resp = client.ilm.start()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a5f7e7d6b92c66e52616845146d2820.asciidoc 0000664 0000000 0000000 00000002200 15176617013 0026217 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/painless-examples.asciidoc:522
[source, python]
----
resp = client.transform.preview_transform(
id="index_compare",
source={
"index": [
"index1",
"index2"
],
"query": {
"match_all": {}
}
},
dest={
"index": "compare"
},
pivot={
"group_by": {
"unique-id": {
"terms": {
"field": ""
}
}
},
"aggregations": {
"compare": {
"scripted_metric": {
"map_script": "state.doc = new HashMap(params['_source'])",
"combine_script": "return state",
"reduce_script": " \n if (states.size() != 2) {\n return \"count_mismatch\"\n }\n if (states.get(0).equals(states.get(1))) {\n return \"match\"\n } else {\n return \"mismatch\"\n }\n "
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a67608dadbf220a2f040f3a79d3677d.asciidoc 0000664 0000000 0000000 00000001314 15176617013 0026501 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2a70194ebd2f01a3229a5092513676b3.asciidoc 0000664 0000000 0000000 00000001363 15176617013 0026173 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/htmlstrip-charfilter.asciidoc:106
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"char_filter": [
"my_custom_html_strip_char_filter"
]
}
},
"char_filter": {
"my_custom_html_strip_char_filter": {
"type": "html_strip",
"escaped_tags": [
"b"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a71e2d7f7179dd76183d30789046808.asciidoc 0000664 0000000 0000000 00000000717 15176617013 0026163 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/multivalued-fields.asciidoc:224
[source, python]
----
resp = client.bulk(
index="mv",
refresh=True,
operations=[
{
"index": {}
},
{
"a": 1,
"b": [
2,
1
]
},
{
"index": {}
},
{
"a": 2,
"b": 3
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a91e1fb8ad93a188fa9d77ec01bc431.asciidoc 0000664 0000000 0000000 00000001711 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-inner-hits.asciidoc:90
[source, python]
----
resp = client.indices.create(
index="test",
mappings={
"properties": {
"comments": {
"type": "nested"
}
}
},
)
print(resp)
resp1 = client.index(
index="test",
id="1",
refresh=True,
document={
"title": "Test title",
"comments": [
{
"author": "kimchy",
"number": 1
},
{
"author": "nik9000",
"number": 2
}
]
},
)
print(resp1)
resp2 = client.search(
index="test",
query={
"nested": {
"path": "comments",
"query": {
"match": {
"comments.number": 2
}
},
"inner_hits": {}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/2a9747bcfaf1f9491ebd410b3fcb6798.asciidoc 0000664 0000000 0000000 00000000454 15176617013 0026670 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:45
[source, python]
----
resp = client.search(
query={
"query_string": {
"query": "(new york city) OR (big apple)",
"default_field": "content"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2a9d3119a9e26e29220be436b9382955.asciidoc 0000664 0000000 0000000 00000001032 15176617013 0026215 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:241
[source, python]
----
resp = client.indices.create(
index="mistral-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 1024,
"element_type": "float",
"similarity": "dot_product"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2aa548b692fc2fe7b6f0d90eb8b2ae29.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/delete-watch.asciidoc:66
[source, python]
----
resp = client.watcher.delete_watch(
id="my_watch",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2abfe0d3f5593d23d2dfa608b1e2532a.asciidoc 0000664 0000000 0000000 00000001574 15176617013 0026640 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:796
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"user_name": {
"terms": {
"field": "user_name"
}
}
},
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d",
"order": "desc"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ac37c3c572170ded67f1d5a0c8151ab.asciidoc 0000664 0000000 0000000 00000000501 15176617013 0026544 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1204
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
tiebreaker_field="event.sequence",
query="\n process where process.name == \"cmd.exe\" and stringContains(process.executable, \"System32\")\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ac7efe3919ee0c7971f5d502f482662.asciidoc 0000664 0000000 0000000 00000001427 15176617013 0026455 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// vectors/vector-functions.asciidoc:159
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"script_score": {
"query": {
"bool": {
"filter": {
"term": {
"status": "published"
}
}
}
},
"script": {
"source": "1 / (1 + l1norm(params.queryVector, 'my_dense_vector'))",
"params": {
"queryVector": [
4,
3.4,
-0.2
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2acf75803494fef29f9ca70671aa6be1.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-delete-roles.asciidoc:100
[source, python]
----
resp = client.security.bulk_delete_role(
names=[
"my_admin_role",
"superuser"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ad35a13262f98574a48f88b4a838512.asciidoc 0000664 0000000 0000000 00000000305 15176617013 0026221 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/alias-privileges.asciidoc:92
[source, python]
----
resp = client.get(
index="current_year",
id="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ade05fb3fb06a67df25e097dfadb045.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026773 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/range-enrich-policy-type-ex.asciidoc:125
[source, python]
----
resp = client.get(
index="my-index-000001",
id="my_id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2aec92bc31bc24bce58d983738f9e0fe.asciidoc 0000664 0000000 0000000 00000000710 15176617013 0026741 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/matrix-stats-aggregation.asciidoc:128
[source, python]
----
resp = client.search(
aggs={
"matrixstats": {
"matrix_stats": {
"fields": [
"poverty",
"income"
],
"missing": {
"income": 50000
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2afc1231679898bd864d06679d9e951b.asciidoc 0000664 0000000 0000000 00000001611 15176617013 0026325 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline.asciidoc:202
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "day"
},
"aggs": {
"categories": {
"terms": {
"field": "category"
}
},
"min_bucket_selector": {
"bucket_selector": {
"buckets_path": {
"count": "categories._bucket_count"
},
"script": {
"source": "params.count != 0"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2afd49985950cbcccf727fa858d00067.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0026532 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2afdf0d83724953aa2875b5fb37d60cc.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026573 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:384
[source, python]
----
resp = client.esql.async_query_get(
id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
wait_for_completion_timeout="30s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2b1c560f00d9bcf5caaf56c03f6b5962.asciidoc 0000664 0000000 0000000 00000000422 15176617013 0026635 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connector-sync-jobs-api.asciidoc:85
[source, python]
----
resp = client.perform_request(
"GET",
"/_connector/_sync_job",
params={
"job_type": "full,incremental"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2b47be4b712147a429102aef386470ee.asciidoc 0000664 0000000 0000000 00000000554 15176617013 0026344 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/detect-threats-with-eql.asciidoc:277
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n sequence by process.pid\n [process where process.name == \"regsvr32.exe\"]\n [library where dll.name == \"scrobj.dll\"]\n [network where true]\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2b59b014349d45bf894aca90b2b1fbe0.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-a-data-stream.asciidoc:377
[source, python]
----
resp = client.indices.delete_data_stream(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2b5a5f8689f04d095fa86570130ee4d4.asciidoc 0000664 0000000 0000000 00000000740 15176617013 0026365 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:22
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_id": {
"type": "keyword"
},
"my_join_field": {
"type": "join",
"relations": {
"question": "answer"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2b5c69778eb3daba9fbd7242bcc2daf9.asciidoc 0000664 0000000 0000000 00000001672 15176617013 0027104 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-api-key.asciidoc:729
[source, python]
----
resp = client.security.query_api_keys(
size=0,
query={
"bool": {
"filter": {
"term": {
"invalidated": True
}
}
}
},
aggs={
"invalidated_keys": {
"composite": {
"sources": [
{
"username": {
"terms": {
"field": "username"
}
}
},
{
"key_name": {
"terms": {
"field": "name"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2b7687e3d7c06824950e00618c297864.asciidoc 0000664 0000000 0000000 00000000313 15176617013 0026071 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/resolve-cluster.asciidoc:205
[source, python]
----
resp = client.indices.resolve_cluster(
name="my-index*,clust*:my-index*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ba15c066d55a9b26d49b09471151cb4.asciidoc 0000664 0000000 0000000 00000003465 15176617013 0026345 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/adjacency-matrix-aggregation.asciidoc:36
[source, python]
----
resp = client.bulk(
index="emails",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"accounts": [
"hillary",
"sidney"
]
},
{
"index": {
"_id": 2
}
},
{
"accounts": [
"hillary",
"donald"
]
},
{
"index": {
"_id": 3
}
},
{
"accounts": [
"vladimir",
"donald"
]
}
],
)
print(resp)
resp1 = client.search(
index="emails",
size=0,
aggs={
"interactions": {
"adjacency_matrix": {
"filters": {
"grpA": {
"terms": {
"accounts": [
"hillary",
"sidney"
]
}
},
"grpB": {
"terms": {
"accounts": [
"donald",
"mitt"
]
}
},
"grpC": {
"terms": {
"accounts": [
"vladimir",
"nigel"
]
}
}
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/2bacdcb278705d944f367cfb984cf4d2.asciidoc 0000664 0000000 0000000 00000001073 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:32
[source, python]
----
resp = client.search(
index="my-index-000001",
sort=[
{
"post_date": {
"order": "asc",
"format": "strict_date_optional_time_nanos"
}
},
"user",
{
"name": "desc"
},
{
"age": "desc"
},
"_score"
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2bc1d52efec2076dc9fc2a3a2d90e8ab.asciidoc 0000664 0000000 0000000 00000000577 15176617013 0027066 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/boxplot-aggregation.asciidoc:177
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_boxplot": {
"boxplot": {
"field": "load_time",
"execution_hint": "high_accuracy"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2bc57cd3f32b59b0b44ca63b19cdfcc0.asciidoc 0000664 0000000 0000000 00000001037 15176617013 0026772 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:623
[source, python]
----
resp = client.search(
index="image-index",
knn={
"field": "image-vector",
"query_vector": [
1,
5,
-20
],
"k": 5,
"num_candidates": 50,
"similarity": 36,
"filter": {
"term": {
"file-type": "png"
}
}
},
fields=[
"title"
],
source=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2c079d1ae4819a0c206b9e1aa5623523.asciidoc 0000664 0000000 0000000 00000002737 15176617013 0026341 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2c090fe7ec7b66b3f5c178d71c46323b.asciidoc 0000664 0000000 0000000 00000000554 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:403
[source, python]
----
resp = client.indices.stats(
metric="fielddata",
human=True,
fields="my_join_field",
)
print(resp)
resp1 = client.nodes.stats(
metric="indices",
index_metric="fielddata",
human=True,
fields="my_join_field",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/2c0dbdcf400cde5d36f7c9e6c1101011.asciidoc 0000664 0000000 0000000 00000000244 15176617013 0026617 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/health.asciidoc:107
[source, python]
----
resp = client.cat.health(
v=True,
ts=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2c1e16e9ac24cfea979af2a69900d3c2.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0026645 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/put-synonym-rule.asciidoc:113
[source, python]
----
resp = client.synonyms.put_synonym_rule(
set_id="my-synonyms-set",
rule_id="test-1",
synonyms="hello, hi, howdy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2c27a8eb6528126f37a843d434cd88b6.asciidoc 0000664 0000000 0000000 00000000626 15176617013 0026367 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/flatten-graph-tokenfilter.asciidoc:39
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "synonym_graph",
"synonyms": [
"dns, domain name system"
]
}
],
text="domain name system is fragile",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2c3207c0c985d253b2ecccc14e69e25a.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:412
[source, python]
----
resp = client.indices.add_block(
index=".ds-my-data-stream-2023.07.26-000001",
block="write",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2c3dff44904d3d73ff47f1afe89c7f86.asciidoc 0000664 0000000 0000000 00000000425 15176617013 0026705 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:375
[source, python]
----
resp = client.update_by_query(
index="my-index-000001",
query={
"term": {
"user.id": "kimchy"
}
},
max_docs=1,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2c44657adf550b8ade5cf5334106d38b.asciidoc 0000664 0000000 0000000 00000001073 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1404
[source, python]
----
resp = client.search(
index="my-index-000001",
runtime_mappings={
"http.clientip": {
"type": "ip",
"script": "\n String clientip=grok('%{COMMONAPACHELOG}').extract(doc[\"message\"].value)?.clientip;\n if (clientip != null) emit(clientip);\n "
}
},
query={
"match": {
"http.clientip": "40.135.0.0"
}
},
fields=[
"http.clientip"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2c602b4ee8f22cda2cdf19bad31da0af.asciidoc 0000664 0000000 0000000 00000002200 15176617013 0027112 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster.asciidoc:59
[source, python]
----
resp = client.nodes.info()
print(resp)
resp1 = client.nodes.info(
node_id="_all",
)
print(resp1)
resp2 = client.nodes.info(
node_id="_local",
)
print(resp2)
resp3 = client.nodes.info(
node_id="_master",
)
print(resp3)
resp4 = client.nodes.info(
node_id="node_name_goes_here",
)
print(resp4)
resp5 = client.nodes.info(
node_id="node_name_goes_*",
)
print(resp5)
resp6 = client.nodes.info(
node_id="10.0.0.3,10.0.0.4",
)
print(resp6)
resp7 = client.nodes.info(
node_id="10.0.0.*",
)
print(resp7)
resp8 = client.nodes.info(
node_id="_all,master:false",
)
print(resp8)
resp9 = client.nodes.info(
node_id="data:true,ingest:true",
)
print(resp9)
resp10 = client.nodes.info(
node_id="coordinating_only:true",
)
print(resp10)
resp11 = client.nodes.info(
node_id="master:true,voting_only:false",
)
print(resp11)
resp12 = client.nodes.info(
node_id="rack:2",
)
print(resp12)
resp13 = client.nodes.info(
node_id="ra*:2",
)
print(resp13)
resp14 = client.nodes.info(
node_id="ra*:2*",
)
print(resp14)
----
python-elasticsearch-9.4.0/docs/examples/2c86840a46242a38cf82024a9321be46.asciidoc 0000664 0000000 0000000 00000001142 15176617013 0026177 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2ceded6ee764adf1aaaac0a1cd25ed5f.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0027351 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:418
[source, python]
----
resp = client.cat.indices(
v=True,
health="red",
h="index,status,health",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2d01a9e5550b525496757f1bd7f0e706.asciidoc 0000664 0000000 0000000 00000000562 15176617013 0026301 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/index_.asciidoc:456
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
timeout="5m",
document={
"@timestamp": "2099-11-15T13:12:00",
"message": "GET /search HTTP/1.1 200 1070000",
"user": {
"id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2d0244c020075595acb625aa5ba8f455.asciidoc 0000664 0000000 0000000 00000001333 15176617013 0026326 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2d150ff3b6b991b58fea6aa5cc669aa3.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-phrase-query.asciidoc:66
[source, python]
----
resp = client.search(
query={
"match_phrase": {
"message": {
"query": "this is a test",
"analyzer": "my_analyzer"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2d2f5ec97aa34ff7822a6a1ed08ef335.asciidoc 0000664 0000000 0000000 00000002003 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:423
[source, python]
----
resp = client.bulk(
index="test",
refresh=True,
operations=[
{
"index": {
"_index": "test1"
}
},
{
"s": 1,
"m": 3.1415
},
{
"index": {
"_index": "test1"
}
},
{
"s": 2,
"m": 1
},
{
"index": {
"_index": "test2"
}
},
{
"s": 3.1,
"m": 2.71828
}
],
)
print(resp)
resp1 = client.search(
index="test*",
filter_path="aggregations",
aggs={
"tm": {
"top_metrics": {
"metrics": {
"field": "m"
},
"sort": {
"s": "asc"
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/2d37b02cbf6d30ae11bf239a54ec9423.asciidoc 0000664 0000000 0000000 00000003575 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:316
[source, python]
----
resp = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {}
},
{
"@timestamp": 1516729294000,
"model_number": "QVKC92Q",
"measures": {
"voltage": "5.2",
"start": "300",
"end": "8675309"
}
},
{
"index": {}
},
{
"@timestamp": 1516642894000,
"model_number": "QVKC92Q",
"measures": {
"voltage": "5.8",
"start": "300",
"end": "8675309"
}
},
{
"index": {}
},
{
"@timestamp": 1516556494000,
"model_number": "QVKC92Q",
"measures": {
"voltage": "5.1",
"start": "300",
"end": "8675309"
}
},
{
"index": {}
},
{
"@timestamp": 1516470094000,
"model_number": "QVKC92Q",
"measures": {
"voltage": "5.6",
"start": "300",
"end": "8675309"
}
},
{
"index": {}
},
{
"@timestamp": 1516383694000,
"model_number": "HG537PU",
"measures": {
"voltage": "4.2",
"start": "400",
"end": "8625309"
}
},
{
"index": {}
},
{
"@timestamp": 1516297294000,
"model_number": "HG537PU",
"measures": {
"voltage": "4.0",
"start": "400",
"end": "8625309"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2d60e3bdfee7afbddee149f40450b8b5.asciidoc 0000664 0000000 0000000 00000000463 15176617013 0027072 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/validate.asciidoc:149
[source, python]
----
resp = client.indices.validate_query(
index="my-index-000001",
query={
"query_string": {
"query": "@timestamp:foo",
"lenient": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2d8fcb03de417a71e7888bbdd948a692.asciidoc 0000664 0000000 0000000 00000000261 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/transforms.asciidoc:197
[source, python]
----
resp = client.cat.transforms(
v=True,
format="json",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2d9b30acd6b5683f39d53494c0dd779c.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/restart-cluster.asciidoc:147
[source, python]
----
resp = client.cat.health()
print(resp)
resp1 = client.cat.recovery()
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/2dad2b0c8ba503228f4b11cecca0b348.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0026663 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-migrate-data-stream-from-ilm-to-dsl.asciidoc:222
[source, python]
----
resp = client.indices.put_data_lifecycle(
name="dsl-data-stream",
data_retention="7d",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2de6885bacb8769b8f22dce253c96b0c.asciidoc 0000664 0000000 0000000 00000001045 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/intervals-query.asciidoc:424
[source, python]
----
resp = client.search(
query={
"intervals": {
"my_text": {
"match": {
"query": "hot porridge",
"filter": {
"script": {
"source": "interval.start > 10 && interval.end < 20 && interval.gaps == 0"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2e09666d3ad5ad9afc22763ee6e97a2b.asciidoc 0000664 0000000 0000000 00000000557 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// slm/apis/slm-put.asciidoc:160
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="hourly-snapshots",
schedule="1h",
name="",
repository="my_repository",
config={
"indices": [
"data-*",
"important"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2e364833626c9790c042c8f006fcc999.asciidoc 0000664 0000000 0000000 00000001403 15176617013 0026232 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/multiplexer-tokenfilter.asciidoc:36
[source, python]
----
resp = client.indices.create(
index="multiplexer_example",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"my_multiplexer"
]
}
},
"filter": {
"my_multiplexer": {
"type": "multiplexer",
"filters": [
"lowercase",
"lowercase, porter_stem"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2e36fe22051a47e052e349854d9948b9.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/explain.asciidoc:198
[source, python]
----
resp = client.explain(
index="my-index-000001",
id="0",
q="message:search",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2e3d1b293da93f2a9ecfc26786ec28d6.asciidoc 0000664 0000000 0000000 00000016077 15176617013 0026700 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:60
[source, python]
----
resp = client.indices.put_index_template(
name="my-data-stream-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
template={
"settings": {
"index": {
"mode": "time_series",
"routing_path": [
"kubernetes.namespace",
"kubernetes.host",
"kubernetes.node",
"kubernetes.pod"
],
"number_of_replicas": 0,
"number_of_shards": 2
}
},
"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)
----
python-elasticsearch-9.4.0/docs/examples/2e7844477b41fcfa9efefee4ec0e7101.asciidoc 0000664 0000000 0000000 00000002420 15176617013 0026741 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2e796e5ca59768d4426abbf9a049db3e.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/split-index.asciidoc:175
[source, python]
----
resp = client.indices.split(
index="my_source_index",
target="my_target_index",
settings={
"index.number_of_shards": 2
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2e7f4b9be999422a12abb680572b13c8.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026434 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/get-lifecycle.asciidoc:82
[source, python]
----
resp = client.ilm.get_lifecycle(
name="my_policy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2e847378ba26aa64d40186b6e3e6a1da.asciidoc 0000664 0000000 0000000 00000000653 15176617013 0026511 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/unsigned_long.asciidoc:159
[source, python]
----
resp = client.search(
index="my_index",
query={
"script_score": {
"query": {
"match_all": {}
},
"script": {
"source": "field('my_counter').asBigInteger(BigInteger.ZERO).floatValue()"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2e93eaaebf75fa4a2451e8a76ffa9f20.asciidoc 0000664 0000000 0000000 00000000753 15176617013 0027022 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:105
[source, python]
----
resp = client.indices.put_index_template(
name="my-data-stream-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
priority=500,
template={
"mappings": {
"properties": {
"message": {
"type": "text"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ebcdd00ccbf26b4c8e6d9c80dfb3d55.asciidoc 0000664 0000000 0000000 00000000756 15176617013 0027154 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:170
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "linestring",
"coordinates": [
[
-377.03653,
389.897676
],
[
-377.009051,
389.889939
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ec8d757188349a4630e120ba2c98c3b.asciidoc 0000664 0000000 0000000 00000000606 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/pattern_replace-tokenfilter.asciidoc:36
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "pattern_replace",
"pattern": "(dog)",
"replacement": "watch$1"
}
],
text="foxes jump lazy dogs",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ee002e60bd7a38d466e5f0eb0c38946.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:375
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"add": {
"index": "my-index-2099.05.06-000001",
"alias": "my-alias",
"routing": "1"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ee239df3243c98418f7d9a5c7be4cfd.asciidoc 0000664 0000000 0000000 00000001461 15176617013 0026676 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/flatten-graph-tokenfilter.asciidoc:203
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_custom_index_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"my_custom_word_delimiter_graph_filter",
"flatten_graph"
]
}
},
"filter": {
"my_custom_word_delimiter_graph_filter": {
"type": "word_delimiter_graph",
"catenate_all": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2eebaeb3983a04ef7a9201c1f4d40dc1.asciidoc 0000664 0000000 0000000 00000003364 15176617013 0026716 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/dissect-syntax.asciidoc:204
[source, python]
----
resp = client.bulk(
index="my-index",
refresh=True,
operations=[
{
"index": {}
},
{
"timestamp": "2020-04-30T14:30:17-05:00",
"message": "40.135.0.0 - - [30/Apr/2020:14:30:17 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:30:53-05:00",
"message": "232.0.0.0 - - [30/Apr/2020:14:30:53 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:12-05:00",
"message": "26.1.0.0 - - [30/Apr/2020:14:31:12 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:19-05:00",
"message": "247.37.0.0 - - [30/Apr/2020:14:31:19 -0500] \"GET /french/splash_inet.html HTTP/1.0\" 200 3781"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:22-05:00",
"message": "247.37.0.0 - - [30/Apr/2020:14:31:22 -0500] \"GET /images/hm_nbg.jpg HTTP/1.0\" 304 0"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:27-05:00",
"message": "252.0.0.0 - - [30/Apr/2020:14:31:27 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:28-05:00",
"message": "not a valid apache log"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2f0b2181c434a879a23b4643bdd92575.asciidoc 0000664 0000000 0000000 00000000536 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-settings.asciidoc:82
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001,my-index-000002",
)
print(resp)
resp1 = client.indices.get_settings(
index="_all",
)
print(resp1)
resp2 = client.indices.get_settings(
index="log_2099_*",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/2f195eeb93229e40c4d8f1a6ab4a358c.asciidoc 0000664 0000000 0000000 00000001243 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/fingerprint.asciidoc:39
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"fingerprint": {
"fields": [
"user"
]
}
}
]
},
docs=[
{
"_source": {
"user": {
"last_name": "Smith",
"first_name": "John",
"date_of_birth": "1980-01-15",
"is_active": True
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2f2580ea420e1836d922fe48fa8ada97.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/delete-auto-follow-pattern.asciidoc:39
[source, python]
----
resp = client.ccr.delete_auto_follow_pattern(
name="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2f2fd35905feef0b561c05d70c7064c1.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026510 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:570
[source, python]
----
resp = client.indices.get_mapping(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2f4a55dfeba8851b306ef9c1b216ef54.asciidoc 0000664 0000000 0000000 00000000401 15176617013 0026645 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:85
[source, python]
----
resp = client.search(
index="bug_reports",
query={
"term": {
"labels.release": "v1.3.0"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2f4e28c81db47547ad39d0926babab12.asciidoc 0000664 0000000 0000000 00000002133 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:689
[source, python]
----
resp = client.indices.create(
index="estonian_example",
settings={
"analysis": {
"filter": {
"estonian_stop": {
"type": "stop",
"stopwords": "_estonian_"
},
"estonian_keywords": {
"type": "keyword_marker",
"keywords": [
"näide"
]
},
"estonian_stemmer": {
"type": "stemmer",
"language": "estonian"
}
},
"analyzer": {
"rebuilt_estonian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"estonian_stop",
"estonian_keywords",
"estonian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2f72a63c73dd672ac2dc3997ad15dd41.asciidoc 0000664 0000000 0000000 00000001026 15176617013 0026570 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2f9574fee2ebecd6f7d917ee99b26bcc.asciidoc 0000664 0000000 0000000 00000000660 15176617013 0027127 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/doc-values.asciidoc:65
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"status_code": {
"type": "keyword"
},
"session_id": {
"type": "keyword",
"doc_values": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2f98924c3d593ea2b60edb9cef5bee22.asciidoc 0000664 0000000 0000000 00000000274 15176617013 0026746 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:484
[source, python]
----
resp = client.indices.forcemerge(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2f9ee29fe49f7d206a41212aa5945296.asciidoc 0000664 0000000 0000000 00000001033 15176617013 0026362 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/2fa45d74ba9933188c4728f8a9e5372c.asciidoc 0000664 0000000 0000000 00000000753 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/index_.asciidoc:227
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"action.auto_create_index": "my-index-000001,index10,-index1*,+ind*"
},
)
print(resp)
resp1 = client.cluster.put_settings(
persistent={
"action.auto_create_index": "false"
},
)
print(resp1)
resp2 = client.cluster.put_settings(
persistent={
"action.auto_create_index": "true"
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/2fa7ded8515b32f26c54394ea598f573.asciidoc 0000664 0000000 0000000 00000001670 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/index-templates.asciidoc:123
[source, python]
----
resp = client.indices.put_index_template(
name="template_1",
index_patterns=[
"te*",
"bar*"
],
template={
"settings": {
"number_of_shards": 1
},
"mappings": {
"_source": {
"enabled": True
},
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
},
"aliases": {
"mydata": {}
}
},
priority=500,
composed_of=[
"component_template1",
"runtime_component_template"
],
version=3,
meta={
"description": "my custom"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2fc2c790a85be29bbcba50bdde1493f4.asciidoc 0000664 0000000 0000000 00000000352 15176617013 0027002 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:225
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="my_snapshot_2099.05.06",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2fc80a2ad1ca8b2dcb13ed1895b8e861.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026717 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/update-settings.asciidoc:128
[source, python]
----
resp = client.cluster.put_settings(
transient={
"indices.recovery.*": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2fd0b3c132b46aa34cc9d92dd2d4bc85.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026715 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/common-grams-tokenfilter.asciidoc:28
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "common_grams",
"common_words": [
"is",
"the"
]
}
],
text="the quick fox is brown",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2fe28d9a91b3081a9ec4601af8fb7b1c.asciidoc 0000664 0000000 0000000 00000001531 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:716
[source, python]
----
resp = client.indices.create(
index="test",
mappings={
"dynamic": False,
"properties": {
"text": {
"type": "text"
}
}
},
)
print(resp)
resp1 = client.index(
index="test",
refresh=True,
document={
"text": "words words",
"flag": "bar"
},
)
print(resp1)
resp2 = client.index(
index="test",
refresh=True,
document={
"text": "words words",
"flag": "foo"
},
)
print(resp2)
resp3 = client.indices.put_mapping(
index="test",
properties={
"text": {
"type": "text"
},
"flag": {
"type": "text",
"analyzer": "keyword"
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/2fea3e324939cc7e9c396964aeee7111.asciidoc 0000664 0000000 0000000 00000000544 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-query.asciidoc:256
[source, python]
----
resp = client.search(
query={
"match": {
"message": {
"query": "to be or not to be",
"operator": "and",
"zero_terms_query": "all"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2fee452baff92b409cbfc8d71eb5fc0e.asciidoc 0000664 0000000 0000000 00000000224 15176617013 0027151 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/nodes.asciidoc:361
[source, python]
----
resp = client.cat.nodes(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/2ffa953b29ed0156c9e610daf66b8e48.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-tutorial.asciidoc:410
[source, python]
----
resp = client.ilm.explain_lifecycle(
index="timeseries-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/300576666769b78fa6fa26b232837f81.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026147 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/get-autoscaling-capacity.asciidoc:22
[source, python]
----
resp = client.autoscaling.get_autoscaling_capacity()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/305c4cfb2ad4b58b4c319ffbf32336cc.asciidoc 0000664 0000000 0000000 00000000726 15176617013 0026723 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:143
[source, python]
----
resp = client.search(
index="my-index-000001",
script_fields={
"my_doubled_field": {
"script": {
"lang": "painless",
"source": "doc['my_field'].value * params.get('multiplier');",
"params": {
"multiplier": 2
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3082ae0c3ecdc61808103214631b40c6.asciidoc 0000664 0000000 0000000 00000001371 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/avg-bucket-aggregation.asciidoc:57
[source, python]
----
resp = client.search(
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"avg_monthly_sales": {
"avg_bucket": {
"buckets_path": "sales_per_month>sales",
"gap_policy": "skip",
"format": "#,##0.00;(#,##0.00)"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/309f0721145b5c656338a02459c3ff1e.asciidoc 0000664 0000000 0000000 00000000507 15176617013 0026207 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rank-feature-query.asciidoc:254
[source, python]
----
resp = client.search(
index="test",
query={
"rank_feature": {
"field": "pagerank",
"saturation": {
"pivot": 8
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/30abc76a39e551f4b52c65002bb6405d.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:285
[source, python]
----
resp = client.security.get_api_key(
username="myuser",
realm_name="native1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/30bd3c0785f3df4795684754adeb5ecb.asciidoc 0000664 0000000 0000000 00000000720 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:97
[source, python]
----
resp = client.render_search_template(
source={
"query": {
"match": {
"message": "{{query_string}}"
}
},
"from": "{{from}}",
"size": "{{size}}"
},
params={
"query_string": "hello world",
"from": 20,
"size": 10
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/30d051f534aeb884176eedb2c11dac85.asciidoc 0000664 0000000 0000000 00000001102 15176617013 0026550 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/30db2702dd0071c72a090b8311d0db09.asciidoc 0000664 0000000 0000000 00000001442 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/tophits-aggregation.asciidoc:201
[source, python]
----
resp = client.search(
index="sales",
query={
"match": {
"body": "elections"
}
},
aggs={
"top_sites": {
"terms": {
"field": "domain",
"order": {
"top_hit": "desc"
}
},
"aggs": {
"top_tags_hits": {
"top_hits": {}
},
"top_hit": {
"max": {
"script": {
"source": "_score"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/30f3e3b9df46afd12e68bc71f18483b4.asciidoc 0000664 0000000 0000000 00000001021 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:131
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
)
print(resp)
resp1 = client.indices.create(
index="my-index-000002",
)
print(resp1)
resp2 = client.indices.put_mapping(
index="my-index-000001,my-index-000002",
properties={
"user": {
"properties": {
"name": {
"type": "keyword"
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/30fa37c9575fe81a0ea7c12cfc08e277.asciidoc 0000664 0000000 0000000 00000001020 15176617013 0026564 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/copy-to.asciidoc:71
[source, python]
----
resp = client.indices.create(
index="bad_example_index",
mappings={
"properties": {
"field_1": {
"type": "text",
"copy_to": "field_2"
},
"field_2": {
"type": "text",
"copy_to": "field_3"
},
"field_3": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/310bdfb0d0d75bac7bff036a3fe51d4d.asciidoc 0000664 0000000 0000000 00000001023 15176617013 0027040 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:145
[source, python]
----
resp = client.ingest.put_pipeline(
id="azure_ai_studio_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "azure_ai_studio_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3166455372f2d96622caff076e91ebe7.asciidoc 0000664 0000000 0000000 00000000534 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:308
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"percolate": {
"field": "query",
"index": "my-index-000001",
"id": "2",
"version": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/316cd43feb3b86396483903af1a048b1.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026347 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:782
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sale_date": {
"date_histogram": {
"field": "date",
"calendar_interval": "year",
"missing": "2000/01/01"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3182f26c61fbe5cf89400804533d5ed2.asciidoc 0000664 0000000 0000000 00000000657 15176617013 0026362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:808
[source, python]
----
resp = client.render_search_template(
id="my-search-template",
params={
"query_string": "My string",
"text_fields": [
{
"user_name": "John"
},
{
"user_name": "kimchy"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/31832bd71c31c46a1ccf8d1c210d89d4.asciidoc 0000664 0000000 0000000 00000001204 15176617013 0026467 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/318e209cc4d6f306e65cb2f5598a50b1.asciidoc 0000664 0000000 0000000 00000000756 15176617013 0026441 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:194
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "LineString",
"coordinates": [
[
-77.03653,
38.897676
],
[
-77.009051,
38.889939
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/31a79a57b242713edec6795599ba0d5d.asciidoc 0000664 0000000 0000000 00000000631 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/semantic-search/field-mappings.asciidoc:15
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"my_tokens": {
"type": "sparse_vector"
},
"my_text_field": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/31ab4ec26176857280af630bf84a2823.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026265 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/saml-sp-metadata.asciidoc:48
[source, python]
----
resp = client.security.saml_service_provider_metadata(
realm_name="saml1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/31ac1b68dc7c26a1d37350be47ae9381.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/completion.asciidoc:12
[source, python]
----
resp = client.indices.create(
index="music",
mappings={
"properties": {
"suggest": {
"type": "completion"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/31aed390c30bd4f42a5c56253695e53f.asciidoc 0000664 0000000 0000000 00000000662 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/whitespace-analyzer.asciidoc:131
[source, python]
----
resp = client.indices.create(
index="whitespace_example",
settings={
"analysis": {
"analyzer": {
"rebuilt_whitespace": {
"tokenizer": "whitespace",
"filter": []
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/31f4400716500149cccbc19aa06bff66.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/dangling-index-delete.asciidoc:19
[source, python]
----
resp = client.dangling_indices.delete_dangling_index(
index_uuid="",
accept_data_loss=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/320645d771e952af2a67bb7445c3688d.asciidoc 0000664 0000000 0000000 00000002241 15176617013 0026303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1648
[source, python]
----
resp = client.indices.create(
index="sorani_example",
settings={
"analysis": {
"filter": {
"sorani_stop": {
"type": "stop",
"stopwords": "_sorani_"
},
"sorani_keywords": {
"type": "keyword_marker",
"keywords": [
"mînak"
]
},
"sorani_stemmer": {
"type": "stemmer",
"language": "sorani"
}
},
"analyzer": {
"rebuilt_sorani": {
"tokenizer": "standard",
"filter": [
"sorani_normalization",
"lowercase",
"decimal_digit",
"sorani_stop",
"sorani_keywords",
"sorani_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/32123981430e5a8b34fe14314fc48429.asciidoc 0000664 0000000 0000000 00000000447 15176617013 0026132 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-multiple-indices.asciidoc:17
[source, python]
----
resp = client.search(
index="my-index-000001,my-index-000002",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3218f8ccd59c8c90349816e0428e8fb8.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026376 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:99
[source, python]
----
resp = client.indices.clear_cache(
fielddata=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3250a8d2d2a9619035040e55a03620b9.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026111 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/network/tracers.asciidoc:46
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.http.HttpTracer": "TRACE",
"logger.org.elasticsearch.http.HttpBodyTracer": "TRACE"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/327466380bcd55361973b4a96c6dccb2.asciidoc 0000664 0000000 0000000 00000002131 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1698
[source, python]
----
resp = client.indices.create(
index="spanish_example",
settings={
"analysis": {
"filter": {
"spanish_stop": {
"type": "stop",
"stopwords": "_spanish_"
},
"spanish_keywords": {
"type": "keyword_marker",
"keywords": [
"ejemplo"
]
},
"spanish_stemmer": {
"type": "stemmer",
"language": "light_spanish"
}
},
"analyzer": {
"rebuilt_spanish": {
"tokenizer": "standard",
"filter": [
"lowercase",
"spanish_stop",
"spanish_keywords",
"spanish_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/32a7acdfb7046966b28f394476c99126.asciidoc 0000664 0000000 0000000 00000000355 15176617013 0026320 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:153
[source, python]
----
resp = client.index(
index="example",
document={
"location": "POINT (-377.03653 389.897676)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/32af23a4b0fea6c81c4688ce5fe4ac35.asciidoc 0000664 0000000 0000000 00000001043 15176617013 0026722 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-rank-aggregation.asciidoc:184
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_ranks": {
"percentile_ranks": {
"field": "load_time",
"values": [
500,
600
],
"hdr": {
"number_of_significant_value_digits": 3
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/32b7963c5cabbe9cc7d15da62f5edda9.asciidoc 0000664 0000000 0000000 00000000566 15176617013 0027104 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-user-profile-data.asciidoc:124
[source, python]
----
resp = client.security.update_user_profile_data(
uid="u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0",
labels={
"direction": "west"
},
data={
"app1": {
"font": "large"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/32b8a5152b47930f2e16c40c8615c7bb.asciidoc 0000664 0000000 0000000 00000003147 15176617013 0026344 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-client.asciidoc:286
[source, python]
----
resp = client.search_application.put(
name="my-example-app",
search_application={
"indices": [
"example-index"
],
"template": {
"script": {
"lang": "mustache",
"source": "\n {\n \"query\": {\n \"bool\": {\n \"must\": [\n {{#query}}\n {\n \"multi_match\" : {\n \"query\": \"{{query}}\",\n \"fields\": [ \"title^4\", \"plot\", \"actors\", \"directors\" ]\n }\n },\n {\n \"multi_match\" : {\n \"query\": \"{{query}}\",\n \"type\": \"phrase_prefix\",\n \"fields\": [ \"title^4\", \"plot\"]\n }\n },\n {{/query}}\n ],\n \"filter\": {{#toJson}}_es_filters{{/toJson}}\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": {},
"_es_aggs": {},
"_es_sort_fields": {},
"size": 10,
"from": 0
},
"dictionary": {}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/32c8c86702ccd68eb70f1573409c2a1f.asciidoc 0000664 0000000 0000000 00000001400 15176617013 0026424 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/32cd57666bc80b8cf793d06fa1086669.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0026373 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:203
[source, python]
----
resp = client.sql.query(
format="tsv",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/32ce26b8af95f7ccc2a7bd5e77a39d6c.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0027031 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:562
[source, python]
----
resp = client.indices.recovery(
index="my-index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/32de5dd306bd014d67053d2f175defcd.asciidoc 0000664 0000000 0000000 00000000400 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/troubleshooting.asciidoc:748
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.xpack.security.authc.saml": "debug"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3312c82f81816bf76629db9582991812.asciidoc 0000664 0000000 0000000 00000001355 15176617013 0026103 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/slowlog.asciidoc:135
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index.search.slowlog.threshold.query.warn": "10s",
"index.search.slowlog.threshold.query.info": "5s",
"index.search.slowlog.threshold.query.debug": "2s",
"index.search.slowlog.threshold.query.trace": "500ms",
"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.include.user": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/331caebf810a923644eb6de26e5a97f4.asciidoc 0000664 0000000 0000000 00000000754 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:417
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_join_field": {
"type": "join",
"relations": {
"question": [
"answer",
"comment"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3337c817ebd438254505a31e91c91724.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026136 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-data-stream.asciidoc:77
[source, python]
----
resp = client.indices.get_data_stream(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3341d3bbb53052447a37c92a04c14b70.asciidoc 0000664 0000000 0000000 00000000357 15176617013 0026243 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:356
[source, python]
----
resp = client.update(
index="my-index-000001",
id="1",
script="ctx._source.new_field = 'value_of_new_field'",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3343a4cf559060c422d86c786a95e535.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026224 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/apostrophe-tokenfilter.asciidoc:22
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"apostrophe"
],
text="Istanbul'a veya Istanbul'dan",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/334811cfceb6858aeec5b3461717dd63.asciidoc 0000664 0000000 0000000 00000001065 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/geoip.asciidoc:188
[source, python]
----
resp = client.ingest.put_pipeline(
id="geoip",
description="Add ip geolocation info",
processors=[
{
"geoip": {
"field": "ip"
}
}
],
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="my_id",
pipeline="geoip",
document={
"ip": "80.231.5.0"
},
)
print(resp1)
resp2 = client.get(
index="my-index-000001",
id="my_id",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/33610800d9de3c3e6d6b3c611ace7330.asciidoc 0000664 0000000 0000000 00000000266 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:134
[source, python]
----
resp = client.tasks.get(
task_id="oTUltX4IQMOUUVeiohTt8A:124",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/336613f48dd95ea993dd3bcce264fd0e.asciidoc 0000664 0000000 0000000 00000001017 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-allocate.asciidoc:116
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"cold": {
"actions": {
"allocate": {
"require": {
"box_type": "cold",
"storage": "high"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/33732208fc6e6fe1e8d278299681932e.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026240 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:183
[source, python]
----
resp = client.index(
index="example",
document={
"location": "LINESTRING (-377.03653 389.897676, -377.009051 389.889939)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3386fe07e90844dbcdbbe7c07f09e04a.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/delete-synonyms-set.asciidoc:66
[source, python]
----
resp = client.synonyms.delete_synonym(
id="my-synonyms-set",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/339c4e5af9f9069ad9912aa574488b59.asciidoc 0000664 0000000 0000000 00000002241 15176617013 0026406 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/33b732bb301e99d2161bd2246494f487.asciidoc 0000664 0000000 0000000 00000001025 15176617013 0026206 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/geo-match-enrich-policy-type-ex.asciidoc:95
[source, python]
----
resp = client.ingest.put_pipeline(
id="postal_lookup",
processors=[
{
"enrich": {
"description": "Add 'geo_data' based on 'geo_location'",
"policy_name": "postal_policy",
"field": "geo_location",
"target_field": "geo_data",
"shape_relation": "INTERSECTS"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/33d480fc6812ada75756cf5337bc9092.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026361 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connector-sync-jobs-api.asciidoc:64
[source, python]
----
resp = client.perform_request(
"GET",
"/_connector/_sync_job",
params={
"from": "0",
"size": "2"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/33f148e3d8676de6cc52f58749898a13.asciidoc 0000664 0000000 0000000 00000001045 15176617013 0026332 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:278
[source, python]
----
resp = client.search(
query={
"dis_max": {
"queries": [
{
"match_phrase_prefix": {
"subject": "quick brown f"
}
},
{
"match_phrase_prefix": {
"message": "quick brown f"
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/342ddf9121aeddd82fea2464665e25da.asciidoc 0000664 0000000 0000000 00000000446 15176617013 0026653 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/create-connector-api.asciidoc:27
[source, python]
----
resp = client.connector.put(
connector_id="my-connector",
index_name="search-google-drive",
name="My Connector",
service_type="google_drive",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/343dd09a8c76987e586858be3bdc51eb.asciidoc 0000664 0000000 0000000 00000003006 15176617013 0026541 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:574
[source, python]
----
resp = client.indices.create(
index="my_queries2",
settings={
"analysis": {
"analyzer": {
"wildcard_suffix": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"reverse",
"wildcard_edge_ngram"
]
},
"wildcard_suffix_search_time": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"reverse"
]
}
},
"filter": {
"wildcard_edge_ngram": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 32
}
}
}
},
mappings={
"properties": {
"query": {
"type": "percolator"
},
"my_field": {
"type": "text",
"fields": {
"suffix": {
"type": "text",
"analyzer": "wildcard_suffix",
"search_analyzer": "wildcard_suffix_search_time"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/344b4144244d57f87c6aa4652b100b25.asciidoc 0000664 0000000 0000000 00000000347 15176617013 0026176 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-query.asciidoc:167
[source, python]
----
resp = client.index(
index="my-index-000001",
id="2",
document={
"color": "blue"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/346f28d82acb5427c304aa574fea0008.asciidoc 0000664 0000000 0000000 00000001310 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1847
[source, python]
----
resp = client.indices.create(
index="thai_example",
settings={
"analysis": {
"filter": {
"thai_stop": {
"type": "stop",
"stopwords": "_thai_"
}
},
"analyzer": {
"rebuilt_thai": {
"tokenizer": "thai",
"filter": [
"lowercase",
"decimal_digit",
"thai_stop"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3477a89d869b1f7f72d50c2ca86c4679.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/activate-watch.asciidoc:88
[source, python]
----
resp = client.watcher.activate_watch(
watch_id="my_watch",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3487e60e1ae9d4925ce540cd63574385.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026313 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/boosting-query.asciidoc:18
[source, python]
----
resp = client.search(
query={
"boosting": {
"positive": {
"term": {
"text": "apple"
}
},
"negative": {
"term": {
"text": "pie tart fruit crumble tree"
}
},
"negative_boost": 0.5
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/34be27141e3a476c138546190101c8bc.asciidoc 0000664 0000000 0000000 00000000370 15176617013 0026172 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-vector-tile-api.asciidoc:38
[source, python]
----
resp = client.search_mvt(
index="my-index",
field="my-geo-field",
zoom="15",
x="5271",
y="12710",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/34d51c54b62e9a160c0ddacc10134bb0.asciidoc 0000664 0000000 0000000 00000000536 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-first-query.asciidoc:10
[source, python]
----
resp = client.search(
query={
"span_first": {
"match": {
"span_term": {
"user.id": "kimchy"
}
},
"end": 3
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/34d63740b58209a3d031212909743925.asciidoc 0000664 0000000 0000000 00000001037 15176617013 0025704 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:213
[source, python]
----
resp = client.search(
index="openai-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "openai_embeddings",
"model_text": "Calculate fuel cost"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35260b615d0b5628c95d7cc814c39bd3.asciidoc 0000664 0000000 0000000 00000000744 15176617013 0026356 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/has-child-query.asciidoc:141
[source, python]
----
resp = client.search(
query={
"has_child": {
"type": "child",
"query": {
"function_score": {
"script_score": {
"script": "_score * doc['click_count'].value"
}
}
},
"score_mode": "max"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/353020cb30a885ee7f5ce2b141ba574a.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/prefix-query.asciidoc:58
[source, python]
----
resp = client.search(
query={
"prefix": {
"user": "ki"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc 0000664 0000000 0000000 00000000243 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// health/health.asciidoc:486
[source, python]
----
resp = client.health_report(
verbose=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3544f17cb97b613a2f733707c676f759.asciidoc 0000664 0000000 0000000 00000001523 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filter-aggregation.asciidoc:122
[source, python]
----
resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
aggs={
"f": {
"filters": {
"filters": {
"hats": {
"term": {
"type": "hat"
}
},
"t_shirts": {
"term": {
"type": "t-shirt"
}
}
}
},
"aggs": {
"avg_price": {
"avg": {
"field": "price"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3545261682af72f4bee57f2bac0a9590.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shard-stores.asciidoc:156
[source, python]
----
resp = client.indices.shard_stores(
status="green",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35563ef92dddef9d83906d9c43c60d0f.asciidoc 0000664 0000000 0000000 00000000670 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-termvectors.asciidoc:10
[source, python]
----
resp = client.mtermvectors(
docs=[
{
"_index": "my-index-000001",
"_id": "2",
"term_statistics": True
},
{
"_index": "my-index-000001",
"_id": "1",
"fields": [
"message"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/355d0ee2fcb6c1fc403c6267f710e25a.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:722
[source, python]
----
resp = client.reindex(
source={
"index": [
"my-index-000001",
"my-index-000002"
]
},
dest={
"index": "my-new-index-000002"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35a272df8c919a12d7c3106a18245748.asciidoc 0000664 0000000 0000000 00000000542 15176617013 0026212 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/infer-trained-model.asciidoc:956
[source, python]
----
resp = client.ml.infer_trained_model(
model_id="lang_ident_model_1",
docs=[
{
"text": "The fool doth think he is wise, but the wise man knows himself to be a fool."
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35be136ba9df7474a5521631e2a385b1.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/apis/explain-lifecycle.asciidoc:56
[source, python]
----
resp = client.indices.explain_data_lifecycle(
index=".ds-metrics-2023.03.22-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35c33ef48cf8a4ee368874141622f9d5.asciidoc 0000664 0000000 0000000 00000000736 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:503
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"strings_as_text": {
"match_mapping_type": "string",
"mapping": {
"type": "text"
}
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35c664285f2e8b7d5d50ca37ae3ba794.asciidoc 0000664 0000000 0000000 00000000637 15176617013 0026527 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/collapse-search-results.asciidoc:160
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"message": "GET /search"
}
},
collapse={
"field": "user.id"
},
sort=[
"user.id"
],
search_after=[
"dd5ce1ad"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35eef1765e9a5991d77592a0c7490fe0.asciidoc 0000664 0000000 0000000 00000000510 15176617013 0026374 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/min-aggregation.asciidoc:99
[source, python]
----
resp = client.search(
index="sales",
aggs={
"grade_min": {
"min": {
"field": "grade",
"missing": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35f892b475a1770f18328158be7039fd.asciidoc 0000664 0000000 0000000 00000000605 15176617013 0026233 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:71
[source, python]
----
resp = client.indices.create(
index="my-index-2",
mappings={
"properties": {
"my_vector": {
"type": "dense_vector",
"dims": 3,
"similarity": "dot_product"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/35fc63cbefce7bc131ad467b5ba209ef.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0027062 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/disk/decrease-data-node-disk-usage.asciidoc:79
[source, python]
----
resp = client.cat.allocation(
v=True,
s="disk.avail",
h="node,disk.percent,disk.avail,disk.total,disk.used,disk.indices,shards",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3608e4fcd17dd8d5f88ec9a3db2f5d89.asciidoc 0000664 0000000 0000000 00000000436 15176617013 0026767 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/put-synonyms-set.asciidoc:89
[source, python]
----
resp = client.synonyms.put_synonym(
id="my-synonyms-set",
synonyms_set=[
{
"synonyms": "hello => hi => howdy"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/360b3cef34bbddc5d9579ca95f0cb061.asciidoc 0000664 0000000 0000000 00000000473 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:155
[source, python]
----
resp = client.indices.put_mapping(
index="my-data-stream",
write_index_only=True,
properties={
"message": {
"type": "text"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/360c4f373e72ba861584ee85bd218124.asciidoc 0000664 0000000 0000000 00000001344 15176617013 0026276 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:262
[source, python]
----
resp = client.indices.create(
index="test_index",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"porter_stem"
]
}
}
}
},
mappings={
"properties": {
"query": {
"type": "percolator"
},
"body": {
"type": "text",
"analyzer": "my_analyzer"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3613f402ee63f0efb6b8d9c6a919b410.asciidoc 0000664 0000000 0000000 00000000664 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:133
[source, python]
----
resp = client.esql.query(
format="txt",
query="\n FROM library\n | KEEP author, name, page_count, release_date\n | SORT page_count DESC\n | LIMIT 5\n ",
filter={
"range": {
"page_count": {
"gte": 100,
"lte": 200
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/362dfccdb6f7933b22c909542e0b4e0a.asciidoc 0000664 0000000 0000000 00000000635 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:221
[source, python]
----
resp = client.update_by_query(
index="my-data-stream",
query={
"match": {
"user.id": "l7gk7f82"
}
},
script={
"source": "ctx._source.user.id = params.new_id",
"params": {
"new_id": "XgdX0NoX"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3649194a97d265a3bc758f8b38f7561e.asciidoc 0000664 0000000 0000000 00000000716 15176617013 0026331 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-text-hybrid-search:21
[source, python]
----
resp = client.indices.create(
index="semantic-embeddings",
mappings={
"properties": {
"semantic_text": {
"type": "semantic_text"
},
"content": {
"type": "text",
"copy_to": "semantic_text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/365256ebdfa47b449780771d9beba8d9.asciidoc 0000664 0000000 0000000 00000000372 15176617013 0026540 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/check-in-connector-sync-job-api.asciidoc:56
[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/_sync_job/my-connector-sync-job/_check_in",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/36792c81c053e0555407d1e83e7e054f.asciidoc 0000664 0000000 0000000 00000005535 15176617013 0026227 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/36962727b806315b221e8a63e05caddc.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026345 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/explicit-mapping.asciidoc:49
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"employee-id": {
"type": "keyword",
"index": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/36ac0ef9ea63efc431580f7ade8ad53c.asciidoc 0000664 0000000 0000000 00000000564 15176617013 0027020 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:78
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "openai-embeddings",
"pipeline": "openai_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/36b26905c5f96d0b785c3267fb63838d.asciidoc 0000664 0000000 0000000 00000033346 15176617013 0026327 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:422
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"ip": {
"type": "ip"
},
"version": {
"type": "version"
},
"missing_keyword": {
"type": "keyword"
},
"@timestamp": {
"type": "date"
},
"type_test": {
"type": "keyword"
},
"@timestamp_pretty": {
"type": "date",
"format": "dd-MM-yyyy"
},
"event_type": {
"type": "keyword"
},
"event": {
"properties": {
"category": {
"type": "alias",
"path": "event_type"
}
}
},
"host": {
"type": "keyword"
},
"os": {
"type": "keyword"
},
"bool": {
"type": "boolean"
},
"uptime": {
"type": "long"
},
"port": {
"type": "long"
}
}
},
)
print(resp)
resp1 = client.indices.create(
index="my-index-000002",
mappings={
"properties": {
"ip": {
"type": "ip"
},
"@timestamp": {
"type": "date"
},
"@timestamp_pretty": {
"type": "date",
"format": "yyyy-MM-dd"
},
"type_test": {
"type": "keyword"
},
"event_type": {
"type": "keyword"
},
"event": {
"properties": {
"category": {
"type": "alias",
"path": "event_type"
}
}
},
"host": {
"type": "keyword"
},
"op_sys": {
"type": "keyword"
},
"bool": {
"type": "boolean"
},
"uptime": {
"type": "long"
},
"port": {
"type": "long"
}
}
},
)
print(resp1)
resp2 = client.indices.create(
index="my-index-000003",
mappings={
"properties": {
"host_ip": {
"type": "ip"
},
"@timestamp": {
"type": "date"
},
"date": {
"type": "date"
},
"event_type": {
"type": "keyword"
},
"event": {
"properties": {
"category": {
"type": "alias",
"path": "event_type"
}
}
},
"missing_keyword": {
"type": "keyword"
},
"host": {
"type": "keyword"
},
"os": {
"type": "keyword"
},
"bool": {
"type": "boolean"
},
"uptime": {
"type": "long"
},
"port": {
"type": "long"
}
}
},
)
print(resp2)
resp3 = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"@timestamp": "1234567891",
"@timestamp_pretty": "12-12-2022",
"missing_keyword": "test",
"type_test": "abc",
"ip": "10.0.0.1",
"event_type": "alert",
"host": "doom",
"uptime": 0,
"port": 1234,
"os": "win10",
"version": "1.0.0",
"id": 11
},
{
"index": {
"_id": 2
}
},
{
"@timestamp": "1234567892",
"@timestamp_pretty": "13-12-2022",
"event_type": "alert",
"type_test": "abc",
"host": "CS",
"uptime": 5,
"port": 1,
"os": "win10",
"version": "1.2.0",
"id": 12
},
{
"index": {
"_id": 3
}
},
{
"@timestamp": "1234567893",
"@timestamp_pretty": "12-12-2022",
"event_type": "alert",
"type_test": "abc",
"host": "farcry",
"uptime": 1,
"port": 1234,
"bool": False,
"os": "win10",
"version": "2.0.0",
"id": 13
},
{
"index": {
"_id": 4
}
},
{
"@timestamp": "1234567894",
"@timestamp_pretty": "13-12-2022",
"event_type": "alert",
"type_test": "abc",
"host": "GTA",
"uptime": 3,
"port": 12,
"os": "slack",
"version": "10.0.0",
"id": 14
},
{
"index": {
"_id": 5
}
},
{
"@timestamp": "1234567895",
"@timestamp_pretty": "17-12-2022",
"event_type": "alert",
"host": "sniper 3d",
"uptime": 6,
"port": 1234,
"os": "fedora",
"version": "20.1.0",
"id": 15
},
{
"index": {
"_id": 6
}
},
{
"@timestamp": "1234568896",
"@timestamp_pretty": "17-12-2022",
"event_type": "alert",
"host": "doom",
"port": 65123,
"bool": True,
"os": "redhat",
"version": "20.10.0",
"id": 16
},
{
"index": {
"_id": 7
}
},
{
"@timestamp": "1234567897",
"@timestamp_pretty": "17-12-2022",
"missing_keyword": "yyy",
"event_type": "failure",
"host": "doom",
"uptime": 15,
"port": 1234,
"bool": True,
"os": "redhat",
"version": "20.2.0",
"id": 17
},
{
"index": {
"_id": 8
}
},
{
"@timestamp": "1234567898",
"@timestamp_pretty": "12-12-2022",
"missing_keyword": "test",
"event_type": "success",
"host": "doom",
"uptime": 16,
"port": 512,
"os": "win10",
"version": "1.2.3",
"id": 18
},
{
"index": {
"_id": 9
}
},
{
"@timestamp": "1234567899",
"@timestamp_pretty": "15-12-2022",
"missing_keyword": "test",
"event_type": "success",
"host": "GTA",
"port": 12,
"bool": True,
"os": "win10",
"version": "1.2.3",
"id": 19
},
{
"index": {
"_id": 10
}
},
{
"@timestamp": "1234567893",
"missing_keyword": None,
"ip": "10.0.0.5",
"event_type": "alert",
"host": "farcry",
"uptime": 1,
"port": 1234,
"bool": True,
"os": "win10",
"version": "1.2.3",
"id": 110
}
],
)
print(resp3)
resp4 = client.bulk(
index="my-index-000002",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"@timestamp": "1234567991",
"type_test": "abc",
"ip": "10.0.0.1",
"event_type": "alert",
"host": "doom",
"uptime": 0,
"port": 1234,
"op_sys": "win10",
"id": 21
},
{
"index": {
"_id": 2
}
},
{
"@timestamp": "1234567992",
"type_test": "abc",
"event_type": "alert",
"host": "CS",
"uptime": 5,
"port": 1,
"op_sys": "win10",
"id": 22
},
{
"index": {
"_id": 3
}
},
{
"@timestamp": "1234567993",
"type_test": "abc",
"@timestamp_pretty": "2022-12-17",
"event_type": "alert",
"host": "farcry",
"uptime": 1,
"port": 1234,
"bool": False,
"op_sys": "win10",
"id": 23
},
{
"index": {
"_id": 4
}
},
{
"@timestamp": "1234567994",
"event_type": "alert",
"host": "GTA",
"uptime": 3,
"port": 12,
"op_sys": "slack",
"id": 24
},
{
"index": {
"_id": 5
}
},
{
"@timestamp": "1234567995",
"event_type": "alert",
"host": "sniper 3d",
"uptime": 6,
"port": 1234,
"op_sys": "fedora",
"id": 25
},
{
"index": {
"_id": 6
}
},
{
"@timestamp": "1234568996",
"@timestamp_pretty": "2022-12-17",
"ip": "10.0.0.5",
"event_type": "alert",
"host": "doom",
"port": 65123,
"bool": True,
"op_sys": "redhat",
"id": 26
},
{
"index": {
"_id": 7
}
},
{
"@timestamp": "1234567997",
"@timestamp_pretty": "2022-12-17",
"event_type": "failure",
"host": "doom",
"uptime": 15,
"port": 1234,
"bool": True,
"op_sys": "redhat",
"id": 27
},
{
"index": {
"_id": 8
}
},
{
"@timestamp": "1234567998",
"ip": "10.0.0.1",
"event_type": "success",
"host": "doom",
"uptime": 16,
"port": 512,
"op_sys": "win10",
"id": 28
},
{
"index": {
"_id": 9
}
},
{
"@timestamp": "1234567999",
"ip": "10.0.0.1",
"event_type": "success",
"host": "GTA",
"port": 12,
"bool": False,
"op_sys": "win10",
"id": 29
}
],
)
print(resp4)
resp5 = client.bulk(
index="my-index-000003",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"@timestamp": "1334567891",
"host_ip": "10.0.0.1",
"event_type": "alert",
"host": "doom",
"uptime": 0,
"port": 12,
"os": "win10",
"id": 31
},
{
"index": {
"_id": 2
}
},
{
"@timestamp": "1334567892",
"event_type": "alert",
"host": "CS",
"os": "win10",
"id": 32
},
{
"index": {
"_id": 3
}
},
{
"@timestamp": "1334567893",
"event_type": "alert",
"host": "farcry",
"bool": True,
"os": "win10",
"id": 33
},
{
"index": {
"_id": 4
}
},
{
"@timestamp": "1334567894",
"event_type": "alert",
"host": "GTA",
"os": "slack",
"bool": True,
"id": 34
},
{
"index": {
"_id": 5
}
},
{
"@timestamp": "1234567895",
"event_type": "alert",
"host": "sniper 3d",
"os": "fedora",
"id": 35
},
{
"index": {
"_id": 6
}
},
{
"@timestamp": "1234578896",
"host_ip": "10.0.0.1",
"event_type": "alert",
"host": "doom",
"bool": True,
"os": "redhat",
"id": 36
},
{
"index": {
"_id": 7
}
},
{
"@timestamp": "1234567897",
"event_type": "failure",
"missing_keyword": "test",
"host": "doom",
"bool": True,
"os": "redhat",
"id": 37
},
{
"index": {
"_id": 8
}
},
{
"@timestamp": "1234577898",
"event_type": "success",
"host": "doom",
"os": "win10",
"id": 38,
"date": "1671235200000"
},
{
"index": {
"_id": 9
}
},
{
"@timestamp": "1234577899",
"host_ip": "10.0.0.5",
"event_type": "success",
"host": "GTA",
"bool": True,
"os": "win10",
"id": 39
}
],
)
print(resp5)
----
python-elasticsearch-9.4.0/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc 0000664 0000000 0000000 00000000365 15176617013 0026761 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// quickstart/getting-started.asciidoc:484
[source, python]
----
resp = client.search(
index="books",
query={
"match": {
"name": "brave"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/36d229f734adcdab00be266a7ce038b1.asciidoc 0000664 0000000 0000000 00000000605 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:404
[source, python]
----
resp = client.indices.create(
index="my-bit-vectors",
mappings={
"properties": {
"my_vector": {
"type": "dense_vector",
"dims": 40,
"element_type": "bit"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/36da9668fef56910370f16bfb772cc40.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shard-request-cache.asciidoc:125
[source, python]
----
resp = client.indices.stats(
metric="request_cache",
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/36e09bbd5896498ede0f5d37a18eae2c.asciidoc 0000664 0000000 0000000 00000000601 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/parent-id-query.asciidoc:60
[source, python]
----
resp = client.index(
index="my-index-000001",
id="2",
routing="1",
refresh=True,
document={
"text": "This is a child document.",
"my-join-field": {
"name": "my-child",
"parent": "1"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/36fae9dfc0b815546b45745bac054b67.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:496
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"model_number": "HG537PU"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/370b297ed3433577adf53e64f572d89d.asciidoc 0000664 0000000 0000000 00000000364 15176617013 0026402 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/delete-connector-sync-job-api.asciidoc:52
[source, python]
----
resp = client.perform_request(
"DELETE",
"/_connector/_sync_job/my-connector-sync-job-id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/371962cf63e65c10026177c6a1bad0b6.asciidoc 0000664 0000000 0000000 00000000247 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/start-slm.asciidoc:63
[source, python]
----
resp = client.slm.start()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3722dad876023e0757138dd5a6d3240e.asciidoc 0000664 0000000 0000000 00000000664 15176617013 0026272 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/37530f35f315b9f35e3e6a13cf2a1ccd.asciidoc 0000664 0000000 0000000 00000001073 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:731
[source, python]
----
resp = client.search(
aggs={
"actors": {
"terms": {
"field": "actors",
"size": 10,
"collect_mode": "breadth_first"
},
"aggs": {
"costars": {
"terms": {
"field": "actors",
"size": 5
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3758b8f2ab9f6f28a764ee6c42c85766.asciidoc 0000664 0000000 0000000 00000001062 15176617013 0026467 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:550
[source, python]
----
resp = client.search(
index="my-index-000001",
scroll="1m",
slice={
"id": 0,
"max": 2
},
query={
"match": {
"message": "foo"
}
},
)
print(resp)
resp1 = client.search(
index="my-index-000001",
scroll="1m",
slice={
"id": 1,
"max": 2
},
query={
"match": {
"message": "foo"
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/3759ca688c4bd3c838780a9aad63258b.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-index-template.asciidoc:41
[source, python]
----
resp = client.indices.get_index_template(
name="template_1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/375bf2c51ce6cc386f9d4d635d5e84a7.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-grid-query.asciidoc:345
[source, python]
----
resp = client.search(
index="my_locations",
query={
"geo_grid": {
"location": {
"geohex": "811fbffffffffff"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/376fbc965e1b093f6dbc198a94c83aa9.asciidoc 0000664 0000000 0000000 00000002772 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/common-script-uses.asciidoc:260
[source, python]
----
resp = client.bulk(
index="my-index",
refresh=True,
operations=[
{
"index": {}
},
{
"gc": "[2021-04-27T16:16:34.699+0000][82460][gc,heap,exit] class space used 266K, capacity 384K, committed 384K, reserved 1048576K"
},
{
"index": {}
},
{
"gc": "[2021-03-24T20:27:24.184+0000][90239][gc,heap,exit] class space used 15255K, capacity 16726K, committed 16844K, reserved 1048576K"
},
{
"index": {}
},
{
"gc": "[2021-03-24T20:27:24.184+0000][90239][gc,heap,exit] Metaspace used 115409K, capacity 119541K, committed 120248K, reserved 1153024K"
},
{
"index": {}
},
{
"gc": "[2021-04-19T15:03:21.735+0000][84408][gc,heap,exit] class space used 14503K, capacity 15894K, committed 15948K, reserved 1048576K"
},
{
"index": {}
},
{
"gc": "[2021-04-19T15:03:21.735+0000][84408][gc,heap,exit] Metaspace used 107719K, capacity 111775K, committed 112724K, reserved 1146880K"
},
{
"index": {}
},
{
"gc": "[2021-04-27T16:16:34.699+0000][82460][gc,heap,exit] class space used 266K, capacity 367K, committed 384K, reserved 1048576K"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/376ff4b2b5f657481af78a778aaab57f.asciidoc 0000664 0000000 0000000 00000002452 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:154
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"nr": {
"type": "integer"
},
"state": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="my-index",
refresh=True,
operations=[
{
"index": {}
},
{
"nr": 1,
"state": "started"
},
{
"index": {}
},
{
"nr": 2,
"state": "stopped"
},
{
"index": {}
},
{
"nr": 3,
"state": "N/A"
},
{
"index": {}
},
{
"nr": 4
}
],
)
print(resp1)
resp2 = client.search(
index="my-index",
filter_path="aggregations",
aggs={
"my_top_metrics": {
"top_metrics": {
"metrics": {
"field": "state",
"missing": "N/A"
},
"sort": {
"nr": "desc"
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/377af0ea9b19c113f224d8150890b41b.asciidoc 0000664 0000000 0000000 00000004270 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significantterms-aggregation.asciidoc:412
[source, python]
----
resp = client.search(
query={
"bool": {
"filter": [
{
"term": {
"event.outcome": "failure"
}
},
{
"range": {
"@timestamp": {
"gte": "2021-02-01",
"lt": "2021-02-04"
}
}
},
{
"term": {
"service.name": {
"value": "frontend-node"
}
}
}
]
}
},
aggs={
"failure_p_value": {
"significant_terms": {
"field": "user_agent.version",
"background_filter": {
"bool": {
"must_not": [
{
"term": {
"event.outcome": "failure"
}
}
],
"filter": [
{
"range": {
"@timestamp": {
"gte": "2021-02-01",
"lt": "2021-02-04"
}
}
},
{
"term": {
"service.name": {
"value": "frontend-node"
}
}
}
]
}
},
"p_value": {
"background_is_superset": False,
"normalize_above": 1000
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/378e55f78fa13578a1302bae8d479765.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026324 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-query.asciidoc:134
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"color": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/37983daac3d9c8582583a507b3adb7f2.asciidoc 0000664 0000000 0000000 00000000431 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shutdown/apis/shutdown-delete.asciidoc:57
[source, python]
----
resp = client.shutdown.put_node(
node_id="USpTGYaBSIKbgSUJR2Z9lg",
type="restart",
reason="Demonstrating how the node shutdown API works",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/37ae7c3e4d6d954487ec4185fe7d9ec8.asciidoc 0000664 0000000 0000000 00000001005 15176617013 0026627 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significantterms-aggregation.asciidoc:130
[source, python]
----
resp = client.search(
aggregations={
"forces": {
"terms": {
"field": "force"
},
"aggregations": {
"significant_crime_types": {
"significant_terms": {
"field": "crime_type"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/37b84f2ab7c2f6b4fe0e14cc7e018b1f.asciidoc 0000664 0000000 0000000 00000002132 15176617013 0026721 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/bi-directional-disaster-recovery.asciidoc:41
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"clusterB": {
"mode": "proxy",
"skip_unavailable": True,
"server_name": "clusterb.es.region-b.gcp.elastic-cloud.com",
"proxy_socket_connections": 18,
"proxy_address": "clusterb.es.region-b.gcp.elastic-cloud.com:9400"
}
}
}
},
)
print(resp)
resp1 = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"clusterA": {
"mode": "proxy",
"skip_unavailable": True,
"server_name": "clustera.es.region-a.gcp.elastic-cloud.com",
"proxy_socket_connections": 18,
"proxy_address": "clustera.es.region-a.gcp.elastic-cloud.com:9400"
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/37c73410bf13429279cbc61a413957d8.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026206 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:558
[source, python]
----
resp = client.cluster.stats(
filter_path="indices.shards.total",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/37eaab0630976d3dee90a52011342883.asciidoc 0000664 0000000 0000000 00000000734 15176617013 0026263 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stop-tokenfilter.asciidoc:106
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "whitespace",
"filter": [
"stop"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/37f1f2e75ed95308ae436bbbb8d5645e.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/start-trial.asciidoc:44
[source, python]
----
resp = client.license.post_start_trial(
acknowledge=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3819d0a5c2eed635c88e9e7bf2e81584.asciidoc 0000664 0000000 0000000 00000000430 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/revert-snapshot.asciidoc:84
[source, python]
----
resp = client.ml.revert_model_snapshot(
job_id="low_request_rate",
snapshot_id="1637092688",
delete_intervening_results=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/386eb7dcd3149db82605bf22c5d851bf.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-api-key.asciidoc:373
[source, python]
----
resp = client.security.create_api_key(
name="application-key-1",
metadata={
"application": "my-application"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/388d3eda4f792d3fce044777739217e6.asciidoc 0000664 0000000 0000000 00000000730 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:442
[source, python]
----
resp = client.ml.evaluate_data_frame(
index="animal_classification",
evaluation={
"classification": {
"actual_field": "animal_class",
"predicted_field": "ml.animal_class_prediction",
"metrics": {
"multiclass_confusion_matrix": {}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/388ec2b038d3ad69378f4c2e5bc36dce.asciidoc 0000664 0000000 0000000 00000001562 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-field-masking-query.asciidoc:16
[source, python]
----
resp = client.search(
query={
"span_near": {
"clauses": [
{
"span_term": {
"text": "quick brown"
}
},
{
"span_field_masking": {
"query": {
"span_term": {
"text.stems": "fox"
}
},
"field": "text"
}
}
],
"slop": 5,
"in_order": False
}
},
highlight={
"require_field_match": False,
"fields": {
"*": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/38af4a55c1ea0f908dc7b06d680d2789.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:507
[source, python]
----
resp = client.indices.create_data_stream(
name="new-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/38b20fe981605e80a41517e9aa13134a.asciidoc 0000664 0000000 0000000 00000001550 15176617013 0026256 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/bucket-selector-aggregation.asciidoc:51
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"total_sales": {
"sum": {
"field": "price"
}
},
"sales_bucket_filter": {
"bucket_selector": {
"buckets_path": {
"totalSales": "total_sales"
},
"script": "params.totalSales > 200"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/38eed000de433b540116928681c520d3.asciidoc 0000664 0000000 0000000 00000000344 15176617013 0026174 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/preview-datafeed.asciidoc:116
[source, python]
----
resp = client.ml.preview_datafeed(
datafeed_id="datafeed-high_sum_total_sales",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/38f7739f750f1411bccf511a0abaaea3.asciidoc 0000664 0000000 0000000 00000000245 15176617013 0026630 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/field-caps.asciidoc:18
[source, python]
----
resp = client.field_caps(
fields="rating",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/38ffa96674b5fd4042589af0ebb0437b.asciidoc 0000664 0000000 0000000 00000000554 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/configuring-ldap-realm.asciidoc:152
[source, python]
----
resp = client.security.put_role_mapping(
name="basic_users",
roles=[
"user"
],
rules={
"field": {
"groups": "cn=users,dc=example,dc=com"
}
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3924ee252581ebb96ac0e60046125ae8.asciidoc 0000664 0000000 0000000 00000000272 15176617013 0026344 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-users.asciidoc:68
[source, python]
----
resp = client.security.get_user(
username="jacknich",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3951d7fcd7f849fa278daf342872125a.asciidoc 0000664 0000000 0000000 00000000313 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:378
[source, python]
----
resp = client.indices.analyze(
index="analyze_sample",
text="this is a test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/39760996f94ad34aaceaa16a5cc97993.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shutdown/apis/shutdown-get.asciidoc:67
[source, python]
----
resp = client.shutdown.get_node(
node_id="USpTGYaBSIKbgSUJR2Z9lg",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/397ab5f9ea0b69ae85038bb0b9915180.asciidoc 0000664 0000000 0000000 00000000324 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-dsl.asciidoc:523
[source, python]
----
resp = client.indices.data_streams_stats(
name="datastream",
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/397bdb40d0146102f1f4c6a35675e16a.asciidoc 0000664 0000000 0000000 00000002140 15176617013 0026331 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/recipes/stemming.asciidoc:11
[source, python]
----
resp = client.indices.create(
index="index",
settings={
"analysis": {
"analyzer": {
"english_exact": {
"tokenizer": "standard",
"filter": [
"lowercase"
]
}
}
}
},
mappings={
"properties": {
"body": {
"type": "text",
"analyzer": "english",
"fields": {
"exact": {
"type": "text",
"analyzer": "english_exact"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="index",
id="1",
document={
"body": "Ski resort"
},
)
print(resp1)
resp2 = client.index(
index="index",
id="2",
document={
"body": "A pair of skis"
},
)
print(resp2)
resp3 = client.indices.refresh(
index="index",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/398389933901b572a06a752bc780af7c.asciidoc 0000664 0000000 0000000 00000000727 15176617013 0026233 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-anthropic.asciidoc:137
[source, python]
----
resp = client.inference.put(
task_type="completion",
inference_id="anthropic_completion",
inference_config={
"service": "anthropic",
"service_settings": {
"api_key": "",
"model_id": ""
},
"task_settings": {
"max_tokens": 1024
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/39963032d423e2f20f53c4621b6ca3c6.asciidoc 0000664 0000000 0000000 00000000324 15176617013 0026255 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/ngram-tokenizer.asciidoc:24
[source, python]
----
resp = client.indices.analyze(
tokenizer="ngram",
text="Quick Fox",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/39ce44333d28ed2b833722d3e3cb06f3.asciidoc 0000664 0000000 0000000 00000001751 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/bool-query.asciidoc:187
[source, python]
----
resp = client.search(
include_named_queries_score=True,
query={
"bool": {
"should": [
{
"match": {
"name.first": {
"query": "shay",
"_name": "first"
}
}
},
{
"match": {
"name.last": {
"query": "banon",
"_name": "last"
}
}
}
],
"filter": {
"terms": {
"name.last": [
"banon",
"kimchy"
],
"_name": "test"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/39d6f575c9458d9c941364dfd0493fa0.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026402 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-calendar-event.asciidoc:118
[source, python]
----
resp = client.ml.get_calendar_events(
calendar_id="planned-outages",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a12feb0de224bfaaf518d95b9f516ff.asciidoc 0000664 0000000 0000000 00000002761 15176617013 0027015 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/put-watch.asciidoc:126
[source, python]
----
resp = client.watcher.put_watch(
id="my-watch",
trigger={
"schedule": {
"cron": "0 0/1 * * * ?"
}
},
input={
"search": {
"request": {
"indices": [
"logstash*"
],
"body": {
"query": {
"bool": {
"must": {
"match": {
"response": 404
}
},
"filter": {
"range": {
"@timestamp": {
"from": "{{ctx.trigger.scheduled_time}}||-5m",
"to": "{{ctx.trigger.triggered_time}}"
}
}
}
}
}
}
}
}
},
condition={
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
actions={
"email_admin": {
"email": {
"to": "admin@domain.host.com",
"subject": "404 recently encountered"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a204b57072a104d9b50f3a9e064a8f6.asciidoc 0000664 0000000 0000000 00000000534 15176617013 0026335 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/3a2953fd81d65118a776c87a81530e15.asciidoc 0000664 0000000 0000000 00000000665 15176617013 0026227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:605
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"order": "score",
"fields": {
"comment": {
"fragment_size": 150,
"number_of_fragments": 3
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a2f37f8f32b1aa6bcfb252b9e00f904.asciidoc 0000664 0000000 0000000 00000000377 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules.asciidoc:97
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index": {
"mode": "standard"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a3adae6dbb2c0316a7d98d0a6c1d4f8.asciidoc 0000664 0000000 0000000 00000002000 15176617013 0026762 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:342
[source, python]
----
resp = client.search(
index="quantized-image-index",
knn={
"field": "image-vector",
"query_vector": [
0.1,
-2
],
"k": 15,
"num_candidates": 100
},
fields=[
"title"
],
rescore={
"window_size": 10,
"query": {
"rescore_query": {
"script_score": {
"query": {
"match_all": {}
},
"script": {
"source": "cosineSimilarity(params.query_vector, 'image-vector') + 1.0",
"params": {
"query_vector": [
0.1,
-2
]
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a3e6e2627cafa08e4402a0de95785cc.asciidoc 0000664 0000000 0000000 00000001203 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/collapse-search-results.asciidoc:207
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"message": "you know for search"
}
},
collapse={
"field": "user.id"
},
rescore={
"window_size": 50,
"query": {
"rescore_query": {
"match_phrase": {
"message": "you know for search"
}
},
"query_weight": 0.3,
"rescore_query_weight": 1.4
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a489743e49902df38e3368cae00717a.asciidoc 0000664 0000000 0000000 00000000261 15176617013 0026303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/high-cpu-usage.asciidoc:47
[source, python]
----
resp = client.nodes.hot_threads()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a4953663a5a3809b692c27446e16b7f.asciidoc 0000664 0000000 0000000 00000000605 15176617013 0026225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:206
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "amazon-bedrock-embeddings",
"pipeline": "amazon_bedrock_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a5f2e2313614ea9693545edee22ac43.asciidoc 0000664 0000000 0000000 00000000401 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/delete-service-token.asciidoc:53
[source, python]
----
resp = client.security.delete_service_token(
namespace="elastic",
service="fleet-server",
name="token42",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a6238835c7d9f51e6d91f92885fadeb.asciidoc 0000664 0000000 0000000 00000001037 15176617013 0026545 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:13
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"post_date": {
"type": "date"
},
"user": {
"type": "keyword"
},
"name": {
"type": "keyword"
},
"age": {
"type": "integer"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3a64ae799cc03fadbb802794730c23da.asciidoc 0000664 0000000 0000000 00000001061 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-shape-query.asciidoc:86
[source, python]
----
resp = client.indices.create(
index="example_points",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.index(
index="example_points",
id="1",
refresh=True,
document={
"name": "Wind & Wetter, Berlin, Germany",
"location": [
13.400544,
52.530286
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/3aa0e2d25a51bf5f3f0bda7fd8403bf2.asciidoc 0000664 0000000 0000000 00000001245 15176617013 0026766 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stop-tokenfilter.asciidoc:183
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"default": {
"tokenizer": "whitespace",
"filter": [
"my_custom_stop_words_filter"
]
}
},
"filter": {
"my_custom_stop_words_filter": {
"type": "stop",
"ignore_case": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ab8f65fcb55a0e3664c55749ec41efd.asciidoc 0000664 0000000 0000000 00000002273 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1407
[source, python]
----
resp = client.indices.create(
index="persian_example",
settings={
"analysis": {
"char_filter": {
"zero_width_spaces": {
"type": "mapping",
"mappings": [
"\\u200C=>\\u0020"
]
}
},
"filter": {
"persian_stop": {
"type": "stop",
"stopwords": "_persian_"
}
},
"analyzer": {
"rebuilt_persian": {
"tokenizer": "standard",
"char_filter": [
"zero_width_spaces"
],
"filter": [
"lowercase",
"decimal_digit",
"arabic_normalization",
"persian_normalization",
"persian_stop",
"persian_stem"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3abedc1d68fe1d20621157406b2b1de0.asciidoc 0000664 0000000 0000000 00000001621 15176617013 0026540 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/word-delimiter-tokenfilter.asciidoc:359
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"filter": [
"my_custom_word_delimiter_filter"
]
}
},
"filter": {
"my_custom_word_delimiter_filter": {
"type": "word_delimiter",
"type_table": [
"- => ALPHA"
],
"split_on_case_change": False,
"split_on_numerics": False,
"stem_english_possessive": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ac075c5b5bbe648d40d06cce3061367.asciidoc 0000664 0000000 0000000 00000000732 15176617013 0026477 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:577
[source, python]
----
resp = client.render_search_template(
source="{ \"query\": { \"bool\": { \"filter\": [ {{#year_scope}} { \"range\": { \"@timestamp\": { \"gte\": \"now-1y/d\", \"lt\": \"now/d\" } } }, {{/year_scope}} { \"term\": { \"user.id\": \"{{user_id}}\" }}]}}}",
params={
"year_scope": False,
"user_id": "kimchy"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ac8b5234e9d53859245cf8ab0094ca5.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-job.asciidoc:74
[source, python]
----
resp = client.ml.delete_job(
job_id="total-requests",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3af10fde8138d9d95df127d39d9a0ed2.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/troubleshooting-shards-capacity.asciidoc:223
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.max_shards_per_node": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3afc6dacf90b42900ab571aad8a61d75.asciidoc 0000664 0000000 0000000 00000002211 15176617013 0026706 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1599
[source, python]
----
resp = client.indices.create(
index="serbian_example",
settings={
"analysis": {
"filter": {
"serbian_stop": {
"type": "stop",
"stopwords": "_serbian_"
},
"serbian_keywords": {
"type": "keyword_marker",
"keywords": [
"пример"
]
},
"serbian_stemmer": {
"type": "stemmer",
"language": "serbian"
}
},
"analyzer": {
"rebuilt_serbian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"serbian_stop",
"serbian_keywords",
"serbian_stemmer",
"serbian_normalization"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b0475515ee692a2d9850c2bd7cdb895.asciidoc 0000664 0000000 0000000 00000001425 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:648
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"unindexed_longs": {
"match_mapping_type": "long",
"mapping": {
"type": "long",
"index": False
}
}
},
{
"unindexed_doubles": {
"match_mapping_type": "double",
"mapping": {
"type": "float",
"index": False
}
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b04cc894e6a47d57983484010feac0c.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:869
[source, python]
----
resp = client.get(
index="metricbeat-2016.05.30-1",
id="1",
)
print(resp)
resp1 = client.get(
index="metricbeat-2016.05.31-1",
id="1",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/3b05128cba6852e79a905bcdd5a8ebc0.asciidoc 0000664 0000000 0000000 00000000336 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:374
[source, python]
----
resp = client.search(
index="my-index-000001",
size="surprise_me",
error_trace=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b162509ed14eda44a9681cd1108fa39.asciidoc 0000664 0000000 0000000 00000001331 15176617013 0026420 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/phrase-suggest.asciidoc:80
[source, python]
----
resp = client.search(
index="test",
suggest={
"text": "noble prize",
"simple_phrase": {
"phrase": {
"field": "title.trigram",
"size": 1,
"gram_size": 3,
"direct_generator": [
{
"field": "title.trigram",
"suggest_mode": "always"
}
],
"highlight": {
"pre_tag": "",
"post_tag": " "
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b18e9de638ff0b1c7a1f1f6bf1c24f3.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026723 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-app-privileges.asciidoc:94
[source, python]
----
resp = client.security.get_privileges(
application="myapp",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b1ff884f3bab390ae357e622c0544a9.asciidoc 0000664 0000000 0000000 00000003103 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rrf.asciidoc:186
[source, python]
----
resp = client.indices.create(
index="example-index",
mappings={
"properties": {
"text": {
"type": "text"
},
"vector": {
"type": "dense_vector",
"dims": 1,
"index": True,
"similarity": "l2_norm",
"index_options": {
"type": "hnsw"
}
},
"integer": {
"type": "integer"
}
}
},
)
print(resp)
resp1 = client.index(
index="example-index",
id="1",
document={
"text": "rrf",
"vector": [
5
],
"integer": 1
},
)
print(resp1)
resp2 = client.index(
index="example-index",
id="2",
document={
"text": "rrf rrf",
"vector": [
4
],
"integer": 2
},
)
print(resp2)
resp3 = client.index(
index="example-index",
id="3",
document={
"text": "rrf rrf rrf",
"vector": [
3
],
"integer": 1
},
)
print(resp3)
resp4 = client.index(
index="example-index",
id="4",
document={
"text": "rrf rrf rrf rrf",
"integer": 2
},
)
print(resp4)
resp5 = client.index(
index="example-index",
id="5",
document={
"vector": [
0
],
"integer": 1
},
)
print(resp5)
resp6 = client.indices.refresh(
index="example-index",
)
print(resp6)
----
python-elasticsearch-9.4.0/docs/examples/3b40db1c5c6b36f087d7a09a4ce285c6.asciidoc 0000664 0000000 0000000 00000000250 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-index-template.asciidoc:93
[source, python]
----
resp = client.indices.get_index_template()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b606631284877f9bca15051630995ad.asciidoc 0000664 0000000 0000000 00000001010 15176617013 0026126 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:441
[source, python]
----
resp = client.search(
index="my_test_scores",
query={
"term": {
"grad_year": "2099"
}
},
sort=[
{
"_script": {
"type": "number",
"script": {
"source": "doc['math_score'].value + doc['verbal_score'].value"
},
"order": "desc"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b64821fe9db73eb03860c60d775d7ff.asciidoc 0000664 0000000 0000000 00000001115 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-cross-cluster-api-key.asciidoc:197
[source, python]
----
resp = client.perform_request(
"PUT",
"/_security/cross_cluster/api_key/VuaCfGcBCdbkQm-e5aOx",
headers={"Content-Type": "application/json"},
body={
"access": {
"replication": [
{
"names": [
"archive"
]
}
]
},
"metadata": {
"application": "replication"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b8ab7027e0d616fb432acd8813e086c.asciidoc 0000664 0000000 0000000 00000000540 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/index_.asciidoc:544
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"@timestamp": "2099-11-15T13:12:00",
"message": "GET /search HTTP/1.1 200 1070000",
"user": {
"id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3b9c54604535d97e8368d47148aecc6f.asciidoc 0000664 0000000 0000000 00000000441 15176617013 0026377 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/update-snapshot.asciidoc:55
[source, python]
----
resp = client.ml.update_model_snapshot(
job_id="it_ops_new_logs",
snapshot_id="1491852978",
description="Snapshot 1",
retain=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ba2896bcc724c27be8f0decf6f81813.asciidoc 0000664 0000000 0000000 00000000674 15176617013 0026670 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// monitoring/indices.asciidoc:126
[source, python]
----
resp = client.indices.put_template(
name="custom_monitoring",
index_patterns=[
".monitoring-beats-7-*",
".monitoring-es-7-*",
".monitoring-kibana-7-*",
".monitoring-logstash-7-*"
],
order=1,
settings={
"number_of_shards": 5,
"number_of_replicas": 2
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3bb491db29deba25e1cc82bcaa1aa1a1.asciidoc 0000664 0000000 0000000 00000000520 15176617013 0027102 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:781
[source, python]
----
resp = client.reindex(
source={
"index": "my-index-000001"
},
dest={
"index": "my-new-index-000001"
},
script={
"source": "ctx._source.tag = ctx._source.remove(\"flag\")"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3bb5951a9e1186af5d154f56ffc13502.asciidoc 0000664 0000000 0000000 00000001506 15176617013 0026432 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/ignore-above.asciidoc:10
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"message": {
"type": "keyword",
"ignore_above": 20
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"message": "Syntax error"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"message": "Syntax error with some long stacktrace"
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
aggs={
"messages": {
"terms": {
"field": "message"
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/3bc4a3681e3ea9cb3de49f72085807d8.asciidoc 0000664 0000000 0000000 00000004265 15176617013 0026533 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/3bc872dbcdad8ff02cbaea39e7f38352.asciidoc 0000664 0000000 0000000 00000000505 15176617013 0027071 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:204
[source, python]
----
resp = client.indices.create(
index="index_double",
mappings={
"properties": {
"field": {
"type": "date"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3bfa2362add163802fc2210cc2f37ba2.asciidoc 0000664 0000000 0000000 00000000461 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/clone-snapshot-api.asciidoc:16
[source, python]
----
resp = client.snapshot.clone(
repository="my_repository",
snapshot="source_snapshot",
target_snapshot="target_snapshot",
indices="index_a,index_b",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3c04f75bcbb07125d51b21b9b2c9f6f0.asciidoc 0000664 0000000 0000000 00000002005 15176617013 0026546 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/index-field.asciidoc:11
[source, python]
----
resp = client.index(
index="index_1",
id="1",
document={
"text": "Document in index 1"
},
)
print(resp)
resp1 = client.index(
index="index_2",
id="2",
refresh=True,
document={
"text": "Document in index 2"
},
)
print(resp1)
resp2 = client.search(
index="index_1,index_2",
query={
"terms": {
"_index": [
"index_1",
"index_2"
]
}
},
aggs={
"indices": {
"terms": {
"field": "_index",
"size": 10
}
}
},
sort=[
{
"_index": {
"order": "asc"
}
}
],
script_fields={
"index_name": {
"script": {
"lang": "painless",
"source": "doc['_index']"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/3c09ca91057216125ed0e3856a91ff95.asciidoc 0000664 0000000 0000000 00000015631 15176617013 0026302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-ilm.asciidoc:91
[source, python]
----
resp = client.indices.put_index_template(
name="datastream_template",
index_patterns=[
"datastream*"
],
data_stream={},
template={
"settings": {
"index": {
"mode": "time_series",
"number_of_replicas": 0,
"number_of_shards": 2
},
"index.lifecycle.name": "datastream_policy"
},
"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)
----
python-elasticsearch-9.4.0/docs/examples/3c0d0c38e1c819a35a68cdba5ae8ccc4.asciidoc 0000664 0000000 0000000 00000001007 15176617013 0026774 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:262
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="alibabacloud_ai_search_embeddings",
inference_config={
"service": "alibabacloud-ai-search",
"service_settings": {
"api_key": "",
"service_id": "",
"host": "",
"workspace": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3c345feb7c52fd54bcb5d5505fd8bc3b.asciidoc 0000664 0000000 0000000 00000000652 15176617013 0027012 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/infer-trained-model.asciidoc:1115
[source, python]
----
resp = client.ml.infer_trained_model(
model_id="model2",
docs=[
{
"text_field": ""
}
],
inference_config={
"question_answering": {
"question": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3c36dc17359c6b6b6a40d04da9293fa7.asciidoc 0000664 0000000 0000000 00000001436 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:393
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_movavg": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.unweightedAvg(values)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3c5d5a5c34a62724942329658c688f5e.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0026240 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:480
[source, python]
----
resp = client.ml.set_upgrade_mode(
enabled=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3c65cb58e131ef46f4dd081683b970ac.asciidoc 0000664 0000000 0000000 00000001070 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-distance-query.asciidoc:125
[source, python]
----
resp = client.search(
index="my_locations,my_geoshapes",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "200km",
"pin.location": {
"lat": 40,
"lon": -70
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3c6abb9885cb1a997fcdd16f7fa4f673.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0026753 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shrink-index.asciidoc:17
[source, python]
----
resp = client.indices.shrink(
index="my-index-000001",
target="shrunk-my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3c7621a81fa982b79f040a6d2611530e.asciidoc 0000664 0000000 0000000 00000001614 15176617013 0026263 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/simulate-template.asciidoc:157
[source, python]
----
resp = client.cluster.put_component_template(
name="ct1",
template={
"settings": {
"index.number_of_shards": 2
}
},
)
print(resp)
resp1 = client.cluster.put_component_template(
name="ct2",
template={
"settings": {
"index.number_of_replicas": 0
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
},
)
print(resp1)
resp2 = client.indices.put_index_template(
name="final-template",
index_patterns=[
"my-index-*"
],
composed_of=[
"ct1",
"ct2"
],
priority=5,
)
print(resp2)
resp3 = client.indices.simulate_template(
name="final-template",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/3cd2f7f9096a8e8180f27b6c30e71840.asciidoc 0000664 0000000 0000000 00000001165 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filters-aggregation.asciidoc:76
[source, python]
----
resp = client.search(
index="logs",
size=0,
aggs={
"messages": {
"filters": {
"filters": [
{
"match": {
"body": "error"
}
},
{
"match": {
"body": "warning"
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3cd93a48906069709b76420c66930c01.asciidoc 0000664 0000000 0000000 00000001267 15176617013 0026064 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stemmer-tokenfilter.asciidoc:264
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"my_stemmer"
]
}
},
"filter": {
"my_stemmer": {
"type": "stemmer",
"language": "light_german"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3d05fa99ba8e1f2c3f3dfe59e4ee60f6.asciidoc 0000664 0000000 0000000 00000000476 15176617013 0027037 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:24
[source, python]
----
resp = client.search(
query={
"match": {
"content": "kimchy"
}
},
highlight={
"fields": {
"content": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3d1a0e1dc5310544d032108ae0b3f099.asciidoc 0000664 0000000 0000000 00000000341 15176617013 0026310 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-all-query.asciidoc:23
[source, python]
----
resp = client.search(
query={
"match_all": {
"boost": 1.2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3d1ff6097e2359f927c88c2ccdb36252.asciidoc 0000664 0000000 0000000 00000000205 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/root.asciidoc:17
[source, python]
----
resp = client.info()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3d316bddd8503a6cc10566630a4155d3.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026326 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/get-settings.asciidoc:22
[source, python]
----
resp = client.perform_request(
"GET",
"/_watcher/settings",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3d48d1ba49f680aac32177d653944623.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026267 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/actions.asciidoc:186
[source, python]
----
resp = client.watcher.ack_watch(
watch_id="",
action_id="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3d6935e04de21ab2f103e5b61cfd7a5b.asciidoc 0000664 0000000 0000000 00000000675 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:647
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"rename": {
"description": "Rename 'provider' to 'cloud.provider'",
"field": "provider",
"target_field": "cloud.provider",
"ignore_failure": True
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3d6a56dd3d93ece0e3da3fb66b4696d3.asciidoc 0000664 0000000 0000000 00000000222 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-usage.asciidoc:71
[source, python]
----
resp = client.nodes.usage()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3d82257167e8a14a7f474848b32da128.asciidoc 0000664 0000000 0000000 00000001157 15176617013 0026225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/set.asciidoc:157
[source, python]
----
resp = client.ingest.put_pipeline(
id="set_bar",
description="sets the value of bar from the field foo",
processors=[
{
"set": {
"field": "bar",
"copy_from": "foo"
}
}
],
)
print(resp)
resp1 = client.ingest.simulate(
id="set_bar",
docs=[
{
"_source": {
"foo": [
"foo1",
"foo2"
]
}
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/3da35090e093c2d83c3b7d0d83bcb4ae.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026640 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// path-settings-overview.asciidoc:51
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.exclude._name": "target-node-name"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3db2b5a6424aa92ecab7a8640c38685a.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete.asciidoc:186
[source, python]
----
resp = client.delete(
index="my-index-000001",
id="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3dd45f65e7bfe207e8d796118f25613c.asciidoc 0000664 0000000 0000000 00000000337 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/increase-cluster-shard-limit.asciidoc:147
[source, python]
----
resp = client.cluster.get_settings(
flat_settings=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3e121b43773cbb6dffa9b483c86a1f8d.asciidoc 0000664 0000000 0000000 00000001454 15176617013 0026660 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-update-api-keys.asciidoc:87
[source, python]
----
resp = client.security.create_api_key(
name="my-api-key",
role_descriptors={
"role-a": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"index-a*"
],
"privileges": [
"read"
]
}
]
}
},
metadata={
"application": "my-application",
"environment": {
"level": 1,
"trusted": True,
"tags": [
"dev",
"staging"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3e13c8a81f40a537eddc0b57633b45f8.asciidoc 0000664 0000000 0000000 00000000356 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:295
[source, python]
----
resp = client.indices.analyze(
index="test_index",
analyzer="my_analyzer",
text="missing bicycles",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3e1cb34fd6e510c79c2fff2126ac1c61.asciidoc 0000664 0000000 0000000 00000000561 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/meta-field.asciidoc:9
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"_meta": {
"class": "MyApp::User",
"version": {
"min": "1.0",
"max": "1.3"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3e278e6c193b4c17dbdc70670e15d78c.asciidoc 0000664 0000000 0000000 00000000701 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:654
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"fields": {
"comment": {
"fragment_size": 150,
"number_of_fragments": 3,
"no_match_size": 150
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3e33c1a4298ea6a0dec65a3ebf9ba973.asciidoc 0000664 0000000 0000000 00000000400 15176617013 0026721 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:339
[source, python]
----
resp = client.termvectors(
index="my-index-000001",
doc={
"fullname": "John Doe",
"text": "test test test"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3e4227250d49e81df48773f8ba803ea7.asciidoc 0000664 0000000 0000000 00000000440 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:134
[source, python]
----
resp = client.indices.put_mapping(
index="my-data-stream",
properties={
"message": {
"type": "text"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3e6db3d80439c2c176dbd1bb1296b6cf.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:1010
[source, python]
----
resp = client.render_search_template(
id="my-search-template",
params={
"query_string": "hello world"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3e8ed6ae016eb823cb00d9035b8ac459.asciidoc 0000664 0000000 0000000 00000000245 15176617013 0026564 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search.asciidoc:16
[source, python]
----
resp = client.search(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ea33023474e77d73ac0540e3a02b0b2.asciidoc 0000664 0000000 0000000 00000001104 15176617013 0026307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/mapping-roles.asciidoc:148
[source, python]
----
resp = client.security.put_role_mapping(
name="basic_users",
roles=[
"user"
],
rules={
"any": [
{
"field": {
"dn": "cn=John Doe,cn=contractors,dc=example,dc=com"
}
},
{
"field": {
"groups": "cn=users,dc=example,dc=com"
}
}
]
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ea4c971b3f47735dcc207ee2645fa03.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026510 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/3eb4cdd4a799a117ac1ff5f02b18a512.asciidoc 0000664 0000000 0000000 00000001427 15176617013 0026640 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:70
[source, python]
----
resp = client.indices.create(
index="index",
mappings={
"properties": {
"query": {
"type": "percolator"
},
"body": {
"type": "text"
}
}
},
)
print(resp)
resp1 = client.indices.update_aliases(
actions=[
{
"add": {
"index": "index",
"alias": "queries"
}
}
],
)
print(resp1)
resp2 = client.index(
index="queries",
id="1",
refresh=True,
document={
"query": {
"match": {
"body": "quick brown fox"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/3ec95ba697ff97ee2d1a721a393b5926.asciidoc 0000664 0000000 0000000 00000003205 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/analyzer.asciidoc:38
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase"
]
},
"my_stop_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"english_stop"
]
}
},
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
}
}
}
},
mappings={
"properties": {
"title": {
"type": "text",
"analyzer": "my_analyzer",
"search_analyzer": "my_stop_analyzer",
"search_quote_analyzer": "my_analyzer"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"title": "The Quick Brown Fox"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"title": "A Quick Brown Fox"
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
query={
"query_string": {
"query": "\"the quick brown fox\""
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/3eca58ef7592b3a857ea3a9898de5997.asciidoc 0000664 0000000 0000000 00000001367 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geohashgrid-aggregation.asciidoc:99
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggregations={
"zoomed-in": {
"filter": {
"geo_bounding_box": {
"location": {
"top_left": "POINT (4.9 52.4)",
"bottom_right": "POINT (5.0 52.3)"
}
}
},
"aggregations": {
"zoom1": {
"geohash_grid": {
"field": "location",
"precision": 8
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ed39eb60fbfafb70f7825b8d103bf17.asciidoc 0000664 0000000 0000000 00000001052 15176617013 0026730 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-distance-query.asciidoc:75
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "200km",
"pin.location": {
"lat": 40,
"lon": -70
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ed79871d956bfb2d6d2721d7272520c.asciidoc 0000664 0000000 0000000 00000000267 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/stats.asciidoc:118
[source, python]
----
resp = client.watcher.stats(
metric="current_watches",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ee232bcb2281a12b33cd9764ee4081a.asciidoc 0000664 0000000 0000000 00000001410 15176617013 0026462 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/geo-grid.asciidoc:174
[source, python]
----
resp = client.ingest.put_pipeline(
id="geohex2shape",
description="translate H3 cell to polygon with enriched fields",
processors=[
{
"geo_grid": {
"description": "Ingest H3 cells like '811fbffffffffff' and create polygons",
"field": "geocell",
"tile_type": "geohex",
"target_format": "wkt",
"target_field": "shape",
"parent_field": "parent",
"children_field": "children",
"non_children_field": "nonChildren",
"precision_field": "precision"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f1fe5f5f99b98d0891f38003e10b636.asciidoc 0000664 0000000 0000000 00000000542 15176617013 0026373 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-async-query-api.asciidoc:23
[source, python]
----
resp = client.esql.async_query(
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)
----
python-elasticsearch-9.4.0/docs/examples/3f20459d358611793272f63dc596e889.asciidoc 0000664 0000000 0000000 00000001014 15176617013 0026104 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significanttext-aggregation.asciidoc:455
[source, python]
----
resp = client.search(
index="news",
query={
"match": {
"custom_all": "elasticsearch"
}
},
aggs={
"tags": {
"significant_text": {
"field": "custom_all",
"source_fields": [
"content",
"title"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f292a5f67e20f91bf18f5c2412a07bf.asciidoc 0000664 0000000 0000000 00000000761 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/match-enrich-policy-type-ex.asciidoc:79
[source, python]
----
resp = client.ingest.put_pipeline(
id="user_lookup",
processors=[
{
"enrich": {
"description": "Add 'user' data based on 'email'",
"policy_name": "users-policy",
"field": "email",
"target_field": "user",
"max_matches": "1"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f2e5132e35b9e8b3203a4a0541cf0d4.asciidoc 0000664 0000000 0000000 00000000706 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-searchable-snapshot.asciidoc:103
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"cold": {
"actions": {
"searchable_snapshot": {
"snapshot_repository": "backing_repo"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f30310cc6d0adae6b0f61705624a695.asciidoc 0000664 0000000 0000000 00000000713 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/create-snapshot-api.asciidoc:166
[source, python]
----
resp = client.snapshot.create(
repository="my_repository",
snapshot="snapshot_2",
wait_for_completion=True,
indices="index_1,index_2",
ignore_unavailable=True,
include_global_state=False,
metadata={
"taken_by": "user123",
"taken_because": "backup before upgrading"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f5b5bee692e7d4b0992dc0a64e95a60.asciidoc 0000664 0000000 0000000 00000002127 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-inner-hits.asciidoc:442
[source, python]
----
resp = client.indices.create(
index="test",
mappings={
"properties": {
"my_join_field": {
"type": "join",
"relations": {
"my_parent": "my_child"
}
}
}
},
)
print(resp)
resp1 = client.index(
index="test",
id="1",
refresh=True,
document={
"number": 1,
"my_join_field": "my_parent"
},
)
print(resp1)
resp2 = client.index(
index="test",
id="2",
routing="1",
refresh=True,
document={
"number": 1,
"my_join_field": {
"name": "my_child",
"parent": "1"
}
},
)
print(resp2)
resp3 = client.search(
index="test",
query={
"has_child": {
"type": "my_child",
"query": {
"match": {
"number": 1
}
},
"inner_hits": {}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/3f60a892bed18151b7baac6cc712576a.asciidoc 0000664 0000000 0000000 00000001002 15176617013 0026551 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/kstem-tokenfilter.asciidoc:98
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "whitespace",
"filter": [
"lowercase",
"kstem"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f669878713a14dfba251c7ce74dd5c4.asciidoc 0000664 0000000 0000000 00000002002 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:640
[source, python]
----
resp = client.transform.preview_transform(
source={
"index": "kibana_sample_data_ecommerce"
},
pivot={
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id"
}
}
},
"aggregations": {
"last": {
"top_metrics": {
"metrics": [
{
"field": "email"
},
{
"field": "customer_first_name.keyword"
},
{
"field": "customer_last_name.keyword"
}
],
"sort": {
"order_date": "desc"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f8dc309b63fa0437898107b0d964217.asciidoc 0000664 0000000 0000000 00000000267 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/anomaly-detectors.asciidoc:287
[source, python]
----
resp = client.cat.ml_jobs(
h="id,s,dpr,mb",
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f94ed945ae6416a0eb372c2db14d7e0.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0026563 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/recipes/stemming.asciidoc:116
[source, python]
----
resp = client.search(
index="index",
query={
"simple_query_string": {
"fields": [
"body.exact"
],
"query": "ski"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3f9dcf2aa42f3ecfb5ebfe48c1774103.asciidoc 0000664 0000000 0000000 00000000522 15176617013 0027007 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/3faec4ca15d8c2fbbd16781b1c8693d6.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0026725 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:473
[source, python]
----
resp = client.search(
index="mistral-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "mistral_embeddings",
"model_text": "Calculate fuel cost"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3faf5e2873de340acfe0a617017db784.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0026566 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:283
[source, python]
----
resp = client.search(
query={
"query_string": {
"query": "(content:this OR name:this) AND (content:that OR name:that)"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3fb1289c80a354da66693bfb25d7b412.asciidoc 0000664 0000000 0000000 00000000740 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:514
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="nightly-snapshots",
schedule="0 30 2 * * ?",
name="",
repository="my_repository",
config={
"include_global_state": False,
"indices": "*"
},
retention={
"expire_after": "30d",
"min_count": 5,
"max_count": 50
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3fb2f41ad229a31ad3ae408cc50cbed5.asciidoc 0000664 0000000 0000000 00000000435 15176617013 0026762 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-api.asciidoc:234
[source, python]
----
resp = client.search(
index="my-index-000001",
timeout="2s",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3fe0fb38f75d2a34fb1e6ac9bedbcdbc.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0027302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/ignored-field.asciidoc:21
[source, python]
----
resp = client.search(
query={
"exists": {
"field": "_ignored"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3fe4264ace04405989141c43aadfff81.asciidoc 0000664 0000000 0000000 00000000710 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-roles.asciidoc:173
[source, python]
----
resp = client.security.put_role(
name="cli_or_drivers_minimal",
cluster=[
"cluster:monitor/main"
],
indices=[
{
"names": [
"test"
],
"privileges": [
"read",
"indices:admin/get"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3fe5e6c0d5ea4586aa04f989ae54b72e.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/verify-repo-api.asciidoc:31
[source, python]
----
resp = client.snapshot.verify_repository(
name="my_repository",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3fe79ed63195c5f8018648a5a6d645f6.asciidoc 0000664 0000000 0000000 00000000640 15176617013 0026405 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/routing-field.asciidoc:87
[source, python]
----
resp = client.indices.create(
index="my-index-000002",
mappings={
"_routing": {
"required": True
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000002",
id="1",
document={
"text": "No routing value provided"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/3fe9006f6c7faea162e43fb250f4da38.asciidoc 0000664 0000000 0000000 00000000502 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:483
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"set": {
"field": "_source.my-long-field",
"value": 10
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3fecd5c6d0c172566da4a54320e1cff3.asciidoc 0000664 0000000 0000000 00000000727 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/dictionary-decompounder-tokenfilter.asciidoc:32
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "dictionary_decompounder",
"word_list": [
"Donau",
"dampf",
"meer",
"schiff"
]
}
],
text="Donaudampfschiff",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/3ffe9952786ab258bb6ab928b03148a2.asciidoc 0000664 0000000 0000000 00000000440 15176617013 0026440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/rare-terms-aggregation.asciidoc:92
[source, python]
----
resp = client.search(
aggs={
"genres": {
"rare_terms": {
"field": "genre"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/400e89eb46ead8e9c9e40f123fd5e590.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:434
[source, python]
----
resp = client.reindex(
source={
"index": "source",
"size": 100
},
dest={
"index": "dest",
"routing": "=cat"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/402092585940953420404c2884a47e59.asciidoc 0000664 0000000 0000000 00000002060 15176617013 0025636 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:860
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d",
"order": "desc"
}
}
},
{
"product": {
"terms": {
"field": "product"
}
}
}
]
},
"aggregations": {
"the_avg": {
"avg": {
"field": "price"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4029af36cb3f8202549017f7378803b4.asciidoc 0000664 0000000 0000000 00000000234 15176617013 0026133 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/get-settings.asciidoc:16
[source, python]
----
resp = client.cluster.get_settings()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4053de806dfd9172167999ce098107c4.asciidoc 0000664 0000000 0000000 00000000546 15176617013 0026243 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/constant-score-query.asciidoc:12
[source, python]
----
resp = client.search(
query={
"constant_score": {
"filter": {
"term": {
"user.id": "kimchy"
}
},
"boost": 1.2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/405511f7c1f12cc0a227b4563fe7b2e2.asciidoc 0000664 0000000 0000000 00000000365 15176617013 0026412 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-async-query-get-api.asciidoc:17
[source, python]
----
resp = client.esql.async_query_get(
id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/405ac843a9156d3cab374e199cac87fb.asciidoc 0000664 0000000 0000000 00000000575 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/create-connector-sync-job-api.asciidoc:21
[source, python]
----
resp = client.perform_request(
"POST",
"/_connector/_sync_job",
headers={"Content-Type": "application/json"},
body={
"id": "connector-id",
"job_type": "full",
"trigger_method": "on_demand"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/405db6f3a01eceacfaa8b0ed3e4b3ac2.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0027172 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-overall-buckets.asciidoc:181
[source, python]
----
resp = client.ml.get_overall_buckets(
job_id="job-*",
top_n=2,
overall_score=50,
start="1403532000000",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4061fd5ba7221ca85805ed14d59a6bc5.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:271
[source, python]
----
resp = client.delete_script(
id="calculate-score",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/406a0f1c1aac947bcee58f86b6d036c1.asciidoc 0000664 0000000 0000000 00000003143 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/actions.asciidoc:112
[source, python]
----
resp = client.watcher.put_watch(
id="log_event_watch",
trigger={
"schedule": {
"interval": "5m"
}
},
input={
"search": {
"request": {
"indices": "log-events",
"body": {
"size": 0,
"query": {
"match": {
"status": "error"
}
}
}
}
}
},
condition={
"compare": {
"ctx.payload.hits.total": {
"gt": 5
}
}
},
throttle_period="15m",
actions={
"email_administrator": {
"email": {
"to": "sys.admino@host.domain",
"subject": "Encountered {{ctx.payload.hits.total}} errors",
"body": "Too many error in the system, see attached data",
"attachments": {
"attached_data": {
"data": {
"format": "json"
}
}
},
"priority": "high"
}
},
"notify_pager": {
"webhook": {
"method": "POST",
"host": "pager.service.domain",
"port": 1234,
"path": "/{{watch_id}}",
"body": "Encountered {{ctx.payload.hits.total}} errors"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/408060f0c52300588a6dee774f4fd6a5.asciidoc 0000664 0000000 0000000 00000044327 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-dsl.asciidoc:218
[source, python]
----
resp = client.bulk(
index="datastream",
refresh=True,
operations=[
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:49:00Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 91153,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 463314616
},
"usage": {
"bytes": 307007078,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 585236
},
"rss": {
"bytes": 102728
},
"pagefaults": 120901,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:45:50Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 124501,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 982546514
},
"usage": {
"bytes": 360035574,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1339884
},
"rss": {
"bytes": 381174
},
"pagefaults": 178473,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:44:50Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 38907,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 862723768
},
"usage": {
"bytes": 379572388,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 431227
},
"rss": {
"bytes": 386580
},
"pagefaults": 233166,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:44:40Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 86706,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 567160996
},
"usage": {
"bytes": 103266017,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1724908
},
"rss": {
"bytes": 105431
},
"pagefaults": 233166,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:44:00Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 150069,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 639054643
},
"usage": {
"bytes": 265142477,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1786511
},
"rss": {
"bytes": 189235
},
"pagefaults": 138172,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:42:40Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 82260,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 854735585
},
"usage": {
"bytes": 309798052,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 924058
},
"rss": {
"bytes": 110838
},
"pagefaults": 259073,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:42:10Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 153404,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 279586406
},
"usage": {
"bytes": 214904955,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1047265
},
"rss": {
"bytes": 91914
},
"pagefaults": 302252,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:40:20Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 125613,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 822782853
},
"usage": {
"bytes": 100475044,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 2109932
},
"rss": {
"bytes": 278446
},
"pagefaults": 74843,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:40:10Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 100046,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 567160996
},
"usage": {
"bytes": 362826547,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1986724
},
"rss": {
"bytes": 402801
},
"pagefaults": 296495,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:38:30Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 40018,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 1062428344
},
"usage": {
"bytes": 265142477,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 2294743
},
"rss": {
"bytes": 340623
},
"pagefaults": 224530,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/40a42f005144cfed3dd1dcf2638e8211.asciidoc 0000664 0000000 0000000 00000000475 15176617013 0026475 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:774
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
params={
"field": "price",
"operator": "gte",
"value": 500
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/40b73b5c7ca144dc3f63f5b741f33d80.asciidoc 0000664 0000000 0000000 00000000745 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:157
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"constant_score": {
"filter": {
"percolate": {
"field": "query",
"document": {
"message": "A new bonsai tree in the office"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/40bd86e400d27e68b8f0ae580c29d32d.asciidoc 0000664 0000000 0000000 00000000357 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:279
[source, python]
----
resp = client.cluster.stats(
human=True,
filter_path="indices.mappings.total_deduplicated_mapping_size*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/40c3e7bb1fdc125a1ab21bd7d7326694.asciidoc 0000664 0000000 0000000 00000001454 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/multivalued-fields.asciidoc:145
[source, python]
----
resp = client.indices.create(
index="mv",
mappings={
"properties": {
"b": {
"type": "long"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="mv",
refresh=True,
operations=[
{
"index": {}
},
{
"a": 1,
"b": [
2,
2,
1
]
},
{
"index": {}
},
{
"a": 2,
"b": [
1,
1
]
}
],
)
print(resp1)
resp2 = client.esql.query(
query="FROM mv | EVAL b=TO_STRING(b) | LIMIT 2",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/40d88d4f53343ef663c89ba488ab8001.asciidoc 0000664 0000000 0000000 00000000721 15176617013 0026362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:412
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "envelope",
"coordinates": [
[
1000,
100
],
[
1001,
100
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/40d90d9dc6f4942bf92d88bfc5a34672.asciidoc 0000664 0000000 0000000 00000000517 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-bool-prefix-query.asciidoc:59
[source, python]
----
resp = client.search(
query={
"match_bool_prefix": {
"message": {
"query": "quick brown f",
"analyzer": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/40f287bf733420bbab134b74c7d0ea5d.asciidoc 0000664 0000000 0000000 00000000747 15176617013 0026560 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/40f97f70e8e743c6a6296c81b920aeb0.asciidoc 0000664 0000000 0000000 00000000425 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:314
[source, python]
----
resp = client.nodes.stats(
human=True,
filter_path="nodes.*.name,nodes.*.indices.mappings.total_estimated_overhead*,nodes.*.jvm.mem.heap_max*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4113c57384aa37c58d11579e20c00760.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026120 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:65
[source, python]
----
resp = client.get(
index="my-index-000001",
id="0",
source=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/41175d304e660da2931764f9a4418fd3.asciidoc 0000664 0000000 0000000 00000000606 15176617013 0026214 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-pipeline-api.asciidoc:94
[source, python]
----
resp = client.connector.update_pipeline(
connector_id="my-connector",
pipeline={
"extract_binary_content": True,
"name": "my-connector-pipeline",
"reduce_whitespace": True,
"run_ml_inference": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/41195ef13af0465cdee1ae18f6c00fde.asciidoc 0000664 0000000 0000000 00000000215 15176617013 0026717 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// slm/apis/slm-stop.asciidoc:52
[source, python]
----
resp = client.slm.stop()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/412f8238ab5182678f1d8f6383031b11.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026122 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-alias.asciidoc:16
[source, python]
----
resp = client.indices.get_alias(
index="my-data-stream",
name="my-alias",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/413fdcc7c437775a16bb55b81c2bbe2b.asciidoc 0000664 0000000 0000000 00000001024 15176617013 0026634 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1616
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
runtime={
"http.client.ip": {
"type": "ip",
"script": "\n String clientip=dissect('%{clientip} %{ident} %{auth} [%{@timestamp}] \"%{verb} %{request} HTTP/%{httpversion}\" %{status} %{size}').extract(doc[\"message\"].value)?.clientip;\n if (clientip != null) emit(clientip);\n "
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/415b46bc2b7a7b4dcf9a73ac67ea20e9.asciidoc 0000664 0000000 0000000 00000000734 15176617013 0026731 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/circle.asciidoc:99
[source, python]
----
resp = client.index(
index="circles",
id="2",
pipeline="polygonize_circles",
document={
"circle": {
"type": "circle",
"radius": "40m",
"coordinates": [
30,
10
]
}
},
)
print(resp)
resp1 = client.get(
index="circles",
id="2",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/416a3ba11232d3c078c1c31340cf356f.asciidoc 0000664 0000000 0000000 00000000540 15176617013 0026313 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:487
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"tags_schema": "styled",
"fields": {
"comment": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/41ad6077f9c1b8d8fefab6ea1660edcd.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0027073 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/format.asciidoc:13
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"date": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/41d24383d29b2808a65258a0a3256e96.asciidoc 0000664 0000000 0000000 00000000562 15176617013 0026135 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/41dbd79f624b998d01c10921e9a35c4b.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:296
[source, python]
----
resp = client.update(
index="test",
id="1",
doc={
"name": "new_name"
},
detect_noop=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/41fd33a293a575bd71a1fac7bcc8b47c.asciidoc 0000664 0000000 0000000 00000002534 15176617013 0026724 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search-application/apis/put-search-application.asciidoc:153
[source, python]
----
resp = client.search_application.put(
name="my-app",
search_application={
"indices": [
"index1",
"index2"
],
"template": {
"script": {
"source": {
"query": {
"query_string": {
"query": "{{query_string}}",
"default_field": "{{default_field}}"
}
}
},
"params": {
"query_string": "*",
"default_field": "*"
}
},
"dictionary": {
"properties": {
"query_string": {
"type": "string"
},
"default_field": {
"type": "string",
"enum": [
"title",
"description"
]
},
"additionalProperties": False
},
"required": [
"query_string"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4207219a892339e8f3abe0df8723dd27.asciidoc 0000664 0000000 0000000 00000000367 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/misc.asciidoc:136
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.metadata.administrator": "sysadmin@example.com"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/421e68e2b9789f0e8c08760d9e685d1c.asciidoc 0000664 0000000 0000000 00000001155 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/update-job.asciidoc:264
[source, python]
----
resp = client.ml.update_job(
job_id="low_request_rate",
description="An updated job",
detectors={
"detector_index": 0,
"description": "An updated detector description"
},
groups=[
"kibana_sample_data",
"kibana_sample_web_logs"
],
model_plot_config={
"enabled": True
},
renormalization_window_days=30,
background_persist_interval="2h",
model_snapshot_retention_days=7,
results_retention_days=60,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/424fbf082cd4affb84439abfc916b597.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026672 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/downsample-data-stream.asciidoc:65
[source, python]
----
resp = client.indices.downsample(
index="my-time-series-index",
target_index="my-downsampled-time-series-index",
config={
"fixed_interval": "1d"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/425eaaf9c7e3b1e77a3474fbab4183b4.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/task-queue-backlog.asciidoc:36
[source, python]
----
resp = client.cat.thread_pool(
v=True,
s="t,n",
h="type,name,node_name,active,queue,rejected,completed",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4275ecbe4aa68d43a8a7139866610a27.asciidoc 0000664 0000000 0000000 00000000722 15176617013 0026355 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/weighted-avg-aggregation.asciidoc:55
[source, python]
----
resp = client.search(
index="exams",
size=0,
aggs={
"weighted_grade": {
"weighted_avg": {
"value": {
"field": "grade"
},
"weight": {
"field": "weight"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/42ba7c1d13aee91fe6f0a8a42c30eb74.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026712 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:132
[source, python]
----
resp = client.indices.rollover(
alias="my-data-stream",
lazy=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/42bc7608bb675dd6238e2fecbb758d06.asciidoc 0000664 0000000 0000000 00000001046 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/geo-match-enrich-policy-type-ex.asciidoc:36
[source, python]
----
resp = client.index(
index="postal_codes",
id="1",
refresh="wait_for",
document={
"location": {
"type": "envelope",
"coordinates": [
[
13,
53
],
[
14,
52
]
]
},
"postal_code": "96598"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/42d02087f1c8ab0452ef373079a76843.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026217 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/stop-analyzer.asciidoc:15
[source, python]
----
resp = client.indices.analyze(
analyzer="stop",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/42deb4fe32afbe0f94185e256a79c447.asciidoc 0000664 0000000 0000000 00000001207 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/stop-analyzer.asciidoc:249
[source, python]
----
resp = client.indices.create(
index="stop_example",
settings={
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
}
},
"analyzer": {
"rebuilt_stop": {
"tokenizer": "lowercase",
"filter": [
"english_stop"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4301cb9d970ec65778f91ce1f438e0d5.asciidoc 0000664 0000000 0000000 00000000740 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:291
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"add": {
"index": "logs-nginx.access-prod",
"alias": "logs"
}
},
{
"add": {
"index": "logs-my_app-default",
"alias": "logs",
"is_write_index": True
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/430705509f8367aef92be413f702520b.asciidoc 0000664 0000000 0000000 00000000371 15176617013 0026207 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-status-api.asciidoc:82
[source, python]
----
resp = client.connector.update_status(
connector_id="my-connector",
status="needs_configuration",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4310869b97d4224acaa6d66b1e196048.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026275 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-search-elser.asciidoc:184
[source, python]
----
resp = client.search(
index="my-index",
query={
"sparse_vector": {
"field": "content_embedding",
"inference_id": "my-elser-endpoint",
"query": "How to avoid muscle soreness after running?"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4323f6d224847eccdce59c23e33fda0a.asciidoc 0000664 0000000 0000000 00000000761 15176617013 0026650 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc:126
[source, python]
----
resp = client.indices.create(
index="cjk_bigram_example",
settings={
"analysis": {
"analyzer": {
"standard_cjk_bigram": {
"tokenizer": "standard",
"filter": [
"cjk_bigram"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/433cf45a23decdf3a096016ffaaf26ba.asciidoc 0000664 0000000 0000000 00000000605 15176617013 0026773 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:396
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"add": {
"index": "my-index-2099.05.06-000001",
"alias": "my-alias",
"search_routing": "1",
"index_routing": "2"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4342ccf6cc24fd80bd3cd1f9a4c2ef8e.asciidoc 0000664 0000000 0000000 00000001003 15176617013 0027062 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:515
[source, python]
----
resp = client.clear_scroll(
scroll_id=[
"DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==",
"DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/435e0d6a7d86e074d572d9671b7b9676.asciidoc 0000664 0000000 0000000 00000001476 15176617013 0026332 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:226
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "Polygon",
"coordinates": [
[
[
100,
0
],
[
101,
0
],
[
101,
1
],
[
100,
1
],
[
100,
0
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/43854be6aae61edbea5f9ab988cb4ce5.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0027111 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/using-ip-filtering.asciidoc:146
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"xpack.security.transport.filter.allow": "172.16.0.0/24"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/43d9e314431336a6f084cea76dfd6489.asciidoc 0000664 0000000 0000000 00000000624 15176617013 0026370 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/43e86fbaeed068dcc981214338559b5a.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/resolve-cluster.asciidoc:92
[source, python]
----
resp = client.indices.resolve_cluster(
name="my-index-*,cluster*:my-index-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/43f77ddf1ed8106d4f47a12d39df8e3b.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/range-enrich-policy-type-ex.asciidoc:113
[source, python]
----
resp = client.index(
index="my-index-000001",
id="my_id",
pipeline="networks_lookup",
document={
"ip": "10.100.34.1"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/43fe75fa9f3fca846598fdad58fd98cb.asciidoc 0000664 0000000 0000000 00000000215 15176617013 0027054 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/usage.asciidoc:44
[source, python]
----
resp = client.xpack.usage()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44198781d164a15be633d4469485a544.asciidoc 0000664 0000000 0000000 00000001234 15176617013 0026066 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/441be98c597698bb2809372abf086c3e.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026376 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/doc-count-field.asciidoc:80
[source, python]
----
resp = client.search(
aggs={
"histogram_titles": {
"terms": {
"field": "my_text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/441f330f6872f995769db1ce2b9627e2.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026321 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:686
[source, python]
----
resp = client.search(
stored_fields=[],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44231f7cdd5c3a21025861cdef31e355.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:206
[source, python]
----
resp = client.indices.shrink(
index="my-index",
target="my-shrunken-index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4427517dcd8ec9997541150cdc11a0de.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/snapshot/corrupt-repository.asciidoc:116
[source, python]
----
resp = client.snapshot.delete_repository(
name="my-repo",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4435b654994b575ba181ea679871c78c.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-api.asciidoc:26
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44385b61342e20ea05f254015b2b04d7.asciidoc 0000664 0000000 0000000 00000000364 15176617013 0026164 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-delete-roles.asciidoc:54
[source, python]
----
resp = client.security.bulk_delete_role(
names=[
"my_admin_role",
"my_user_role"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/443dd902f64b3217505c9595839c3b2d.asciidoc 0000664 0000000 0000000 00000000450 15176617013 0026220 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-multiple-indices.asciidoc:138
[source, python]
----
resp = client.search(
indices_boost=[
{
"my-alias": 1.4
},
{
"my-index*": 1.3
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/443e8da9968f1c65f46a2a65a1e1e078.asciidoc 0000664 0000000 0000000 00000002365 15176617013 0026454 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-tsds.asciidoc:147
[source, python]
----
resp = client.indices.put_index_template(
name="my-weather-sensor-index-template",
index_patterns=[
"metrics-weather_sensors-*"
],
data_stream={},
template={
"settings": {
"index.mode": "time_series",
"index.lifecycle.name": "my-lifecycle-policy"
},
"mappings": {
"properties": {
"sensor_id": {
"type": "keyword",
"time_series_dimension": True
},
"location": {
"type": "keyword",
"time_series_dimension": True
},
"temperature": {
"type": "half_float",
"time_series_metric": "gauge"
},
"humidity": {
"type": "half_float",
"time_series_metric": "gauge"
},
"@timestamp": {
"type": "date"
}
}
}
},
priority=500,
meta={
"description": "Template for my weather sensor data"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/445f8a6ef75fb43da52990b3a9063c78.asciidoc 0000664 0000000 0000000 00000000524 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1656
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"http.responses": "304"
}
},
fields=[
"http.client_ip",
"timestamp",
"http.verb"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/446e8fc8ccfb13bb5ec64e32a5676d18.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/elision-tokenfilter.asciidoc:34
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"elision"
],
text="j’examine près du wharf",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4479e8c63a04fa22207a6a8803eadcad.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026555 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/allocation_awareness.asciidoc:62
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.awareness.attributes": "rack_id"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44939997b0f2601f82a93585a879f65a.asciidoc 0000664 0000000 0000000 00000001321 15176617013 0026167 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/simplepatternsplit-tokenizer.asciidoc:40
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "simple_pattern_split",
"pattern": "_"
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="an_underscored_phrase",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/4498b9d3b0c77e1b9ef6664ff5963ce2.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shard-request-cache.asciidoc:61
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index.requests.cache.enable": False
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44b8a236d7cfb31c43c6d066ae16d8cd.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/profile.asciidoc:40
[source, python]
----
resp = client.search(
index="my-index-000001",
profile=True,
query={
"match": {
"message": "GET /search"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44bca3f17d403517af3616754dc795bb.asciidoc 0000664 0000000 0000000 00000001343 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/script-score-query.asciidoc:352
[source, python]
----
resp = client.explain(
index="my-index-000001",
id="0",
query={
"script_score": {
"query": {
"match": {
"message": "elasticsearch"
}
},
"script": {
"source": "\n long count = doc['count'].value;\n double normalizedCount = count / 10;\n if (explanation != null) {\n explanation.set('normalized count = count / 10 = ' + count + ' / 10 = ' + normalizedCount);\n }\n return normalizedCount;\n "
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44da736ce0e1587c1e7c45eee606ead7.asciidoc 0000664 0000000 0000000 00000000535 15176617013 0026663 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:409
[source, python]
----
resp = client.update_by_query(
index="my-index-000001",
script={
"source": "ctx._source.count++",
"lang": "painless"
},
query={
"term": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44db41b8465af951e366da97ade63bc1.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/apis/reload-analyzers.asciidoc:160
[source, python]
----
resp = client.indices.reload_search_analyzers(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44dd65d69267017fa2fb2cffadef40bb.asciidoc 0000664 0000000 0000000 00000001022 15176617013 0027003 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cardinality-aggregation.asciidoc:188
[source, python]
----
resp = client.search(
index="sales",
size="0",
runtime_mappings={
"type_and_promoted": {
"type": "keyword",
"script": "emit(doc['type'].value + ' ' + doc['promoted'].value)"
}
},
aggs={
"type_promoted_count": {
"cardinality": {
"field": "type_and_promoted"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/44dfac5bc3131014e2c6bb1ebc76b33d.asciidoc 0000664 0000000 0000000 00000000507 15176617013 0026700 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:146
[source, python]
----
resp = client.indices.create(
index="index_double",
mappings={
"properties": {
"field": {
"type": "double"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/451b441c3311103d0d2bdbab771b26d2.asciidoc 0000664 0000000 0000000 00000000661 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:987
[source, python]
----
resp = client.put_script(
id="my-search-template",
script={
"lang": "mustache",
"source": "\n {\n \"query\": {\n \"match\": {\n {{=( )=}}\n \"message\": \"(query_string)\"\n (={{ }}=)\n }\n }\n }\n "
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/451e7c29b2cf738cfc822f7c175bef56.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0026613 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-new-data-stream.asciidoc:29
[source, python]
----
resp = client.indices.put_index_template(
name="my-index-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
priority=500,
template={
"lifecycle": {
"data_retention": "7d"
}
},
meta={
"description": "Template with data stream lifecycle"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4527d9bb12cf738111a188af235d5d4c.asciidoc 0000664 0000000 0000000 00000001071 15176617013 0026423 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/grok-syntax.asciidoc:176
[source, python]
----
resp = client.search(
index="my-index",
runtime_mappings={
"http.clientip": {
"type": "ip",
"script": "\n String clientip=grok('%{COMMONAPACHELOG}').extract(doc[\"message\"].value)?.clientip;\n if (clientip != null) emit(clientip);\n "
}
},
query={
"match": {
"http.clientip": "40.135.0.0"
}
},
fields=[
"http.clientip"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/45499ed1824d1d7cb59972580d2344cb.asciidoc 0000664 0000000 0000000 00000000542 15176617013 0026311 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/unsigned_long.asciidoc:68
[source, python]
----
resp = client.search(
index="my_index",
query={
"range": {
"my_counter": {
"gte": "9223372036854775808",
"lte": "18446744073709551615"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/455029c3d66306ad5d48f6dbddaf7324.asciidoc 0000664 0000000 0000000 00000002736 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/sum-aggregation.asciidoc:140
[source, python]
----
resp = client.indices.create(
index="metrics_index",
mappings={
"properties": {
"latency_histo": {
"type": "histogram"
}
}
},
)
print(resp)
resp1 = client.index(
index="metrics_index",
id="1",
refresh=True,
document={
"network.name": "net-1",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
3,
7,
23,
12,
6
]
}
},
)
print(resp1)
resp2 = client.index(
index="metrics_index",
id="2",
refresh=True,
document={
"network.name": "net-2",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
8,
17,
8,
7,
6
]
}
},
)
print(resp2)
resp3 = client.search(
index="metrics_index",
size="0",
filter_path="aggregations",
aggs={
"total_latency": {
"sum": {
"field": "latency_histo"
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/4553e0acb6336687d61eaecc73f517b7.asciidoc 0000664 0000000 0000000 00000001414 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/mapping-charfilter.asciidoc:109
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"char_filter": [
"my_mappings_char_filter"
]
}
},
"char_filter": {
"my_mappings_char_filter": {
"type": "mapping",
"mappings": [
":) => _happy_",
":( => _sad_"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/45813d971bfa890ffa2f51f3f480cce5.asciidoc 0000664 0000000 0000000 00000000525 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:355
[source, python]
----
resp = client.search(
index="test_index",
query={
"percolate": {
"field": "query",
"document": {
"body": "Bycicles are missing"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/458b2228aed7464d915a5d73cb6b98f6.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/snapshots.asciidoc:135
[source, python]
----
resp = client.cat.snapshots(
repository="repo1",
v=True,
s="id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/45954b8aaedfed57012be8b6538b0a24.asciidoc 0000664 0000000 0000000 00000002073 15176617013 0026571 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/45b74f1904533fdb37a5a6f3c8f4ec9b.asciidoc 0000664 0000000 0000000 00000001531 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/edgengram-tokenizer.asciidoc:144
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 10,
"token_chars": [
"letter",
"digit"
]
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="2 Quick Foxes.",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/45c6e54a9c9e08623af96752b4bde346.asciidoc 0000664 0000000 0000000 00000000735 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-distance-query.asciidoc:213
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "12km",
"pin.location": "POINT (-70 40)"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/45ef5156dbd2d3fd4fd22b8d99f7aad4.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0027023 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/restart-cluster.asciidoc:233
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.enable": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/46064e81620162a23e75002a7eeb8b10.asciidoc 0000664 0000000 0000000 00000000522 15176617013 0026163 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/move-to-step.asciidoc:194
[source, python]
----
resp = client.ilm.move_to_step(
index="my-index-000001",
current_step={
"phase": "hot",
"action": "complete",
"name": "complete"
},
next_step={
"phase": "warm"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/46103fee3cd5f53dc75123def82d52ad.asciidoc 0000664 0000000 0000000 00000000633 15176617013 0026650 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:293
[source, python]
----
resp = client.indices.put_index_template(
name="my-data-stream-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
priority=500,
template={
"settings": {
"index.refresh_interval": "30s"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/464dffb6a6e24a860223d1c32b232f95.asciidoc 0000664 0000000 0000000 00000002320 15176617013 0026416 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/minhash-tokenfilter.asciidoc:134
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"filter": {
"my_shingle_filter": {
"type": "shingle",
"min_shingle_size": 5,
"max_shingle_size": 5,
"output_unigrams": False
},
"my_minhash_filter": {
"type": "min_hash",
"hash_count": 1,
"bucket_count": 512,
"hash_set_size": 1,
"with_rotation": True
}
},
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"my_shingle_filter",
"my_minhash_filter"
]
}
}
}
},
mappings={
"properties": {
"fingerprint": {
"type": "text",
"analyzer": "my_analyzer"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4659f639d71a54df571260ee5798dbb3.asciidoc 0000664 0000000 0000000 00000001371 15176617013 0026402 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geotilegrid-aggregation.asciidoc:114
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggregations={
"zoomed-in": {
"filter": {
"geo_bounding_box": {
"location": {
"top_left": "POINT (4.9 52.4)",
"bottom_right": "POINT (5.0 52.3)"
}
}
},
"aggregations": {
"zoom1": {
"geotile_grid": {
"field": "location",
"precision": 22
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/46658f00edc4865dfe472a392374cd0f.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template-v1.asciidoc:258
[source, python]
----
resp = client.indices.get_template(
name="template_1",
filter_path="*.version",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4670dd81a9865e07ae74ae8b0266e384.asciidoc 0000664 0000000 0000000 00000001515 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/t-test-aggregation.asciidoc:148
[source, python]
----
resp = client.search(
index="node_upgrade",
size=0,
runtime_mappings={
"startup_time_before.adjusted": {
"type": "long",
"script": {
"source": "emit(doc['startup_time_before'].value - params.adjustment)",
"params": {
"adjustment": 10
}
}
}
},
aggs={
"startup_time_ttest": {
"t_test": {
"a": {
"field": "startup_time_before.adjusted"
},
"b": {
"field": "startup_time_after"
},
"type": "paired"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/467833bd44b35a89a7fe0d7df5f253f1.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/pattern-analyzer.asciidoc:29
[source, python]
----
resp = client.indices.analyze(
analyzer="pattern",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/468f7ec42cdd8287cdea3ec1cea4a514.asciidoc 0000664 0000000 0000000 00000000644 15176617013 0027017 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:338
[source, python]
----
resp = client.update(
index="my-index-000001",
id="1",
script={
"source": "if (ctx._source.tags.contains(params['tag'])) { ctx._source.tags.remove(ctx._source.tags.indexOf(params['tag'])) }",
"lang": "painless",
"params": {
"tag": "blue"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/46a0eaaf5c881f1ba716d1812b36c724.asciidoc 0000664 0000000 0000000 00000001424 15176617013 0026476 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/bi-directional-disaster-recovery.asciidoc:87
[source, python]
----
resp = client.ccr.put_auto_follow_pattern(
name="logs-generic-default",
remote_cluster="clusterB",
leader_index_patterns=[
".ds-logs-generic-default-20*"
],
leader_index_exclusion_patterns="*-replicated_from_clustera",
follow_index_pattern="{{leader_index}}-replicated_from_clusterb",
)
print(resp)
resp1 = client.ccr.put_auto_follow_pattern(
name="logs-generic-default",
remote_cluster="clusterA",
leader_index_patterns=[
".ds-logs-generic-default-20*"
],
leader_index_exclusion_patterns="*-replicated_from_clusterb",
follow_index_pattern="{{leader_index}}-replicated_from_clustera",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/46b1c1f6e0c86528be84c373eeb8d425.asciidoc 0000664 0000000 0000000 00000001030 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/update-license.asciidoc:145
[source, python]
----
resp = client.license.post(
acknowledge=True,
licenses=[
{
"uid": "893361dc-9749-4997-93cb-802e3d7fa4xx",
"type": "basic",
"issue_date_in_millis": 1411948800000,
"expiry_date_in_millis": 1914278399999,
"max_nodes": 1,
"issued_to": "issuedTo",
"issuer": "issuer",
"signature": "xx"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/46b771a9932c3fa6057a7b2679c72ef0.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026365 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/46c5c14f20118dcf519ff6ef21360209.asciidoc 0000664 0000000 0000000 00000001012 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-downsample.asciidoc:37
[source, python]
----
resp = client.ilm.put_lifecycle(
name="datastream_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_docs": 1
},
"downsample": {
"fixed_interval": "1h"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/46ce40227fa60aa6ba435f366b3a1f5f.asciidoc 0000664 0000000 0000000 00000000737 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/uni-directional-disaster-recovery.asciidoc:101
[source, python]
----
resp = client.ccr.pause_follow(
index="kibana_sample_data_ecommerce2",
)
print(resp)
resp1 = client.indices.close(
index="kibana_sample_data_ecommerce2",
)
print(resp1)
resp2 = client.ccr.unfollow(
index="kibana_sample_data_ecommerce2",
)
print(resp2)
resp3 = client.indices.open(
index="kibana_sample_data_ecommerce2",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/46ebd468c3f132a4978088964466c5cd.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026324 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/apostrophe-tokenfilter.asciidoc:77
[source, python]
----
resp = client.indices.create(
index="apostrophe_example",
settings={
"analysis": {
"analyzer": {
"standard_apostrophe": {
"tokenizer": "standard",
"filter": [
"apostrophe"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/472ec8c57fec8457e31fe6dd7f6e3713.asciidoc 0000664 0000000 0000000 00000000533 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:448
[source, python]
----
resp = client.search(
query={
"query_string": {
"fields": [
"title"
],
"query": "this that thus",
"minimum_should_match": 2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/473c8ddd4e4b7814a64e5fe40d9d6dca.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/task-management.asciidoc:31
[source, python]
----
resp = client.tasks.cancel(
task_id="2j8UKw1bRO283PMwDugNNg:5326",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4752f82fec8b46e5a4b3788b76e3041f.asciidoc 0000664 0000000 0000000 00000001101 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-migrate.asciidoc:84
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"migrate": {
"enabled": False
},
"allocate": {
"include": {
"rack_id": "one,two"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/47909e194d10743093f4a22c27a85925.asciidoc 0000664 0000000 0000000 00000001317 15176617013 0026063 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:198
[source, python]
----
resp = client.search(
size=10000,
query={
"match": {
"user.id": "elkbee"
}
},
pit={
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==",
"keep_alive": "1m"
},
sort=[
{
"@timestamp": {
"order": "asc",
"format": "strict_date_optional_time_nanos",
"numeric_type": "date_nanos"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/47e6dfb5b09d954c9c0c33fda2b6c66d.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026743 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-user.asciidoc:167
[source, python]
----
resp = client.security.put_user(
username="jacknich",
password="l0ng-r4nd0m-p@ssw0rd",
roles=[
"admin",
"other_role1"
],
full_name="Jack Nicholson",
email="jacknich@example.com",
metadata={
"intelligence": 7
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/47fde7874e15a37242993fd69c62063b.asciidoc 0000664 0000000 0000000 00000000672 15176617013 0026324 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-rank-aggregation.asciidoc:29
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_ranks": {
"percentile_ranks": {
"field": "load_time",
"values": [
500,
600
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/480e531db799c4c909afd8e2a73a8d0b.asciidoc 0000664 0000000 0000000 00000000231 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/forcemerge.asciidoc:199
[source, python]
----
resp = client.indices.forcemerge()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4818a1288ac24a56d6d6a4130ee70202.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026247 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:212
[source, python]
----
resp = client.get_script(
id="my-search-template",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4824a823a830a2a5d990eacfd783ac22.asciidoc 0000664 0000000 0000000 00000001157 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:448
[source, python]
----
resp = client.delete_by_query(
index="my-index-000001",
slice={
"id": 0,
"max": 2
},
query={
"range": {
"http.response.bytes": {
"lt": 2000000
}
}
},
)
print(resp)
resp1 = client.delete_by_query(
index="my-index-000001",
slice={
"id": 1,
"max": 2
},
query={
"range": {
"http.response.bytes": {
"lt": 2000000
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/48313f620c2871b6f4019b66be730109.asciidoc 0000664 0000000 0000000 00000001561 15176617013 0026127 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/filter-search-results.asciidoc:112
[source, python]
----
resp = client.search(
index="shirts",
query={
"bool": {
"filter": {
"term": {
"brand": "gucci"
}
}
}
},
aggs={
"colors": {
"terms": {
"field": "color"
}
},
"color_red": {
"filter": {
"term": {
"color": "red"
}
},
"aggs": {
"models": {
"terms": {
"field": "model"
}
}
}
}
},
post_filter={
"term": {
"color": "red"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/483d669ec0768bc4e275a568c6164704.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026232 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/post-pause-follow.asciidoc:35
[source, python]
----
resp = client.ccr.pause_follow(
index="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/484e24d1ed1a154ba9753e6090d38d78.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026355 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:140
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "point",
"coordinates": [
-377.03653,
389.897676
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/487f0e07fd83c05f9763e0795c525e2e.asciidoc 0000664 0000000 0000000 00000003770 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geoline-aggregation.asciidoc:13
[source, python]
----
resp = client.indices.create(
index="test",
mappings={
"properties": {
"my_location": {
"type": "geo_point"
},
"group": {
"type": "keyword"
},
"@timestamp": {
"type": "date"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="test",
refresh=True,
operations=[
{
"index": {}
},
{
"my_location": {
"lat": 52.373184,
"lon": 4.889187
},
"@timestamp": "2023-01-02T09:00:00Z"
},
{
"index": {}
},
{
"my_location": {
"lat": 52.370159,
"lon": 4.885057
},
"@timestamp": "2023-01-02T10:00:00Z"
},
{
"index": {}
},
{
"my_location": {
"lat": 52.369219,
"lon": 4.901618
},
"@timestamp": "2023-01-02T13:00:00Z"
},
{
"index": {}
},
{
"my_location": {
"lat": 52.374081,
"lon": 4.91235
},
"@timestamp": "2023-01-02T16:00:00Z"
},
{
"index": {}
},
{
"my_location": {
"lat": 52.371667,
"lon": 4.914722
},
"@timestamp": "2023-01-03T12:00:00Z"
}
],
)
print(resp1)
resp2 = client.search(
index="test",
filter_path="aggregations",
aggs={
"line": {
"geo_line": {
"point": {
"field": "my_location"
},
"sort": {
"field": "@timestamp"
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/488f6df1df71972392b670ce557f7ff3.asciidoc 0000664 0000000 0000000 00000000501 15176617013 0026466 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template-v1.asciidoc:240
[source, python]
----
resp = client.indices.put_template(
name="template_1",
index_patterns=[
"my-index-*"
],
order=0,
settings={
"number_of_shards": 1
},
version=123,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/48d9697a14dfe131325521f48a7adc84.asciidoc 0000664 0000000 0000000 00000000754 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:867
[source, python]
----
resp = client.render_search_template(
id="my-search-template",
params={
"query_string": "My string",
"text_fields": [
{
"user_name": "John",
"last": False
},
{
"user_name": "kimchy",
"last": True
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/48de51de87a8ad9fd8b8db1ca25b85c1.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0027026 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/similarity.asciidoc:542
[source, python]
----
resp = client.indices.close(
index="index",
)
print(resp)
resp1 = client.indices.put_settings(
index="index",
settings={
"index": {
"similarity": {
"default": {
"type": "boolean"
}
}
}
},
)
print(resp1)
resp2 = client.indices.open(
index="index",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/48e142e6c69014e0509d4c9251749d77.asciidoc 0000664 0000000 0000000 00000000670 15176617013 0026153 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-openai.asciidoc:161
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="openai-embeddings",
inference_config={
"service": "openai",
"service_settings": {
"api_key": "",
"model_id": "text-embedding-3-small",
"dimensions": 128
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/49100a4f53c0ba345fadacdc4f2f86e4.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0026710 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:74
[source, python]
----
resp = client.search(
q="kimchy",
filter_path="took,hits.hits._id,hits.hits._score",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4955bae30f265b9e436f82b015de6d7e.asciidoc 0000664 0000000 0000000 00000000573 15176617013 0026527 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-query.asciidoc:193
[source, python]
----
resp = client.search(
index="my-index-000001",
pretty=True,
query={
"terms": {
"color": {
"index": "my-index-000001",
"id": "2",
"path": "color"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/496d35c89dc991a1509f7e8fb93ade45.asciidoc 0000664 0000000 0000000 00000002346 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:232
[source, python]
----
resp = client.indices.create(
index="bengali_example",
settings={
"analysis": {
"filter": {
"bengali_stop": {
"type": "stop",
"stopwords": "_bengali_"
},
"bengali_keywords": {
"type": "keyword_marker",
"keywords": [
"উদাহরণ"
]
},
"bengali_stemmer": {
"type": "stemmer",
"language": "bengali"
}
},
"analyzer": {
"rebuilt_bengali": {
"tokenizer": "standard",
"filter": [
"lowercase",
"decimal_digit",
"bengali_keywords",
"indic_normalization",
"bengali_normalization",
"bengali_stop",
"bengali_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4980d6fcb369692b0b29ddc6767d4324.asciidoc 0000664 0000000 0000000 00000000407 15176617013 0026374 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/diagnose-unassigned-shards.asciidoc:198
[source, python]
----
resp = client.cluster.allocation_explain(
index="my-index-000001",
shard=0,
primary=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4982c547be1ad9455ae836990aea92c5.asciidoc 0000664 0000000 0000000 00000000631 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// 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)
----
python-elasticsearch-9.4.0/docs/examples/4989cc97ce1c8fff634a10d343031bd0.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/disk/increase-data-node-capacity.asciidoc:104
[source, python]
----
resp = client.cat.shards(
v=True,
h="state,node",
s="state",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/49a19615ebe2c013b8321152163478ab.asciidoc 0000664 0000000 0000000 00000001361 15176617013 0026173 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/49c052a748c943180db78fee8e144239.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026312 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-api-key-cache.asciidoc:56
[source, python]
----
resp = client.security.clear_api_key_cache(
ids="yVGMr3QByxdh1MSaicYx,YoiMaqREw0YVpjn40iMg",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/49c40b51da2469a6e00fea8fa6fbf56e.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/task-management.asciidoc:11
[source, python]
----
resp = client.tasks.list(
pretty=True,
detailed=True,
group_by="parents",
human=True,
actions="*data/read/esql",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/49cb3f48a0097bfc597c52fa51c6d379.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/saml-guide.asciidoc:936
[source, python]
----
resp = client.security.put_role(
name="saml-service-role",
cluster=[
"manage_saml",
"manage_token"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/49d87c2eb7314ed34221c5fb4f21dfcc.asciidoc 0000664 0000000 0000000 00000000340 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:263
[source, python]
----
resp = client.indices.analyze(
index="analyze_sample",
normalizer="my_normalizer",
text="BaR",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/49e8773a34fcbf825de38426cff5509c.asciidoc 0000664 0000000 0000000 00000000550 15176617013 0026541 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/profile.asciidoc:1275
[source, python]
----
resp = client.search(
index="my-knn-index",
profile=True,
knn={
"field": "my-vector",
"query_vector": [
-5,
9,
-12
],
"k": 3,
"num_candidates": 100
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/49f4d2a461536d150e16b1e0a3148678.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0026202 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/clearcache.asciidoc:116
[source, python]
----
resp = client.indices.clear_cache(
index="my-index-000001",
fielddata=True,
)
print(resp)
resp1 = client.indices.clear_cache(
index="my-index-000001",
query=True,
)
print(resp1)
resp2 = client.indices.clear_cache(
index="my-index-000001",
request=True,
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/4a1951844bd39f26961bfc965f3432b1.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-get.asciidoc:144
[source, python]
----
resp = client.mget(
index="my-index-000001",
docs=[
{
"_id": "1"
},
{
"_id": "2"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4a2080ae55d931eb0643cc3eb91ec524.asciidoc 0000664 0000000 0000000 00000002046 15176617013 0026474 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/multi-fields.asciidoc:82
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"text": {
"type": "text",
"fields": {
"english": {
"type": "text",
"analyzer": "english"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"text": "quick brown fox"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"text": "quick brown foxes"
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
query={
"multi_match": {
"query": "quick brown foxes",
"fields": [
"text",
"text.english"
],
"type": "most_fields"
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/4a4b8a406681584a91c0e614c1fa4344.asciidoc 0000664 0000000 0000000 00000002226 15176617013 0026261 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-api-keys.asciidoc:134
[source, python]
----
resp = client.security.create_api_key(
name="my-api-key",
expiration="1d",
role_descriptors={
"role-a": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"index-a*"
],
"privileges": [
"read"
]
}
]
},
"role-b": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"index-b*"
],
"privileges": [
"all"
]
}
]
}
},
metadata={
"application": "my-application",
"environment": {
"level": 1,
"trusted": True,
"tags": [
"dev",
"staging"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4a72c68b96f44e80463084dfc0449d51.asciidoc 0000664 0000000 0000000 00000001046 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:287
[source, python]
----
resp = client.search(
index="my-index-000001",
runtime_mappings={
"day_of_week": {
"type": "keyword",
"script": {
"source": "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))"
}
}
},
aggs={
"day_of_week": {
"terms": {
"field": "day_of_week"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4a7510a9c0468303658383c00796dad2.asciidoc 0000664 0000000 0000000 00000000775 15176617013 0026136 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/ignore-malformed.asciidoc:70
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index.mapping.ignore_malformed": True
},
mappings={
"properties": {
"number_one": {
"type": "byte"
},
"number_two": {
"type": "integer",
"ignore_malformed": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4aa81a694266fb634904224d14cd9a87.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0026273 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:668
[source, python]
----
resp = client.search(
index="my_queries2",
query={
"percolate": {
"field": "query",
"document": {
"my_field": "wxyz"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4ae494d1e62231e832fc0436b04e2014.asciidoc 0000664 0000000 0000000 00000000735 15176617013 0026253 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/validate.asciidoc:122
[source, python]
----
resp = client.indices.validate_query(
index="my-index-000001",
query={
"bool": {
"must": {
"query_string": {
"query": "*:*"
}
},
"filter": {
"term": {
"user.id": "kimchy"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4af15c4f26ddefb9c350e7a246a66a15.asciidoc 0000664 0000000 0000000 00000001364 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:362
[source, python]
----
resp = client.search(
index="node",
filter_path="aggregations",
aggs={
"ip": {
"terms": {
"field": "ip",
"order": {
"tm.m": "desc"
}
},
"aggs": {
"tm": {
"top_metrics": {
"metrics": {
"field": "m"
},
"sort": {
"date": "desc"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4b1044259a6d777d87529eae25675005.asciidoc 0000664 0000000 0000000 00000000676 15176617013 0026155 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:450
[source, python]
----
resp = client.ingest.put_pipeline(
id="set-foo",
description="sets foo",
processors=[
{
"set": {
"field": "foo",
"value": "bar"
}
}
],
)
print(resp)
resp1 = client.update_by_query(
index="my-index-000001",
pipeline="set-foo",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/4b3a49710fafa35d6d41a8ec12434515.asciidoc 0000664 0000000 0000000 00000001277 15176617013 0026422 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:467
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"percolate": {
"field": "query",
"documents": [
{
"message": "bonsai tree"
},
{
"message": "new tree"
},
{
"message": "the office"
},
{
"message": "office tree"
}
]
}
},
highlight={
"fields": {
"message": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4b5110a21676cc0e26e050a4b4552235.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026145 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/get-synonyms-set.asciidoc:81
[source, python]
----
resp = client.synonyms.get_synonym(
id="my-synonyms-set",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4b91ad7c9b44e07db4a4e81390f19ad3.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026564 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/4ba86373e13e106de044f190343be328.asciidoc 0000664 0000000 0000000 00000001762 15176617013 0026265 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:365
[source, python]
----
resp = client.search(
aggs={
"countries": {
"terms": {
"field": "artist.country",
"order": [
{
"rock>playback_stats.avg": "desc"
},
{
"_count": "desc"
}
]
},
"aggs": {
"rock": {
"filter": {
"term": {
"genre": "rock"
}
},
"aggs": {
"playback_stats": {
"stats": {
"field": "play_count"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bb4a64cf04e3feb133b0221d29beaa9.asciidoc 0000664 0000000 0000000 00000000432 15176617013 0026700 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:127
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="my_snapshot_2099.05.06",
indices="my-index,logs-my_app-default",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bb7bcfebca682fb9c9e3e47bfd5ef6f.asciidoc 0000664 0000000 0000000 00000001630 15176617013 0027333 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:821
[source, python]
----
resp = client.search(
size=0,
track_total_hits=False,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"user_name": {
"terms": {
"field": "user_name"
}
}
},
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d",
"order": "desc"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bba59cf745ac7b996bf90308bc26957.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026537 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pathhierarchy-tokenizer.asciidoc:349
[source, python]
----
resp = client.search(
index="file-path-test",
query={
"bool": {
"must": {
"match": {
"file_path": "16"
}
},
"filter": {
"term": {
"file_path.tree": "/User/alice"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bc4db44b8c74610b73f21a421099a13.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026323 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-tokens.asciidoc:194
[source, python]
----
resp = client.security.invalidate_token(
realm_name="saml1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bc744b0f33b322741a8caf6d8d7d765.asciidoc 0000664 0000000 0000000 00000000566 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/index_.asciidoc:594
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
op_type="create",
document={
"@timestamp": "2099-11-15T13:12:00",
"message": "GET /search HTTP/1.1 200 1070000",
"user": {
"id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bd42e31ac4a5cf237777f1a0e97aba8.asciidoc 0000664 0000000 0000000 00000000313 15176617013 0026640 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:286
[source, python]
----
resp = client.transform.start_transform(
transform_id="suspicious_client_ips",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4be07b34db282044c88d5021c7ea08ee.asciidoc 0000664 0000000 0000000 00000001466 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:17
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"my_vector": {
"type": "dense_vector",
"dims": 3
},
"my_text": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index",
id="1",
document={
"my_text": "text1",
"my_vector": [
0.5,
10,
6
]
},
)
print(resp1)
resp2 = client.index(
index="my-index",
id="2",
document={
"my_text": "text2",
"my_vector": [
-0.5,
10,
10
]
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/4be20da16d2b58216e8b307218c7bf3a.asciidoc 0000664 0000000 0000000 00000001230 15176617013 0026466 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:188
[source, python]
----
resp = client.indices.put_index_template(
name="my-data-stream-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
priority=500,
template={
"mappings": {
"properties": {
"host": {
"properties": {
"ip": {
"type": "ip",
"ignore_malformed": True
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bef98a2dac575a50ee0783c2269f1db.asciidoc 0000664 0000000 0000000 00000000676 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:498
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"text_embedding": {
"type": "dense_vector",
"dims": 384,
"index_options": {
"type": "flat"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bf6bb703a52267379ae2b1e1308cf8b.asciidoc 0000664 0000000 0000000 00000001044 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/script-query.asciidoc:156
[source, python]
----
resp = client.search(
query={
"bool": {
"filter": {
"script": {
"script": {
"source": "doc['num1'].value > params.param1",
"lang": "painless",
"params": {
"param1": 5
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4bfcb2861f1d572bd0d66acd66deab0b.asciidoc 0000664 0000000 0000000 00000000441 15176617013 0027053 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/update-datafeed.asciidoc:166
[source, python]
----
resp = client.ml.update_datafeed(
datafeed_id="datafeed-test-job",
query={
"term": {
"geo.src": "US"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c174e228b6b74497b73ef2be80de7ad.asciidoc 0000664 0000000 0000000 00000000264 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/get-trained-models.asciidoc:1467
[source, python]
----
resp = client.ml.get_trained_models()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c3db8987d7b2d3d3df78ff1e71e7ede.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0027040 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-query.asciidoc:22
[source, python]
----
resp = client.search(
query={
"match": {
"message": {
"query": "this is a test"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c5f0d7af287618062bb627b44ccb23e.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:197
[source, python]
----
resp = client.indices.forcemerge(
index="my-index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c712bd5637892a11f16b8975a0a98ed.asciidoc 0000664 0000000 0000000 00000000263 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/dataframeanalytics.asciidoc:137
[source, python]
----
resp = client.cat.ml_data_frame_analytics(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c777b8360ef6c7671ae2e3803c0b0f6.asciidoc 0000664 0000000 0000000 00000001734 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/tophits-aggregation.asciidoc:52
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"top_tags": {
"terms": {
"field": "type",
"size": 3
},
"aggs": {
"top_sales_hits": {
"top_hits": {
"sort": [
{
"date": {
"order": "desc"
}
}
],
"_source": {
"includes": [
"date",
"price"
]
},
"size": 1
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c77d12039fe2445c9251e33979071ac.asciidoc 0000664 0000000 0000000 00000000772 15176617013 0026225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/categorize-text-aggregation.asciidoc:282
[source, python]
----
resp = client.search(
index="log-messages",
filter_path="aggregations",
aggs={
"categories": {
"categorize_text": {
"field": "message",
"categorization_filters": [
"\\w+\\_\\d{3}"
],
"similarity_threshold": 11
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c803b088c1915a7b0634d5cafabe606.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0026474 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/ipprefix-aggregation.asciidoc:219
[source, python]
----
resp = client.search(
index="network-traffic",
size=0,
aggs={
"ipv4-subnets": {
"ip_prefix": {
"field": "ipv4",
"prefix_length": 24,
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c9350ed09b28f00e297ebe73c3b95a2.asciidoc 0000664 0000000 0000000 00000000714 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-elasticsearch.asciidoc:236
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="my-msmarco-minilm-model",
inference_config={
"service": "elasticsearch",
"service_settings": {
"num_allocations": 1,
"num_threads": 1,
"model_id": "msmarco-MiniLM-L12-cos-v5"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4c95d54b32df4dc49e9762b6c1ae2c05.asciidoc 0000664 0000000 0000000 00000001001 15176617013 0026565 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/text.asciidoc:368
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"tag": {
"type": "text",
"fielddata": True,
"fielddata_frequency_filter": {
"min": 0.001,
"max": 0.1,
"min_segment_size": 500
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc 0000664 0000000 0000000 00000000251 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/allocation-explain.asciidoc:457
[source, python]
----
resp = client.cluster.allocation_explain()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4ca5bc2c2b2f64d15b9c16370ae97a39.asciidoc 0000664 0000000 0000000 00000001042 15176617013 0026557 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geohashgrid-aggregation.asciidoc:212
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggregations={
"tiles-in-bounds": {
"geohash_grid": {
"field": "location",
"precision": 8,
"bounds": {
"top_left": "POINT (4.21875 53.4375)",
"bottom_right": "POINT (5.625 52.03125)"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4cb44556b8c699f43489b17b42ddd475.asciidoc 0000664 0000000 0000000 00000000757 15176617013 0026410 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-get.asciidoc:222
[source, python]
----
resp = client.mget(
docs=[
{
"_index": "test",
"_id": "1",
"stored_fields": [
"field1",
"field2"
]
},
{
"_index": "test",
"_id": "2",
"stored_fields": [
"field3",
"field4"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4cd40113e0fc90c37976f28d7e4a2327.asciidoc 0000664 0000000 0000000 00000002530 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/normalizer.asciidoc:18
[source, python]
----
resp = client.indices.create(
index="index",
settings={
"analysis": {
"normalizer": {
"my_normalizer": {
"type": "custom",
"char_filter": [],
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
mappings={
"properties": {
"foo": {
"type": "keyword",
"normalizer": "my_normalizer"
}
}
},
)
print(resp)
resp1 = client.index(
index="index",
id="1",
document={
"foo": "BÀR"
},
)
print(resp1)
resp2 = client.index(
index="index",
id="2",
document={
"foo": "bar"
},
)
print(resp2)
resp3 = client.index(
index="index",
id="3",
document={
"foo": "baz"
},
)
print(resp3)
resp4 = client.indices.refresh(
index="index",
)
print(resp4)
resp5 = client.search(
index="index",
query={
"term": {
"foo": "BAR"
}
},
)
print(resp5)
resp6 = client.search(
index="index",
query={
"match": {
"foo": "BAR"
}
},
)
print(resp6)
----
python-elasticsearch-9.4.0/docs/examples/4cdbd53f08df4bf66e2a47c0f1fcb3f8.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0027073 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/clearcache.asciidoc:136
[source, python]
----
resp = client.indices.clear_cache(
index="my-index-000001",
fields="foo,bar",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4cdcc3fde5cea165a3a7567962b9bd61.asciidoc 0000664 0000000 0000000 00000003141 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/put-synonyms-set.asciidoc:131
[source, python]
----
resp = client.synonyms.put_synonym(
id="my-synonyms-set",
synonyms_set=[
{
"id": "test-1",
"synonyms": "hello, hi"
}
],
)
print(resp)
resp1 = client.indices.create(
index="test-index",
settings={
"analysis": {
"filter": {
"synonyms_filter": {
"type": "synonym_graph",
"synonyms_set": "my-synonyms-set",
"updateable": True
}
},
"analyzer": {
"my_index_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase"
]
},
"my_search_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"synonyms_filter"
]
}
}
}
},
mappings={
"properties": {
"title": {
"type": "text",
"analyzer": "my_index_analyzer",
"search_analyzer": "my_search_analyzer"
}
}
},
)
print(resp1)
resp2 = client.synonyms.put_synonym(
id="my-synonyms-set",
synonyms_set=[
{
"id": "test-1",
"synonyms": "hello, hi, howdy"
}
],
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/4ce4563e207233c48ffe849728052dca.asciidoc 0000664 0000000 0000000 00000000255 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:412
[source, python]
----
resp = client.indices.rollover(
alias="logs-my_app-default",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4d21725453955582ff12b4a1104aa7b6.asciidoc 0000664 0000000 0000000 00000000524 15176617013 0026176 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/update-filter.asciidoc:50
[source, python]
----
resp = client.ml.update_filter(
filter_id="safe_domains",
description="Updated list of domains",
add_items=[
"*.myorg.com"
],
remove_items=[
"wikipedia.org"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4d2e6eb7fea407deeb7a859c267fda62.asciidoc 0000664 0000000 0000000 00000001466 15176617013 0027035 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/put-job.asciidoc:260
[source, python]
----
resp = client.rollup.put_job(
id="sensor",
index_pattern="sensor-*",
rollup_index="sensor_rollup",
cron="*/30 * * * * ?",
page_size=1000,
groups={
"date_histogram": {
"field": "timestamp",
"fixed_interval": "1h",
"delay": "7d"
},
"terms": {
"fields": [
"node"
]
}
},
metrics=[
{
"field": "temperature",
"metrics": [
"min",
"max",
"sum"
]
},
{
"field": "voltage",
"metrics": [
"avg"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4d46e2160784bdf7cce948e9f0d31fc8.asciidoc 0000664 0000000 0000000 00000001651 15176617013 0026617 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/word-delimiter-graph-tokenfilter.asciidoc:410
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"filter": [
"my_custom_word_delimiter_graph_filter"
]
}
},
"filter": {
"my_custom_word_delimiter_graph_filter": {
"type": "word_delimiter_graph",
"type_table": [
"- => ALPHA"
],
"split_on_case_change": False,
"split_on_numerics": False,
"stem_english_possessive": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4d7c0b52d3c0a084157428624c543c90.asciidoc 0000664 0000000 0000000 00000000225 15176617013 0026174 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/common/apis/get-ml-info.asciidoc:44
[source, python]
----
resp = client.ml.info()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4da0cb8693e9ceceee2ba3b558014bbf.asciidoc 0000664 0000000 0000000 00000001565 15176617013 0027073 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/4dc151eebefd484a28aed1a175743364.asciidoc 0000664 0000000 0000000 00000001000 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:93
[source, python]
----
resp = client.ingest.put_pipeline(
id="openai_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "openai_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4de4bb55bbc0a76c75d256f245a3ee3f.asciidoc 0000664 0000000 0000000 00000000556 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/elastic-infer-service.asciidoc:100
[source, python]
----
resp = client.inference.put(
task_type="sparse_embedding",
inference_id="elser-model-eis",
inference_config={
"service": "elastic",
"service_settings": {
"model_name": "elser"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4ded8ad815ac0e83b1c21a6c18fd0763.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/ecommerce-tutorial.asciidoc:401
[source, python]
----
resp = client.transform.start_transform(
transform_id="ecommerce-customer-transform",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4e1f02928ef243bf07fd425754b7642b.asciidoc 0000664 0000000 0000000 00000000472 15176617013 0026360 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/add-nodes.asciidoc:109
[source, python]
----
resp = client.cluster.post_voting_config_exclusions(
node_names="node_name",
)
print(resp)
resp1 = client.cluster.post_voting_config_exclusions(
node_names="node_name",
timeout="1m",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/4e2317aa45e87922d07c8ddc67a82d32.asciidoc 0000664 0000000 0000000 00000001422 15176617013 0026434 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pathhierarchy-tokenizer.asciidoc:100
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "path_hierarchy",
"delimiter": "-",
"replacement": "/",
"skip": 2
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="one-two-three-four-five",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/4e3414fc712b16311f9e433dd366f49d.asciidoc 0000664 0000000 0000000 00000000344 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/delete-inference.asciidoc:70
[source, python]
----
resp = client.inference.delete(
task_type="sparse_embedding",
inference_id="my-elser-model",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4e4608ae4ce93c27bd174a9ea078cab2.asciidoc 0000664 0000000 0000000 00000001726 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/semantic-search/hybrid-search.asciidoc:10
[source, python]
----
resp = client.search(
index="my-index",
retriever={
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"match": {
"my_text_field": "the query string"
}
}
}
},
{
"standard": {
"query": {
"sparse_vector": {
"field": "my_tokens",
"inference_id": "my-elser-endpoint",
"query": "the query string"
}
}
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4e50d9d25bfb07ac73e3a2be5d2fbbf7.asciidoc 0000664 0000000 0000000 00000001327 15176617013 0027065 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:229
[source, python]
----
resp = client.search(
size=10000,
query={
"match": {
"user.id": "elkbee"
}
},
pit={
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==",
"keep_alive": "1m"
},
sort=[
{
"@timestamp": {
"order": "asc",
"format": "strict_date_optional_time_nanos"
}
},
{
"_shard_doc": "desc"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4e5f7a97efdbf517f7a2ed6ef7ff469c.asciidoc 0000664 0000000 0000000 00000000535 15176617013 0027137 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:409
[source, python]
----
resp = client.render_search_template(
source="{ \"query\": { \"terms\": { \"tags\": {{#toJson}}tags{{/toJson}} }}}",
params={
"tags": [
"prod",
"es01"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4e6b78ac991ed2d5f9a2e7c89f4fc471.asciidoc 0000664 0000000 0000000 00000000547 15176617013 0026713 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/completion-suggest.asciidoc:121
[source, python]
----
resp = client.search(
index="music",
pretty=True,
suggest={
"song-suggest": {
"prefix": "nir",
"completion": {
"field": "suggest"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4e926063a9494b563387617b08c4f232.asciidoc 0000664 0000000 0000000 00000000375 15176617013 0026072 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:284
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="*",
verbose=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4e931cfac74e46e221cf4a9ab88a182d.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/field-caps.asciidoc:251
[source, python]
----
resp = client.field_caps(
fields="rating,title",
include_unmapped=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4ed946065faa92f9950f04e402676a97.asciidoc 0000664 0000000 0000000 00000000236 15176617013 0026316 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/info.asciidoc:206
[source, python]
----
resp = client.xpack.info(
human=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4edfb5934d14ad7655bd7e19a112b5c0.asciidoc 0000664 0000000 0000000 00000002637 15176617013 0026573 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/4ee31fd4ea6d18f32ec28b7fa433441d.asciidoc 0000664 0000000 0000000 00000000751 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/put-app-privileges.asciidoc:94
[source, python]
----
resp = client.security.put_privileges(
privileges={
"myapp": {
"read": {
"actions": [
"data:read/*",
"action:login"
],
"metadata": {
"description": "Read access to myapp"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4eeded40f30949e359714a5bb6c88612.asciidoc 0000664 0000000 0000000 00000000562 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:31
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "elser-embeddings",
"pipeline": "elser_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4f08d9e21d9f199acc77abfb83287878.asciidoc 0000664 0000000 0000000 00000000753 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search-application/apis/search-application-search.asciidoc:130
[source, python]
----
resp = client.search_application.search(
name="my-app",
params={
"query_string": "my first query",
"text_fields": [
{
"name": "title",
"boost": 5
},
{
"name": "description",
"boost": 1
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4f140d8922efdf3420e41b1cb669a289.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026432 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/delete-component-template.asciidoc:31
[source, python]
----
resp = client.cluster.delete_component_template(
name="template_1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4f1e1205154d280db21fbd2754ed5398.asciidoc 0000664 0000000 0000000 00000001042 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/aggregate-metric-double.asciidoc:114
[source, python]
----
resp = client.indices.create(
index="stats-index",
mappings={
"properties": {
"agg_metric": {
"type": "aggregate_metric_double",
"metrics": [
"min",
"max",
"sum",
"value_count"
],
"default_metric": "max"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4f3366fc26e7ea4de446dfa5cdec9683.asciidoc 0000664 0000000 0000000 00000000677 15176617013 0026766 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/function-score-query.asciidoc:380
[source, python]
----
resp = client.search(
query={
"function_score": {
"gauss": {
"@timestamp": {
"origin": "2013-09-17",
"scale": "10d",
"offset": "5d",
"decay": 0.5
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4f621ab694f62ddb89e0684a9e76c4d1.asciidoc 0000664 0000000 0000000 00000000633 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:586
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"fields": {
"comment": {
"fragment_size": 150,
"number_of_fragments": 3
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4f666d710758578e2582850dac3ad144.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0026221 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-user-profile-data.asciidoc:141
[source, python]
----
resp = client.security.get_user_profile(
uid="u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0",
data="*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4f6694ef147a73b1163bde3c13779d26.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0026365 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/4f67b5f5c040f611bd2560a5d38ea6f5.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/rare-terms-aggregation.asciidoc:331
[source, python]
----
resp = client.search(
aggs={
"genres": {
"rare_terms": {
"field": "genre",
"missing": "N/A"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4f8a4ad49e2bca6784c88ede18a1a709.asciidoc 0000664 0000000 0000000 00000000232 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/delete-license.asciidoc:43
[source, python]
----
resp = client.license.delete()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4fa9ee04188cbf0b38cfc28f6a56527d.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-datafeed.asciidoc:80
[source, python]
----
resp = client.ml.get_datafeeds(
datafeed_id="datafeed-high_sum_total_sales",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4fb0629146ca78b85e823edd405497bb.asciidoc 0000664 0000000 0000000 00000000766 15176617013 0026454 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/put-dfanalytics.asciidoc:914
[source, python]
----
resp = client.ml.put_data_frame_analytics(
id="loan_classification",
source={
"index": "loan-applicants"
},
dest={
"index": "loan-applicants-classified"
},
analysis={
"classification": {
"dependent_variable": "label",
"training_percent": 75,
"num_top_classes": 2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4fcca1687d7b2cf08de526539fea5a76.asciidoc 0000664 0000000 0000000 00000002504 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/text-expansion-query.asciidoc:119
[source, python]
----
resp = client.search(
index="my-index",
query={
"bool": {
"should": [
{
"text_expansion": {
"ml.inference.title_expanded.predicted_value": {
"model_id": ".elser_model_2",
"model_text": "How is the weather in Jamaica?",
"boost": 1
}
}
},
{
"text_expansion": {
"ml.inference.description_expanded.predicted_value": {
"model_id": ".elser_model_2",
"model_text": "How is the weather in Jamaica?",
"boost": 1
}
}
},
{
"multi_match": {
"query": "How is the weather in Jamaica?",
"fields": [
"title",
"description"
],
"boost": 4
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/4ff2dcec03fe097075cf1d174a019a1f.asciidoc 0000664 0000000 0000000 00000001011 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:721
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match_phrase": {
"message": "number 1"
}
},
highlight={
"fields": {
"message": {
"type": "plain",
"fragment_size": 15,
"number_of_fragments": 3,
"fragmenter": "simple"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50096ee0ca53fe8a88450ebb2a50f285.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:143
[source, python]
----
resp = client.sql.query(
format="csv",
delimiter=";",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5024c524a7db0d6bb44c1820007cc5f4.asciidoc 0000664 0000000 0000000 00000001245 15176617013 0026402 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/grok.asciidoc:39
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"description": "...",
"processors": [
{
"grok": {
"field": "message",
"patterns": [
"%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes:int} %{NUMBER:duration:double}"
]
}
}
]
},
docs=[
{
"_source": {
"message": "55.3.244.1 GET /index.html 15824 0.043"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50522d3d5b3d055f712ad737e3d1707a.asciidoc 0000664 0000000 0000000 00000001626 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/token-count.asciidoc:14
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"name": {
"type": "text",
"fields": {
"length": {
"type": "token_count",
"analyzer": "standard"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"name": "John Smith"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"name": "Rachel Alice Williams"
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
query={
"term": {
"name.length": 3
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/505a6c21a4cb608d3662fab1a35eb6df.asciidoc 0000664 0000000 0000000 00000002102 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/doc-count-field.asciidoc:54
[source, python]
----
resp = client.index(
index="my_index",
id="1",
document={
"my_text": "histogram_1",
"my_histogram": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
3,
7,
23,
12,
6
]
},
"_doc_count": 45
},
)
print(resp)
resp1 = client.index(
index="my_index",
id="2",
document={
"my_text": "histogram_2",
"my_histogram": {
"values": [
0.1,
0.25,
0.35,
0.4,
0.45,
0.5
],
"counts": [
8,
17,
8,
7,
6,
2
]
},
"_doc_count": 62
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/50764f4ea88079156b0aff2835bcdc45.asciidoc 0000664 0000000 0000000 00000000375 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:221
[source, python]
----
resp = client.cluster.state(
metric="metadata",
pretty=True,
filter_path="metadata.stored_scripts",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5093bfd281dbe41bd0dba8ff979e6e47.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026753 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/apis/get-stored-script-api.asciidoc:30
[source, python]
----
resp = client.get_script(
id="my-stored-script",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50a9623c153cabe64101efb633e10e6c.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/delete-autoscaling-policy.asciidoc:37
[source, python]
----
resp = client.autoscaling.delete_autoscaling_policy(
name="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50b5c0332949d2154c72b629b5fa6222.asciidoc 0000664 0000000 0000000 00000000574 15176617013 0026205 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:345
[source, python]
----
resp = client.index(
index="my-index-000001",
refresh="wait_for",
document={
"user_id": 12345
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
refresh="wait_for",
document={
"user_id": 12346
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/50c2b06ecddb5a4aebd8b78e38af5f1f.asciidoc 0000664 0000000 0000000 00000002617 15176617013 0027153 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-a-data-stream.asciidoc:55
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my-lifecycle-policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50gb"
}
}
},
"warm": {
"min_age": "30d",
"actions": {
"shrink": {
"number_of_shards": 1
},
"forcemerge": {
"max_num_segments": 1
}
}
},
"cold": {
"min_age": "60d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"frozen": {
"min_age": "90d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"delete": {
"min_age": "735d",
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50c2cea2adbe9523458c2686ab11df54.asciidoc 0000664 0000000 0000000 00000001340 15176617013 0026555 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc:206
[source, python]
----
resp = client.indices.create(
index="text_payloads",
mappings={
"properties": {
"text": {
"type": "text",
"term_vector": "with_positions_payloads",
"analyzer": "payload_delimiter"
}
}
},
settings={
"analysis": {
"analyzer": {
"payload_delimiter": {
"tokenizer": "whitespace",
"filter": [
"delimited_payload"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50d5c5b7e8ed9a95b8d9a25a32a77425.asciidoc 0000664 0000000 0000000 00000000432 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/unique-tokenfilter.asciidoc:26
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"unique"
],
text="the quick fox jumps the lazy fox",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50d9c0508ddb0fc5ba5a893eec219dd8.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/synthetic-source.asciidoc:129
[source, python]
----
resp = client.index(
index="idx",
id="1",
document={
"foo.bar.baz": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50dc35d3d8705bd62aed20a15209476c.asciidoc 0000664 0000000 0000000 00000001035 15176617013 0026413 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:364
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping9",
rules={
"field": {
"realm.name": "cloud-saml"
}
},
role_templates=[
{
"template": {
"source": "saml_user"
}
},
{
"template": {
"source": "_user_{{username}}"
}
}
],
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/50f922e9f002d8ac570953be59414b7b.asciidoc 0000664 0000000 0000000 00000000567 15176617013 0026365 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/combined-fields-query.asciidoc:156
[source, python]
----
resp = client.search(
query={
"combined_fields": {
"query": "database systems",
"fields": [
"title",
"abstract"
],
"operator": "and"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/511e5bb8ab881171b7e8629095e30b85.asciidoc 0000664 0000000 0000000 00000000261 15176617013 0026276 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-dsl.asciidoc:400
[source, python]
----
resp = client.search(
index="datastream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/515e1104d136082e826d1b32af011759.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0026110 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/nested-aggregation.asciidoc:38
[source, python]
----
resp = client.index(
index="products",
id="0",
refresh=True,
document={
"name": "LED TV",
"resellers": [
{
"reseller": "companyA",
"price": 350
},
{
"reseller": "companyB",
"price": 500
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5174c3c731fc1703e5b43ae2bae7a80e.asciidoc 0000664 0000000 0000000 00000000447 15176617013 0026557 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/apis/clear-sql-cursor-api.asciidoc:29
[source, python]
----
resp = client.sql.clear_cursor(
cursor="sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/518fcf1dc1edd7dba0864accf71b49f4.asciidoc 0000664 0000000 0000000 00000000455 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-shard-routing.asciidoc:48
[source, python]
----
resp = client.search(
index="my-index-000001",
preference="_local",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5195a88194f7a139c635a84398d76205.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026102 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/restore-snapshot-api.asciidoc:60
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="my_snapshot",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/519e46350316a33162740e5d7968aa2c.asciidoc 0000664 0000000 0000000 00000000751 15176617013 0026132 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/51b40610ae05730b4c6afd25647d7ae0.asciidoc 0000664 0000000 0000000 00000001333 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:489
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"date": "2015-10-01T05:30:00Z"
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"date": "2015-10-01T06:30:00Z"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
size="0",
aggs={
"by_day": {
"date_histogram": {
"field": "date",
"calendar_interval": "day",
"offset": "+6h"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/51b44224feee6e2e5974824334474c77.asciidoc 0000664 0000000 0000000 00000000610 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-s3.asciidoc:371
[source, python]
----
resp = client.snapshot.create_repository(
name="my_s3_repository",
repository={
"type": "s3",
"settings": {
"client": "my-client",
"bucket": "my-bucket",
"endpoint": "my.s3.endpoint"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/51f1a0930362594b231a5bcc17673768.asciidoc 0000664 0000000 0000000 00000001013 15176617013 0026116 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/modify-data-streams-api.asciidoc:17
[source, python]
----
resp = client.indices.modify_data_stream(
actions=[
{
"remove_backing_index": {
"data_stream": "my-logs",
"index": ".ds-my-logs-2099.01.01-000001"
}
},
{
"add_backing_index": {
"data_stream": "my-logs",
"index": "index-to-add"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/51f6cb682424e110f289af79c106f4c7.asciidoc 0000664 0000000 0000000 00000000420 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/troubleshooting-shards-capacity.asciidoc:401
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.max_shards_per_node.frozen": 3200
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5275842787967b6db876025f4a1c6942.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026105 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters.asciidoc:128
[source, python]
----
resp = client.search(
suggest={
"text": "tring out Elasticsearch",
"my-suggest-1": {
"term": {
"field": "message"
}
},
"my-suggest-2": {
"term": {
"field": "user"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5276a831513623e43ed567eb52b6dba9.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026356 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-shard-routing.asciidoc:109
[source, python]
----
resp = client.index(
index="my-index-000001",
routing="my-routing-value",
document={
"@timestamp": "2099-11-15T13:12:00",
"message": "GET /search HTTP/1.1 200 1070000",
"user": {
"id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/528e5f1c345c3769248cc6889e8cf552.asciidoc 0000664 0000000 0000000 00000000456 15176617013 0026336 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/similarity.asciidoc:47
[source, python]
----
resp = client.indices.put_mapping(
index="index",
properties={
"title": {
"type": "text",
"similarity": "my_similarity"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/529671ffaf7cc75fe83a81d729788be4.asciidoc 0000664 0000000 0000000 00000001242 15176617013 0026552 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/529b975b7cedaac58dce9821956adc37.asciidoc 0000664 0000000 0000000 00000004327 15176617013 0026703 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:390
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
102,
2
],
[
103,
2
],
[
103,
3
],
[
102,
3
],
[
102,
2
]
]
],
[
[
[
100,
0
],
[
101,
0
],
[
101,
1
],
[
100,
1
],
[
100,
0
]
],
[
[
100.2,
0.2
],
[
100.8,
0.2
],
[
100.8,
0.8
],
[
100.2,
0.8
],
[
100.2,
0.2
]
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52a2d119addb15366a935115518335fd.asciidoc 0000664 0000000 0000000 00000000544 15176617013 0026261 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shrink-index.asciidoc:52
[source, python]
----
resp = client.indices.put_settings(
index="my_source_index",
settings={
"settings": {
"index.number_of_replicas": 0,
"index.routing.allocation.require._name": "shrink_node_name"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52b71aa4ae6563abae78cd20ff06d1e9.asciidoc 0000664 0000000 0000000 00000000363 15176617013 0026722 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/hotspotting.asciidoc:148
[source, python]
----
resp = client.nodes.stats(
human=True,
filter_path="nodes.*.name,nodes.*.indices.indexing",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52bc577a0d0cd42b46f33e0ef5124df8.asciidoc 0000664 0000000 0000000 00000000726 15176617013 0026565 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:644
[source, python]
----
resp = client.put_script(
id="my-search-template",
script={
"lang": "mustache",
"source": {
"query": {
"match": {
"message": "{{query_string}}"
}
},
"from": "{{from}}",
"size": "{{size}}"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52be795b68e6ef3f396f35fea52d0481.asciidoc 0000664 0000000 0000000 00000000452 15176617013 0026540 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/detect-threats-with-eql.asciidoc:51
[source, python]
----
resp = client.indices.put_index_template(
name="my-data-stream-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
priority=500,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52c2b4c180388f5ae044588ba70b70f0.asciidoc 0000664 0000000 0000000 00000001210 15176617013 0026333 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/knn-query.asciidoc:178
[source, python]
----
resp = client.search(
index="my-image-index",
size=10,
query={
"bool": {
"must": {
"knn": {
"field": "image-vector",
"query_vector": [
-5,
9,
-12
],
"k": 3
}
},
"filter": {
"term": {
"file-type": "png"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52c7e4172a446c394210a07c464c57d2.asciidoc 0000664 0000000 0000000 00000000356 15176617013 0026204 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:606
[source, python]
----
resp = client.delete_by_query_rethrottle(
task_id="r1A2WoRbTwKZ516z6NEs5A:36619",
requests_per_second="-1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52cdb5526ce69d0223d1dd198308bfea.asciidoc 0000664 0000000 0000000 00000001113 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/dynamic.asciidoc:53
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic": False,
"properties": {
"user": {
"properties": {
"name": {
"type": "text"
},
"social_networks": {
"dynamic": True,
"properties": {}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52f1c1689ab35353858cdeaab7597546.asciidoc 0000664 0000000 0000000 00000000730 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/common-log-format-example.asciidoc:174
[source, python]
----
resp = client.index(
index="my-data-stream",
pipeline="my-pipeline",
document={
"message": "89.160.20.128 - - [05/May/2099:16:21:15 +0000] \"GET /favicon.ico HTTP/1.1\" 200 3638 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36\""
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52f4c5eb08d39f98e2e2f5527ece9731.asciidoc 0000664 0000000 0000000 00000001104 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-alibabacloud-ai-search.asciidoc:210
[source, python]
----
resp = client.inference.put(
task_type="sparse_embedding",
inference_id="alibabacloud_ai_search_sparse",
inference_config={
"service": "alibabacloud-ai-search",
"service_settings": {
"api_key": "",
"service_id": "ops-text-sparse-embedding-001",
"host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
"workspace": "default"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/52fd112e970882c4d7cc4b0cca8e2c6f.asciidoc 0000664 0000000 0000000 00000001002 15176617013 0026641 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/numeric.asciidoc:23
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"number_of_bytes": {
"type": "integer"
},
"time_in_seconds": {
"type": "float"
},
"price": {
"type": "scaled_float",
"scaling_factor": 100
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5302f4f2bcc0f400ff71c791e6f68d7b.asciidoc 0000664 0000000 0000000 00000000627 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keyword-marker-tokenfilter.asciidoc:95
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "keyword_marker",
"keywords": [
"jumping"
]
},
"stemmer"
],
text="fox running and jumping",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5305bc07c1bf90bab3e8db1de3e31b26.asciidoc 0000664 0000000 0000000 00000000463 15176617013 0026705 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shutdown/apis/shutdown-put.asciidoc:102
[source, python]
----
resp = client.shutdown.put_node(
node_id="USpTGYaBSIKbgSUJR2Z9lg",
type="restart",
reason="Demonstrating how the node shutdown API works",
allocation_delay="20m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/532ddf9afdcd0b1c9c0bb331e74d8df3.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0027060 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:158
[source, python]
----
resp = client.indices.create(
index="index_long",
mappings={
"properties": {
"field": {
"type": "long"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/532f371934b61fb4992d37bedcc085de.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shutdown/apis/shutdown-get.asciidoc:55
[source, python]
----
resp = client.shutdown.put_node(
node_id="USpTGYaBSIKbgSUJR2Z9lg",
type="restart",
reason="Demonstrating how the node shutdown API works",
allocation_delay="10m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5330191ec9f11281ebf6867bf11c58ae.asciidoc 0000664 0000000 0000000 00000000464 15176617013 0026437 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:394
[source, python]
----
resp = client.delete_by_query(
index="my-index-000001",
routing="1",
query={
"range": {
"age": {
"gte": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5332c4cca5fbb45cc700dcd34f37bc38.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026714 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:557
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"english": "Some English text",
"count": 5
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/537bce129338d9227bccb6a0283dab45.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0026475 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/53aa8b21e2b1c4d48960343711296704.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026114 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/regexp-syntax.asciidoc:60
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"regexp": {
"my_field.keyword": "a\\\\.*"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/53b908c3432118c5a6e460f74d32006b.asciidoc 0000664 0000000 0000000 00000000516 15176617013 0026177 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:11
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "this is a test",
"fields": [
"subject",
"message"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/53bb7f0e3429861aadb8dd3d588085cd.asciidoc 0000664 0000000 0000000 00000000446 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:272
[source, python]
----
resp = client.search(
index="my-data-stream",
seq_no_primary_term=True,
query={
"match": {
"user.id": "yWIumJd7"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/53c6256295111524d5ff2885bdcb99a9.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/get-transform-stats.asciidoc:328
[source, python]
----
resp = client.transform.get_transform(
transform_id="_stats",
from_="5",
size="10",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/53d9d2ec9cb8d211772d764e76fe6890.asciidoc 0000664 0000000 0000000 00000000567 15176617013 0026473 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/53e4ac5a4009fd21024f4b31e54aa83f.asciidoc 0000664 0000000 0000000 00000000426 15176617013 0026467 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/oidc-guide.asciidoc:619
[source, python]
----
resp = client.security.put_user(
username="facilitator",
password="",
roles=[
"facilitator-role"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/54059961f05904368ced52c894a50e23.asciidoc 0000664 0000000 0000000 00000001430 15176617013 0026142 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:214
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_moving_max": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.max(values)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/540aefc39303c925a4efff71ebe2f002.asciidoc 0000664 0000000 0000000 00000000517 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significantterms-aggregation.asciidoc:560
[source, python]
----
resp = client.search(
aggs={
"tags": {
"significant_terms": {
"field": "tag",
"min_doc_count": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5433bb83628cc91d81fbe53c533b2a09.asciidoc 0000664 0000000 0000000 00000000765 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/asciifolding-tokenfilter.asciidoc:83
[source, python]
----
resp = client.indices.create(
index="asciifold_example",
settings={
"analysis": {
"analyzer": {
"standard_asciifolding": {
"tokenizer": "standard",
"filter": [
"asciifolding"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5457c94f0039c6b95c7f9f305d0c6b58.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0026372 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-stats.asciidoc:2538
[source, python]
----
resp = client.nodes.stats(
metric="indices",
)
print(resp)
resp1 = client.nodes.stats(
metric="os,process",
)
print(resp1)
resp2 = client.nodes.stats(
node_id="10.0.0.1",
metric="process",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/548a9b6f447bb820380c1c23e57c18c3.asciidoc 0000664 0000000 0000000 00000001000 15176617013 0026340 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:15
[source, python]
----
resp = client.ingest.put_pipeline(
id="cohere_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "cohere_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/548b85bd9e6e7d33e36133953869449b.asciidoc 0000664 0000000 0000000 00000000370 15176617013 0026251 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:338
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"xpack.monitoring.collection.enabled": False
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/54a215d242ab65123b09e9dfb71bcbbf.asciidoc 0000664 0000000 0000000 00000000547 15176617013 0026635 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:237
[source, python]
----
resp = client.search(
aggs={
"genres": {
"terms": {
"field": "genre",
"order": {
"_key": "asc"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/54a47b5d07e7bfbea75c77f35eaae18d.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0027022 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/54c12d5099d7b715c15f5bbf65b386a1.asciidoc 0000664 0000000 0000000 00000000774 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:310
[source, python]
----
resp = client.indices.create(
index="alibabacloud-ai-search-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 1024,
"element_type": "float"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/55085e6a2891040b6ac696561d0787c8.asciidoc 0000664 0000000 0000000 00000001371 15176617013 0026150 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/55096381f811388fafd8e244dd2402c8.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/rollover-index.asciidoc:451
[source, python]
----
resp = client.indices.rollover(
alias="my-alias",
settings={
"index.number_of_shards": 2
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/551467688d8c701315d0a371850a4056.asciidoc 0000664 0000000 0000000 00000000600 15176617013 0025764 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:54
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "hugging-face-embeddings",
"pipeline": "hugging_face_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/551799fef2f86e393db83a967e4a30d1.asciidoc 0000664 0000000 0000000 00000001660 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/aggregate-metric-double.asciidoc:264
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"agg_metric": {
"type": "aggregate_metric_double",
"metrics": [
"min",
"max",
"sum",
"value_count"
],
"default_metric": "max"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"agg_metric": {
"min": -302.5,
"max": 702.3,
"sum": 200,
"value_count": 25
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/553904c175a76d5ba83bc5d46fff7373.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/saml-guide.asciidoc:1031
[source, python]
----
resp = client.security.saml_logout(
token="46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3",
refresh_token="mJdXLtmvTUSpoLwMvdBt_w",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/553d79817bb1333970e99507c37a159a.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0026151 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/similarity.asciidoc:522
[source, python]
----
resp = client.indices.create(
index="index",
settings={
"index": {
"similarity": {
"default": {
"type": "boolean"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc 0000664 0000000 0000000 00000001015 15176617013 0026437 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/nested.asciidoc:60
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"bool": {
"must": [
{
"match": {
"user.first": "Alice"
}
},
{
"match": {
"user.last": "Smith"
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5566cff431570f522e1fc5475b2ed875.asciidoc 0000664 0000000 0000000 00000003527 15176617013 0026375 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/phrase-suggest.asciidoc:22
[source, python]
----
resp = client.indices.create(
index="test",
settings={
"index": {
"number_of_shards": 1,
"analysis": {
"analyzer": {
"trigram": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"shingle"
]
},
"reverse": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"reverse"
]
}
},
"filter": {
"shingle": {
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 3
}
}
}
}
},
mappings={
"properties": {
"title": {
"type": "text",
"fields": {
"trigram": {
"type": "text",
"analyzer": "trigram"
},
"reverse": {
"type": "text",
"analyzer": "reverse"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="test",
refresh=True,
document={
"title": "noble warriors"
},
)
print(resp1)
resp2 = client.index(
index="test",
refresh=True,
document={
"title": "nobel prize"
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/55838e0b21c4f4da2dc8aaec045a6d5f.asciidoc 0000664 0000000 0000000 00000001203 15176617013 0026714 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:185
[source, python]
----
resp = client.search(
index="latency",
size=0,
runtime_mappings={
"load_time.seconds": {
"type": "long",
"script": {
"source": "emit(doc['load_time'].value / params.timeUnit)",
"params": {
"timeUnit": 1000
}
}
}
},
aggs={
"load_time_outlier": {
"percentiles": {
"field": "load_time.seconds"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/558b3f9b987771e9f9f35e51a0d7e062.asciidoc 0000664 0000000 0000000 00000001376 15176617013 0026416 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/profile.asciidoc:1160
[source, python]
----
resp = client.indices.create(
index="my-dfs-index",
settings={
"number_of_shards": 2,
"number_of_replicas": 1
},
mappings={
"properties": {
"my-keyword": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="my-dfs-index",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"my-keyword": "a"
},
{
"index": {
"_id": "2"
}
},
{
"my-keyword": "b"
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/5597eeb8f43b5d47bd07f27122c24194.asciidoc 0000664 0000000 0000000 00000000736 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:1073
[source, python]
----
resp = client.async_search.submit(
index="my-index-000001,cluster_one:my-index-000001,cluster_two:my-index-000001",
ccs_minimize_roundtrips=False,
query={
"match": {
"user.id": "kimchy"
}
},
source=[
"user.id",
"message",
"http.response.status_code"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/55d349ccb0efd5e1c06c6dd383a593cf.asciidoc 0000664 0000000 0000000 00000000666 15176617013 0026744 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:1030
[source, python]
----
resp = client.async_search.submit(
index="my-index-000001,cluster*:my-index-*,cluster_three:-my-index-000001",
query={
"match": {
"user.id": "kimchy"
}
},
source=[
"user.id",
"message",
"http.response.status_code"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/55e8ddf643726dec51531ada0bec7143.asciidoc 0000664 0000000 0000000 00000000223 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// slm/apis/slm-stats.asciidoc:32
[source, python]
----
resp = client.slm.get_stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/55f0fec6342f677af74de2124b801aa2.asciidoc 0000664 0000000 0000000 00000000611 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:229
[source, python]
----
resp = client.search(
index="byte-image-index",
knn={
"field": "byte-image-vector",
"query_vector": [
-5,
9
],
"k": 10,
"num_candidates": 100
},
fields=[
"title"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/55f4a15b84b724b9fbf2efd29a4da120.asciidoc 0000664 0000000 0000000 00000000247 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/authenticate.asciidoc:41
[source, python]
----
resp = client.security.authenticate()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5619103306878d58a058bce87c5bd82b.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026304 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/recovery.asciidoc:342
[source, python]
----
resp = client.indices.recovery(
human=True,
detailed=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5632c3b947062d3a5fc0e4f3413b3308.asciidoc 0000664 0000000 0000000 00000000521 15176617013 0026253 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/register-fs-repo.asciidoc:17
[source, python]
----
resp = client.snapshot.create_repository(
name="my_fs_backup",
repository={
"type": "fs",
"settings": {
"location": "/mount/backups/my_fs_backup_location"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/563dfbf421422c837ee6929ae2ede876.asciidoc 0000664 0000000 0000000 00000000305 15176617013 0026532 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/migrate-to-data-stream.asciidoc:59
[source, python]
----
resp = client.indices.migrate_to_data_stream(
name="my-logs",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/565386eee0951865a684e41fab53b40c.asciidoc 0000664 0000000 0000000 00000001024 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-elser.asciidoc:128
[source, python]
----
resp = client.inference.put(
task_type="sparse_embedding",
inference_id="my-elser-model",
inference_config={
"service": "elser",
"service_settings": {
"adaptive_allocations": {
"enabled": True,
"min_number_of_allocations": 3,
"max_number_of_allocations": 10
},
"num_threads": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56563f91d9f0b74e9e4aae9cb221845b.asciidoc 0000664 0000000 0000000 00000001756 15176617013 0026537 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-cross-cluster-api-key.asciidoc:111
[source, python]
----
resp = client.perform_request(
"POST",
"/_security/cross_cluster/api_key",
headers={"Content-Type": "application/json"},
body={
"name": "my-cross-cluster-api-key",
"expiration": "1d",
"access": {
"search": [
{
"names": [
"logs*"
]
}
],
"replication": [
{
"names": [
"archive*"
]
}
]
},
"metadata": {
"description": "phase one",
"environment": {
"level": 1,
"trusted": True,
"tags": [
"dev",
"staging"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/565908b03edff1d6e6e7cdfb92177faf.asciidoc 0000664 0000000 0000000 00000001000 15176617013 0026743 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/stats-aggregation.asciidoc:53
[source, python]
----
resp = client.search(
index="exams",
size=0,
runtime_mappings={
"grade.weighted": {
"type": "double",
"script": "\n emit(doc['grade'].value * doc['weight'].value)\n "
}
},
aggs={
"grades_stats": {
"stats": {
"field": "grade.weighted"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/568979150ce18739f8d3ea859355aaa3.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026323 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-users.asciidoc:92
[source, python]
----
resp = client.security.get_user(
username="jacknich",
with_profile_uid=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/569f10fee671632017c722fd983009d4.asciidoc 0000664 0000000 0000000 00000002045 15176617013 0026223 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:548
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"shop": {
"terms": {
"field": "shop"
}
}
},
{
"product": {
"terms": {
"field": "product"
}
}
},
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56a1aa4f7fa62f2289e20607e3039bf3.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:19
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"email": {
"type": "keyword"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56a903530990313b753b1be33578997a.asciidoc 0000664 0000000 0000000 00000001615 15176617013 0026064 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:448
[source, python]
----
resp = client.search(
query={
"dis_max": {
"queries": [
{
"multi_match": {
"query": "Will Smith",
"type": "cross_fields",
"fields": [
"first",
"last"
],
"minimum_should_match": "50%"
}
},
{
"multi_match": {
"query": "Will Smith",
"type": "cross_fields",
"fields": [
"*.edge"
]
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56b6b50b174a935d368301ebd717231d.asciidoc 0000664 0000000 0000000 00000000267 15176617013 0026265 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/stats.asciidoc:125
[source, python]
----
resp = client.watcher.stats(
metric="current_watches",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56da252798b8e7b006738428aa1a7f4c.asciidoc 0000664 0000000 0000000 00000001203 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:373
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"my_range": {
"type": "long_range"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"my_range": {
"gt": 200,
"lt": 300
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/56da9c55774f4c2e8eadde0579bdc60c.asciidoc 0000664 0000000 0000000 00000001071 15176617013 0026746 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:463
[source, python]
----
resp = client.search(
index="test*",
filter_path="aggregations",
aggs={
"tm": {
"top_metrics": {
"metrics": {
"field": "m"
},
"sort": {
"s": {
"order": "asc",
"numeric_type": "double"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56db76c987106a870357854d3068ad98.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026164 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-rules/apis/list-query-rulesets.asciidoc:164
[source, python]
----
resp = client.query_rules.list_rulesets()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56e90a63f94eeb882fe8acbcd74229c2.asciidoc 0000664 0000000 0000000 00000001430 15176617013 0026670 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:256
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_moving_min": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.min(values)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56f3a6bec7be5a90fb43144c331a5b5a.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026635 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:260
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
flat_settings=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/56fa6c9e08258157d445e2f92274962b.asciidoc 0000664 0000000 0000000 00000000636 15176617013 0026244 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/shingle-tokenfilter.asciidoc:220
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 3,
"output_unigrams": False
}
],
text="quick brown fox jumps",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/571314a948e49f1f9614d36fcf79392a.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026317 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:877
[source, python]
----
resp = client.async_search.get(
id="FjktRGJ1Y2w1U0phLTRhZnVyeUZ2MVEbWEJyeVBPQldTV3FGZGdIeUVabXBldzo5NzA4",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/578808065fee8691355b8f25c35782cd.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026247 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/profile.asciidoc:1023
[source, python]
----
resp = client.search(
index="my-index-000001",
filter_path="profile.shards.fetch",
profile=True,
query={
"term": {
"user.id": {
"value": "elkbee"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5797df4b8e71d821a1488cbb63481104.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/troubleshooting-shards-capacity.asciidoc:418
[source, python]
----
resp = client.health_report(
feature="shards_capacity",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/57a3e8d2ca64e37e90d658c4cd935399.asciidoc 0000664 0000000 0000000 00000001170 15176617013 0026461 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/distance-feature-query.asciidoc:127
[source, python]
----
resp = client.search(
index="items",
query={
"bool": {
"must": {
"match": {
"name": "chocolate"
}
},
"should": {
"distance_feature": {
"field": "location",
"pivot": "1000m",
"origin": [
-71.3,
41.15
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/57c690f8fa95bacf4b250803be7467e4.asciidoc 0000664 0000000 0000000 00000000365 15176617013 0026532 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:427
[source, python]
----
resp = client.index(
index="example",
document={
"location": "BBOX (1000.0, 1002.0, 2000.0, 1000.0)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/57dc15e5ad663c342fd5c1d86fcd1b29.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/oidc-prepare-authentication-api.asciidoc:106
[source, python]
----
resp = client.security.oidc_prepare_authentication(
realm="oidc1",
state="lGYK0EcSLjqH6pkT5EVZjC6eIW5YCGgywj2sxROO",
nonce="zOBXLJGUooRrbLbQk5YCcyC8AXw3iloynvluYhZ5",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/57e0bbab98f17d5b564d1ea146a55fe4.asciidoc 0000664 0000000 0000000 00000001465 15176617013 0026660 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template.asciidoc:227
[source, python]
----
resp = client.indices.put_index_template(
name="template_1",
index_patterns=[
"temp*"
],
priority=0,
template={
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"_source": {
"enabled": False
}
}
},
)
print(resp)
resp1 = client.indices.put_index_template(
name="template_2",
index_patterns=[
"template*"
],
priority=1,
template={
"settings": {
"number_of_shards": 2
},
"mappings": {
"_source": {
"enabled": True
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/582c4b05401dbc190b19411282d85310.asciidoc 0000664 0000000 0000000 00000000617 15176617013 0026105 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:380
[source, python]
----
resp = client.update(
index="my-index-000001",
id="1",
script={
"source": "if (ctx._source.tags.contains(params['tag'])) { ctx.op = 'delete' } else { ctx.op = 'none' }",
"lang": "painless",
"params": {
"tag": "green"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/582da02c09e0597b4396c87e33571e7b.asciidoc 0000664 0000000 0000000 00000000451 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:311
[source, python]
----
resp = client.sql.query(
format="json",
cursor="sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5836b09198feb1269ed12839b416123d.asciidoc 0000664 0000000 0000000 00000000475 15176617013 0026230 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/5837d5f50665ac0a26181d3aaeb3f204.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/start-trained-model-deployment.asciidoc:214
[source, python]
----
resp = client.ml.start_trained_model_deployment(
model_id="my_model",
deployment_id="my_model_for_search",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/584f502cf840134f2db5f39e2483ced1.asciidoc 0000664 0000000 0000000 00000002167 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1454
[source, python]
----
resp = client.indices.create(
index="portuguese_example",
settings={
"analysis": {
"filter": {
"portuguese_stop": {
"type": "stop",
"stopwords": "_portuguese_"
},
"portuguese_keywords": {
"type": "keyword_marker",
"keywords": [
"exemplo"
]
},
"portuguese_stemmer": {
"type": "stemmer",
"language": "light_portuguese"
}
},
"analyzer": {
"rebuilt_portuguese": {
"tokenizer": "standard",
"filter": [
"lowercase",
"portuguese_stop",
"portuguese_keywords",
"portuguese_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/585a34ad79aee16678b37da785933ac8.asciidoc 0000664 0000000 0000000 00000000211 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/stop.asciidoc:85
[source, python]
----
resp = client.ilm.stop()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/585b19369cb9b9763a7e8d405f009a47.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:249
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
runtime={
"day_of_week": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5865ca8d2bcd087ed5dbee33fafee57f.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0027170 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-existing-data-stream.asciidoc:111
[source, python]
----
resp = client.indices.explain_data_lifecycle(
index=".ds-my-data-stream-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/586cfa0e5fd695b7d451e854f9fb4a9c.asciidoc 0000664 0000000 0000000 00000001741 15176617013 0026706 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-grid-query.asciidoc:20
[source, python]
----
resp = client.indices.create(
index="my_locations",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.index(
index="my_locations",
id="1",
refresh=True,
document={
"location": "POINT(4.912350 52.374081)",
"city": "Amsterdam",
"name": "NEMO Science Museum"
},
)
print(resp1)
resp2 = client.index(
index="my_locations",
id="2",
refresh=True,
document={
"location": "POINT(4.405200 51.222900)",
"city": "Antwerp",
"name": "Letterenhuis"
},
)
print(resp2)
resp3 = client.index(
index="my_locations",
id="3",
refresh=True,
document={
"location": "POINT(2.336389 48.861111)",
"city": "Paris",
"name": "Musée du Louvre"
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/58ca855be30049f8f0879e532db51ee2.asciidoc 0000664 0000000 0000000 00000002402 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/put-transform.asciidoc:320
[source, python]
----
resp = client.transform.put_transform(
transform_id="ecommerce_transform1",
source={
"index": "kibana_sample_data_ecommerce",
"query": {
"term": {
"geoip.continent_name": {
"value": "Asia"
}
}
}
},
pivot={
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id",
"missing_bucket": True
}
}
},
"aggregations": {
"max_price": {
"max": {
"field": "taxful_total_price"
}
}
}
},
description="Maximum priced ecommerce data by customer_id in Asia",
dest={
"index": "kibana_sample_data_ecommerce_transform1",
"pipeline": "add_timestamp_pipeline"
},
frequency="5m",
sync={
"time": {
"field": "order_date",
"delay": "60s"
}
},
retention_policy={
"time": {
"field": "order_date",
"max_age": "30d"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/58dd26afc919722e21358c91e112b27a.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026350 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/58e684e0b771b4646662fe12d3060c05.asciidoc 0000664 0000000 0000000 00000000754 15176617013 0026220 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/cjk-width-tokenfilter.asciidoc:69
[source, python]
----
resp = client.indices.create(
index="cjk_width_example",
settings={
"analysis": {
"analyzer": {
"standard_cjk_width": {
"tokenizer": "standard",
"filter": [
"cjk_width"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/58f72be60c25752d7899a35fc60fe6eb.asciidoc 0000664 0000000 0000000 00000000363 15176617013 0026541 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/misc.asciidoc:182
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.indices.recovery": "DEBUG"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/591c7fb7451069829a14bba593136f1f.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026300 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/forecast.asciidoc:88
[source, python]
----
resp = client.ml.forecast(
job_id="low_request_rate",
duration="10d",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5969c446688c8b326acc80276573e9d2.asciidoc 0000664 0000000 0000000 00000001503 15176617013 0026245 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:324
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"number_of_fragments": 3,
"fragment_size": 150,
"fields": {
"body": {
"pre_tags": [
""
],
"post_tags": [
" "
]
},
"blog.title": {
"number_of_fragments": 0
},
"blog.author": {
"number_of_fragments": 0
},
"blog.comment": {
"number_of_fragments": 5,
"order": "score"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/59726e3c90e1218487a781508788c243.asciidoc 0000664 0000000 0000000 00000000634 15176617013 0026022 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/autodatehistogram-aggregation.asciidoc:293
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sale_date": {
"auto_date_histogram": {
"field": "date",
"buckets": 10,
"missing": "2000/01/01"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/597d456edfcb3d410954a3e9b5babf9a.asciidoc 0000664 0000000 0000000 00000000706 15176617013 0026744 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/disk-usage.asciidoc:51
[source, python]
----
resp = client.indices.create(
index="index",
mappings={
"dynamic_templates": [
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5987afb2c17c73fe3d860937565ef115.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026372 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/point-in-time-api.asciidoc:46
[source, python]
----
resp = client.open_point_in_time(
index="my-index-000001",
keep_alive="1m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/599454613ac699d447537e79e65ae35a.asciidoc 0000664 0000000 0000000 00000000654 15176617013 0026256 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:67
[source, python]
----
resp = client.search(
index="my-index-000001",
script_fields={
"my_doubled_field": {
"script": {
"source": "doc['my_field'].value * params['multiplier']",
"params": {
"multiplier": 2
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/599f693cc7d30b1153f5eeecec8eb23a.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/delete-index-template-v1.asciidoc:35
[source, python]
----
resp = client.indices.delete_template(
name="my-legacy-index-template",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/59aa5216630f80c5dc298fc5bba4a819.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026513 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/59b8b9555f4aa30bc4613f819e9fc8f0.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/close.asciidoc:78
[source, python]
----
resp = client.indices.close(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/59d015f7bd0eeab40d0885010a62fa70.asciidoc 0000664 0000000 0000000 00000001200 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/role-templates.asciidoc:52
[source, python]
----
resp = client.security.put_role(
name="example2",
indices=[
{
"names": [
"my-index-000001"
],
"privileges": [
"read"
],
"query": {
"template": {
"source": {
"term": {
"group.id": "{{_user.metadata.group_id}}"
}
}
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc 0000664 0000000 0000000 00000000614 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-openai.asciidoc:177
[source, python]
----
resp = client.inference.put(
task_type="completion",
inference_id="openai-completion",
inference_config={
"service": "openai",
"service_settings": {
"api_key": "",
"model_id": "gpt-3.5-turbo"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/59f0ad2a6f97200e98e8eb079cdd8334.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-get.asciidoc:162
[source, python]
----
resp = client.mget(
index="my-index-000001",
ids=[
"1",
"2"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5a006feed86309b547bbaa1baca1c496.asciidoc 0000664 0000000 0000000 00000003477 15176617013 0026725 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:148
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"numeric_counts": {
"match_mapping_type": [
"long",
"double"
],
"match": "count",
"mapping": {
"type": "{dynamic_type}",
"index": False
}
}
},
{
"integers": {
"match_mapping_type": "long",
"mapping": {
"type": "integer"
}
}
},
{
"strings": {
"match_mapping_type": "string",
"mapping": {
"type": "text",
"fields": {
"raw": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
{
"non_objects_keyword": {
"match_mapping_type": "*",
"unmatch_mapping_type": "object",
"mapping": {
"type": "keyword"
}
}
}
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"my_integer": 5,
"my_string": "Some string",
"my_boolean": "false",
"field": {
"count": 4
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/5a3855f1b3e37d89ab7cbcc4f7ae1dd3.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0027014 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc:43
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "limit",
"max_token_count": 2
}
],
text="quick fox jumps over lazy dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5a3fe9584d203d1fd6c96981ba34e0de.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/geo-match-enrich-policy-type-ex.asciidoc:17
[source, python]
----
resp = client.indices.create(
index="postal_codes",
mappings={
"properties": {
"location": {
"type": "geo_shape"
},
"postal_code": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5a6bb9ac6830668ecc00550c1aa8f2f1.asciidoc 0000664 0000000 0000000 00000000724 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:286
[source, python]
----
resp = client.security.put_role(
name="logstash-reader",
indices=[
{
"names": [
"logstash-*"
],
"privileges": [
"read_cross_cluster",
"read",
"view_index_metadata"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5a754dcc854b9154296550a0b581cb9d.asciidoc 0000664 0000000 0000000 00000000560 15176617013 0026356 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/ipprefix-aggregation.asciidoc:50
[source, python]
----
resp = client.search(
index="network-traffic",
size=0,
aggs={
"ipv4-subnets": {
"ip_prefix": {
"field": "ipv4",
"prefix_length": 24
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5a7f05ab1d05b4eef5ff327168517165.asciidoc 0000664 0000000 0000000 00000000510 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-shard-routing.asciidoc:140
[source, python]
----
resp = client.search(
index="my-index-000001",
routing="my-routing-value,my-routing-value-2",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5ab9b44939fb30f5b4adbdcc4bcc0733.asciidoc 0000664 0000000 0000000 00000001017 15176617013 0026776 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-ilm.asciidoc:53
[source, python]
----
resp = client.ilm.put_lifecycle(
name="datastream_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_age": "5m"
},
"downsample": {
"fixed_interval": "1h"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5ad365ed9e1a3c26093a0f09666c133a.asciidoc 0000664 0000000 0000000 00000000735 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:252
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping5",
role_templates=[
{
"template": {
"source": "{{#tojson}}groups{{/tojson}}"
},
"format": "json"
}
],
rules={
"field": {
"realm.name": "saml1"
}
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5afbd9caed88c32f8a2968c07054f096.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/logstash/delete-pipeline.asciidoc:73
[source, python]
----
resp = client.logstash.delete_pipeline(
id="my_pipeline",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b0cc9e186a8f765a11141809b8b17b7.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026351 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search-application/apis/list-search-applications.asciidoc:106
[source, python]
----
resp = client.search_application.list(
from_="0",
size="3",
q="app*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b191f2dbfa46c774cc9b9b9e8d1d831.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-user-privileges.asciidoc:40
[source, python]
----
resp = client.security.get_user_privileges()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b1ae98ad03e2819fc7c3468840ef448.asciidoc 0000664 0000000 0000000 00000000440 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:637
[source, python]
----
resp = client.eql.search(
index="my-index*",
query="\n sample by host\n [any where uptime > 0]\n [any where port > 100]\n [any where bool == true]\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b266deba5396c7810af1b8315c23596.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-grid-query.asciidoc:62
[source, python]
----
resp = client.search(
index="my_locations",
size=0,
aggs={
"grouped": {
"geohash_grid": {
"field": "location",
"precision": 2
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b281956e35a26e734c482b42b356c0d.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026270 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/alias-exists.asciidoc:16
[source, python]
----
resp = client.indices.exists_alias(
name="my-alias",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b2a13366bd4e1ab4b25d04d360570dc.asciidoc 0000664 0000000 0000000 00000000717 15176617013 0026463 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-component-template.asciidoc:262
[source, python]
----
resp = client.cluster.put_component_template(
name="template_1",
template={
"settings": {
"number_of_shards": 1
}
},
meta={
"description": "set number of shards to one",
"serialization": {
"class": "MyComponentTemplate",
"id": 10
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b3384992c398ea8a3064d2e08725e2b.asciidoc 0000664 0000000 0000000 00000002742 15176617013 0026310 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:291
[source, python]
----
resp = client.indices.create(
index="node",
mappings={
"properties": {
"ip": {
"type": "ip"
},
"date": {
"type": "date"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="node",
refresh=True,
operations=[
{
"index": {}
},
{
"ip": "192.168.0.1",
"date": "2020-01-01T01:01:01",
"m": 1
},
{
"index": {}
},
{
"ip": "192.168.0.1",
"date": "2020-01-01T02:01:01",
"m": 2
},
{
"index": {}
},
{
"ip": "192.168.0.2",
"date": "2020-01-01T02:01:01",
"m": 3
}
],
)
print(resp1)
resp2 = client.search(
index="node",
filter_path="aggregations",
aggs={
"ip": {
"terms": {
"field": "ip"
},
"aggs": {
"tm": {
"top_metrics": {
"metrics": {
"field": "m"
},
"sort": {
"date": "desc"
}
}
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/5b58007f10700ec7934580f034404652.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0025760 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/index_.asciidoc:579
[source, python]
----
resp = client.create(
index="my-index-000001",
id="1",
document={
"@timestamp": "2099-11-15T13:12:00",
"message": "GET /search HTTP/1.1 200 1070000",
"user": {
"id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b6bc085943e9189236d98b3c05ed62c.asciidoc 0000664 0000000 0000000 00000001105 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:44
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "25GB"
}
}
},
"delete": {
"min_age": "30d",
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5b7d6f1db88ca6f42c48fa3dbb4341e8.asciidoc 0000664 0000000 0000000 00000000443 15176617013 0026737 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-mapping.asciidoc:85
[source, python]
----
resp = client.indices.get_mapping(
index="*",
)
print(resp)
resp1 = client.indices.get_mapping(
index="_all",
)
print(resp1)
resp2 = client.indices.get_mapping()
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/5b8119b4d9a09f4643be5a5b40875c8f.asciidoc 0000664 0000000 0000000 00000001542 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/boolean.asciidoc:78
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"is_published": True
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"is_published": False
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
aggs={
"publish_state": {
"terms": {
"field": "is_published"
}
}
},
sort=[
"is_published"
],
fields=[
{
"field": "weight"
}
],
runtime_mappings={
"weight": {
"type": "long",
"script": "emit(doc['is_published'].value ? 10 : 0)"
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/5bb0d84185df2f276f01bb2fba709e1a.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026633 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1482
[source, python]
----
resp = client.eql.search(
index="cluster_one:my-data-stream,cluster_two:my-data-stream",
query="\n process where process.name == \"regsvr32.exe\"\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5bba213a7f543190139d1a69ab2ed076.asciidoc 0000664 0000000 0000000 00000000535 15176617013 0026415 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/5bbccf103107e505c17ae59863753efd.asciidoc 0000664 0000000 0000000 00000000377 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-influencer.asciidoc:158
[source, python]
----
resp = client.ml.get_influencers(
job_id="high_sum_total_sales",
sort="influencer_score",
desc=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5c187ba92dd1678fda86b5eec8cc7421.asciidoc 0000664 0000000 0000000 00000000763 15176617013 0026674 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/script-query.asciidoc:24
[source, python]
----
resp = client.search(
query={
"bool": {
"filter": {
"script": {
"script": "\n double amount = doc['amount'].value;\n if (doc['type'].value == 'expense') {\n amount *= -1;\n }\n return amount < 10;\n "
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5c22172a944864a7d138decdc08558b4.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/detect-threats-with-eql.asciidoc:73
[source, python]
----
resp = client.cat.indices(
index="my-data-stream",
v=True,
h="health,status,index,docs.count",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5c249eaeb99e6aee07162128288ac1b1.asciidoc 0000664 0000000 0000000 00000001576 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/moving-percentiles-aggregation.asciidoc:43
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_percentile": {
"percentiles": {
"field": "price",
"percents": [
1,
99
]
}
},
"the_movperc": {
"moving_percentiles": {
"buckets_path": "the_percentile",
"window": 10
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5c24a9a0ddbfa50628dacdb9d25f7ab0.asciidoc 0000664 0000000 0000000 00000000554 15176617013 0027056 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/extendedstats-aggregation.asciidoc:172
[source, python]
----
resp = client.search(
index="exams",
size=0,
aggs={
"grades_stats": {
"extended_stats": {
"field": "grade",
"missing": 0
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5c2f486c27bd5346e512265f93375d16.asciidoc 0000664 0000000 0000000 00000000534 15176617013 0026227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/range-query.asciidoc:241
[source, python]
----
resp = client.search(
query={
"range": {
"timestamp": {
"time_zone": "+01:00",
"gte": "2020-01-01T00:00:00",
"lte": "now"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5c6fbeac20dc23b613847f35d431ecab.asciidoc 0000664 0000000 0000000 00000001601 15176617013 0026710 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/function-score-query.asciidoc:578
[source, python]
----
resp = client.search(
query={
"function_score": {
"functions": [
{
"gauss": {
"price": {
"origin": "0",
"scale": "20"
}
}
},
{
"gauss": {
"location": {
"origin": "11, 12",
"scale": "2km"
}
}
}
],
"query": {
"match": {
"properties": "balcony"
}
},
"score_mode": "multiply"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5c7ece1f30267adabdb832424871900a.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026467 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-unbalanced-cluster.asciidoc:24
[source, python]
----
resp = client.cat.allocation(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5c8ac24dd56e85d8f3f6705ec3c6dc32.asciidoc 0000664 0000000 0000000 00000001167 15176617013 0026672 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/circle.asciidoc:27
[source, python]
----
resp = client.indices.create(
index="circles",
mappings={
"properties": {
"circle": {
"type": "geo_shape"
}
}
},
)
print(resp)
resp1 = client.ingest.put_pipeline(
id="polygonize_circles",
description="translate circle to polygon",
processors=[
{
"circle": {
"field": "circle",
"error_distance": 28,
"shape_type": "geo_shape"
}
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/5ccfd9f4698dcd7cdfbc6bad60081aab.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0027232 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/get-dfanalytics.asciidoc:218
[source, python]
----
resp = client.ml.get_data_frame_analytics(
id="loganalytics",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5cd792dff7d5891c33bef098d9338ce1.asciidoc 0000664 0000000 0000000 00000001522 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/store.asciidoc:20
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"title": {
"type": "text",
"store": True
},
"date": {
"type": "date",
"store": True
},
"content": {
"type": "text"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"title": "Some short title",
"date": "2015-01-01",
"content": "A very long content field..."
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
stored_fields=[
"title",
"date"
],
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/5ceb734e3affe00e2cdc29af748d95bf.asciidoc 0000664 0000000 0000000 00000001036 15176617013 0027100 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/5cf12cc4f98d98dc79bead7e6556679c.asciidoc 0000664 0000000 0000000 00000000543 15176617013 0026720 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/5cfab507e50d8c5182939412a9dbcdc8.asciidoc 0000664 0000000 0000000 00000003523 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geocentroid-aggregation.asciidoc:184
[source, python]
----
resp = client.indices.create(
index="places",
mappings={
"properties": {
"geometry": {
"type": "geo_shape"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="places",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"name": "NEMO Science Museum",
"geometry": "POINT(4.912350 52.374081)"
},
{
"index": {
"_id": 2
}
},
{
"name": "Sportpark De Weeren",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
4.965305328369141,
52.39347642069457
],
[
4.966979026794433,
52.391721758934835
],
[
4.969425201416015,
52.39238958618537
],
[
4.967944622039794,
52.39420969150824
],
[
4.965305328369141,
52.39347642069457
]
]
]
}
}
],
)
print(resp1)
resp2 = client.search(
index="places",
size="0",
aggs={
"centroid": {
"geo_centroid": {
"field": "geometry"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/5d03bb385904d20c5323885706738459.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026007 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/aliases.asciidoc:16
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"add": {
"index": "my-data-stream",
"alias": "my-alias"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5d3ee81bcf6ad57f39052c9065963cc3.asciidoc 0000664 0000000 0000000 00000001377 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/copy-to.asciidoc:139
[source, python]
----
resp = client.indices.create(
index="test_index",
mappings={
"dynamic": "strict",
"properties": {
"description": {
"properties": {
"notes": {
"type": "text",
"copy_to": [
"description.notes_raw"
],
"analyzer": "standard",
"search_analyzer": "standard"
},
"notes_raw": {
"type": "keyword"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5d428ea66252fd252b6a8d6f47605c86.asciidoc 0000664 0000000 0000000 00000001521 15176617013 0026365 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc:176
[source, python]
----
resp = client.indices.create(
index="cjk_bigram_example",
settings={
"analysis": {
"analyzer": {
"han_bigrams": {
"tokenizer": "standard",
"filter": [
"han_bigrams_filter"
]
}
},
"filter": {
"han_bigrams_filter": {
"type": "cjk_bigram",
"ignored_scripts": [
"hangul",
"hiragana",
"katakana"
],
"output_unigrams": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5d5b06468c54308f52c212cca5d58fef.asciidoc 0000664 0000000 0000000 00000000514 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:469
[source, python]
----
resp = client.sql.query(
format="json",
cursor="sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl+v///w8=",
columnar=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5d5cdbd4c5c62a90ff2a39cba4a59368.asciidoc 0000664 0000000 0000000 00000001163 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:610
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
params={
"elser": True,
"text": True,
"query_string": "where is the best mountain climbing?",
"elser_fields": [
{
"name": "title",
"boost": 1
},
{
"name": "description",
"boost": 1
}
],
"text_query_boost": 4,
"min_score": 10
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5d689d74062cddd01a0711a2fa7f23fd.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/network/tracers.asciidoc:92
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.transport.TransportService.tracer": "TRACE"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5d7980d8c745abf7ea0fa573e818bd5b.asciidoc 0000664 0000000 0000000 00000001353 15176617013 0026672 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/shingle-tokenfilter.asciidoc:488
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"en": {
"tokenizer": "standard",
"filter": [
"my_shingle_filter"
]
}
},
"filter": {
"my_shingle_filter": {
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 5,
"output_unigrams": False
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5d9d7b84e2fec7ecd832145cbb951cf1.asciidoc 0000664 0000000 0000000 00000001337 15176617013 0026747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:600
[source, python]
----
resp = client.search(
size=0,
aggs={
"expired_sessions": {
"terms": {
"field": "account_id",
"include": {
"partition": 0,
"num_partitions": 20
},
"size": 10000,
"order": {
"last_access": "asc"
}
},
"aggs": {
"last_access": {
"max": {
"field": "access_date"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5da6efd5b038ada64c9e853c88c1ec47.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:114
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "brown fox",
"type": "best_fields",
"fields": [
"subject",
"message"
],
"tie_breaker": 0.3
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5daf8ede198be9b118da5bee9896cb00.asciidoc 0000664 0000000 0000000 00000001545 15176617013 0027035 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:333
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"flattened": {
"type": "flattened"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"flattened": {
"field": [
"apple",
"apple",
"banana",
"avocado",
"10",
"200",
"AVOCADO",
"Banana",
"Tangerine"
]
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/5dbf06ca9058843f572676fcaf587f75.asciidoc 0000664 0000000 0000000 00000000571 15176617013 0026471 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/variablewidthhistogram-aggregation.asciidoc:18
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"prices": {
"variable_width_histogram": {
"field": "price",
"buckets": 2
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5ddc26da6e163fda54f52d33b5157051.asciidoc 0000664 0000000 0000000 00000000545 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/semantic-search/search.asciidoc:9
[source, python]
----
resp = client.search(
index="my-index",
query={
"sparse_vector": {
"field": "my_tokens",
"inference_id": "my-elser-endpoint",
"query": "the query string"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5deeed427f35cbaee4b8ddc45002a9d7.asciidoc 0000664 0000000 0000000 00000000374 15176617013 0027075 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-delete-roles.asciidoc:77
[source, python]
----
resp = client.security.bulk_delete_role(
names=[
"my_admin_role",
"not_an_existing_role"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5df3226fdc8f1f66ae92ba2f527af8c0.asciidoc 0000664 0000000 0000000 00000000336 15176617013 0026741 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:52
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"my_field": 5
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5dfb23f6e36ef484f1d3271bae76a8d1.asciidoc 0000664 0000000 0000000 00000000246 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/recovery.asciidoc:240
[source, python]
----
resp = client.indices.recovery(
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5dfe24287bb930ad33345caf092a004b.asciidoc 0000664 0000000 0000000 00000000475 15176617013 0026475 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/exists-query.asciidoc:56
[source, python]
----
resp = client.search(
query={
"bool": {
"must_not": {
"exists": {
"field": "user.id"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e021307d331a4483a5aa2198168451b.asciidoc 0000664 0000000 0000000 00000001311 15176617013 0026102 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-roles.asciidoc:189
[source, python]
----
resp = client.security.put_role(
name="only_remote_access_role",
remote_indices=[
{
"clusters": [
"my_remote"
],
"names": [
"logs*"
],
"privileges": [
"read",
"read_cross_cluster",
"view_index_metadata"
]
}
],
remote_cluster=[
{
"clusters": [
"my_remote"
],
"privileges": [
"monitor_stats"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e099493f135ff7bd614e935c4f2bf5a.asciidoc 0000664 0000000 0000000 00000000516 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shard-request-cache.asciidoc:88
[source, python]
----
resp = client.search(
index="my-index-000001",
request_cache=True,
size=0,
aggs={
"popular_colors": {
"terms": {
"field": "colors"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e124875d97c27362ae858160ae1c6d5.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:50
[source, python]
----
resp = client.ccr.get_auto_follow_pattern()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e21dbac92f34d236a8f0cc0d3a39cdd.asciidoc 0000664 0000000 0000000 00000001645 15176617013 0027001 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/jwt-realm.asciidoc:411
[source, python]
----
resp = client.security.put_role_mapping(
name="jwt1_users",
refresh=True,
roles=[
"user"
],
rules={
"all": [
{
"field": {
"realm.name": "jwt1"
}
},
{
"field": {
"username": "principalname1"
}
},
{
"field": {
"dn": "CN=Principal Name 1,DC=example.com"
}
},
{
"field": {
"groups": "group1"
}
},
{
"field": {
"metadata.jwt_claim_other": "other1"
}
}
]
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e2f7097eb299de553d0fa0087d70a59.asciidoc 0000664 0000000 0000000 00000001247 15176617013 0026453 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:748
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index": {
"sort.field": [
"username",
"timestamp"
],
"sort.order": [
"asc",
"desc"
]
}
},
mappings={
"properties": {
"username": {
"type": "keyword",
"doc_values": True
},
"timestamp": {
"type": "date"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e3673bcbef5731746e400c4f3fe134d.asciidoc 0000664 0000000 0000000 00000001063 15176617013 0026511 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-shape-query.asciidoc:262
[source, python]
----
resp = client.index(
index="test",
id="1",
document={
"location": [
{
"coordinates": [
46.25,
20.14
],
"type": "point"
},
{
"coordinates": [
47.49,
19.04
],
"type": "point"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e415c490a46358643ee2aab554b4876.asciidoc 0000664 0000000 0000000 00000000536 15176617013 0026302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:63
[source, python]
----
resp = client.cluster.allocation_explain(
filter_path="index,node_allocation_decisions.node_name,node_allocation_decisions.deciders.*",
index="my-index",
shard=0,
primary=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e47a407b6ca29dadf6eac5ab1d71163.asciidoc 0000664 0000000 0000000 00000001630 15176617013 0026716 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-polygon-query.asciidoc:12
[source, python]
----
resp = client.search(
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_polygon": {
"person.location": {
"points": [
{
"lat": 40,
"lon": -70
},
{
"lat": 30,
"lon": -80
},
{
"lat": 20,
"lon": -90
}
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e6419bc3e2db0d0f05bce58d8cc9215.asciidoc 0000664 0000000 0000000 00000001500 15176617013 0026641 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:669
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"rename": {
"description": "Rename 'provider' to 'cloud.provider'",
"field": "provider",
"target_field": "cloud.provider",
"on_failure": [
{
"set": {
"description": "Set 'error.message'",
"field": "error.message",
"value": "Field 'provider' does not exist. Cannot rename to 'cloud.provider'",
"override": False
}
}
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e87dd38ac3a0fd59ad794005b16d13e.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026563 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:353
[source, python]
----
resp = client.slm.get_lifecycle(
policy_id="nightly-snapshots",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5e9a7845e60b79685aab59877c5fbd1a.asciidoc 0000664 0000000 0000000 00000000430 15176617013 0026540 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/ignored-field.asciidoc:51
[source, python]
----
resp = client.search(
aggs={
"ignored_fields": {
"terms": {
"field": "_ignored"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5ea9da129ca70a5fe534f27a82d80b29.asciidoc 0000664 0000000 0000000 00000000547 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:681
[source, python]
----
resp = client.indices.create(
index="example",
mappings={
"properties": {
"comment": {
"type": "text",
"index_options": "offsets"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5f031b7bd2b7d98d2d10df7420d269ff.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026566 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:407
[source, python]
----
resp = client.indices.resolve_index(
name="new-data-stream*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5f16358ebb5d14b86f57612d5f92d923.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0026367 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/5f1ed9cfdc149763b444acfbe10b0e16.asciidoc 0000664 0000000 0000000 00000000531 15176617013 0026722 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:271
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"user_id": {
"type": "keyword",
"ignore_above": 20
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5f3373887e8d3dc31239b687a5151449.asciidoc 0000664 0000000 0000000 00000001247 15176617013 0026161 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/coerce.asciidoc:19
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"number_one": {
"type": "integer"
},
"number_two": {
"type": "integer",
"coerce": False
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"number_one": "10"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"number_two": "10"
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/5f3549ac7fee94682ca0d7439eebdd2a.asciidoc 0000664 0000000 0000000 00000000504 15176617013 0026746 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:235
[source, python]
----
resp = client.search(
index="index_long,index_double",
sort=[
{
"field": {
"numeric_type": "date_nanos"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5f72ab800c3db9d118df95e2a378d411.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026510 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/alias-privileges.asciidoc:59
[source, python]
----
resp = client.get(
index=".ds-my-data-stream-2099.03.09-000003",
id="2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5f7b59d4fad0bdce6b09abb520ddb51d.asciidoc 0000664 0000000 0000000 00000002307 15176617013 0027137 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/use-elasticsearch-for-time-series-data.asciidoc:101
[source, python]
----
resp = client.search(
index="my-data-stream",
runtime_mappings={
"source.ip": {
"type": "ip",
"script": "\n String sourceip=grok('%{IPORHOST:sourceip} .*').extract(doc[ \"message\" ].value)?.sourceip;\n if (sourceip != null) emit(sourceip);\n "
}
},
query={
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"gte": "now-1d/d",
"lt": "now/d"
}
}
},
{
"range": {
"source.ip": {
"gte": "192.0.2.0",
"lte": "192.0.2.255"
}
}
}
]
}
},
fields=[
"*"
],
source=False,
sort=[
{
"@timestamp": "desc"
},
{
"source.ip": "desc"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5f8acd1e367b048b5542dbc6079bcc88.asciidoc 0000664 0000000 0000000 00000001631 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/hyphenation-decompounder-tokenfilter.asciidoc:144
[source, python]
----
resp = client.indices.create(
index="hyphenation_decompound_example",
settings={
"analysis": {
"analyzer": {
"standard_hyphenation_decompound": {
"tokenizer": "standard",
"filter": [
"22_char_hyphenation_decompound"
]
}
},
"filter": {
"22_char_hyphenation_decompound": {
"type": "hyphenation_decompounder",
"word_list_path": "analysis/example_word_list.txt",
"hyphenation_patterns_path": "analysis/hyphenation_patterns.xml",
"max_subword_size": 22
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5f8fb5513d4f725434db2f517ad4298f.asciidoc 0000664 0000000 0000000 00000001553 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/similarity.asciidoc:359
[source, python]
----
resp = client.indices.create(
index="index",
settings={
"number_of_shards": 1,
"similarity": {
"scripted_tfidf": {
"type": "scripted",
"weight_script": {
"source": "double idf = Math.log((field.docCount+1.0)/(term.docFreq+1.0)) + 1.0; return query.boost * idf;"
},
"script": {
"source": "double tf = Math.sqrt(doc.freq); double norm = 1/Math.sqrt(doc.length); return weight * tf * norm;"
}
}
}
},
mappings={
"properties": {
"field": {
"type": "text",
"similarity": "scripted_tfidf"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5faa121e00a0582160b2adb2b72fed67.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-settings.asciidoc:98
[source, python]
----
resp = client.indices.get_settings(
index="log_2099_-*",
name="index.number_*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5fca6671bc8eaddc44ac488d1c3c6909.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-calendar.asciidoc:95
[source, python]
----
resp = client.ml.get_calendars(
calendar_id="planned-outages",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5fd002a018c589eb73fadad25889dbe9.asciidoc 0000664 0000000 0000000 00000003136 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-using-query-rules.asciidoc:122
[source, python]
----
resp = client.query_rules.put_ruleset(
ruleset_id="my-ruleset",
rules=[
{
"rule_id": "rule1",
"type": "pinned",
"criteria": [
{
"type": "fuzzy",
"metadata": "query_string",
"values": [
"puggles",
"pugs"
]
},
{
"type": "exact",
"metadata": "user_country",
"values": [
"us"
]
}
],
"actions": {
"ids": [
"id1",
"id2"
]
}
},
{
"rule_id": "rule2",
"type": "exclude",
"criteria": [
{
"type": "contains",
"metadata": "query_string",
"values": [
"beagles"
]
}
],
"actions": {
"docs": [
{
"_index": "my-index-000001",
"_id": "id3"
},
{
"_index": "my-index-000002",
"_id": "id4"
}
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5fde0d78e9b2cc0519f8a63848ed344e.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026612 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-rules/apis/get-query-ruleset.asciidoc:108
[source, python]
----
resp = client.query_rules.get_ruleset(
ruleset_id="my-ruleset",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/5ffe6fd303400e8678fa1ead291e237f.asciidoc 0000664 0000000 0000000 00000000522 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:30
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_outlier": {
"percentiles": {
"field": "load_time"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/600d33c80f8872dda85c87ed41da95fd.asciidoc 0000664 0000000 0000000 00000001061 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:343
[source, python]
----
resp = client.search(
index="azure-ai-studio-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "azure_ai_studio_embeddings",
"model_text": "Calculate fuel cost"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6013ed65d2058da5ce704b47a504b60a.asciidoc 0000664 0000000 0000000 00000001617 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:222
[source, python]
----
resp = client.bulk(
index="test",
refresh=True,
operations=[
{
"index": {}
},
{
"s": 1,
"m": 3.1415
},
{
"index": {}
},
{
"s": 2,
"m": 1
},
{
"index": {}
},
{
"s": 3,
"m": 2.71828
}
],
)
print(resp)
resp1 = client.search(
index="test",
filter_path="aggregations",
aggs={
"tm": {
"top_metrics": {
"metrics": {
"field": "m"
},
"sort": {
"s": "desc"
},
"size": 3
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/601ad3b0ceccb3fcd282e5ec36748954.asciidoc 0000664 0000000 0000000 00000000363 15176617013 0026650 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-service-credentials.asciidoc:64
[source, python]
----
resp = client.security.get_service_credentials(
namespace="elastic",
service="fleet-server",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/60299454aa19fec15a604a0dd06fe522.asciidoc 0000664 0000000 0000000 00000000446 15176617013 0026422 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/disk/increase-other-node-capacity.asciidoc:27
[source, python]
----
resp = client.cluster.get_settings(
include_defaults=True,
filter_path="*.cluster.routing.allocation.disk.watermark.high*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/602e04051c092cf77de2f75a563661b8.asciidoc 0000664 0000000 0000000 00000000221 15176617013 0026263 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat.asciidoc:63
[source, python]
----
resp = client.cat.master(
help=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/604da59fe41160efa10a846a9dacc07a.asciidoc 0000664 0000000 0000000 00000000356 15176617013 0026636 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/get-async-eql-status-api.asciidoc:25
[source, python]
----
resp = client.eql.get_status(
id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6061aadb3b870791278212d1e8f52b39.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/common/apis/get-ml-memory.asciidoc:234
[source, python]
----
resp = client.ml.get_memory_stats(
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/608cadc6b8a3f194612b69279ccc96de.asciidoc 0000664 0000000 0000000 00000002426 15176617013 0026613 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:728
[source, python]
----
resp = client.search_application.put(
name="my_search_application",
search_application={
"indices": [
"index1"
],
"template": {
"script": {
"lang": "mustache",
"source": "\n {\n \"query\": {\n \"script_score\": {\n \"query\": {\n \"bool\": {\n \"filter\": {\n \"range\": {\n \"{{field}}\": {\n \"{{operator}}\": {{value}}\n }\n }\n }\n }\n },\n \"script\": {\n \"source\": \"cosineSimilarity({{#toJson}}query_vector{{/toJson}}, '{{dense_vector_field}}') + 1.0\"\n }\n }\n }\n }\n ",
"params": {
"field": "price",
"operator": "gte",
"value": 1000,
"dense_vector_field": "product-vector",
"query_vector": []
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6097ae69c64454a92a89ef01b994e9f9.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026415 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/put-synonym-rule.asciidoc:151
[source, python]
----
resp = client.synonyms.put_synonym_rule(
set_id="my-synonyms-set",
rule_id="test-1",
synonyms="hello => hi => howdy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/60a9aa5dcde9023901f6ff27231a10c4.asciidoc 0000664 0000000 0000000 00000001047 15176617013 0026472 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significanttext-aggregation.asciidoc:417
[source, python]
----
resp = client.search(
index="news",
query={
"match": {
"content": "madrid"
}
},
aggs={
"tags": {
"significant_text": {
"field": "content",
"background_filter": {
"term": {
"content": "spain"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/60b0fc1b6ae418621ff1b31591fa1fce.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026627 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:280
[source, python]
----
resp = client.watcher.delete_watch(
id="cluster_health_watch",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/60cab62af1540db2ad3b696b0ee1d7a8.asciidoc 0000664 0000000 0000000 00000000531 15176617013 0026705 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:165
[source, python]
----
resp = client.search(
index="queries",
query={
"percolate": {
"field": "query",
"document": {
"body": "fox jumps over the lazy dog"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/60d3f9a99cc91b43aaa7524a9a74dba0.asciidoc 0000664 0000000 0000000 00000000305 15176617013 0026641 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/rejected-requests.asciidoc:50
[source, python]
----
resp = client.nodes.stats(
metric="breaker",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/60f889fbed5df3185444f7015b48ed76.asciidoc 0000664 0000000 0000000 00000000264 15176617013 0026464 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-index.asciidoc:16
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/610f629d0486a64546d62402a0a5e00f.asciidoc 0000664 0000000 0000000 00000000517 15176617013 0026176 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-syntax.asciidoc:296
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"query_string": {
"query": "kimchy\\!",
"fields": [
"user.id"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/612c2e975f833de9815651135735eae5.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:253
[source, python]
----
resp = client.tasks.cancel(
nodes="nodeId1,nodeId2",
actions="*reindex",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/615dc36f0978c676624fb7d1144b4899.asciidoc 0000664 0000000 0000000 00000000345 15176617013 0026244 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/618c9d42284c067891fb57034a4fd834.asciidoc 0000664 0000000 0000000 00000000253 15176617013 0026227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/start-job.asciidoc:56
[source, python]
----
resp = client.rollup.start_job(
id="sensor",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/61bf6ac15ae3e22323454a9a2872a2fa.asciidoc 0000664 0000000 0000000 00000000507 15176617013 0026471 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cardinality-aggregation.asciidoc:13
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"type_count": {
"cardinality": {
"field": "type"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/61c49cee90c6aa0eafbdd5cc03936e7d.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0027063 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic-mapping.asciidoc:11
[source, python]
----
resp = client.index(
index="data",
id="1",
document={
"count": 5
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/61d6b9503459914c436930c3ae87d454.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026140 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-rules/apis/list-query-rulesets.asciidoc:171
[source, python]
----
resp = client.query_rules.list_rulesets(
from_="0",
size="3",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/61e38e95191f4dde791070c6fce8a092.asciidoc 0000664 0000000 0000000 00000001437 15176617013 0026455 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:546
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_movavg": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.holt(values, 0.3, 0.1)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/621665fdbd7fc103c09bfeed28b67b1a.asciidoc 0000664 0000000 0000000 00000000256 15176617013 0026731 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:150
[source, python]
----
resp = client.count(
filter_path="-_shards",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/621f4553e24592d40c8cdbbdfaeb027e.asciidoc 0000664 0000000 0000000 00000001006 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:387
[source, python]
----
resp = client.search(
index="image-index",
knn={
"field": "image-vector",
"query_vector": [
54,
10,
-2
],
"k": 5,
"num_candidates": 50,
"filter": {
"term": {
"file-type": "png"
}
}
},
fields=[
"title"
],
source=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6220087321e6d288024a70c6b09bd720.asciidoc 0000664 0000000 0000000 00000000515 15176617013 0026113 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:358
[source, python]
----
resp = client.index(
index="my-index-000001",
id="4",
refresh=True,
document={
"query": {
"match": {
"message": "lazy dog"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6244204213f60edf2f23295f9059f2c9.asciidoc 0000664 0000000 0000000 00000000266 15176617013 0026222 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/stats.asciidoc:169
[source, python]
----
resp = client.watcher.stats(
metric="queued_watches",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/624e69dedf42c4877234b87ec1d00068.asciidoc 0000664 0000000 0000000 00000000356 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/snapshot/repeated-snapshot-failures.asciidoc:105
[source, python]
----
resp = client.slm.get_lifecycle(
policy_id="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/62c311e7ab4de8b79e532929a5069975.asciidoc 0000664 0000000 0000000 00000002726 15176617013 0026323 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/rank-features.asciidoc:16
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"topics": {
"type": "rank_features"
},
"negative_reviews": {
"type": "rank_features",
"positive_score_impact": False
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"topics": {
"politics": 20,
"economics": 50.8
},
"negative_reviews": {
"1star": 10,
"2star": 100
}
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"topics": {
"politics": 5.2,
"sports": 80.1
},
"negative_reviews": {
"1star": 1,
"2star": 10
}
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
query={
"rank_feature": {
"field": "topics.politics"
}
},
)
print(resp3)
resp4 = client.search(
index="my-index-000001",
query={
"rank_feature": {
"field": "negative_reviews.1star"
}
},
)
print(resp4)
resp5 = client.search(
index="my-index-000001",
query={
"term": {
"topics": "economics"
}
},
)
print(resp5)
----
python-elasticsearch-9.4.0/docs/examples/62ccee6ad356428c2d625742f961ceb7.asciidoc 0000664 0000000 0000000 00000000345 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-api-key.asciidoc:206
[source, python]
----
resp = client.security.update_api_key(
id="VuaCfGcBCdbkQm-e5aOx",
role_descriptors={},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/62d3c8fccb11471bdc12555c1a7777f2.asciidoc 0000664 0000000 0000000 00000000522 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/synthetic-source.asciidoc:93
[source, python]
----
resp = client.index(
index="idx",
id="1",
document={
"foo": [
{
"bar": 1
},
{
"baz": 2
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/62eafc5b3ab75cc67314d5a8567d6077.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:231
[source, python]
----
resp = client.security.get_api_key(
username="myuser",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/62f1ec1bb5cc5a9c2efd536a7474f549.asciidoc 0000664 0000000 0000000 00000000524 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/hunspell-tokenfilter.asciidoc:73
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "hunspell",
"locale": "en_US"
}
],
text="the foxes jumping quickly",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/630d127ccedd25a6cff31ea098ac2847.asciidoc 0000664 0000000 0000000 00000001506 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/t-test-aggregation.asciidoc:86
[source, python]
----
resp = client.search(
index="node_upgrade",
size=0,
aggs={
"startup_time_ttest": {
"t_test": {
"a": {
"field": "startup_time_before",
"filter": {
"term": {
"group": "A"
}
}
},
"b": {
"field": "startup_time_before",
"filter": {
"term": {
"group": "B"
}
}
},
"type": "heteroscedastic"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6326f5c6fd2a6e6b1aff9a643b94f455.asciidoc 0000664 0000000 0000000 00000001577 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/fields.asciidoc:50
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"text": "quick brown fox",
"popularity": 1
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"text": "quick fox",
"popularity": 5
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"function_score": {
"query": {
"match": {
"text": "quick brown fox"
}
},
"script_score": {
"script": {
"lang": "expression",
"source": "_score * doc['popularity']"
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/6329fb2840a4373ff6d342f2653247cb.asciidoc 0000664 0000000 0000000 00000000266 15176617013 0026300 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// quickstart/getting-started.asciidoc:299
[source, python]
----
resp = client.indices.get_mapping(
index="books",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/634ecacf14b83c5f0bb8b6273cf6418e.asciidoc 0000664 0000000 0000000 00000003507 15176617013 0026656 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-security.asciidoc:128
[source, python]
----
resp = client.search_application.put(
name="website-product-search",
search_application={
"indices": [
"website-products"
],
"template": {
"script": {
"source": {
"query": {
"term": {
"{{field_name}}": "{{field_value}}"
}
},
"aggs": {
"color_facet": {
"terms": {
"field": "color",
"size": "{{agg_size}}"
}
}
}
},
"params": {
"field_name": "product_name",
"field_value": "hello world",
"agg_size": 5
}
},
"dictionary": {
"properties": {
"field_name": {
"type": "string",
"enum": [
"name",
"color",
"description"
]
},
"field_value": {
"type": "string"
},
"agg_size": {
"type": "integer",
"minimum": 1,
"maximum": 10
}
},
"required": [
"field_name"
],
"additionalProperties": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/63521e0089c631d6668c44a0a9d7fdcc.asciidoc 0000664 0000000 0000000 00000001267 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc:123
[source, python]
----
resp = client.indices.create(
index="custom_limit_example",
settings={
"analysis": {
"analyzer": {
"whitespace_five_token_limit": {
"tokenizer": "whitespace",
"filter": [
"five_token_limit"
]
}
},
"filter": {
"five_token_limit": {
"type": "limit",
"max_token_count": 5
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6352e846bb83725ae6d853aa64d8697d.asciidoc 0000664 0000000 0000000 00000001052 15176617013 0026375 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-distance-query.asciidoc:158
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "12km",
"pin.location": {
"lat": 40,
"lon": -70
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6365312d470426cab1b77e9ffde49170.asciidoc 0000664 0000000 0000000 00000000665 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/document-level-security.asciidoc:30
[source, python]
----
resp = client.security.put_role(
name="click_role",
indices=[
{
"names": [
"events-*"
],
"privileges": [
"read"
],
"query": "{\"match\": {\"category\": \"click\"}}"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/636ee2066450605247ec1f68d04b8ee4.asciidoc 0000664 0000000 0000000 00000000443 15176617013 0026277 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1465
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"http.clientip": "40.135.0.0"
}
},
fields=[
"*"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/63893e7e9479a9b60db71dcddcc79aaf.asciidoc 0000664 0000000 0000000 00000000323 15176617013 0026757 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-calendar.asciidoc:44
[source, python]
----
resp = client.ml.delete_calendar(
calendar_id="planned-outages",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/63a53fcb0717ae9033a679cbfc932851.asciidoc 0000664 0000000 0000000 00000001065 15176617013 0026435 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/63bf3480627a89b4b4ede4150e1d6bc0.asciidoc 0000664 0000000 0000000 00000004531 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-create-roles.asciidoc:125
[source, python]
----
resp = client.security.bulk_put_role(
roles={
"my_admin_role": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"index1",
"index2"
],
"privileges": [
"all"
],
"field_security": {
"grant": [
"title",
"body"
]
},
"query": "{\"match\": {\"title\": \"foo\"}}"
}
],
"applications": [
{
"application": "myapp",
"privileges": [
"admin",
"read"
],
"resources": [
"*"
]
}
],
"run_as": [
"other_user"
],
"metadata": {
"version": 1
}
},
"my_user_role": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"index1"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"title",
"body"
]
},
"query": "{\"match\": {\"title\": \"foo\"}}"
}
],
"applications": [
{
"application": "myapp",
"privileges": [
"admin",
"read"
],
"resources": [
"*"
]
}
],
"run_as": [
"other_user"
],
"metadata": {
"version": 1
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/63cc960215ae83b359c12df3c0993bfa.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-index.asciidoc:136
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index": {
"number_of_shards": 3,
"number_of_replicas": 2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/63e20883732ec30b5400046be2efb0f1.asciidoc 0000664 0000000 0000000 00000000255 15176617013 0026327 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/flush.asciidoc:127
[source, python]
----
resp = client.indices.flush(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/63ecdab34940af053acc409164914c32.asciidoc 0000664 0000000 0000000 00000003353 15176617013 0026415 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/sparse-vector.asciidoc:63
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"text": {
"type": "text",
"analyzer": "standard"
},
"impact": {
"type": "sparse_vector"
},
"positive": {
"type": "sparse_vector"
},
"negative": {
"type": "sparse_vector"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
document={
"text": "I had some terribly delicious carrots.",
"impact": [
{
"I": 0.55,
"had": 0.4,
"some": 0.28,
"terribly": 0.01,
"delicious": 1.2,
"carrots": 0.8
},
{
"I": 0.54,
"had": 0.4,
"some": 0.28,
"terribly": 2.01,
"delicious": 0.02,
"carrots": 0.4
}
],
"positive": {
"I": 0.55,
"had": 0.4,
"some": 0.28,
"terribly": 0.01,
"delicious": 1.2,
"carrots": 0.8
},
"negative": {
"I": 0.54,
"had": 0.4,
"some": 0.28,
"terribly": 2.01,
"delicious": 0.02,
"carrots": 0.4
}
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"term": {
"impact": {
"value": "delicious"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/640621cea39cdeeb76fbc95bff31a18d.asciidoc 0000664 0000000 0000000 00000001321 15176617013 0027007 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-last-sync-api.asciidoc:122
[source, python]
----
resp = client.connector.last_sync(
connector_id="my-connector",
last_access_control_sync_error="Houston, we have a problem!",
last_access_control_sync_scheduled_at="2023-11-09T15:13:08.231Z",
last_access_control_sync_status="pending",
last_deleted_document_count=42,
last_incremental_sync_scheduled_at="2023-11-09T15:13:08.231Z",
last_indexed_document_count=42,
last_sync_error="Houston, we have a problem!",
last_sync_scheduled_at="2024-11-09T15:13:08.231Z",
last_sync_status="completed",
last_synced="2024-11-09T15:13:08.231Z",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/640a89d0b39630269433425ff476faf3.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026223 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// upgrade/archived-settings.asciidoc:32
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"archived.*": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/640da6dd719a34975b5627dfa5fcdd55.asciidoc 0000664 0000000 0000000 00000000367 15176617013 0026613 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:487
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"xpack.monitoring.collection.enabled": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/640dbeecb736bd25f6f2b392b76a7531.asciidoc 0000664 0000000 0000000 00000000253 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/stats.asciidoc:1914
[source, python]
----
resp = client.cluster.stats(
include_remotes=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/640e4f2c2d29f9851320a70927bd7a6c.asciidoc 0000664 0000000 0000000 00000000357 15176617013 0026360 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-with-existing-indices.asciidoc:185
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"indices.lifecycle.poll_interval": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/641009f2147e1ca56215c701f45c970b.asciidoc 0000664 0000000 0000000 00000001026 15176617013 0026174 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geotilegrid-aggregation.asciidoc:185
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggregations={
"tiles-in-bounds": {
"geotile_grid": {
"field": "location",
"precision": 22,
"bounds": {
"top_left": "POINT (4.9 52.4)",
"bottom_right": "POINT (5.0 52.3)"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6414b9276ba1c63898c3ff5cbe03c54e.asciidoc 0000664 0000000 0000000 00000000225 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/segments.asciidoc:134
[source, python]
----
resp = client.indices.segments()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/641f75862c70e25e79d249d9e0a79f03.asciidoc 0000664 0000000 0000000 00000001506 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/nested-query.asciidoc:41
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"nested": {
"path": "obj1",
"query": {
"bool": {
"must": [
{
"match": {
"obj1.name": "blue"
}
},
{
"range": {
"obj1.count": {
"gt": 5
}
}
}
]
}
},
"score_mode": "avg"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/642161d70dacf7d153767d37d3726838.asciidoc 0000664 0000000 0000000 00000000305 15176617013 0026223 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-index-caps.asciidoc:171
[source, python]
----
resp = client.rollup.get_rollup_index_caps(
index="*_rollup",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/642c0c1c76e9bf226cd216ebae9ab958.asciidoc 0000664 0000000 0000000 00000002204 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keep-words-tokenfilter.asciidoc:118
[source, python]
----
resp = client.indices.create(
index="keep_words_example",
settings={
"analysis": {
"analyzer": {
"standard_keep_word_array": {
"tokenizer": "standard",
"filter": [
"keep_word_array"
]
},
"standard_keep_word_file": {
"tokenizer": "standard",
"filter": [
"keep_word_file"
]
}
},
"filter": {
"keep_word_array": {
"type": "keep",
"keep_words": [
"one",
"two",
"three"
]
},
"keep_word_file": {
"type": "keep",
"keep_words_path": "analysis/example_word_list.txt"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/643b9506d1129d5215f9a1bb0b509aba.asciidoc 0000664 0000000 0000000 00000001414 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:316
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"full_name": {
"path_match": "name.*",
"path_unmatch": "*.middle",
"mapping": {
"type": "text",
"copy_to": "full_name"
}
}
}
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"name": {
"first": "John",
"middle": "Winston",
"last": "Lennon"
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/643e19c3b6ac1134554dd890e2249c2b.asciidoc 0000664 0000000 0000000 00000000552 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/logs.asciidoc:20
[source, python]
----
resp = client.indices.put_index_template(
name="my-index-template",
index_patterns=[
"logs-*"
],
data_stream={},
template={
"settings": {
"index.mode": "logsdb"
}
},
priority=101,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/645433e8e479e5d71c100f66dd2de5d0.asciidoc 0000664 0000000 0000000 00000044404 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:256
[source, python]
----
resp = client.bulk(
index="my-data-stream",
refresh=True,
pipeline="my-timestamp-pipeline",
operations=[
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:49:00Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 91153,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 463314616
},
"usage": {
"bytes": 307007078,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 585236
},
"rss": {
"bytes": 102728
},
"pagefaults": 120901,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:45:50Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 124501,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 982546514
},
"usage": {
"bytes": 360035574,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1339884
},
"rss": {
"bytes": 381174
},
"pagefaults": 178473,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:44:50Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 38907,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 862723768
},
"usage": {
"bytes": 379572388,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 431227
},
"rss": {
"bytes": 386580
},
"pagefaults": 233166,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:44:40Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 86706,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 567160996
},
"usage": {
"bytes": 103266017,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1724908
},
"rss": {
"bytes": 105431
},
"pagefaults": 233166,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:44:00Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 150069,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 639054643
},
"usage": {
"bytes": 265142477,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1786511
},
"rss": {
"bytes": 189235
},
"pagefaults": 138172,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:42:40Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 82260,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 854735585
},
"usage": {
"bytes": 309798052,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 924058
},
"rss": {
"bytes": 110838
},
"pagefaults": 259073,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:42:10Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 153404,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 279586406
},
"usage": {
"bytes": 214904955,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1047265
},
"rss": {
"bytes": 91914
},
"pagefaults": 302252,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:40:20Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 125613,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 822782853
},
"usage": {
"bytes": 100475044,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 2109932
},
"rss": {
"bytes": 278446
},
"pagefaults": 74843,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:40:10Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 100046,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 567160996
},
"usage": {
"bytes": 362826547,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 1986724
},
"rss": {
"bytes": 402801
},
"pagefaults": 296495,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
},
{
"create": {}
},
{
"@timestamp": "2022-06-21T15:38:30Z",
"kubernetes": {
"host": "gke-apps-0",
"node": "gke-apps-0-0",
"pod": "gke-apps-0-0-0",
"container": {
"cpu": {
"usage": {
"nanocores": 40018,
"core": {
"ns": 12828317850
},
"node": {
"pct": 0.0000277905
},
"limit": {
"pct": 0.0000277905
}
}
},
"memory": {
"available": {
"bytes": 1062428344
},
"usage": {
"bytes": 265142477,
"node": {
"pct": 0.01770037710617187
},
"limit": {
"pct": 0.00009923134671484496
}
},
"workingset": {
"bytes": 2294743
},
"rss": {
"bytes": 340623
},
"pagefaults": 224530,
"majorpagefaults": 0
},
"start_time": "2021-03-30T07:59:06Z",
"name": "container-name-44"
},
"namespace": "namespace26"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64622409407316d2d47094e692d9b516.asciidoc 0000664 0000000 0000000 00000001214 15176617013 0026000 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:401
[source, python]
----
resp = client.ml.evaluate_data_frame(
index="student_performance_mathematics_reg",
query={
"term": {
"ml.is_training": {
"value": False
}
}
},
evaluation={
"regression": {
"actual_field": "G3",
"predicted_field": "ml.G3_prediction",
"metrics": {
"r_squared": {},
"mse": {},
"msle": {},
"huber": {}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6464124d1677f4552ddddd95a340ca3a.asciidoc 0000664 0000000 0000000 00000001245 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:196
[source, python]
----
resp = client.index(
index="library",
refresh=True,
document={
"title": "Book #1",
"rating": 200.1
},
)
print(resp)
resp1 = client.index(
index="library",
refresh=True,
document={
"title": "Book #2",
"rating": 1.7
},
)
print(resp1)
resp2 = client.index(
index="library",
refresh=True,
document={
"title": "Book #3",
"rating": 0.1
},
)
print(resp2)
resp3 = client.search(
filter_path="hits.hits._source",
source="title",
sort="rating:desc",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/646d71869f1a18c5bede7759559bfc47.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-field-mapping.asciidoc:242
[source, python]
----
resp = client.indices.get_field_mapping(
index="_all",
fields="message",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6490d89a4e43cac5e6b9bc19840d5478.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/fingerprint-analyzer.asciidoc:19
[source, python]
----
resp = client.indices.analyze(
analyzer="fingerprint",
text="Yes yes, Gödel said this sentence is consistent and.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64a6fb4bcb8cfea139a0e5d3765c063a.asciidoc 0000664 0000000 0000000 00000000347 15176617013 0026726 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/translate.asciidoc:9
[source, python]
----
resp = client.sql.translate(
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=10,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64a79861225553799b26e118d7851dcc.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026156 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/error-handling.asciidoc:61
[source, python]
----
resp = client.ilm.explain_lifecycle(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64aff98cf477555e7411714c17006572.asciidoc 0000664 0000000 0000000 00000000454 15176617013 0026153 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/range-query.asciidoc:150
[source, python]
----
resp = client.search(
query={
"range": {
"timestamp": {
"gte": "now-1d/d",
"lte": "now/d"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64c572abc23394a77b6cca0b5368ee1d.asciidoc 0000664 0000000 0000000 00000000247 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// features/apis/get-features-api.asciidoc:18
[source, python]
----
resp = client.features.get_features()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64c804869ddfbcb9075817d0bbf71b5c.asciidoc 0000664 0000000 0000000 00000001045 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:592
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
params={
"elser": True,
"query_string": "where is the best mountain climbing?",
"elser_fields": [
{
"name": "title",
"boost": 1
},
{
"name": "description",
"boost": 1
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64ca2ccb79a8f4add5b8fe2d3322ae92.asciidoc 0000664 0000000 0000000 00000000467 15176617013 0027017 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/avg-aggregation.asciidoc:13
[source, python]
----
resp = client.search(
index="exams",
size="0",
aggs={
"avg_grade": {
"avg": {
"field": "grade"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64d24f4b2a57dba48092dafe3eb68ad1.asciidoc 0000664 0000000 0000000 00000000607 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-get.asciidoc:245
[source, python]
----
resp = client.mget(
index="test",
stored_fields="field1,field2",
docs=[
{
"_id": "1"
},
{
"_id": "2",
"stored_fields": [
"field3",
"field4"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/64ffaa6814ec1ec4f59b8f33b47cffb4.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0027024 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// upgrade/archived-settings.asciidoc:73
[source, python]
----
resp = client.indices.put_settings(
index="my-index",
settings={
"archived.*": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/650a0fb27c66a790c4687267423af1da.asciidoc 0000664 0000000 0000000 00000000673 15176617013 0026355 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:104
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"remove": {
"index": "logs-nginx.access-prod",
"alias": "logs"
}
},
{
"add": {
"index": "logs-my_app-default",
"alias": "logs"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6521c3578dc4ad4a6db697700986e78e.asciidoc 0000664 0000000 0000000 00000001665 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/context-suggest.asciidoc:315
[source, python]
----
resp = client.search(
index="place",
pretty=True,
suggest={
"place_suggestion": {
"prefix": "tim",
"completion": {
"field": "suggest",
"size": 10,
"contexts": {
"location": [
{
"lat": 43.6624803,
"lon": -79.3863353,
"precision": 2
},
{
"context": {
"lat": 43.6624803,
"lon": -79.3863353
},
"boost": 2
}
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/653c0d0ef146c997ef6bc6450d4f5f94.asciidoc 0000664 0000000 0000000 00000001012 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:700
[source, python]
----
resp = client.search(
aggs={
"actors": {
"terms": {
"field": "actors",
"size": 10
},
"aggs": {
"costars": {
"terms": {
"field": "actors",
"size": 5
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/654882f545eca8d7047695f867c63072.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026166 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/stop-transform.asciidoc:87
[source, python]
----
resp = client.transform.stop_transform(
transform_id="ecommerce_transform",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/65578c390837cb4c0fcc77fb17857714.asciidoc 0000664 0000000 0000000 00000001177 15176617013 0026325 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline.asciidoc:92
[source, python]
----
resp = client.search(
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"max_monthly_sales": {
"max_bucket": {
"buckets_path": "sales_per_month>sales"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/657cf67bbc48f3b8c7fa15e275a5ef72.asciidoc 0000664 0000000 0000000 00000000624 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/ignore-missing-component-templates.asciidoc:14
[source, python]
----
resp = client.cluster.put_component_template(
name="logs-foo_component1",
template={
"mappings": {
"properties": {
"host.name": {
"type": "keyword"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/658842bf41e0fcb7969937155946a0ff.asciidoc 0000664 0000000 0000000 00000000630 15176617013 0026323 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:157
[source, python]
----
resp = client.security.put_role(
name="slm-read-only",
cluster=[
"read_slm"
],
indices=[
{
"names": [
".slm-history-*"
],
"privileges": [
"read"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/65b6185356f16f2f0d84bc5aee2ed0fc.asciidoc 0000664 0000000 0000000 00000000547 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/sparse-vector-query.asciidoc:26
[source, python]
----
resp = client.search(
query={
"sparse_vector": {
"field": "ml.tokens",
"inference_id": "the inference ID to produce the token weights",
"query": "the query string"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/65c671fbecdb5b0d75c13d63f87e36f0.asciidoc 0000664 0000000 0000000 00000001372 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geodistance-aggregation.asciidoc:149
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggs={
"rings_around_amsterdam": {
"geo_distance": {
"field": "location",
"origin": "POINT (4.894 52.3760)",
"ranges": [
{
"to": 100000
},
{
"from": 100000,
"to": 300000
},
{
"from": 300000
}
],
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6606d46685d10377b996b5f20f1229b5.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026144 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-index-name-api.asciidoc:82
[source, python]
----
resp = client.connector.update_index_name(
connector_id="my-connector",
index_name="data-from-my-google-drive",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6636701d31b0c9eb8316f1f8e99cc918.asciidoc 0000664 0000000 0000000 00000001350 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/scripted-metric-aggregation.asciidoc:19
[source, python]
----
resp = client.search(
index="ledger",
size="0",
query={
"match_all": {}
},
aggs={
"profit": {
"scripted_metric": {
"init_script": "state.transactions = []",
"map_script": "state.transactions.add(doc.type.value == 'sale' ? doc.amount.value : -1 * doc.amount.value)",
"combine_script": "double profit = 0; for (t in state.transactions) { profit += t } return profit",
"reduce_script": "double profit = 0; for (a in states) { profit += a } return profit"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/66539dc6011dd2e0282cf81db1f3df27.asciidoc 0000664 0000000 0000000 00000000243 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat.asciidoc:91
[source, python]
----
resp = client.cat.nodes(
h="ip,port,heapPercent,name",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/666c420fe61fa122386da3c356a64943.asciidoc 0000664 0000000 0000000 00000001075 15176617013 0026272 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:602
[source, python]
----
resp = client.search(
query={
"term": {
"user": "kimchy"
}
},
sort={
"_script": {
"type": "number",
"script": {
"lang": "painless",
"source": "doc['field_name'].value * params.factor",
"params": {
"factor": 1.1
}
},
"order": "asc"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6689aa213884196b47a6f482d4993749.asciidoc 0000664 0000000 0000000 00000000714 15176617013 0026115 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/put-pipeline.asciidoc:17
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline-id",
description="My optional pipeline description",
processors=[
{
"set": {
"description": "My optional processor description",
"field": "my-keyword-field",
"value": "foo"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/66915e95b723ee2f6e5164a94b8f98c1.asciidoc 0000664 0000000 0000000 00000000365 15176617013 0026411 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/6693f0ffa0de3229b5dedda197810e70.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026573 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1368
[source, python]
----
resp = client.eql.get(
id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
keep_alive="5d",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/669773766b041be768003055ad523038.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0025775 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/alias-privileges.asciidoc:47
[source, python]
----
resp = client.get(
index=".ds-my-data-stream-2099.03.08-000002",
id="2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6705eca2095ade294548cfb25bf2dd86.asciidoc 0000664 0000000 0000000 00000000417 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/diagnose-unassigned-shards.asciidoc:166
[source, python]
----
resp = client.cat.shards(
v=True,
h="index,shard,prirep,state,node,unassigned.reason",
s="state",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/672d30eb3af573140d966e88b14814f8.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/date-index-name.asciidoc:43
[source, python]
----
resp = client.index(
index="my-index",
id="1",
pipeline="monthlyindex",
document={
"date1": "2016-04-25T12:02:01.789Z"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6742a8cd0b7b4c1c325ce2f22faf6cb4.asciidoc 0000664 0000000 0000000 00000000716 15176617013 0026720 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/categorize-text-aggregation.asciidoc:213
[source, python]
----
resp = client.search(
index="log-messages",
filter_path="aggregations",
aggs={
"categories": {
"categorize_text": {
"field": "message",
"categorization_filters": [
"\\w+\\_\\d{3}"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/674bb755111c6fbaa4c5ac759395c122.asciidoc 0000664 0000000 0000000 00000000562 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:132
[source, python]
----
resp = client.indices.get_settings(
index="my-index",
flat_settings=True,
include_defaults=True,
)
print(resp)
resp1 = client.cluster.get_settings(
flat_settings=True,
include_defaults=True,
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/67967388db610dcb9d24fb59ede348d8.asciidoc 0000664 0000000 0000000 00000000467 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/min-aggregation.asciidoc:17
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"min_price": {
"min": {
"field": "price"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/67a1f31cf60773a2378c2c30723c4b96.asciidoc 0000664 0000000 0000000 00000000732 15176617013 0026270 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-rank-aggregation.asciidoc:216
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_ranks": {
"percentile_ranks": {
"field": "load_time",
"values": [
500,
600
],
"missing": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/67a490d749a0c3bb16a266663423893d.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026217 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/getting-started.asciidoc:202
[source, python]
----
resp = client.watcher.delete_watch(
id="log_error_watch",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/67a55ac3aaee09f4aeeb7d2763da3335.asciidoc 0000664 0000000 0000000 00000003517 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geobounds-aggregation.asciidoc:104
[source, python]
----
resp = client.indices.create(
index="places",
mappings={
"properties": {
"geometry": {
"type": "geo_shape"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="places",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"name": "NEMO Science Museum",
"geometry": "POINT(4.912350 52.374081)"
},
{
"index": {
"_id": 2
}
},
{
"name": "Sportpark De Weeren",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
4.965305328369141,
52.39347642069457
],
[
4.966979026794433,
52.391721758934835
],
[
4.969425201416015,
52.39238958618537
],
[
4.967944622039794,
52.39420969150824
],
[
4.965305328369141,
52.39347642069457
]
]
]
}
}
],
)
print(resp1)
resp2 = client.search(
index="places",
size="0",
aggs={
"viewport": {
"geo_bounds": {
"field": "geometry"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/67aac8882fa476db8a5878b67ea08eb3.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/repo-analysis-api.asciidoc:32
[source, python]
----
resp = client.perform_request(
"POST",
"/_snapshot/my_repository/_analyze",
params={
"blob_count": "10",
"max_blob_size": "1mb",
"timeout": "120s"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/67b71a95b6fe6c83faae51ea038a1bf1.asciidoc 0000664 0000000 0000000 00000000352 15176617013 0026725 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:407
[source, python]
----
resp = client.esql.async_query_delete(
id="FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/67bab07fda27ef77e3bc948211051a33.asciidoc 0000664 0000000 0000000 00000000407 15176617013 0026503 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/hotspotting.asciidoc:160
[source, python]
----
resp = client.cat.thread_pool(
thread_pool_patterns="write,search",
v=True,
s="n,nn",
h="n,nn,q,a,r,c",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/67c3808751223eef69a57e6fd02ddf4f.asciidoc 0000664 0000000 0000000 00000001236 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/mlt-query.asciidoc:38
[source, python]
----
resp = client.search(
query={
"more_like_this": {
"fields": [
"title",
"description"
],
"like": [
{
"_index": "imdb",
"_id": "1"
},
{
"_index": "imdb",
"_id": "2"
},
"and potentially some more text here as well"
],
"min_term_freq": 1,
"max_query_terms": 12
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/67ffa135c50c43d6788636c88078c7d1.asciidoc 0000664 0000000 0000000 00000000756 15176617013 0026327 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/simulate-pipeline.asciidoc:156
[source, python]
----
resp = client.ingest.simulate(
id="my-pipeline-id",
docs=[
{
"_index": "index",
"_id": "id",
"_source": {
"foo": "bar"
}
},
{
"_index": "index",
"_id": "id",
"_source": {
"foo": "rab"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/682336e5232c9ad3d866cb203d1c58c1.asciidoc 0000664 0000000 0000000 00000001037 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:135
[source, python]
----
resp = client.indices.create(
index="azure-openai-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 1536,
"element_type": "float",
"similarity": "dot_product"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6843d859e2965d17cad4f033c81db83f.asciidoc 0000664 0000000 0000000 00000000770 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:351
[source, python]
----
resp = client.indices.put_index_template(
name="my-data-stream-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
priority=500,
template={
"settings": {
"sort.field": [
"@timestamp"
],
"sort.order": [
"desc"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6856f7c6a732ab55ca71c1ee2ec2bbad.asciidoc 0000664 0000000 0000000 00000002734 15176617013 0027007 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/max-aggregation.asciidoc:126
[source, python]
----
resp = client.indices.create(
index="metrics_index",
mappings={
"properties": {
"latency_histo": {
"type": "histogram"
}
}
},
)
print(resp)
resp1 = client.index(
index="metrics_index",
id="1",
refresh=True,
document={
"network.name": "net-1",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
3,
7,
23,
12,
6
]
}
},
)
print(resp1)
resp2 = client.index(
index="metrics_index",
id="2",
refresh=True,
document={
"network.name": "net-2",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
8,
17,
8,
7,
6
]
}
},
)
print(resp2)
resp3 = client.search(
index="metrics_index",
size="0",
filter_path="aggregations",
aggs={
"max_latency": {
"max": {
"field": "latency_histo"
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/6859530dd9d85e59bd33a53ec96a3836.asciidoc 0000664 0000000 0000000 00000000752 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/match-enrich-policy-type-ex.asciidoc:20
[source, python]
----
resp = client.index(
index="users",
id="1",
refresh="wait_for",
document={
"email": "mardy.brown@asciidocsmith.com",
"first_name": "Mardy",
"last_name": "Brown",
"city": "New Orleans",
"county": "Orleans",
"state": "LA",
"zip": 70116,
"web": "mardy.asciidocsmith.com"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/686bc640b877de845c46bef372a9866c.asciidoc 0000664 0000000 0000000 00000001513 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/parent-aggregation.asciidoc:95
[source, python]
----
resp = client.search(
index="parent_example",
size="0",
aggs={
"top-names": {
"terms": {
"field": "owner.display_name.keyword",
"size": 10
},
"aggs": {
"to-questions": {
"parent": {
"type": "answer"
},
"aggs": {
"top-tags": {
"terms": {
"field": "tags.keyword",
"size": 10
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/68721288dc9ad8aa1b55099b4d303051.asciidoc 0000664 0000000 0000000 00000000561 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:534
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "quick brown f",
"type": "bool_prefix",
"fields": [
"subject",
"message"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/68738b4fd0dda177022be45be95b4c84.asciidoc 0000664 0000000 0000000 00000000336 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:208
[source, python]
----
resp = client.reindex_rethrottle(
task_id="r1A2WoRbTwKZ516z6NEs5A:36619",
requests_per_second="-1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6884454f57c3a41059037ea762f48d77.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026157 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/standard-analyzer.asciidoc:17
[source, python]
----
resp = client.indices.analyze(
analyzer="standard",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/68a891f609ca3a379d2d64e4914f3067.asciidoc 0000664 0000000 0000000 00000000417 15176617013 0026315 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/kstem-tokenfilter.asciidoc:29
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"kstem"
],
text="the foxes jumping quickly",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/68b64313bf89ec3f2c645da61999dbb4.asciidoc 0000664 0000000 0000000 00000000251 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-info.asciidoc:226
[source, python]
----
resp = client.nodes.info(
node_id="plugins",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/68cb8a452e780ca78b0cb761be3629af.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:714
[source, python]
----
resp = client.search(
stored_fields="_none_",
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/68d7f7d4d268ee98caead5aef19933d6.asciidoc 0000664 0000000 0000000 00000002675 15176617013 0027002 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/tsds-reindex.asciidoc:168
[source, python]
----
resp = client.cluster.put_component_template(
name="destination_template",
template={
"settings": {
"index": {
"number_of_replicas": 0,
"number_of_shards": 4,
"mode": "time_series",
"routing_path": [
"metricset"
],
"time_series": {
"end_time": "2023-09-01T14:00:00.000Z",
"start_time": "2023-09-01T06:00:00.000Z"
}
}
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
},
"metricset": {
"type": "keyword",
"time_series_dimension": True
},
"k8s": {
"properties": {
"tx": {
"type": "long"
},
"rx": {
"type": "long"
}
}
}
}
}
},
)
print(resp)
resp1 = client.indices.put_index_template(
name="2",
index_patterns=[
"k9s*"
],
composed_of=[
"destination_template"
],
data_stream={},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/691fe20d467324ed43a36fd15852c492.asciidoc 0000664 0000000 0000000 00000000500 15176617013 0026272 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/uni-directional-disaster-recovery.asciidoc:174
[source, python]
----
resp = client.ccr.follow(
index="kibana_sample_data_ecommerce",
wait_for_active_shards="1",
remote_cluster="clusterB",
leader_index="kibana_sample_data_ecommerce2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/692606cc6d6462becc321d92961a3bac.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// text-structure/apis/test-grok-pattern.asciidoc:60
[source, python]
----
resp = client.text_structure.test_grok_pattern(
grok_pattern="Hello %{WORD:first_name} %{WORD:last_name}",
text=[
"Hello John Doe",
"this does not match"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/69541f0bb81ab3797926bb2a00607cda.asciidoc 0000664 0000000 0000000 00000000701 15176617013 0026415 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/69582847099ee62ed34feddfaba83ef6.asciidoc 0000664 0000000 0000000 00000000603 15176617013 0026706 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/histogram-aggregation.asciidoc:307
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"quantity": {
"histogram": {
"field": "quantity",
"interval": 10,
"missing": 0
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/698e0a2b67ba7842caa801d9ef46ebe3.asciidoc 0000664 0000000 0000000 00000001010 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:511
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"require_field_match": False,
"fields": {
"body": {
"pre_tags": [
""
],
"post_tags": [
" "
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/69a08e7bdcc616f3bdcb8ae842d9e30e.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0027016 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:360
[source, python]
----
resp = client.get(
index="my-index-000001",
id="1",
stored_fields="tags,counter",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/69ab708fe65a75f870223d2289c3d171.asciidoc 0000664 0000000 0000000 00000001350 15176617013 0026304 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/redact.asciidoc:107
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"description": "Hide my IP",
"processors": [
{
"redact": {
"field": "message",
"patterns": [
"%{IP:REDACTED}",
"%{EMAILADDRESS:REDACTED}"
],
"prefix": "*",
"suffix": "*"
}
}
]
},
docs=[
{
"_source": {
"message": "55.3.244.1 GET /index.html 15824 0.043 test@elastic.co"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/69c07cfdf8054c301cd6186c5d71aa02.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026500 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:350
[source, python]
----
resp = client.update_by_query(
index="my-index-000001,my-index-000002",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/69d5710bdec73041c66f21d5f96637e8.asciidoc 0000664 0000000 0000000 00000000511 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:216
[source, python]
----
resp = client.indices.create(
index="index_long",
mappings={
"properties": {
"field": {
"type": "date_nanos"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/69d9b8fd364596aa37eae6864d8a6d89.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/getting-started.asciidoc:61
[source, python]
----
resp = client.search(
index=".watcher-history*",
pretty=True,
sort=[
{
"result.execution_time": "desc"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/69daf5ec2a9bc07096e1833286c36076.asciidoc 0000664 0000000 0000000 00000000745 15176617013 0026372 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-tutorial.asciidoc:334
[source, python]
----
resp = client.indices.put_index_template(
name="timeseries_template",
index_patterns=[
"timeseries-*"
],
template={
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "timeseries_policy",
"index.lifecycle.rollover_alias": "timeseries"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/69f8b0f2a9ba47e11f363d788cee9d6d.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026705 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// migration/apis/deprecation.asciidoc:146
[source, python]
----
resp = client.migration.deprecations(
index="logstash-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6a1702dd50690cae833572e48a0ddf25.asciidoc 0000664 0000000 0000000 00000000507 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:33
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "Will Smith",
"fields": [
"title",
"*_name"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6a350a17701e8c8158407191f2718b66.asciidoc 0000664 0000000 0000000 00000000272 15176617013 0026054 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/post-unfollow.asciidoc:80
[source, python]
----
resp = client.ccr.unfollow(
index="follower_index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6a3a578ce37fb2c63ccfab7f75db9bae.asciidoc 0000664 0000000 0000000 00000000456 15176617013 0027164 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:295
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"ingest.geoip.downloader.enabled": False,
"indices.lifecycle.history_index_enabled": False
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6a3a86ff58e5f20950d429cf2832c229.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/get-pipeline.asciidoc:82
[source, python]
----
resp = client.ingest.get_pipeline(
id="my-pipeline-id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6a3f06962cceb3dfd3cd4fb5c679fa75.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0027023 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/mapping-charfilter.asciidoc:141
[source, python]
----
resp = client.indices.analyze(
index="my-index-000001",
tokenizer="keyword",
char_filter=[
"my_mappings_char_filter"
],
text="I'm delighted about it :(",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6a50c1c53673fe9cc3cbda38a2853cdd.asciidoc 0000664 0000000 0000000 00000000347 15176617013 0026730 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:683
[source, python]
----
resp = client.sql.delete_async(
id="FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6a55dbba114c6c1408474f7e9cfdbb94.asciidoc 0000664 0000000 0000000 00000000555 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/register-repository.asciidoc:167
[source, python]
----
resp = client.snapshot.create_repository(
name="my_unverified_backup",
verify=False,
repository={
"type": "fs",
"settings": {
"location": "my_unverified_backup_location"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6a9655fe22fa5db7a540c145bcf1fb31.asciidoc 0000664 0000000 0000000 00000001124 15176617013 0026636 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/aggregate-metric-double.asciidoc:133
[source, python]
----
resp = client.index(
index="stats-index",
id="1",
document={
"agg_metric": {
"min": -302.5,
"max": 702.3,
"sum": 200,
"value_count": 25
}
},
)
print(resp)
resp1 = client.index(
index="stats-index",
id="2",
document={
"agg_metric": {
"min": -93,
"max": 1702.3,
"sum": 300,
"value_count": 25
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/6a969ebe7490d93d35be895b14e5a42a.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:309
[source, python]
----
resp = client.indices.get(
index="logs-my_app-default",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6aa2941855d13f365f70aa8767ecb137.asciidoc 0000664 0000000 0000000 00000001762 15176617013 0026365 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/multi-fields.asciidoc:10
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"city": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"city": "New York"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"city": "York"
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
query={
"match": {
"city": "york"
}
},
sort={
"city.raw": "asc"
},
aggs={
"Cities": {
"terms": {
"field": "city.raw"
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/6aca241c0361d26f134712821e2d09a9.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026241 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/clean-up-repo-api.asciidoc:85
[source, python]
----
resp = client.snapshot.cleanup_repository(
name="my_repository",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6af9dc1c3240aa8e623ff3622bcb1b48.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0026633 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/allocation_filtering.asciidoc:70
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.exclude._ip": "192.168.2.*"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b0288acb739c4667d41339e5100c327.asciidoc 0000664 0000000 0000000 00000000470 15176617013 0026211 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-query.asciidoc:234
[source, python]
----
resp = client.search(
query={
"match": {
"message": {
"query": "this is a testt",
"fuzziness": "AUTO"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b0d492c0f50103fefeab385a7bebd01.asciidoc 0000664 0000000 0000000 00000000764 15176617013 0026714 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/constant-keyword.asciidoc:11
[source, python]
----
resp = client.indices.create(
index="logs-debug",
mappings={
"properties": {
"@timestamp": {
"type": "date"
},
"message": {
"type": "text"
},
"level": {
"type": "constant_keyword",
"value": "debug"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b104a66ab47fc1e1f24a5738f82feb4.asciidoc 0000664 0000000 0000000 00000000527 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/getting-started.asciidoc:288
[source, python]
----
resp = client.ccr.put_auto_follow_pattern(
name="beats",
remote_cluster="leader",
leader_index_patterns=[
"metricbeat-*",
"packetbeat-*"
],
follow_index_pattern="{{leader_index}}-copy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b1336ff477f91d4a0db0b06db546ff0.asciidoc 0000664 0000000 0000000 00000000225 15176617013 0026563 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/stop.asciidoc:51
[source, python]
----
resp = client.watcher.stop()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b1e837a8469eca2d03d5c36f5910f34.asciidoc 0000664 0000000 0000000 00000001244 15176617013 0026437 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filter-aggregation.asciidoc:13
[source, python]
----
resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
aggs={
"avg_price": {
"avg": {
"field": "price"
}
},
"t_shirts": {
"filter": {
"term": {
"type": "t-shirt"
}
},
"aggs": {
"avg_price": {
"avg": {
"field": "price"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b3dcde0656d3a96dbcfed1ec814e10a.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0027057 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shutdown/apis/shutdown-delete.asciidoc:71
[source, python]
----
resp = client.shutdown.delete_node(
node_id="USpTGYaBSIKbgSUJR2Z9lg",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b67c6121efb86ee100d40c2646f77b5.asciidoc 0000664 0000000 0000000 00000000556 15176617013 0026437 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/6b6e275efe3d2aafe0fc3443f2c96868.asciidoc 0000664 0000000 0000000 00000000611 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:161
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "google-vertex-ai-embeddings",
"pipeline": "google_vertex_ai_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b6f5e0ab4ef523fc9a3a4a655848f64.asciidoc 0000664 0000000 0000000 00000000572 15176617013 0026607 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/sparse-vector-query.asciidoc:44
[source, python]
----
resp = client.search(
query={
"sparse_vector": {
"field": "ml.tokens",
"query_vector": {
"token1": 0.5,
"token2": 0.3,
"token3": 0.2
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b6fd0a5942dfb9762ad2790cf421a80.asciidoc 0000664 0000000 0000000 00000002356 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-client.asciidoc:363
[source, python]
----
resp = client.search_application.put(
name="my-example-app",
search_application={
"indices": [
"example-index"
],
"template": {
"script": {
"lang": "mustache",
"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": {},
"_es_aggs": {},
"_es_sort_fields": {},
"size": 10,
"from": 0
},
"dictionary": {}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b77795e9249c8d9865f7a49fd86a863.asciidoc 0000664 0000000 0000000 00000000464 15176617013 0026365 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/range-query.asciidoc:16
[source, python]
----
resp = client.search(
query={
"range": {
"age": {
"gte": 10,
"lte": 20,
"boost": 2
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6b8c5c8145c287c4fc535fa57ccf95a7.asciidoc 0000664 0000000 0000000 00000000407 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connector-sync-jobs-api.asciidoc:71
[source, python]
----
resp = client.perform_request(
"GET",
"/_connector/_sync_job",
params={
"status": "pending"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6ba332596f5eb29660c90ab2d480e7dc.asciidoc 0000664 0000000 0000000 00000001204 15176617013 0026510 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template-v1.asciidoc:189
[source, python]
----
resp = client.indices.put_template(
name="template_1",
index_patterns=[
"te*"
],
order=0,
settings={
"number_of_shards": 1
},
mappings={
"_source": {
"enabled": False
}
},
)
print(resp)
resp1 = client.indices.put_template(
name="template_2",
index_patterns=[
"tes*"
],
order=1,
settings={
"number_of_shards": 1
},
mappings={
"_source": {
"enabled": True
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/6baf72c04d48cb04c2f8be609ff3b3b5.asciidoc 0000664 0000000 0000000 00000000716 15176617013 0026731 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/6bbc613bd4f9aec1bbdbabf5db021d28.asciidoc 0000664 0000000 0000000 00000001244 15176617013 0027203 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:232
[source, python]
----
resp = client.search(
query={
"bool": {
"should": [
{
"match": {
"title": "quick brown fox"
}
},
{
"match": {
"title.original": "quick brown fox"
}
},
{
"match": {
"title.shingles": "quick brown fox"
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6bfa0a9a50c4e94276c7d63af1c31d9e.asciidoc 0000664 0000000 0000000 00000002537 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/context-suggest.asciidoc:25
[source, python]
----
resp = client.indices.create(
index="place",
mappings={
"properties": {
"suggest": {
"type": "completion",
"contexts": [
{
"name": "place_type",
"type": "category"
},
{
"name": "location",
"type": "geo",
"precision": 4
}
]
}
}
},
)
print(resp)
resp1 = client.indices.create(
index="place_path_category",
mappings={
"properties": {
"suggest": {
"type": "completion",
"contexts": [
{
"name": "place_type",
"type": "category",
"path": "cat"
},
{
"name": "location",
"type": "geo",
"precision": 4,
"path": "loc"
}
]
},
"loc": {
"type": "geo_point"
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/6c00dae1a456ae5e854e98e895dca2ab.asciidoc 0000664 0000000 0000000 00000000761 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/function-score-query.asciidoc:137
[source, python]
----
resp = client.search(
query={
"function_score": {
"query": {
"match": {
"message": "elasticsearch"
}
},
"script_score": {
"script": {
"source": "Math.log(2 + doc['my-int'].value)"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6c0acbff2df9003ccaf4350c9e2e186e.asciidoc 0000664 0000000 0000000 00000001556 15176617013 0027010 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-polygon-query.asciidoc:62
[source, python]
----
resp = client.search(
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_polygon": {
"person.location": {
"points": [
[
-70,
40
],
[
-80,
30
],
[
-90,
20
]
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6c3f7c8601e8cc13d36eef98a5e2cb34.asciidoc 0000664 0000000 0000000 00000001515 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/nested-query.asciidoc:139
[source, python]
----
resp = client.indices.create(
index="drivers",
mappings={
"properties": {
"driver": {
"type": "nested",
"properties": {
"last_name": {
"type": "text"
},
"vehicle": {
"type": "nested",
"properties": {
"make": {
"type": "text"
},
"model": {
"type": "text"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6c70b022a8a74b887fe46e514feb38c0.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/recovery.asciidoc:18
[source, python]
----
resp = client.indices.recovery(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6c72460570307f23478100db04a84c8e.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026115 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-component-template.asciidoc:92
[source, python]
----
resp = client.cluster.get_component_template(
name="temp*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6c72f6791ba9223943f7556c5bfaa728.asciidoc 0000664 0000000 0000000 00000000710 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:58
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"user.id": "kimchy"
}
},
fields=[
"user.id",
"http.response.*",
{
"field": "@timestamp",
"format": "epoch_millis"
}
],
source=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6c8bf6d4d68b7756f953be4c07655337.asciidoc 0000664 0000000 0000000 00000000565 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-reload-secure-settings.asciidoc:69
[source, python]
----
resp = client.nodes.reload_secure_settings(
secure_settings_password="keystore-password",
)
print(resp)
resp1 = client.nodes.reload_secure_settings(
node_id="nodeId1,nodeId2",
secure_settings_password="keystore-password",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/6c927313867647e0ef3cd3a37cb410cc.asciidoc 0000664 0000000 0000000 00000000347 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-api-keys.asciidoc:185
[source, python]
----
resp = client.security.invalidate_api_key(
username="myuser",
realm_name="native1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6cb1dae368c945ecf7c9ec332a5743a2.asciidoc 0000664 0000000 0000000 00000001500 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/text.asciidoc:180
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"text": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"text": [
"the quick brown fox",
"the quick brown fox",
"jumped over the lazy dog"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc 0000664 0000000 0000000 00000004052 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/nested.asciidoc:87
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"user": {
"type": "nested"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"group": "fans",
"user": [
{
"first": "John",
"last": "Smith"
},
{
"first": "Alice",
"last": "White"
}
]
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"nested": {
"path": "user",
"query": {
"bool": {
"must": [
{
"match": {
"user.first": "Alice"
}
},
{
"match": {
"user.last": "Smith"
}
}
]
}
}
}
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
query={
"nested": {
"path": "user",
"query": {
"bool": {
"must": [
{
"match": {
"user.first": "Alice"
}
},
{
"match": {
"user.last": "White"
}
}
]
}
},
"inner_hits": {
"highlight": {
"fields": {
"user.first": {}
}
}
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/6ce6cac9df216c52371c2e77e6e07ba1.asciidoc 0000664 0000000 0000000 00000003104 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-rules/apis/put-query-ruleset.asciidoc:123
[source, python]
----
resp = client.query_rules.put_ruleset(
ruleset_id="my-ruleset",
rules=[
{
"rule_id": "my-rule1",
"type": "pinned",
"criteria": [
{
"type": "contains",
"metadata": "user_query",
"values": [
"pugs",
"puggles"
]
},
{
"type": "exact",
"metadata": "user_country",
"values": [
"us"
]
}
],
"actions": {
"ids": [
"id1",
"id2"
]
}
},
{
"rule_id": "my-rule2",
"type": "exclude",
"criteria": [
{
"type": "fuzzy",
"metadata": "user_query",
"values": [
"rescue dogs"
]
}
],
"actions": {
"docs": [
{
"_index": "index1",
"_id": "id3"
},
{
"_index": "index2",
"_id": "id4"
}
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6ce8334def48552ba7d44025580d9105.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026275 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:242
[source, python]
----
resp = client.indices.create(
index="",
aliases={
"my-alias": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6cf3307c00f464c46475e352e067d714.asciidoc 0000664 0000000 0000000 00000001360 15176617013 0026212 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:103
[source, python]
----
resp = client.search(
index="my_geoshapes",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_bounding_box": {
"pin.location": {
"top_left": {
"lat": 40.73,
"lon": -74.1
},
"bottom_right": {
"lat": 40.01,
"lon": -71.12
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6d48f83c4a36d0544d876d3eff48dcef.asciidoc 0000664 0000000 0000000 00000000250 15176617013 0026676 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:262
[source, python]
----
resp = client.slm.execute_retention()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6d81c749ff9554044ee5f3ad92dcb89a.asciidoc 0000664 0000000 0000000 00000002676 15176617013 0026634 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-tsds.asciidoc:58
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my-weather-sensor-lifecycle-policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_age": "1d",
"max_primary_shard_size": "50gb"
}
}
},
"warm": {
"min_age": "30d",
"actions": {
"shrink": {
"number_of_shards": 1
},
"forcemerge": {
"max_num_segments": 1
}
}
},
"cold": {
"min_age": "60d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"frozen": {
"min_age": "90d",
"actions": {
"searchable_snapshot": {
"snapshot_repository": "found-snapshots"
}
}
},
"delete": {
"min_age": "735d",
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6db118771354792646229e7a3c30c7e9.asciidoc 0000664 0000000 0000000 00000002501 15176617013 0026145 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:991
[source, python]
----
resp = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {}
},
{
"timestamp": 1516729294000,
"temperature": 200,
"voltage": 5.2,
"node": "a"
},
{
"index": {}
},
{
"timestamp": 1516642894000,
"temperature": 201,
"voltage": 5.8,
"node": "b"
},
{
"index": {}
},
{
"timestamp": 1516556494000,
"temperature": 202,
"voltage": 5.1,
"node": "a"
},
{
"index": {}
},
{
"timestamp": 1516470094000,
"temperature": 198,
"voltage": 5.6,
"node": "b"
},
{
"index": {}
},
{
"timestamp": 1516383694000,
"temperature": 200,
"voltage": 4.2,
"node": "c"
},
{
"index": {}
},
{
"timestamp": 1516297294000,
"temperature": 202,
"voltage": 4,
"node": "c"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6dbfe5565a95508e65d304131847f9fc.asciidoc 0000664 0000000 0000000 00000000556 15176617013 0026402 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/edgengram-tokenfilter.asciidoc:34
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 2
}
],
text="the quick brown fox jumps",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6dcd3916679f6aa64f79524c75991ebd.asciidoc 0000664 0000000 0000000 00000000564 15176617013 0026476 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:248
[source, python]
----
resp = client.esql.query(
query="\n FROM library\n | EVAL year = DATE_EXTRACT(\"year\", release_date)\n | WHERE page_count > 300 AND author == \"Frank Herbert\"\n | STATS count = COUNT(*) by year\n | WHERE count > 0\n | LIMIT 5\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6dd2a107bc64fd6f058fb17c21640649.asciidoc 0000664 0000000 0000000 00000000341 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-tokens.asciidoc:216
[source, python]
----
resp = client.security.invalidate_token(
username="myuser",
realm_name="saml1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6dd4c02fe3d6b800648a04d3e2d29fc1.asciidoc 0000664 0000000 0000000 00000000363 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/delete-snapshot-api.asciidoc:78
[source, python]
----
resp = client.snapshot.delete(
repository="my_repository",
snapshot="snapshot_2,snapshot_3",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc 0000664 0000000 0000000 00000000776 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-azure-ai-studio.asciidoc:185
[source, python]
----
resp = client.inference.put(
task_type="completion",
inference_id="azure_ai_studio_completion",
inference_config={
"service": "azureaistudio",
"service_settings": {
"api_key": "",
"target": "",
"provider": "",
"endpoint_type": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6e000496a1fa8b57148518eaad692f35.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026344 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-all-query.asciidoc:39
[source, python]
----
resp = client.search(
query={
"match_none": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6e0b675eff7ed73c09a76a415930a486.asciidoc 0000664 0000000 0000000 00000000633 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/parent-id-query.asciidoc:24
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my-join-field": {
"type": "join",
"relations": {
"my-parent": "my-child"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6e1157f3184fa192d47a3d0e3ea17a6c.asciidoc 0000664 0000000 0000000 00000001241 15176617013 0026500 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/unique-tokenfilter.asciidoc:130
[source, python]
----
resp = client.indices.create(
index="letter_unique_pos_example",
settings={
"analysis": {
"analyzer": {
"letter_unique_pos": {
"tokenizer": "letter",
"filter": [
"unique_pos"
]
}
},
"filter": {
"unique_pos": {
"type": "unique",
"only_on_same_position": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6e1ae8d6103e0b77f14fb0ea1bfb7ffa.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0027056 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:397
[source, python]
----
resp = client.index(
index="example",
document={
"location": "GEOMETRYCOLLECTION (POINT (1000.0 100.0), LINESTRING (1001.0 100.0, 1002.0 100.0))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6e498b9dc753b94abf2618c407fa5cd8.asciidoc 0000664 0000000 0000000 00000000504 15176617013 0026613 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/6e6b78e6b689a5d6aa637271b6d084e2.asciidoc 0000664 0000000 0000000 00000002744 15176617013 0026461 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/6e86225ed4a6e3be8078b83ef301f731.asciidoc 0000664 0000000 0000000 00000000550 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:66
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"percolate": {
"field": "query",
"document": {
"message": "A new bonsai tree in the office"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6ea062455229151e311869a81ee40252.asciidoc 0000664 0000000 0000000 00000001011 15176617013 0026032 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-multiple-indices.asciidoc:83
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
resp1 = client.search(
index="_all",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp1)
resp2 = client.search(
index="*",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/6edfc35a66afd9b884431fccf48fdbf5.asciidoc 0000664 0000000 0000000 00000000716 15176617013 0027121 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-with-synonyms.asciidoc:114
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"lowercase",
{
"type": "synonym_graph",
"synonyms": [
"pc => personal computer",
"computer, pc, laptop"
]
}
],
text="Check how PC synonyms work",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6eead05dd3b04722ef0ea5644c2e047d.asciidoc 0000664 0000000 0000000 00000002554 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/bucket-script-aggregation.asciidoc:50
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"total_sales": {
"sum": {
"field": "price"
}
},
"t-shirts": {
"filter": {
"term": {
"type": "t-shirt"
}
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"t-shirt-percentage": {
"bucket_script": {
"buckets_path": {
"tShirtSales": "t-shirts>sales",
"totalSales": "total_sales"
},
"script": "params.tShirtSales / params.totalSales * 100"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f0389ac52808df23bb6081a1acd4eed.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026635 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/built-in-users.asciidoc:158
[source, python]
----
resp = client.security.enable_user(
username="logstash_system",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f07152055e99416deb10e95b428b847.asciidoc 0000664 0000000 0000000 00000001273 15176617013 0026227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/edgengram-tokenfilter.asciidoc:199
[source, python]
----
resp = client.indices.create(
index="edge_ngram_custom_example",
settings={
"analysis": {
"analyzer": {
"default": {
"tokenizer": "whitespace",
"filter": [
"3_5_edgegrams"
]
}
},
"filter": {
"3_5_edgegrams": {
"type": "edge_ngram",
"min_gram": 3,
"max_gram": 5
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f34e27481460a95e59ffbacb76bd637.asciidoc 0000664 0000000 0000000 00000002547 15176617013 0026542 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/custom-analyzer.asciidoc:159
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"char_filter": [
"emoticons"
],
"tokenizer": "punctuation",
"filter": [
"lowercase",
"english_stop"
]
}
},
"tokenizer": {
"punctuation": {
"type": "pattern",
"pattern": "[ .,!?]"
}
},
"char_filter": {
"emoticons": {
"type": "mapping",
"mappings": [
":) => _happy_",
":( => _sad_"
]
}
},
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_custom_analyzer",
text="I'm a :) person, and you?",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/6f3b723bf6179b96c3413597ed7f49e1.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026376 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-update-api-keys.asciidoc:302
[source, python]
----
resp = client.security.bulk_update_api_keys(
ids=[
"VuaCfGcBCdbkQm-e5aOx",
"H3_AhoIBA9hmeQJdg7ij"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f48ab7cbb8a4a46d0e9272c07166eaf.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026653 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/apis/sql-translate-api.asciidoc:18
[source, python]
----
resp = client.sql.translate(
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=10,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f4cbebfd6d2cee54aa3e7a86a755ef8.asciidoc 0000664 0000000 0000000 00000001560 15176617013 0027170 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/knn-query.asciidoc:210
[source, python]
----
resp = client.search(
index="my-image-index",
size=3,
query={
"bool": {
"should": [
{
"match": {
"title": {
"query": "mountain lake",
"boost": 1
}
}
},
{
"knn": {
"field": "image-vector",
"query_vector": [
-5,
9,
-12
],
"k": 10,
"boost": 2
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f5adbd55a3a2760e7fe9d32df18b1a1.asciidoc 0000664 0000000 0000000 00000000527 15176617013 0026730 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/getting-started.asciidoc:114
[source, python]
----
resp = client.index(
index="logs",
document={
"timestamp": "2015-05-17T18:12:07.613Z",
"request": "GET index.html",
"status_code": 404,
"message": "Error: File not found"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f6d5a4a90e1265822628d4ced963639.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026311 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/field-mapping.asciidoc:63
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"create_date": "2015/09/02"
},
)
print(resp)
resp1 = client.indices.get_mapping(
index="my-index-000001",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/6f842819c50e8490080dd085e0c6aca3.asciidoc 0000664 0000000 0000000 00000000453 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/normalizer.asciidoc:125
[source, python]
----
resp = client.search(
index="index",
size=0,
aggs={
"foo_terms": {
"terms": {
"field": "foo"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f855bc92b4cc6e6a63f95bce1cb4441.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/logstash/get-pipeline.asciidoc:75
[source, python]
----
resp = client.logstash.get_pipeline(
id="my_pipeline",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f8a682c908b826ca90cadd9d2f582b4.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:670
[source, python]
----
resp = client.search(
stored_fields=[
"user",
"postDate"
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6f8bdca97e43aac75e32de655aa4314a.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026731 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/6fa02c2ad485bbe91f44b321158250f3.asciidoc 0000664 0000000 0000000 00000001170 15176617013 0026411 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/search-as-you-type.asciidoc:87
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"multi_match": {
"query": "brown f",
"type": "bool_prefix",
"fields": [
"my_field",
"my_field._2gram",
"my_field._3gram"
]
}
},
highlight={
"fields": {
"my_field": {
"matched_fields": [
"my_field._index_prefix"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6fa570ae7039171e2ab722344ec1063f.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026336 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-field-mapping.asciidoc:20
[source, python]
----
resp = client.indices.get_field_mapping(
index="my-index-000001",
fields="user",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6fbb88f399618e1b47412082062ce2bd.asciidoc 0000664 0000000 0000000 00000002032 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:537
[source, python]
----
resp = client.transform.preview_transform(
source={
"index": "kibana_sample_data_logs"
},
pivot={
"group_by": {
"timestamp": {
"date_histogram": {
"field": "timestamp",
"fixed_interval": "1h"
}
}
},
"aggregations": {
"bytes.max": {
"max": {
"field": "bytes"
}
},
"top": {
"top_metrics": {
"metrics": [
{
"field": "clientip"
},
{
"field": "geo.src"
}
],
"sort": {
"bytes": "desc"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6fbbf40cab0187f544ff7bca31d18d57.asciidoc 0000664 0000000 0000000 00000002552 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:253
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "Polygon",
"coordinates": [
[
[
100,
0
],
[
101,
0
],
[
101,
1
],
[
100,
1
],
[
100,
0
]
],
[
[
100.2,
0.2
],
[
100.8,
0.2
],
[
100.8,
0.8
],
[
100.2,
0.8
],
[
100.2,
0.2
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6fc778e9a888b16b937c5c2a7a1ec140.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// searchable-snapshots/apis/clear-cache.asciidoc:75
[source, python]
----
resp = client.searchable_snapshots.clear_cache(
index="my-index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6fd82baa17a48e09e3d2eed514af7f46.asciidoc 0000664 0000000 0000000 00000003132 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:359
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "MultiLineString",
"coordinates": [
[
[
102,
2
],
[
103,
2
],
[
103,
3
],
[
102,
3
]
],
[
[
100,
0
],
[
101,
0
],
[
101,
1
],
[
100,
1
]
],
[
[
100.2,
0.2
],
[
100.8,
0.2
],
[
100.8,
0.8
],
[
100.2,
0.8
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6fe6c095c6995e0f2214f5f3bc85d74e.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/apis/delete-lifecycle.asciidoc:83
[source, python]
----
resp = client.indices.delete_data_lifecycle(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/6febf0e6883b23b15ac213abc4bac326.asciidoc 0000664 0000000 0000000 00000001051 15176617013 0026701 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/context-suggest.asciidoc:282
[source, python]
----
resp = client.search(
index="place",
suggest={
"place_suggestion": {
"prefix": "tim",
"completion": {
"field": "suggest",
"size": 10,
"contexts": {
"location": {
"lat": 43.662,
"lon": -79.38
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7011fcdd231804f9c3894154ae2c3fbc.asciidoc 0000664 0000000 0000000 00000000477 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/sparse-vector.asciidoc:14
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"text.tokens": {
"type": "sparse_vector"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/701f1fffc65e9e51c96aa60261e2eae3.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026653 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-cross-cluster-api-key.asciidoc:126
[source, python]
----
resp = client.security.get_api_key(
id="VuaCfGcBCdbkQm-e5aOx",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7021ddb273a3a00847324d2f670c4c04.asciidoc 0000664 0000000 0000000 00000001573 15176617013 0026247 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:548
[source, python]
----
resp = client.search(
index="image-index",
query={
"match": {
"title": {
"query": "mountain lake",
"boost": 0.9
}
}
},
knn=[
{
"field": "image-vector",
"query_vector": [
54,
10,
-2
],
"k": 5,
"num_candidates": 50,
"boost": 0.1
},
{
"field": "title-vector",
"query_vector": [
1,
20,
-52,
23,
10
],
"k": 10,
"num_candidates": 10,
"boost": 0.5
}
],
size=10,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7067a498bb6c788854a26443a64b843a.asciidoc 0000664 0000000 0000000 00000001330 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/script-query.asciidoc:87
[source, python]
----
resp = client.search(
runtime_mappings={
"amount.signed": {
"type": "double",
"script": "\n double amount = doc['amount'].value;\n if (doc['type'].value == 'expense') {\n amount *= -1;\n }\n emit(amount);\n "
}
},
query={
"bool": {
"filter": {
"range": {
"amount.signed": {
"lt": 10
}
}
}
}
},
fields=[
{
"field": "amount.signed"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/708e7ec681be41791f232817a07cda82.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-api.asciidoc:538
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="snapshot*",
size="2",
sort="name",
offset="2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/70bbe14bc4d5a5d58e81ab2b02408817.asciidoc 0000664 0000000 0000000 00000000543 15176617013 0026474 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/configuring-pki-realm.asciidoc:159
[source, python]
----
resp = client.security.put_role_mapping(
name="users",
roles=[
"user"
],
rules={
"field": {
"dn": "cn=John Doe,ou=example,o=com"
}
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/70c736ecb3746dbe839af0e468712805.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/delete-transform.asciidoc:59
[source, python]
----
resp = client.transform.delete_transform(
transform_id="ecommerce_transform",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/update-trained-model-deployment.asciidoc:80
[source, python]
----
resp = client.ml.update_trained_model_deployment(
model_id="elastic__distilbert-base-uncased-finetuned-conll03-english",
number_of_allocations=4,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/70f89dd6b71ea890ad3cf47d83e43344.asciidoc 0000664 0000000 0000000 00000001337 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:66
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
description="My optional pipeline description",
processors=[
{
"set": {
"description": "My optional processor description",
"field": "my-long-field",
"value": 10
}
},
{
"set": {
"description": "Set 'my-boolean-field' to true",
"field": "my-boolean-field",
"value": True
}
},
{
"lowercase": {
"field": "my-keyword-field"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7106e6317e6368b9863cf64df9c6f0c9.asciidoc 0000664 0000000 0000000 00000001203 15176617013 0026402 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/put-transform.asciidoc:384
[source, python]
----
resp = client.transform.put_transform(
transform_id="ecommerce_transform2",
source={
"index": "kibana_sample_data_ecommerce"
},
latest={
"unique_key": [
"customer_id"
],
"sort": "order_date"
},
description="Latest order for each customer",
dest={
"index": "kibana_sample_data_ecommerce_transform2"
},
frequency="5m",
sync={
"time": {
"field": "order_date",
"delay": "60s"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/711443504b69d0d296e717c716a223e2.asciidoc 0000664 0000000 0000000 00000001772 15176617013 0026133 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/nested-query.asciidoc:212
[source, python]
----
resp = client.search(
index="drivers",
query={
"nested": {
"path": "driver",
"query": {
"nested": {
"path": "driver.vehicle",
"query": {
"bool": {
"must": [
{
"match": {
"driver.vehicle.make": "Powell Motors"
}
},
{
"match": {
"driver.vehicle.model": "Canyonero"
}
}
]
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7148c8512079d378af70302e65502dd2.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026132 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-tutorial.asciidoc:378
[source, python]
----
resp = client.indices.create(
index="timeseries-000001",
aliases={
"timeseries": {
"is_write_index": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7163346755400594d1dd7e445aa19ff0.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026217 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/docs/connectors-API-tutorial.asciidoc:426
[source, python]
----
resp = client.search(
index="music",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/719141517d83b7e8e929b347a8d67c9f.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026334 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:337
[source, python]
----
resp = client.indices.get(
index="kibana_sample_data_flights,.ds-my-data-stream-2022.06.17-000001",
features="settings",
flat_settings=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/71998bb300ac2a58419b0772cdc1c586.asciidoc 0000664 0000000 0000000 00000001331 15176617013 0026345 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/version.asciidoc:85
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"versions": {
"type": "version"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"versions": [
"8.0.0-beta1",
"8.5.0",
"0.90.12",
"2.6.1",
"1.3.4",
"1.3.4"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/71c629c44bf3c542a0daacbfc253c4b0.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026701 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/stats.asciidoc:1907
[source, python]
----
resp = client.cluster.stats(
node_id="node1,node*,master:false",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/71de08a2d962c66f0c60677eff23f8d1.asciidoc 0000664 0000000 0000000 00000001417 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-aggregation.asciidoc:123
[source, python]
----
resp = client.search(
index="sales",
aggs={
"price_ranges": {
"range": {
"field": "price",
"keyed": True,
"ranges": [
{
"key": "cheap",
"to": 100
},
{
"key": "average",
"from": 100,
"to": 200
},
{
"key": "expensive",
"from": 200
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/71e47a83f632ef159956287bbfe4ca12.asciidoc 0000664 0000000 0000000 00000001242 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/shape-query.asciidoc:54
[source, python]
----
resp = client.search(
index="example",
query={
"shape": {
"geometry": {
"shape": {
"type": "envelope",
"coordinates": [
[
1355,
5355
],
[
1400,
5200
]
]
},
"relation": "within"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/71fa652ddea811eb3c8bf8c5db21e549.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:230
[source, python]
----
resp = client.indices.analyze(
index="analyze_sample",
analyzer="whitespace",
text="this is a test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/722238b4e7b78cdb3c6a986780e7e286.asciidoc 0000664 0000000 0000000 00000001114 15176617013 0026376 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-field-note.asciidoc:105
[source, python]
----
resp = client.search(
index="range_index",
size="0",
query={
"range": {
"time_frame": {
"gte": "2019-11-01",
"format": "yyyy-MM-dd"
}
}
},
aggs={
"november_data": {
"date_histogram": {
"field": "time_frame",
"calendar_interval": "day",
"format": "yyyy-MM-dd"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/726994d8f3793b86628255a797155a52.asciidoc 0000664 0000000 0000000 00000000323 15176617013 0026033 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors.asciidoc:19
[source, python]
----
resp = client.nodes.info(
node_id="ingest",
filter_path="nodes.*.ingest.processors",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/72a3668ddc95d9aec47cc679d1e7afc5.asciidoc 0000664 0000000 0000000 00000001461 15176617013 0026762 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:79
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"cluster_one": {
"seeds": [
"35.238.149.1:9300"
],
"skip_unavailable": True
},
"cluster_two": {
"seeds": [
"35.238.149.2:9300"
],
"skip_unavailable": False
},
"cluster_three": {
"seeds": [
"35.238.149.3:9300"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/72ae3851160fcf02b8e2cdfd4e57d238.asciidoc 0000664 0000000 0000000 00000000247 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/start-ilm.asciidoc:66
[source, python]
----
resp = client.ilm.start()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/72b999120785dfba2827268482e9be0a.asciidoc 0000664 0000000 0000000 00000003627 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geobounds-aggregation.asciidoc:12
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"location": "POINT (4.912350 52.374081)",
"name": "NEMO Science Museum"
},
{
"index": {
"_id": 2
}
},
{
"location": "POINT (4.901618 52.369219)",
"name": "Museum Het Rembrandthuis"
},
{
"index": {
"_id": 3
}
},
{
"location": "POINT (4.914722 52.371667)",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {
"_id": 4
}
},
{
"location": "POINT (4.405200 51.222900)",
"name": "Letterenhuis"
},
{
"index": {
"_id": 5
}
},
{
"location": "POINT (2.336389 48.861111)",
"name": "Musée du Louvre"
},
{
"index": {
"_id": 6
}
},
{
"location": "POINT (2.327000 48.860000)",
"name": "Musée d'Orsay"
}
],
)
print(resp1)
resp2 = client.search(
index="museums",
size="0",
query={
"match": {
"name": "musée"
}
},
aggs={
"viewport": {
"geo_bounds": {
"field": "location",
"wrap_longitude": True
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/72bae0252b74ff6fd9f0702ff008d84a.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-api.asciidoc:670
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="*",
sort="name",
from_sort_value="snapshot_2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/72beebe779a258c225dee7b023e60c52.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026565 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/point-in-time-api.asciidoc:152
[source, python]
----
resp = client.nodes.stats(
metric="indices",
index_metric="search",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/730045fae3743c39b612813a42c330c3.asciidoc 0000664 0000000 0000000 00000000757 15176617013 0026176 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/73250f845738c428246a3ade66a8f54c.asciidoc 0000664 0000000 0000000 00000002074 15176617013 0026310 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/weighted-avg-aggregation.asciidoc:152
[source, python]
----
resp = client.index(
index="exams",
refresh=True,
document={
"grade": 100,
"weight": [
2,
3
]
},
)
print(resp)
resp1 = client.index(
index="exams",
refresh=True,
document={
"grade": 80,
"weight": 3
},
)
print(resp1)
resp2 = client.search(
index="exams",
filter_path="aggregations",
size=0,
runtime_mappings={
"weight.combined": {
"type": "double",
"script": "\n double s = 0;\n for (double w : doc['weight']) {\n s += w;\n }\n emit(s);\n "
}
},
aggs={
"weighted_grade": {
"weighted_avg": {
"value": {
"script": "doc.grade.value + 1"
},
"weight": {
"field": "weight.combined"
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/734e2b1d1ca84a305240a449738f0eba.asciidoc 0000664 0000000 0000000 00000000445 15176617013 0026412 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:467
[source, python]
----
resp = client.cat.indices(
v=True,
index=".ds-my-data-stream-2022.06.17-000001,kibana_sample_data_flightsh=index,status,health",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/73646c12ad33a813ab2280f1dc83500e.asciidoc 0000664 0000000 0000000 00000000441 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/put-follow.asciidoc:30
[source, python]
----
resp = client.ccr.follow(
index="",
wait_for_active_shards="1",
remote_cluster="",
leader_index="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/738db420e3ad2a127ea75fb8e5051926.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:455
[source, python]
----
resp = client.search(
index="last-log-from-clientip",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/73b07b24ab2c4cd304a57f9cbda8b863.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026634 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// behavioral-analytics/apis/list-analytics-collection.asciidoc:66
[source, python]
----
resp = client.search_application.get_behavioral_analytics()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/73be1f93d789264e5b972ddb5991bc66.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0026470 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/logging-config.asciidoc:180
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.discovery": "DEBUG"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/73d1a6c5ef90b7e35d43a0bfdc1e158d.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026717 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-index-caps.asciidoc:95
[source, python]
----
resp = client.rollup.get_rollup_index_caps(
index="sensor_rollup",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/73df03be6ee78b10106581dbd7cb39ef.asciidoc 0000664 0000000 0000000 00000001432 15176617013 0026653 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:489
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_movavg": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.ewma(values, 0.3)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/73ebc89cb32adb389ae16bb088d7c7e6.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:242
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.enable": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/73f9271dee9b8539b6aa7e17f323c623.asciidoc 0000664 0000000 0000000 00000001424 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/multi-terms-aggregation.asciidoc:342
[source, python]
----
resp = client.search(
index="products",
aggs={
"genres_and_products": {
"multi_terms": {
"terms": [
{
"field": "genre"
},
{
"field": "product"
}
],
"order": {
"total_quantity": "desc"
}
},
"aggs": {
"total_quantity": {
"sum": {
"field": "quantity"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/73fa0d6d03cd98ea538fff9e89d99eed.asciidoc 0000664 0000000 0000000 00000000355 15176617013 0027061 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-service-accounts.asciidoc:63
[source, python]
----
resp = client.security.get_service_accounts(
namespace="elastic",
service="fleet-server",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7404c6e809fee5d7eb9678a82a872806.asciidoc 0000664 0000000 0000000 00000000744 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations.asciidoc:180
[source, python]
----
resp = client.search(
index="my-index-000001",
aggs={
"my-agg-name": {
"terms": {
"field": "my-field"
},
"aggs": {
"my-sub-agg-name": {
"avg": {
"field": "my-other-field"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/741180473ba526219578ad0422f4fe81.asciidoc 0000664 0000000 0000000 00000001303 15176617013 0026124 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-features-api.asciidoc:97
[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/my-connector/_features",
headers={"Content-Type": "application/json"},
body={
"features": {
"document_level_security": {
"enabled": True
},
"incremental_sync": {
"enabled": True
},
"sync_rules": {
"advanced": {
"enabled": False
},
"basic": {
"enabled": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7429b16221fe741fd31b0584786dd0b0.asciidoc 0000664 0000000 0000000 00000000573 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/post-inference.asciidoc:249
[source, python]
----
resp = client.inference.inference(
task_type="text_embedding",
inference_id="my-cohere-endpoint",
input="The sky above the port was the color of television tuned to a dead channel.",
task_settings={
"input_type": "ingest"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/744aeb2af40f519e430e21e004e3c3b7.asciidoc 0000664 0000000 0000000 00000001425 15176617013 0026470 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/multivalued-fields.asciidoc:99
[source, python]
----
resp = client.indices.create(
index="mv",
mappings={
"properties": {
"b": {
"type": "long"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="mv",
refresh=True,
operations=[
{
"index": {}
},
{
"a": 1,
"b": [
2,
2,
1
]
},
{
"index": {}
},
{
"a": 2,
"b": [
1,
1
]
}
],
)
print(resp1)
resp2 = client.esql.query(
query="FROM mv | LIMIT 2",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/7456ef459d510d66ba4492cc9fbdc6c6.asciidoc 0000664 0000000 0000000 00000000743 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/remote-clusters-connect.asciidoc:194
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"cluster_two": {
"mode": None,
"seeds": None,
"skip_unavailable": None,
"transport.compress": None
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/745864ef2427188241a4702b94ea57be.asciidoc 0000664 0000000 0000000 00000001273 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/histogram-aggregation.asciidoc:164
[source, python]
----
resp = client.search(
index="sales",
size="0",
query={
"constant_score": {
"filter": {
"range": {
"price": {
"lte": "500"
}
}
}
}
},
aggs={
"prices": {
"histogram": {
"field": "price",
"interval": 50,
"extended_bounds": {
"min": 0,
"max": 500
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/74678f8bbc7e4fc1885719d1cf63ac67.asciidoc 0000664 0000000 0000000 00000001412 15176617013 0026544 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/daterange-aggregation.asciidoc:354
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"range": {
"date_range": {
"field": "date",
"format": "MM-yyy",
"ranges": [
{
"from": "01-2015",
"to": "03-2015",
"key": "quarter_01"
},
{
"from": "03-2015",
"to": "06-2015",
"key": "quarter_02"
}
],
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/746e0a1cb5984f2672963b363505c7b3.asciidoc 0000664 0000000 0000000 00000001245 15176617013 0026222 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/date.asciidoc:188
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"date": {
"type": "date",
"format": "strict_date_optional_time||epoch_second"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="example",
refresh=True,
document={
"date": 1618321898
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
fields=[
{
"field": "date"
}
],
source=False,
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/746e87db7e1e8b5e6b40d8b5b188de42.asciidoc 0000664 0000000 0000000 00000000476 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/stats-aggregation.asciidoc:14
[source, python]
----
resp = client.search(
index="exams",
size="0",
aggs={
"grades_stats": {
"stats": {
"field": "grade"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7471e97aaaf21c3a200abdd89f15c3cc.asciidoc 0000664 0000000 0000000 00000001140 15176617013 0026706 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/intervals-query.asciidoc:393
[source, python]
----
resp = client.search(
query={
"intervals": {
"my_text": {
"match": {
"query": "hot porridge",
"max_gaps": 10,
"filter": {
"not_containing": {
"match": {
"query": "salty"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7478ff69113fb53f41ea07cdf911fa67.asciidoc 0000664 0000000 0000000 00000001535 15176617013 0026533 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/747a4b5001423938d7d05399d28f1995.asciidoc 0000664 0000000 0000000 00000000356 15176617013 0026076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-with-existing-indices.asciidoc:74
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"indices.lifecycle.poll_interval": "1m"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/74a80c28737a0648db0dfe7f049d12f2.asciidoc 0000664 0000000 0000000 00000000255 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:278
[source, python]
----
resp = client.exists(
index="my-index-000001",
id="0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/74b13ceb6cda3acaa9e9f58c9e5e2431.asciidoc 0000664 0000000 0000000 00000000504 15176617013 0027011 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/meta-field.asciidoc:31
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
meta={
"class": "MyApp2::User3",
"version": {
"min": "1.3",
"max": "1.5"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/74da377bccad43da2b0e276c086d26ba.asciidoc 0000664 0000000 0000000 00000000773 15176617013 0026722 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/cluster-info.asciidoc:388
[source, python]
----
resp = client.cluster.info(
target="_all",
)
print(resp)
resp1 = client.cluster.info(
target="http",
)
print(resp1)
resp2 = client.cluster.info(
target="ingest",
)
print(resp2)
resp3 = client.cluster.info(
target="thread_pool",
)
print(resp3)
resp4 = client.cluster.info(
target="script",
)
print(resp4)
resp5 = client.cluster.info(
target="http,ingest",
)
print(resp5)
----
python-elasticsearch-9.4.0/docs/examples/750ac969f9a05567f5cdf4f93d6244b6.asciidoc 0000664 0000000 0000000 00000000653 15176617013 0026466 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:281
[source, python]
----
resp = client.cluster.reroute(
commands=[
{
"allocate_empty_primary": {
"index": "my-index",
"shard": 0,
"node": "my-node",
"accept_data_loss": "true"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7594a9a85c8511701e281974cbc253e1.asciidoc 0000664 0000000 0000000 00000001051 15176617013 0026215 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:236
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="amazon_bedrock_embeddings",
inference_config={
"service": "amazonbedrock",
"service_settings": {
"access_key": "",
"secret_key": "",
"region": "",
"provider": "",
"model": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/75957a7d1b67e3d47899c5f18b32cb61.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026376 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/close-job.asciidoc:105
[source, python]
----
resp = client.ml.close_job(
job_id="low_request_rate",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/75aba7b1d3a22dce62f26b8b1e6bee58.asciidoc 0000664 0000000 0000000 00000000505 15176617013 0027002 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/validate.asciidoc:173
[source, python]
----
resp = client.indices.validate_query(
index="my-index-000001",
explain=True,
query={
"query_string": {
"query": "@timestamp:foo",
"lenient": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/75c347b181112d2c4538c01ade903afe.asciidoc 0000664 0000000 0000000 00000000601 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:257
[source, python]
----
resp = client.indices.validate_query(
index="my-index-000001",
rewrite=True,
query={
"match": {
"user.id": {
"query": "kimchy",
"fuzziness": "auto"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/75e13a00f0909c955031ff62acc14a79.asciidoc 0000664 0000000 0000000 00000000723 15176617013 0026344 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/collapse-search-results.asciidoc:12
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"message": "GET /search"
}
},
collapse={
"field": "user.id"
},
sort=[
{
"http.response.bytes": {
"order": "desc"
}
}
],
from_=0,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/75e360d03fb416f0a65ca37c662c2e9c.asciidoc 0000664 0000000 0000000 00000001542 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/scripted-metric-aggregation.asciidoc:159
[source, python]
----
resp = client.bulk(
index="transactions",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"type": "sale",
"amount": 80
},
{
"index": {
"_id": 2
}
},
{
"type": "cost",
"amount": 10
},
{
"index": {
"_id": 3
}
},
{
"type": "cost",
"amount": 30
},
{
"index": {
"_id": 4
}
},
{
"type": "sale",
"amount": 130
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/75e6d66e94e61bd8a555beaaee255c36.asciidoc 0000664 0000000 0000000 00000000525 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-search.asciidoc:178
[source, python]
----
resp = client.rollup.rollup_search(
index="sensor_rollup",
size=0,
aggregations={
"avg_temperature": {
"avg": {
"field": "temperature"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/763ce1377c8dfa1ca6a042d8ee99f4f5.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/tsds-reindex.asciidoc:284
[source, python]
----
resp = client.indices.rollover(
alias="k9s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/76448aaaaa2c352bb6e09d2f83a3fbb3.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0026711 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/letter-tokenizer.asciidoc:16
[source, python]
----
resp = client.indices.analyze(
tokenizer="letter",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7659f2f2b0fbe8584b855a01638b95ed.asciidoc 0000664 0000000 0000000 00000001044 15176617013 0026453 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:777
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"user_name": {
"terms": {
"field": "user_name"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/765c9c8b40b67a42121648045dbf10fb.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026340 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/jvm-memory-pressure.asciidoc:11
[source, python]
----
resp = client.nodes.stats(
filter_path="nodes.*.jvm.mem.pools.old",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/766cfc1c9fcd2c186e965761ceb2c07d.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026674 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/increase-tier-capacity.asciidoc:300
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"number_of_replicas": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/769f75829a8e6670aa4cf83d0d737046.asciidoc 0000664 0000000 0000000 00000001523 15176617013 0026323 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/autodatehistogram-aggregation.asciidoc:124
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"date": "2015-10-01T00:30:00Z"
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"date": "2015-10-01T01:30:00Z"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="3",
refresh=True,
document={
"date": "2015-10-01T02:30:00Z"
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
size="0",
aggs={
"by_day": {
"auto_date_histogram": {
"field": "date",
"buckets": 3
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/76b279835936ee4b546a171c671c3cd7.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026313 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/cjk-width-tokenfilter.asciidoc:28
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"cjk_width"
],
text="シーサイドライナー",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/76bc87c2592864152768687c2963d1d1.asciidoc 0000664 0000000 0000000 00000001256 15176617013 0026110 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-api-key.asciidoc:154
[source, python]
----
resp = client.security.update_api_key(
id="VuaCfGcBCdbkQm-e5aOx",
role_descriptors={
"role-a": {
"indices": [
{
"names": [
"*"
],
"privileges": [
"write"
]
}
]
}
},
metadata={
"environment": {
"level": 2,
"trusted": True,
"tags": [
"production"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/76c167d8ab305cb43b594f140c902dfe.asciidoc 0000664 0000000 0000000 00000000624 15176617013 0026510 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shrink-index.asciidoc:168
[source, python]
----
resp = client.indices.shrink(
index="my_source_index",
target="my_target_index",
settings={
"index.number_of_replicas": 1,
"index.number_of_shards": 1,
"index.codec": "best_compression"
},
aliases={
"my_search_indices": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/76c73b54f3f1e5cb1c0fcccd7c3fd18e.asciidoc 0000664 0000000 0000000 00000003631 15176617013 0027074 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/76dbdd0b2bd48c3c6b1a8d81e23bafd6.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0027051 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:149
[source, python]
----
resp = client.indices.analyze(
analyzer="standard",
text="this is a test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/76e02434835630cb830724beb92df354.asciidoc 0000664 0000000 0000000 00000002636 15176617013 0026217 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/77082b1ffaae9ac52dfc133fa597baa7.asciidoc 0000664 0000000 0000000 00000000546 15176617013 0027013 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7709a48020a6cefbbe547fb944541cdb.asciidoc 0000664 0000000 0000000 00000001140 15176617013 0026565 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:421
[source, python]
----
resp = client.bulk(
index="my-bit-vectors",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"my_vector": [
127,
-127,
0,
1,
42
]
},
{
"index": {
"_id": "2"
}
},
{
"my_vector": "8100012a7f"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7741a04e7e621c528cd72848d875776d.asciidoc 0000664 0000000 0000000 00000000340 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-new-data-stream.asciidoc:56
[source, python]
----
resp = client.indices.create_data_stream(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77447e2966708e92f5e219d43ac3f00d.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026312 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:232
[source, python]
----
resp = client.tasks.list(
actions="*reindex",
wait_for_completion=True,
timeout="10s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/774bfde8793dc4927f7cad2dd91c5b5f.asciidoc 0000664 0000000 0000000 00000001113 15176617013 0026756 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/multi-search-template-api.asciidoc:44
[source, python]
----
resp = client.msearch_template(
index="my-index",
search_templates=[
{},
{
"id": "my-search-template",
"params": {
"query_string": "hello world",
"from": 0,
"size": 10
}
},
{},
{
"id": "my-other-search-template",
"params": {
"query_type": "match_all"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77518e8c6198acfe77c0934fd2fe65cb.asciidoc 0000664 0000000 0000000 00000005335 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// text-structure/apis/find-message-structure.asciidoc:93
[source, python]
----
resp = client.text_structure.find_message_structure(
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)
----
python-elasticsearch-9.4.0/docs/examples/7752b677825523bfb0c38ad9325a6d47.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/delete-connector-api.asciidoc:79
[source, python]
----
resp = client.connector.delete(
connector_id="another-connector",
delete_sync_jobs=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/776b553df0e507c96dbdbaedecaca0cc.asciidoc 0000664 0000000 0000000 00000000447 15176617013 0027227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/infer-trained-model.asciidoc:987
[source, python]
----
resp = client.ml.infer_trained_model(
model_id="model2",
docs=[
{
"text_field": "The movie was awesome!!"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7777326c6052fee28061e5b82540aedc.asciidoc 0000664 0000000 0000000 00000000556 15176617013 0026363 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:402
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"grade_percentiles": {
"percentiles": {
"field": "grade",
"missing": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7781b13b0ffff6026d10c4e3ab4a3a51.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026551 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// behavioral-analytics/apis/put-analytics-collection.asciidoc:55
[source, python]
----
resp = client.search_application.put_behavioral_analytics(
name="my_analytics_collection",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77828fcaecc3f058c48b955928198ff6.asciidoc 0000664 0000000 0000000 00000001461 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/grok.asciidoc:132
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"description": "parse multiple patterns",
"processors": [
{
"grok": {
"field": "message",
"patterns": [
"%{FAVORITE_DOG:pet}",
"%{FAVORITE_CAT:pet}"
],
"pattern_definitions": {
"FAVORITE_DOG": "beagle",
"FAVORITE_CAT": "burmese"
}
}
}
]
},
docs=[
{
"_source": {
"message": "I love burmese cats!"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc 0000664 0000000 0000000 00000001001 15176617013 0026152 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-azure-openai.asciidoc:147
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="azure_openai_embeddings",
inference_config={
"service": "azureopenai",
"service_settings": {
"api_key": "",
"resource_name": "",
"deployment_id": "",
"api_version": "2024-02-01"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77c099c97ea6911e2dd6e996da7dcca0.asciidoc 0000664 0000000 0000000 00000000357 15176617013 0026704 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-hot-threads.asciidoc:78
[source, python]
----
resp = client.nodes.hot_threads()
print(resp)
resp1 = client.nodes.hot_threads(
node_id="nodeId1,nodeId2",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/77c50f982906718ecc59aa708aed728f.asciidoc 0000664 0000000 0000000 00000000522 15176617013 0026461 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:299
[source, python]
----
resp = client.update(
index="my-index-000001",
id="1",
script={
"source": "ctx._source.counter += params.count",
"lang": "painless",
"params": {
"count": 4
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77ca1a3193f75651e0bf9e8fe5227a04.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026437 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-job-model-snapshot-upgrade-stats.asciidoc:127
[source, python]
----
resp = client.ml.get_model_snapshot_upgrade_stats(
job_id="low_request_rate",
snapshot_id="_all",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77cebba946fe648873a1e7375c13df41.asciidoc 0000664 0000000 0000000 00000000531 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:215
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.disk.watermark.low": "90%",
"cluster.routing.allocation.disk.watermark.high": "95%"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77d0780c5faea4c9ec51a322a6811b3b.asciidoc 0000664 0000000 0000000 00000003363 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1309
[source, python]
----
resp = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {}
},
{
"timestamp": "2020-04-30T14:30:17-05:00",
"message": "40.135.0.0 - - [30/Apr/2020:14:30:17 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:30:53-05:00",
"message": "232.0.0.0 - - [30/Apr/2020:14:30:53 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:12-05:00",
"message": "26.1.0.0 - - [30/Apr/2020:14:31:12 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:19-05:00",
"message": "247.37.0.0 - - [30/Apr/2020:14:31:19 -0500] \"GET /french/splash_inet.html HTTP/1.0\" 200 3781"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:22-05:00",
"message": "247.37.0.0 - - [30/Apr/2020:14:31:22 -0500] \"GET /images/hm_nbg.jpg HTTP/1.0\" 304 0"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:27-05:00",
"message": "252.0.0.0 - - [30/Apr/2020:14:31:27 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:28-05:00",
"message": "not a valid apache log"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/77e3dcd87d2b2c8e6ec842462b02df1f.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/clone-index.asciidoc:16
[source, python]
----
resp = client.indices.clone(
index="my-index-000001",
target="cloned-my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/78043831fd32004a82930c8ac8a1d809.asciidoc 0000664 0000000 0000000 00000003142 15176617013 0026203 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/78176cd6f570e1534bb40b19e6e900b6.asciidoc 0000664 0000000 0000000 00000000225 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/alias.asciidoc:93
[source, python]
----
resp = client.cat.aliases(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/783c4fa5351a242364210fc32496beb2.asciidoc 0000664 0000000 0000000 00000000573 15176617013 0026261 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/concurrency-control.asciidoc:102
[source, python]
----
resp = client.index(
index="products",
id="1567",
if_seq_no="362",
if_primary_term="2",
document={
"product": "r2d2",
"details": "A resourceful astromech droid",
"tags": [
"droid"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7841b65a3bb880ed66cec453925a50cf.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:380
[source, python]
----
resp = client.delete_by_query(
index="my-index-000001,my-index-000002",
query={
"match_all": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7846974b47a3eab1832a475663d23ad9.asciidoc 0000664 0000000 0000000 00000001416 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:292
[source, python]
----
resp = client.search(
size=10000,
query={
"match": {
"user.id": "elkbee"
}
},
pit={
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==",
"keep_alive": "1m"
},
sort=[
{
"@timestamp": {
"order": "asc",
"format": "strict_date_optional_time_nanos"
}
}
],
search_after=[
"2021-05-20T05:30:04.832Z",
4294967298
],
track_total_hits=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7885ca9d7c61050095288eef6bc6cca9.asciidoc 0000664 0000000 0000000 00000001050 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/jwt-realm.asciidoc:676
[source, python]
----
resp = client.security.put_role_mapping(
name="jwt8_users",
refresh=True,
roles=[
"user"
],
rules={
"all": [
{
"field": {
"realm.name": "jwt8"
}
},
{
"field": {
"username": "principalname1"
}
}
]
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7888c509774a2abfe82ca370c43d8789.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:4
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "cohere-embeddings",
"pipeline": "cohere_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/78c4035e4fbf6851140660f6ed2a1fa5.asciidoc 0000664 0000000 0000000 00000000217 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/stats.asciidoc:121
[source, python]
----
resp = client.indices.stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/78c96113ae4ed0054e581b17542528a7.asciidoc 0000664 0000000 0000000 00000000540 15176617013 0026211 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:409
[source, python]
----
resp = client.reindex(
source={
"index": "source",
"query": {
"match": {
"company": "cat"
}
}
},
dest={
"index": "dest",
"routing": "=cat"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/78e20b4cff470ed7357de1fd74bcfeb7.asciidoc 0000664 0000000 0000000 00000000670 15176617013 0027031 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:137
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"remove": {
"index": "index1",
"alias": "logs-non-existing"
}
},
{
"add": {
"index": "index2",
"alias": "logs-non-existing"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/790684b45bef2bb848ea932f0fd0cfbd.asciidoc 0000664 0000000 0000000 00000001710 15176617013 0026737 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/790c49fe2ec638e5e8db51a9236bba35.asciidoc 0000664 0000000 0000000 00000001375 15176617013 0026612 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:133
[source, python]
----
resp = client.search(
index="my_locations,my_geoshapes",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_bounding_box": {
"pin.location": {
"top_left": {
"lat": 40.73,
"lon": -74.1
},
"bottom_right": {
"lat": 40.01,
"lon": -71.12
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7965d4dbafdc7ca9e1ee6759939dd2e8.asciidoc 0000664 0000000 0000000 00000003703 15176617013 0026776 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/how-watcher-works.asciidoc:50
[source, python]
----
resp = client.watcher.put_watch(
id="log_errors",
metadata={
"color": "red"
},
trigger={
"schedule": {
"interval": "5m"
}
},
input={
"search": {
"request": {
"indices": "log-events",
"body": {
"size": 0,
"query": {
"match": {
"status": "error"
}
}
}
}
}
},
condition={
"compare": {
"ctx.payload.hits.total": {
"gt": 5
}
}
},
transform={
"search": {
"request": {
"indices": "log-events",
"body": {
"query": {
"match": {
"status": "error"
}
}
}
}
}
},
actions={
"my_webhook": {
"webhook": {
"method": "POST",
"host": "mylisteninghost",
"port": 9200,
"path": "/{{watch_id}}",
"body": "Encountered {{ctx.payload.hits.total}} errors"
}
},
"email_administrator": {
"email": {
"to": "sys.admino@host.domain",
"subject": "Encountered {{ctx.payload.hits.total}} errors",
"body": "Too many error in the system, see attached data",
"attachments": {
"attached_data": {
"data": {
"format": "json"
}
}
},
"priority": "high"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/79b43a1bf02fb5b38f54b8d5aa5dab53.asciidoc 0000664 0000000 0000000 00000000637 15176617013 0026726 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/autodatehistogram-aggregation.asciidoc:43
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sales_over_time": {
"auto_date_histogram": {
"field": "date",
"buckets": 5,
"format": "yyyy-MM-dd"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/79bf91ace935d095d8e44b3ef3fe2efa.asciidoc 0000664 0000000 0000000 00000000575 15176617013 0027043 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/diagnose-unassigned-shards.asciidoc:269
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
flat_settings=True,
include_defaults=True,
)
print(resp)
resp1 = client.cluster.get_settings(
flat_settings=True,
include_defaults=True,
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/79cb85efd5e4c435e73b253cb9feabb1.asciidoc 0000664 0000000 0000000 00000001245 15176617013 0027023 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/dissect-syntax.asciidoc:250
[source, python]
----
resp = client.search(
index="my-index",
runtime_mappings={
"http.response": {
"type": "long",
"script": "\n String response=dissect('%{clientip} %{ident} %{auth} [%{@timestamp}] \"%{verb} %{request} HTTP/%{httpversion}\" %{response} %{size}').extract(doc[\"message\"].value)?.response;\n if (response != null) emit(Integer.parseInt(response));\n "
}
},
query={
"match": {
"http.response": "304"
}
},
fields=[
"http.response"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/79d206a528be704050a437adce2496dd.asciidoc 0000664 0000000 0000000 00000001064 15176617013 0026426 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/79e053326a3a8eec828523a035393f66.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026222 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:354
[source, python]
----
resp = client.delete(
index=".ds-my-data-stream-2099.03.08-000003",
id="bfspvnIBr7VVZlfp2lqX",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/79e8bbbd6c440a21b0b4260c8cb1a61c.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026616 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:207
[source, python]
----
resp = client.index(
index="example",
document={
"location": "LINESTRING (-77.03653 38.897676, -77.009051 38.889939)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/79f33e05b203eb46eef7958fbc95ef77.asciidoc 0000664 0000000 0000000 00000000337 15176617013 0026631 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:93
[source, python]
----
resp = client.ccr.get_auto_follow_pattern(
name="my_auto_follow_pattern",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/79feb4a0c0a21b7015a52f9736cd4683.asciidoc 0000664 0000000 0000000 00000002710 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-inner-hits.asciidoc:324
[source, python]
----
resp = client.indices.create(
index="test",
mappings={
"properties": {
"comments": {
"type": "nested",
"properties": {
"votes": {
"type": "nested"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="test",
id="1",
refresh=True,
document={
"title": "Test title",
"comments": [
{
"author": "kimchy",
"text": "comment text",
"votes": []
},
{
"author": "nik9000",
"text": "words words words",
"votes": [
{
"value": 1,
"voter": "kimchy"
},
{
"value": -1,
"voter": "other"
}
]
}
]
},
)
print(resp1)
resp2 = client.search(
index="test",
query={
"nested": {
"path": "comments.votes",
"query": {
"match": {
"comments.votes.voter": "kimchy"
}
},
"inner_hits": {}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/79ff4e7fa5c004226d05d7e2bfb5dc1e.asciidoc 0000664 0000000 0000000 00000002256 15176617013 0026736 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7a0c633a67244e9703344d036e584d95.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0026140 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/enable-user-profile.asciidoc:60
[source, python]
----
resp = client.security.enable_user_profile(
uid="u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7a0eb2222fe282d3aab66e12feff2a3b.asciidoc 0000664 0000000 0000000 00000002104 15176617013 0026762 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:832
[source, python]
----
resp = client.index(
index="ip_location",
refresh=True,
document={
"ip": "192.168.1.1",
"country": "Canada",
"city": "Montreal"
},
)
print(resp)
resp1 = client.index(
index="logs",
id="1",
refresh=True,
document={
"host": "192.168.1.1",
"message": "the first message"
},
)
print(resp1)
resp2 = client.index(
index="logs",
id="2",
refresh=True,
document={
"host": "192.168.1.2",
"message": "the second message"
},
)
print(resp2)
resp3 = client.search(
index="logs",
runtime_mappings={
"location": {
"type": "lookup",
"target_index": "ip_location",
"input_field": "host",
"target_field": "ip",
"fetch_fields": [
"country",
"city"
]
}
},
fields=[
"host",
"message",
"location"
],
source=False,
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/7a23a385a63c87cab58fd494870450fd.asciidoc 0000664 0000000 0000000 00000001052 15176617013 0026441 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:181
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping4",
roles=[
"superuser"
],
enabled=True,
rules={
"any": [
{
"field": {
"username": "esadmin"
}
},
{
"field": {
"groups": "cn=admins,dc=example,dc=com"
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7a27336a61284d079f3cc3994cf927d1.asciidoc 0000664 0000000 0000000 00000003206 15176617013 0026311 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7a2b9a7b2b6553a48bd4db60a939c0fc.asciidoc 0000664 0000000 0000000 00000000646 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:331
[source, python]
----
resp = client.index(
index="test_index",
id="1",
refresh=True,
document={
"query": {
"match": {
"body": {
"query": "miss bicycl",
"analyzer": "whitespace"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7a2fdfd7b0553d63440af7598f9ad867.asciidoc 0000664 0000000 0000000 00000000721 15176617013 0026537 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7a3a7fbd81e5050b42e8c1eca26c7c1d.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026715 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/async-search.asciidoc:340
[source, python]
----
resp = client.async_search.delete(
id="FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7a8de5606f283f4ef171b015eef6befa.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/stats.asciidoc:149
[source, python]
----
resp = client.indices.stats(
metric="search",
groups="group1,group2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7a987cd13383bdc990155d7bd5fb221e.asciidoc 0000664 0000000 0000000 00000001066 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/field-level-security.asciidoc:114
[source, python]
----
resp = client.security.put_role(
name="test_role5",
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"*"
],
"except": [
"customer.handle"
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7ab968a61bb0783f563dd6d29b253901.asciidoc 0000664 0000000 0000000 00000002754 15176617013 0026367 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:379
[source, python]
----
resp = client.indices.create(
index="catalan_example",
settings={
"analysis": {
"filter": {
"catalan_elision": {
"type": "elision",
"articles": [
"d",
"l",
"m",
"n",
"s",
"t"
],
"articles_case": True
},
"catalan_stop": {
"type": "stop",
"stopwords": "_catalan_"
},
"catalan_keywords": {
"type": "keyword_marker",
"keywords": [
"example"
]
},
"catalan_stemmer": {
"type": "stemmer",
"language": "catalan"
}
},
"analyzer": {
"rebuilt_catalan": {
"tokenizer": "standard",
"filter": [
"catalan_elision",
"lowercase",
"catalan_stop",
"catalan_keywords",
"catalan_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7ae434b3667c589a8e70fe560f4ee3f9.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026543 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:18
[source, python]
----
resp = client.update_by_query(
index="my-index-000001",
conflicts="proceed",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7af1f62b0cf496cbf593d83d30b472cc.asciidoc 0000664 0000000 0000000 00000001423 15176617013 0026653 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7b3e913368e96eaa6e22e0d03c81310e.asciidoc 0000664 0000000 0000000 00000000360 15176617013 0026422 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/store.asciidoc:30
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index.store.type": "hybridfs"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7b3f255d28ce5b46d111402b96b41351.asciidoc 0000664 0000000 0000000 00000000570 15176617013 0026256 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/run-as-privilege.asciidoc:170
[source, python]
----
resp = client.security.put_user(
username="admin_user",
refresh=True,
password="l0ng-r4nd0m-p@ssw0rd",
roles=[
"my_admin_role"
],
full_name="Eirian Zola",
metadata={
"intelligence": 7
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7b5c231526846f2f7b98d78f3656ae6a.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:364
[source, python]
----
resp = client.update(
index="test",
id="1",
doc={
"name": "new_name"
},
doc_as_upsert=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7b7a828c21c856a3cbc41fd2f85108bf.asciidoc 0000664 0000000 0000000 00000000611 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:483
[source, python]
----
resp = client.indices.refresh()
print(resp)
resp1 = client.search(
index="my-index-000001",
size="0",
filter_path="hits.total",
query={
"range": {
"http.response.bytes": {
"lt": 2000000
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7b864d61767ab283cfd5f9b9ba784b1f.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:207
[source, python]
----
resp = client.security.get_api_key(
name="my-api-key",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7b908b1189f076942de8cd497ff1fa59.asciidoc 0000664 0000000 0000000 00000000632 15176617013 0026471 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:216
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "quick brown fox",
"type": "most_fields",
"fields": [
"title",
"title.original",
"title.shingles"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7b9dfe5857bde1bd8483ea3241656714.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/whitespace-tokenizer.asciidoc:14
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7ba29f0be2297b54a640b0a17d7ef5ca.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026641 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7bdc283b96c7a965fae23013647b8578.asciidoc 0000664 0000000 0000000 00000000762 15176617013 0026377 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/semantic-text.asciidoc:220
[source, python]
----
resp = client.indices.create(
index="test-index",
mappings={
"properties": {
"source_field": {
"type": "text",
"copy_to": "infer_field"
},
"infer_field": {
"type": "semantic_text",
"inference_id": ".elser-2-elasticsearch"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7c24d4bef3f2045407fbf1b95c5416f9.asciidoc 0000664 0000000 0000000 00000001506 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:34
[source, python]
----
resp = client.indices.create(
index="range_index",
settings={
"number_of_shards": 2
},
mappings={
"properties": {
"expected_attendees": {
"type": "integer_range"
},
"time_frame": {
"type": "date_range",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
},
)
print(resp)
resp1 = client.index(
index="range_index",
id="1",
refresh=True,
document={
"expected_attendees": {
"gte": 10,
"lt": 20
},
"time_frame": {
"gte": "2015-10-31 12:00:00",
"lte": "2015-11-01"
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7c3414279d47e9c29105d061ed316ef8.asciidoc 0000664 0000000 0000000 00000000464 15176617013 0026307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/completion-suggest.asciidoc:104
[source, python]
----
resp = client.index(
index="music",
id="1",
refresh=True,
document={
"suggest": [
"Nevermind",
"Nirvana"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7c4551abbb7a5f3841109f7664bc4aad.asciidoc 0000664 0000000 0000000 00000001236 15176617013 0026564 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/pattern-analyzer.asciidoc:267
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"camel": {
"type": "pattern",
"pattern": "([^\\p{L}\\d]+)|(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)|(?<=[\\p{L}&&[^\\p{Lu}]])(?=\\p{Lu})|(?<=\\p{Lu})(?=\\p{Lu}[\\p{L}&&[^\\p{Lu}]])"
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="camel",
text="MooseX::FTPClass2_beta",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7c5aed55a2a1dce4b63c18e1ce8146ff.asciidoc 0000664 0000000 0000000 00000004324 15176617013 0027010 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/ipprefix-aggregation.asciidoc:14
[source, python]
----
resp = client.indices.create(
index="network-traffic",
mappings={
"properties": {
"ipv4": {
"type": "ip"
},
"ipv6": {
"type": "ip"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="network-traffic",
refresh=True,
operations=[
{
"index": {
"_id": 0
}
},
{
"ipv4": "192.168.1.10",
"ipv6": "2001:db8:a4f8:112a:6001:0:12:7f10"
},
{
"index": {
"_id": 1
}
},
{
"ipv4": "192.168.1.12",
"ipv6": "2001:db8:a4f8:112a:6001:0:12:7f12"
},
{
"index": {
"_id": 2
}
},
{
"ipv4": "192.168.1.33",
"ipv6": "2001:db8:a4f8:112a:6001:0:12:7f33"
},
{
"index": {
"_id": 3
}
},
{
"ipv4": "192.168.1.10",
"ipv6": "2001:db8:a4f8:112a:6001:0:12:7f10"
},
{
"index": {
"_id": 4
}
},
{
"ipv4": "192.168.2.41",
"ipv6": "2001:db8:a4f8:112c:6001:0:12:7f41"
},
{
"index": {
"_id": 5
}
},
{
"ipv4": "192.168.2.10",
"ipv6": "2001:db8:a4f8:112c:6001:0:12:7f10"
},
{
"index": {
"_id": 6
}
},
{
"ipv4": "192.168.2.23",
"ipv6": "2001:db8:a4f8:112c:6001:0:12:7f23"
},
{
"index": {
"_id": 7
}
},
{
"ipv4": "192.168.3.201",
"ipv6": "2001:db8:a4f8:114f:6001:0:12:7201"
},
{
"index": {
"_id": 8
}
},
{
"ipv4": "192.168.3.107",
"ipv6": "2001:db8:a4f8:114f:6001:0:12:7307"
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7c5e41a7c0075d87b8f8348a6efa990c.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0026540 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/managing.asciidoc:102
[source, python]
----
resp = client.ccr.pause_follow(
index="follower_index",
)
print(resp)
resp1 = client.indices.close(
index="follower_index",
)
print(resp1)
resp2 = client.ccr.follow(
index="follower_index",
wait_for_active_shards="1",
remote_cluster="remote_cluster",
leader_index="leader_index",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/7c9076f3e93a8f61189783c736bf6082.asciidoc 0000664 0000000 0000000 00000000746 15176617013 0026257 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/field-level-security.asciidoc:43
[source, python]
----
resp = client.security.put_role(
name="test_role2",
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"event_*"
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7ca224d1a7de20a15c008e1b9dbda377.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0026631 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:807
[source, python]
----
resp = client.search(
aggs={
"tags": {
"terms": {
"field": "tags",
"missing": "N/A"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7cd23457e220c8b64c5b0041d2acc27a.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026455 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/advanced-configuration.asciidoc:123
[source, python]
----
resp = client.nodes.info(
node_id="_all",
metric="jvm",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7cd3d8388c51a9f6ee3f730cdaddbb89.asciidoc 0000664 0000000 0000000 00000000425 15176617013 0027033 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/update-settings.asciidoc:97
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"refresh_interval": None
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7d1cbcb545aa19260073dbb2b7ef5074.asciidoc 0000664 0000000 0000000 00000001542 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:658
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"size": 2,
"sources": [
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d"
}
}
},
{
"product": {
"terms": {
"field": "product"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7d3a74fe0ba3fe95d1c3275365ff9315.asciidoc 0000664 0000000 0000000 00000001653 15176617013 0026527 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:374
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"flattened": {
"type": "flattened"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"flattened": {
"field": [
{
"id": 1,
"name": "foo"
},
{
"id": 2,
"name": "bar"
},
{
"id": 3,
"name": "baz"
}
]
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7d880157a95f64ad339225d4af71c2de.asciidoc 0000664 0000000 0000000 00000000756 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/suggest-user-profile.asciidoc:105
[source, python]
----
resp = client.security.suggest_user_profiles(
name="jack",
hint={
"uids": [
"u_8RKO7AKfEbSiIHZkZZ2LJy2MUSDPWDr3tMI_CkIGApU_0",
"u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0"
],
"labels": {
"direction": [
"north",
"east"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7d9eba51a269571ae62fb8b442b373ce.asciidoc 0000664 0000000 0000000 00000001406 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc:25
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"custom_stems",
"porter_stem"
]
}
},
"filter": {
"custom_stems": {
"type": "stemmer_override",
"rules_path": "analysis/stemmer_override.txt"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7dabae9b37d2cbd724f2a069be9e753b.asciidoc 0000664 0000000 0000000 00000000340 15176617013 0027011 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/reset-job.asciidoc:79
[source, python]
----
resp = client.ml.reset_job(
job_id="total-requests",
wait_for_completion=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7daff6b7e668ab8a762b8ab5dff7a167.asciidoc 0000664 0000000 0000000 00000002246 15176617013 0027040 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/sparse-vector-query.asciidoc:260
[source, python]
----
resp = client.search(
index="my-index",
query={
"sparse_vector": {
"field": "ml.tokens",
"inference_id": "my-elser-model",
"query": "How is the weather in Jamaica?",
"prune": True,
"pruning_config": {
"tokens_freq_ratio_threshold": 5,
"tokens_weight_threshold": 0.4,
"only_score_pruned_tokens": False
}
}
},
rescore={
"window_size": 100,
"query": {
"rescore_query": {
"sparse_vector": {
"field": "ml.tokens",
"inference_id": "my-elser-model",
"query": "How is the weather in Jamaica?",
"prune": True,
"pruning_config": {
"tokens_freq_ratio_threshold": 5,
"tokens_weight_threshold": 0.4,
"only_score_pruned_tokens": True
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7db09cab02d71f3a10d91071216d80fc.asciidoc 0000664 0000000 0000000 00000001036 15176617013 0026462 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7db798942cf2d334456e30ef5fcb801b.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0026521 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7dc6c0a6386289ac6a34105e839ced55.asciidoc 0000664 0000000 0000000 00000001033 15176617013 0026437 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/rate-aggregation.asciidoc:33
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"by_date": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"my_rate": {
"rate": {
"unit": "year"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7dc82f7d36686fd57a47e34cbda39a4e.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026677 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc:47
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"delimited_payload"
],
text="the|0 brown|10 fox|5 is|0 quick|10",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7dd0d9cc6c5982a2c003d301e90feeba.asciidoc 0000664 0000000 0000000 00000001644 15176617013 0026723 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7dd481337e40f16185f3baa3fc2cce15.asciidoc 0000664 0000000 0000000 00000000444 15176617013 0026564 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/routing-field.asciidoc:38
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"terms": {
"_routing": [
"user1"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7de7e647c1c9cbe0a1df0d104fc0a947.asciidoc 0000664 0000000 0000000 00000000472 15176617013 0026726 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-s3.asciidoc:23
[source, python]
----
resp = client.snapshot.create_repository(
name="my_s3_repository",
repository={
"type": "s3",
"settings": {
"bucket": "my-bucket"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7dedb148ff74912de81b8f8275f0d7f3.asciidoc 0000664 0000000 0000000 00000000444 15176617013 0026623 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:174
[source, python]
----
resp = client.search(
index="index",
aggs={
"price_ranges": {
"terms": {
"field": "price_range"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7df191cc7f814e410a4ac7261065e6ef.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:474
[source, python]
----
resp = client.tasks.list(
detailed=True,
actions="*byquery",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e126e2751311db60cfcbb22c9c41caa.asciidoc 0000664 0000000 0000000 00000000211 15176617013 0026612 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/shards.asciidoc:395
[source, python]
----
resp = client.cat.shards()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e16d21cba51eb8960835b63a1a7266a.asciidoc 0000664 0000000 0000000 00000000642 15176617013 0026423 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/field-mapping.asciidoc:103
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_date_formats": [
"MM/dd/yyyy"
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"create_date": "09/25/2015"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7e20b6e15e409b02a5e452ceddf1e1e0.asciidoc 0000664 0000000 0000000 00000001650 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:579
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d",
"order": "desc"
}
}
},
{
"product": {
"terms": {
"field": "product",
"order": "asc"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e2b9bf4ab353c377b761101775edf93.asciidoc 0000664 0000000 0000000 00000001746 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-tsds.asciidoc:220
[source, python]
----
resp = client.bulk(
index="metrics-weather_sensors-dev",
operations=[
{
"create": {}
},
{
"@timestamp": "2099-05-06T16:21:15.000Z",
"sensor_id": "HAL-000001",
"location": "plains",
"temperature": 26.7,
"humidity": 49.9
},
{
"create": {}
},
{
"@timestamp": "2099-05-06T16:25:42.000Z",
"sensor_id": "SYKENET-000001",
"location": "swamp",
"temperature": 32.4,
"humidity": 88.9
}
],
)
print(resp)
resp1 = client.index(
index="metrics-weather_sensors-dev",
document={
"@timestamp": "2099-05-06T16:21:15.000Z",
"sensor_id": "SYKENET-000001",
"location": "swamp",
"temperature": 32.4,
"humidity": 88.9
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7e484b8b41f9dbc2bcf1f340db197c1d.asciidoc 0000664 0000000 0000000 00000000370 15176617013 0026730 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:31
[source, python]
----
resp = client.reindex(
source={
"index": "my-index-000001"
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e48648ca27024831c60b455e836c496.asciidoc 0000664 0000000 0000000 00000001037 15176617013 0026150 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/pinned-query.asciidoc:55
[source, python]
----
resp = client.search(
query={
"pinned": {
"docs": [
{
"_index": "my-index-000001",
"_id": "1"
},
{
"_id": "4"
}
],
"organic": {
"match": {
"description": "iphone"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e49705769c42895fb7b1e2ca028ff47.asciidoc 0000664 0000000 0000000 00000000266 15176617013 0026405 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/securing-communications/update-tls-certificates.asciidoc:713
[source, python]
----
resp = client.cat.nodes()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e4cb3de3e3c75646b60f9f81ddc59cc.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0026751 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/clear-trained-model-deployment-cache.asciidoc:49
[source, python]
----
resp = client.ml.clear_trained_model_deployment_cache(
model_id="elastic__distilbert-base-uncased-finetuned-conll03-english",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e5faa551f2c95ffd627da352563d450.asciidoc 0000664 0000000 0000000 00000000551 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:275
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping6",
roles=[
"example-user"
],
enabled=True,
rules={
"field": {
"dn": "*,ou=subtree,dc=example,dc=com"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e74d1a54e816e8f40cfdaa01b070788.asciidoc 0000664 0000000 0000000 00000002004 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rrf.asciidoc:250
[source, python]
----
resp = client.search(
index="example-index",
retriever={
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"term": {
"text": "rrf"
}
}
}
},
{
"knn": {
"field": "vector",
"query_vector": [
3
],
"k": 5,
"num_candidates": 5
}
}
],
"rank_window_size": 5,
"rank_constant": 1
}
},
size=3,
aggs={
"int_count": {
"terms": {
"field": "integer"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7e77509ab646276ff78f58bb38bec8dd.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026626 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-rules/apis/delete-query-ruleset.asciidoc:75
[source, python]
----
resp = client.query_rules.delete_ruleset(
ruleset_id="my-ruleset",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7ebeb6cf26be5b5ecdfd408bd0fc3215.asciidoc 0000664 0000000 0000000 00000002151 15176617013 0027143 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/profile.asciidoc:1248
[source, python]
----
resp = client.indices.create(
index="my-knn-index",
mappings={
"properties": {
"my-vector": {
"type": "dense_vector",
"dims": 3,
"index": True,
"similarity": "l2_norm"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="my-knn-index",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"my-vector": [
1,
5,
-20
]
},
{
"index": {
"_id": "2"
}
},
{
"my-vector": [
42,
8,
-15
]
},
{
"index": {
"_id": "3"
}
},
{
"my-vector": [
15,
11,
23
]
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7ebfb30b3ece855c1b783d9210939469.asciidoc 0000664 0000000 0000000 00000000344 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/flush-job.asciidoc:108
[source, python]
----
resp = client.ml.flush_job(
job_id="total-requests",
advance_time="1514804400000",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7ed26b34ce90192a1563dcddf0e45dc0.asciidoc 0000664 0000000 0000000 00000001307 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/derivative-aggregation.asciidoc:43
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
},
"sales_deriv": {
"derivative": {
"buckets_path": "sales"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7f1fade93225f8cf6000b93334d76ce4.asciidoc 0000664 0000000 0000000 00000001115 15176617013 0026514 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/7f2d511cb64743c006225e5933a14bb4.asciidoc 0000664 0000000 0000000 00000001565 15176617013 0026260 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-across-clusters.asciidoc:69
[source, python]
----
resp = client.security.put_role(
name="remote1",
cluster=[
"cross_cluster_search"
],
indices=[
{
"names": [
""
],
"privileges": [
"read"
]
}
],
remote_indices=[
{
"names": [
"logs-*"
],
"privileges": [
"read",
"read_cross_cluster"
],
"clusters": [
"my_remote_cluster"
]
}
],
remote_cluster=[
{
"privileges": [
"monitor_enrich"
],
"clusters": [
"my_remote_cluster"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7f37031fb40b68a61255b7c71d7eed0b.asciidoc 0000664 0000000 0000000 00000000425 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/execute-watch.asciidoc:305
[source, python]
----
resp = client.watcher.execute_watch(
id="my_watch",
action_modes={
"action1": "force_simulate",
"action2": "skip"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7f514e9e785e4323d16396359cb184f2.asciidoc 0000664 0000000 0000000 00000000632 15176617013 0026241 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:195
[source, python]
----
resp = client.indices.put_mapping(
index="range_index",
properties={
"ip_allowlist": {
"type": "ip_range"
}
},
)
print(resp)
resp1 = client.index(
index="range_index",
id="2",
document={
"ip_allowlist": "192.168.0.0/16"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7f56755fb6c42f7e6203339a6d0cb6e6.asciidoc 0000664 0000000 0000000 00000000511 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-query.asciidoc:283
[source, python]
----
resp = client.search(
query={
"match": {
"message": {
"query": "ny city",
"auto_generate_synonyms_phrase_query": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7f92ddd4e940a37d6227c43fd279c8f5.asciidoc 0000664 0000000 0000000 00000000452 15176617013 0026540 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:759
[source, python]
----
resp = client.search(
index="my-index-000001",
size=1,
query={
"match": {
"client_ip": "211.11.9.0"
}
},
fields=[
"*"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7fb921376cbf66bf9f381bcdd62030ba.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/apis/get-script-contexts-api.asciidoc:16
[source, python]
----
resp = client.get_script_context()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7fbebf0fc9b4a402917a4723ad547c6a.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/snapshot/corrupt-repository.asciidoc:147
[source, python]
----
resp = client.snapshot.create_repository(
name="my-repo",
repository={
"type": "s3",
"settings": {
"bucket": "repo-bucket",
"client": "elastic-internal-71bcd3",
"base_path": "myrepo"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7fd2532f4e12e3efbc58af195060b31e.asciidoc 0000664 0000000 0000000 00000000774 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/pattern-replace-charfilter.asciidoc:205
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"text": "The fooBarBaz method"
},
)
print(resp)
resp1 = client.search(
index="my-index-000001",
query={
"match": {
"text": "bar"
}
},
highlight={
"fields": {
"text": {}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/7fd5883564d183603e60b37d286ac7e2.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-expired-data.asciidoc:70
[source, python]
----
resp = client.ml.delete_expired_data(
timeout="1h",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7fde3ff91c4a2e7080444af37d5cd287.asciidoc 0000664 0000000 0000000 00000001044 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:289
[source, python]
----
resp = client.esql.query(
query="\n FROM library\n | EVAL year = DATE_EXTRACT(\"year\", release_date)\n | WHERE page_count > ?page_count AND author == ?author\n | STATS count = COUNT(*) by year\n | WHERE count > ?count\n | LIMIT 5\n ",
params=[
{
"page_count": 300
},
{
"author": "Frank Herbert"
},
{
"count": 0
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7fe2179705304af5e87eb382dca6235a.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:318
[source, python]
----
resp = client.indices.open(
index="logs-my_app-default",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7fe9f0a583e079f7fc6fd64d12b6e9e5.asciidoc 0000664 0000000 0000000 00000001376 15176617013 0026716 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/sum-aggregation.asciidoc:54
[source, python]
----
resp = client.search(
index="sales",
size="0",
runtime_mappings={
"price.weighted": {
"type": "double",
"script": "\n double price = doc['price'].value;\n if (doc['promoted'].value) {\n price *= 0.8;\n }\n emit(price);\n "
}
},
query={
"constant_score": {
"filter": {
"match": {
"type": "hat"
}
}
}
},
aggs={
"hat_prices": {
"sum": {
"field": "price.weighted"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc 0000664 0000000 0000000 00000000676 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/nested.asciidoc:24
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"group": "fans",
"user": [
{
"first": "John",
"last": "Smith"
},
{
"first": "Alice",
"last": "White"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/7ff4124df0541ee2496034004f4146d4.asciidoc 0000664 0000000 0000000 00000000507 15176617013 0026204 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/eager-global-ordinals.asciidoc:74
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"tags": {
"type": "keyword",
"eager_global_ordinals": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/800861c15bb33ca01a46fb97dde7537a.asciidoc 0000664 0000000 0000000 00000000305 15176617013 0026475 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-filter.asciidoc:72
[source, python]
----
resp = client.ml.get_filters(
filter_id="safe_domains",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/80135e8c644e34cc70ce8a4e7915d1a2.asciidoc 0000664 0000000 0000000 00000001444 15176617013 0026434 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/attachment.asciidoc:315
[source, python]
----
resp = client.ingest.put_pipeline(
id="attachment",
description="Extract attachment information",
processors=[
{
"attachment": {
"field": "data",
"indexed_chars": 11,
"indexed_chars_field": "max_size",
"remove_binary": True
}
}
],
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="my_id_2",
pipeline="attachment",
document={
"data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=",
"max_size": 5
},
)
print(resp1)
resp2 = client.get(
index="my-index-000001",
id="my_id_2",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/803bbc14fbec0e49dfed9fab49c8a7f8.asciidoc 0000664 0000000 0000000 00000000464 15176617013 0027171 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/term-query.asciidoc:99
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"full_text": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8051766cadded0892290bc2cc06e145c.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/ack-watch.asciidoc:251
[source, python]
----
resp = client.watcher.ack_watch(
watch_id="my_watch",
action_id="action1,action2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/805f5550b90e75aa5cc82b90d8c6c242.asciidoc 0000664 0000000 0000000 00000001204 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significanttext-aggregation.asciidoc:221
[source, python]
----
resp = client.search(
index="news",
query={
"match": {
"content": "elasticsearch"
}
},
aggs={
"sample": {
"sampler": {
"shard_size": 100
},
"aggs": {
"keywords": {
"significant_text": {
"field": "content",
"filter_duplicate_text": True
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/807c0c9763f8c1114b3c8278c2a0cb56.asciidoc 0000664 0000000 0000000 00000002465 15176617013 0026355 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/intervals-query.asciidoc:28
[source, python]
----
resp = client.search(
query={
"intervals": {
"my_text": {
"all_of": {
"ordered": True,
"intervals": [
{
"match": {
"query": "my favorite food",
"max_gaps": 0,
"ordered": True
}
},
{
"any_of": {
"intervals": [
{
"match": {
"query": "hot water"
}
},
{
"match": {
"query": "cold porridge"
}
}
]
}
}
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8080cd9e24a8785728ce7c372ec4acf1.asciidoc 0000664 0000000 0000000 00000000502 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/how-watcher-works.asciidoc:159
[source, python]
----
resp = client.perform_request(
"PUT",
"/_watcher/settings",
headers={"Content-Type": "application/json"},
body={
"index.routing.allocation.include.role": "watcher"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/808f4db1e2361be77dd6816c1f818139.asciidoc 0000664 0000000 0000000 00000000272 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shard-stores.asciidoc:19
[source, python]
----
resp = client.indices.shard_stores(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/80dbaf28d1976dc00de3fe2018067e81.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-management/migrate-index-allocation-filters.asciidoc:132
[source, python]
----
resp = client.indices.delete_template(
name=".cloud-hot-warm-allocation-0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/80dd7f5882c59b9c1c90e8351937441f.asciidoc 0000664 0000000 0000000 00000001401 15176617013 0026315 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-update-api-keys.asciidoc:182
[source, python]
----
resp = client.security.bulk_update_api_keys(
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)
----
python-elasticsearch-9.4.0/docs/examples/80edd2124a822d9f9bf22ecc49d2c2e9.asciidoc 0000664 0000000 0000000 00000000340 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/get-synonym-rule.asciidoc:72
[source, python]
----
resp = client.synonyms.get_synonym_rule(
set_id="my-synonyms-set",
rule_id="test-1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/812a3d7ab461d74efd9136aaf4bcf11c.asciidoc 0000664 0000000 0000000 00000000561 15176617013 0026720 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-field-note.asciidoc:49
[source, python]
----
resp = client.search(
index="range_index",
size="0",
aggs={
"range_histo": {
"histogram": {
"field": "expected_attendees",
"interval": 5
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/812deb6b7668c7444f3b99d843d2adc1.asciidoc 0000664 0000000 0000000 00000001751 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/shape-query.asciidoc:132
[source, python]
----
resp = client.indices.create(
index="shapes",
mappings={
"properties": {
"geometry": {
"type": "shape"
}
}
},
)
print(resp)
resp1 = client.index(
index="shapes",
id="footprint",
document={
"geometry": {
"type": "envelope",
"coordinates": [
[
1355,
5355
],
[
1400,
5200
]
]
}
},
)
print(resp1)
resp2 = client.search(
index="example",
query={
"shape": {
"geometry": {
"indexed_shape": {
"index": "shapes",
"id": "footprint",
"path": "geometry"
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/8141b60ad245ece2ff5e8d0817400ee5.asciidoc 0000664 0000000 0000000 00000000556 15176617013 0026511 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql-search-api.asciidoc:684
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n sequence by process.pid\n [ file where file.name == \"cmd.exe\" and process.pid != 2013 ]\n [ process where stringContains(process.executable, \"regsvr32\") ]\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8141cdaddbe7d794f09f9ee84e46194c.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026677 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/count.asciidoc:73
[source, python]
----
resp = client.cat.count(
index="my-index-000001",
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/81612c2537386e031b7eb604f6756a71.asciidoc 0000664 0000000 0000000 00000000500 15176617013 0026125 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/clone-index.asciidoc:123
[source, python]
----
resp = client.indices.clone(
index="my_source_index",
target="my_target_index",
settings={
"index.number_of_shards": 5
},
aliases={
"my_search_indices": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8194f1fae6aa72ab91ea559daad932d4.asciidoc 0000664 0000000 0000000 00000000474 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-shard-routing.asciidoc:169
[source, python]
----
resp = client.search(
index="my-index-000001",
max_concurrent_shard_requests="3",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/819e00cc6547d925d80090b94e0650d7.asciidoc 0000664 0000000 0000000 00000000655 15176617013 0026225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:243
[source, python]
----
resp = client.search(
index="my-index-000001,cluster_one:my-index-000001,cluster_two:my-index-000001",
query={
"match": {
"user.id": "kimchy"
}
},
source=[
"user.id",
"message",
"http.response.status_code"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/81aad155ff23b1b396833b1182c9d46b.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026421 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:35
[source, python]
----
resp = client.cat.shards(
v=True,
)
print(resp)
resp1 = client.cat.recovery(
v=True,
active_only=True,
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/81c7a392efd505b686eed978fb7d9d17.asciidoc 0000664 0000000 0000000 00000002447 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:636
[source, python]
----
resp = client.indices.create(
index="english_example",
settings={
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "_english_"
},
"english_keywords": {
"type": "keyword_marker",
"keywords": [
"example"
]
},
"english_stemmer": {
"type": "stemmer",
"language": "english"
},
"english_possessive_stemmer": {
"type": "stemmer",
"language": "possessive_english"
}
},
"analyzer": {
"rebuilt_english": {
"tokenizer": "standard",
"filter": [
"english_possessive_stemmer",
"lowercase",
"english_stop",
"english_keywords",
"english_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/81ee2ad368208c4c78098292547b0577.asciidoc 0000664 0000000 0000000 00000000542 15176617013 0026153 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/mapping-roles.asciidoc:180
[source, python]
----
resp = client.security.put_role_mapping(
name="admin_user",
roles=[
"monitoring"
],
rules={
"field": {
"dn": "cn=Admin,ou=example,o=com"
}
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/81ef5774355180fc44d2a52b5182d24a.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0026266 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/string-stats-aggregation.asciidoc:24
[source, python]
----
resp = client.search(
index="my-index-000001",
size="0",
aggs={
"message_stats": {
"string_stats": {
"field": "message.keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/81f1b1e1d5c81683b6bf471c469e6046.asciidoc 0000664 0000000 0000000 00000001210 15176617013 0026351 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/filter-search-results.asciidoc:81
[source, python]
----
resp = client.search(
index="shirts",
query={
"bool": {
"filter": [
{
"term": {
"color": "red"
}
},
{
"term": {
"brand": "gucci"
}
}
]
}
},
aggs={
"models": {
"terms": {
"field": "model"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8206a7cc615ad93fec322513b8fdd4fd.asciidoc 0000664 0000000 0000000 00000000570 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-set-query.asciidoc:107
[source, python]
----
resp = client.index(
index="job-candidates",
id="2",
refresh=True,
document={
"name": "Jason Response",
"programming_languages": [
"java",
"php"
],
"required_matches": 2
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/820f689eaaef15fc07abd1073fa880f8.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:11
[source, python]
----
resp = client.search(
from_=5,
size=20,
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/821422f8a03dc98d024a15fc737fe9eb.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/delete-trained-models-aliases.asciidoc:57
[source, python]
----
resp = client.ml.delete_trained_model_alias(
model_id="flight-delay-prediction-1574775339910",
model_alias="flight_delay_model",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/821ac598f5f4a795a13f8dd0c0c4d8d6.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-tsds.asciidoc:243
[source, python]
----
resp = client.indices.create_data_stream(
name="metrics-weather_sensors-dev",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/824fded1f9db28906ae7e85ae8de9bd0.asciidoc 0000664 0000000 0000000 00000001047 15176617013 0027040 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/post-resume-follow.asciidoc:90
[source, python]
----
resp = client.ccr.resume_follow(
index="follower_index",
max_read_request_operation_count=1024,
max_outstanding_read_requests=16,
max_read_request_size="1024k",
max_write_request_operation_count=32768,
max_write_request_size="16k",
max_outstanding_write_requests=8,
max_write_buffer_count=512,
max_write_buffer_size="512k",
max_retry_delay="10s",
read_poll_timeout="30s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/827b7e9308ea288f18aea00a5accc38e.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-component-template.asciidoc:46
[source, python]
----
resp = client.cluster.get_component_template(
name="template_1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/82844ef45e11c0eece100d3109db3182.asciidoc 0000664 0000000 0000000 00000001063 15176617013 0026411 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-amazon-bedrock.asciidoc:180
[source, python]
----
resp = client.inference.put(
task_type="completion",
inference_id="amazon_bedrock_completion",
inference_config={
"service": "amazonbedrock",
"service_settings": {
"access_key": "",
"secret_key": "",
"region": "us-east-1",
"provider": "amazontitan",
"model": "amazon.titan-text-premier-v1:0"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/828f0045747fde4888a947bb99e190e3.asciidoc 0000664 0000000 0000000 00000001200 15176617013 0026322 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/829a40d484c778a8c58340c7bf09e1d8.asciidoc 0000664 0000000 0000000 00000001322 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/filter-search-results.asciidoc:195
[source, python]
----
resp = client.search(
query={
"match": {
"message": {
"operator": "or",
"query": "the quick brown"
}
}
},
rescore={
"window_size": 50,
"query": {
"rescore_query": {
"match_phrase": {
"message": {
"query": "the quick brown",
"slop": 2
}
}
},
"query_weight": 0.7,
"rescore_query_weight": 1.2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/82bb6c61dab959f4446dc5ecab7ecbdf.asciidoc 0000664 0000000 0000000 00000001602 15176617013 0027156 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/82d6de3081de7b0664f44adf2942675a.asciidoc 0000664 0000000 0000000 00000000367 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// behavioral-analytics/apis/list-analytics-collection.asciidoc:91
[source, python]
----
resp = client.search_application.get_behavioral_analytics(
name="my_analytics_collection",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/82e94b6cdf65e324575f916b3776b779.asciidoc 0000664 0000000 0000000 00000000646 15176617013 0026342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:538
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"strings_as_keywords": {
"match_mapping_type": "string",
"runtime": {}
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/83062a543163370328cf2e21a68c1bd3.asciidoc 0000664 0000000 0000000 00000000671 15176617013 0026175 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-wait-for-snapshot.asciidoc:40
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"delete": {
"actions": {
"wait_for_snapshot": {
"policy": "slm-policy-name"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/831f65d700577e11112c711236110f61.asciidoc 0000664 0000000 0000000 00000001142 15176617013 0025743 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/pattern-analyzer.asciidoc:180
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_email_analyzer": {
"type": "pattern",
"pattern": "\\W|_",
"lowercase": True
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_email_analyzer",
text="John_Smith@foo-bar.com",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/8330b2ea6317769e52d0647ba434b354.asciidoc 0000664 0000000 0000000 00000000540 15176617013 0026204 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-get.asciidoc:268
[source, python]
----
resp = client.mget(
routing="key1",
docs=[
{
"_index": "test",
"_id": "1",
"routing": "key2"
},
{
"_index": "test",
"_id": "2"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8345d2615f43a934fe1871a5120eca1d.asciidoc 0000664 0000000 0000000 00000002326 15176617013 0026343 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/ecommerce-tutorial.asciidoc:77
[source, python]
----
resp = client.transform.preview_transform(
source={
"index": "kibana_sample_data_ecommerce",
"query": {
"bool": {
"filter": {
"term": {
"currency": "EUR"
}
}
}
}
},
pivot={
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id"
}
}
},
"aggregations": {
"total_quantity.sum": {
"sum": {
"field": "total_quantity"
}
},
"taxless_total_price.sum": {
"sum": {
"field": "taxless_total_price"
}
},
"total_quantity.max": {
"max": {
"field": "total_quantity"
}
},
"order_id.cardinality": {
"cardinality": {
"field": "order_id"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/834764b2fba6cbb41eaabd740be75656.asciidoc 0000664 0000000 0000000 00000001111 15176617013 0026636 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc:384
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"tokenizer": "standard",
"filter": [
"keyword_repeat",
"porter_stem",
"remove_duplicates"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8357aa6099089940589ae3e97e7bcffa.asciidoc 0000664 0000000 0000000 00000000251 15176617013 0026470 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-dsl.asciidoc:362
[source, python]
----
resp = client.indices.get_data_stream()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/83780c8f5f17eb21064c1ba6e0a7aa10.asciidoc 0000664 0000000 0000000 00000000414 15176617013 0026467 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/wrapper-query.asciidoc:10
[source, python]
----
resp = client.search(
query={
"wrapper": {
"query": "eyJ0ZXJtIiA6IHsgInVzZXIuaWQiIDogImtpbWNoeSIgfX0="
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/838a4eabebba4c06100fb37dc30c7722.asciidoc 0000664 0000000 0000000 00000001473 15176617013 0026627 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-search.asciidoc:84
[source, python]
----
resp = client.rollup.put_job(
id="sensor",
index_pattern="sensor-*",
rollup_index="sensor_rollup",
cron="*/30 * * * * ?",
page_size=1000,
groups={
"date_histogram": {
"field": "timestamp",
"fixed_interval": "1h",
"delay": "7d"
},
"terms": {
"fields": [
"node"
]
}
},
metrics=[
{
"field": "temperature",
"metrics": [
"min",
"max",
"sum"
]
},
{
"field": "voltage",
"metrics": [
"avg"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/839710129a165cf93c6e329abedf9089.asciidoc 0000664 0000000 0000000 00000001130 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-cross-cluster-api-key.asciidoc:89
[source, python]
----
resp = client.perform_request(
"POST",
"/_security/cross_cluster/api_key",
headers={"Content-Type": "application/json"},
body={
"name": "my-cross-cluster-api-key",
"access": {
"search": [
{
"names": [
"logs*"
]
}
]
},
"metadata": {
"application": "search"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/839a4b2930856790e34cc9dfeb983284.asciidoc 0000664 0000000 0000000 00000000644 15176617013 0026327 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling.asciidoc:129
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"downsample": {
"fixed_interval": "1h"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/83b94f9e7b3a9abca8e165ea56927714.asciidoc 0000664 0000000 0000000 00000000363 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/rollover-index.asciidoc:386
[source, python]
----
resp = client.indices.create(
index="",
aliases={
"my-write-alias": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/83cd4eb89818b4c32f654d370eafa920.asciidoc 0000664 0000000 0000000 00000000565 15176617013 0026527 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keep-types-tokenfilter.asciidoc:41
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "keep_types",
"types": [
""
]
}
],
text="1 quick fox 2 lazy dogs",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/83d712b9ffb2e703212b762eba3c521a.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026472 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:46
[source, python]
----
resp = client.search(
index="my-alias",
ignore_unavailable=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/83d8c920460a12f87b9d5bf65515c367.asciidoc 0000664 0000000 0000000 00000001502 15176617013 0026304 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:342
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_moving_sum": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.stdDev(values, MovingFunctions.unweightedAvg(values))"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/83dd715e45a5da097123c6d10f22f8f4.asciidoc 0000664 0000000 0000000 00000001573 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-containing-query.asciidoc:10
[source, python]
----
resp = client.search(
query={
"span_containing": {
"little": {
"span_term": {
"field1": "foo"
}
},
"big": {
"span_near": {
"clauses": [
{
"span_term": {
"field1": "bar"
}
},
{
"span_term": {
"field1": "baz"
}
}
],
"slop": 5,
"in_order": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/83dfd0852101eca3ba8174c9c38b4e73.asciidoc 0000664 0000000 0000000 00000000266 15176617013 0026511 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// monitoring/indices.asciidoc:112
[source, python]
----
resp = client.indices.get_template(
name=".monitoring-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/840b6c5c3d9c56aed854cfab8da04486.asciidoc 0000664 0000000 0000000 00000004256 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pathhierarchy-tokenizer.asciidoc:195
[source, python]
----
resp = client.indices.create(
index="file-path-test",
settings={
"analysis": {
"analyzer": {
"custom_path_tree": {
"tokenizer": "custom_hierarchy"
},
"custom_path_tree_reversed": {
"tokenizer": "custom_hierarchy_reversed"
}
},
"tokenizer": {
"custom_hierarchy": {
"type": "path_hierarchy",
"delimiter": "/"
},
"custom_hierarchy_reversed": {
"type": "path_hierarchy",
"delimiter": "/",
"reverse": "true"
}
}
}
},
mappings={
"properties": {
"file_path": {
"type": "text",
"fields": {
"tree": {
"type": "text",
"analyzer": "custom_path_tree"
},
"tree_reversed": {
"type": "text",
"analyzer": "custom_path_tree_reversed"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="file-path-test",
id="1",
document={
"file_path": "/User/alice/photos/2017/05/16/my_photo1.jpg"
},
)
print(resp1)
resp2 = client.index(
index="file-path-test",
id="2",
document={
"file_path": "/User/alice/photos/2017/05/16/my_photo2.jpg"
},
)
print(resp2)
resp3 = client.index(
index="file-path-test",
id="3",
document={
"file_path": "/User/alice/photos/2017/05/16/my_photo3.jpg"
},
)
print(resp3)
resp4 = client.index(
index="file-path-test",
id="4",
document={
"file_path": "/User/alice/photos/2017/05/15/my_photo1.jpg"
},
)
print(resp4)
resp5 = client.index(
index="file-path-test",
id="5",
document={
"file_path": "/User/bob/photos/2017/05/16/my_photo1.jpg"
},
)
print(resp5)
----
python-elasticsearch-9.4.0/docs/examples/84108653e9e03b4edacd878ec870df77.asciidoc 0000664 0000000 0000000 00000002146 15176617013 0026542 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1043
[source, python]
----
resp = client.indices.create(
index="hungarian_example",
settings={
"analysis": {
"filter": {
"hungarian_stop": {
"type": "stop",
"stopwords": "_hungarian_"
},
"hungarian_keywords": {
"type": "keyword_marker",
"keywords": [
"példa"
]
},
"hungarian_stemmer": {
"type": "stemmer",
"language": "hungarian"
}
},
"analyzer": {
"rebuilt_hungarian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"hungarian_stop",
"hungarian_keywords",
"hungarian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8417d8d35ec5fc5665dfb2f95d6d1101.asciidoc 0000664 0000000 0000000 00000001170 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/getting-started.asciidoc:131
[source, python]
----
resp = client.search(
index=".watcher-history*",
pretty=True,
query={
"bool": {
"must": [
{
"match": {
"result.condition.met": True
}
},
{
"range": {
"result.execution_time": {
"gte": "now-10s"
}
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/841ad0a70f4271f61f0bac0b467b59c5.asciidoc 0000664 0000000 0000000 00000000603 15176617013 0026472 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-termvectors.asciidoc:97
[source, python]
----
resp = client.mtermvectors(
index="my-index-000001",
docs=[
{
"_id": "2",
"fields": [
"message"
],
"term_statistics": True
},
{
"_id": "1"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/841d8b766902c8e3ae85c228a31383ac.asciidoc 0000664 0000000 0000000 00000000423 15176617013 0026355 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/apis/get-async-sql-search-status-api.asciidoc:18
[source, python]
----
resp = client.sql.get_async_status(
id="FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=",
format="json",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84237aa9da49ab4b4c4e2b21d2548df2.asciidoc 0000664 0000000 0000000 00000000342 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/verify-repo-integrity-api.asciidoc:31
[source, python]
----
resp = client.snapshot.repository_verify_integrity(
name="my_repository",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84243213614fe64930b1d430704afb29.asciidoc 0000664 0000000 0000000 00000000755 15176617013 0026124 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1014
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
runtime={
"voltage_corrected": {
"type": "double",
"script": {
"source": "\n emit(doc['voltage'].value * params['multiplier'])\n ",
"params": {
"multiplier": 2
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84465de841fe5c6099a0382f786f2cb8.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026405 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:76
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"remove": {
"index": "logs-nginx.access-prod",
"alias": "logs"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8478c39c71bbb559ef6ab919f918f22b.asciidoc 0000664 0000000 0000000 00000000627 15176617013 0026547 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1223
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
filter={
"range": {
"@timestamp": {
"gte": "now-1d/d",
"lt": "now/d"
}
}
},
query="\n file where (file.type == \"file\" and file.name == \"cmd.exe\")\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8494d09c39e109a012094eb9d6ec52ac.asciidoc 0000664 0000000 0000000 00000000567 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/pipeline.asciidoc:36
[source, python]
----
resp = client.ingest.put_pipeline(
id="pipelineA",
description="inner pipeline",
processors=[
{
"set": {
"field": "inner_pipeline_set",
"value": "inner"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84c61160ca815e29e9973ba1380219dd.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026270 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// searchable-snapshots/apis/shard-stats.asciidoc:79
[source, python]
----
resp = client.searchable_snapshots.stats(
index="my-index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84c69fb07050f0e89720007a6507a221.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0026114 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/high-cpu-usage.asciidoc:118
[source, python]
----
resp = client.tasks.cancel(
task_id="oTUltX4IQMOUUVeiohTt8A:464",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84e2cf7417c9e0c9e6f3c23031001440.asciidoc 0000664 0000000 0000000 00000000240 15176617013 0026252 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/enrich/enrich-stats.asciidoc:135
[source, python]
----
resp = client.enrich.stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84edb44c5b74426f448b2baa101092d6.asciidoc 0000664 0000000 0000000 00000000444 15176617013 0026420 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:75
[source, python]
----
resp = client.search(
index="range_index",
query={
"term": {
"expected_attendees": {
"value": 12
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84ef9fe951c6d3caa7438238a5b23319.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026446 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/84f2f0cea90340bdd041421afdb58ec3.asciidoc 0000664 0000000 0000000 00000001035 15176617013 0026626 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:7
[source, python]
----
resp = client.indices.create(
index="index1",
mappings={
"properties": {
"comment": {
"type": "text",
"analyzer": "standard",
"fields": {
"english": {
"type": "text",
"analyzer": "english"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/84f3e8524f6ff80e870c03ab71551538.asciidoc 0000664 0000000 0000000 00000000475 15176617013 0026314 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-shard-routing.asciidoc:79
[source, python]
----
resp = client.search(
index="my-index-000001",
preference="my-custom-shard-string",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/850bfd0a00d32475a54ac7f87fb4cc4d.asciidoc 0000664 0000000 0000000 00000001206 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:563
[source, python]
----
resp = client.search(
index="my-index-000001",
runtime_mappings={
"measures.voltage": {
"type": "double",
"script": {
"source": "if (doc['model_number.keyword'].value.equals('HG537PU'))\n {emit(1.7 * params._source['measures']['voltage']);}\n else{emit(params._source['measures']['voltage']);}"
}
}
},
query={
"match": {
"model_number": "HG537PU"
}
},
fields=[
"measures.voltage"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/851f9754dbefc099c54c5423ca4565c0.asciidoc 0000664 0000000 0000000 00000000622 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/ipprefix-aggregation.asciidoc:107
[source, python]
----
resp = client.search(
index="network-traffic",
size=0,
aggs={
"ipv6-subnets": {
"ip_prefix": {
"field": "ipv6",
"prefix_length": 64,
"is_ipv6": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/852b394d78b8c79ee0055b5501981a4b.asciidoc 0000664 0000000 0000000 00000001226 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:607
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"product_name": {
"terms": {
"field": "product",
"missing_bucket": True,
"missing_order": "last"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/853fc710cea79fb4e1a85fb6d149f9c5.asciidoc 0000664 0000000 0000000 00000002335 15176617013 0026675 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/85479e02af00681210e17e3d0ff51e21.asciidoc 0000664 0000000 0000000 00000000570 15176617013 0026257 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/date.asciidoc:93
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"date": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/85519a614ae18c998986d46bbad82b76.asciidoc 0000664 0000000 0000000 00000000732 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:100
[source, python]
----
resp = client.indices.put_index_template(
name="my_template",
index_patterns=[
"test-*"
],
template={
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "my_policy",
"index.lifecycle.rollover_alias": "test-alias"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8566f5ecf4ae14802ba63c8cc7c629f8.asciidoc 0000664 0000000 0000000 00000000634 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:216
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="mistral_embeddings",
inference_config={
"service": "mistral",
"service_settings": {
"api_key": "",
"model": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/856c10ad554c26b70f1121454caff40a.asciidoc 0000664 0000000 0000000 00000000546 15176617013 0026411 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:250
[source, python]
----
resp = client.search(
index="byte-image-index",
knn={
"field": "byte-image-vector",
"query_vector": "fb09",
"k": 10,
"num_candidates": 100
},
fields=[
"title"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8582e918a6275472d2eba2e95f1dbe77.asciidoc 0000664 0000000 0000000 00000001742 15176617013 0026460 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:65
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.disk.watermark.low": "90%",
"cluster.routing.allocation.disk.watermark.low.max_headroom": "100GB",
"cluster.routing.allocation.disk.watermark.high": "95%",
"cluster.routing.allocation.disk.watermark.high.max_headroom": "20GB",
"cluster.routing.allocation.disk.watermark.flood_stage": "97%",
"cluster.routing.allocation.disk.watermark.flood_stage.max_headroom": "5GB",
"cluster.routing.allocation.disk.watermark.flood_stage.frozen": "97%",
"cluster.routing.allocation.disk.watermark.flood_stage.frozen.max_headroom": "5GB"
},
)
print(resp)
resp1 = client.indices.put_settings(
index="*",
expand_wildcards="all",
settings={
"index.blocks.read_only_allow_delete": None
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/858fde15fb0a0340873b123043f8c3b4.asciidoc 0000664 0000000 0000000 00000002026 15176617013 0026336 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/histogram.asciidoc:118
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"my_text": "histogram_1",
"my_histogram": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
3,
7,
23,
12,
6
]
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
document={
"my_text": "histogram_2",
"my_histogram": {
"values": [
0.1,
0.25,
0.35,
0.4,
0.45,
0.5
],
"counts": [
8,
17,
8,
7,
6,
2
]
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/85ae90b63ecba9d2bad16144b054c0a1.asciidoc 0000664 0000000 0000000 00000000717 15176617013 0026626 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:535
[source, python]
----
resp = client.sql.query(
format="txt",
runtime_mappings={
"release_day_of_week": {
"type": "keyword",
"script": "\n emit(doc['release_date'].value.dayOfWeekEnum.toString())\n "
}
},
query="\n SELECT * FROM library WHERE page_count > 300 AND author = 'Frank Herbert'\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/85d2e33791f1a74a69dfb04a60e69306.asciidoc 0000664 0000000 0000000 00000002556 15176617013 0026367 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/actions.asciidoc:57
[source, python]
----
resp = client.watcher.put_watch(
id="error_logs_alert",
metadata={
"color": "red"
},
trigger={
"schedule": {
"interval": "5m"
}
},
input={
"search": {
"request": {
"indices": "log-events",
"body": {
"size": 0,
"query": {
"match": {
"status": "error"
}
}
}
}
}
},
condition={
"compare": {
"ctx.payload.hits.total": {
"gt": 5
}
}
},
actions={
"email_administrator": {
"throttle_period": "15m",
"email": {
"to": "sys.admino@host.domain",
"subject": "Encountered {{ctx.payload.hits.total}} errors",
"body": "Too many error in the system, see attached data",
"attachments": {
"attached_data": {
"data": {
"format": "json"
}
}
},
"priority": "high"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/85e2719d9fd6d2c2d47d28d39f2e3f7e.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// migration/apis/feature-migration.asciidoc:53
[source, python]
----
resp = client.migration.get_feature_upgrade_status()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/85f0e5e8ab91ceab63c21dbedd9f4037.asciidoc 0000664 0000000 0000000 00000002124 15176617013 0027011 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:737
[source, python]
----
resp = client.indices.create(
index="finnish_example",
settings={
"analysis": {
"filter": {
"finnish_stop": {
"type": "stop",
"stopwords": "_finnish_"
},
"finnish_keywords": {
"type": "keyword_marker",
"keywords": [
"esimerkki"
]
},
"finnish_stemmer": {
"type": "stemmer",
"language": "finnish"
}
},
"analyzer": {
"rebuilt_finnish": {
"tokenizer": "standard",
"filter": [
"lowercase",
"finnish_stop",
"finnish_keywords",
"finnish_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/85f2839beeb71edb66988e5c82188be0.asciidoc 0000664 0000000 0000000 00000001001 15176617013 0026537 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/update-license.asciidoc:69
[source, python]
----
resp = client.license.post(
licenses=[
{
"uid": "893361dc-9749-4997-93cb-802e3d7fa4xx",
"type": "basic",
"issue_date_in_millis": 1411948800000,
"expiry_date_in_millis": 1914278399999,
"max_nodes": 1,
"issued_to": "issuedTo",
"issuer": "issuer",
"signature": "xx"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/85f6667f148d16d075493fddf07e2932.asciidoc 0000664 0000000 0000000 00000000504 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:616
[source, python]
----
resp = client.reindex(
source={
"index": ".ds-my-data-stream-2099.03.07-000001"
},
dest={
"index": "new-data-stream",
"op_type": "create"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/85f9fc6f98e8573efed9b034e853d5ae.asciidoc 0000664 0000000 0000000 00000000610 15176617013 0026716 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc 0000664 0000000 0000000 00000000756 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-cohere.asciidoc:214
[source, python]
----
resp = client.inference.put(
task_type="rerank",
inference_id="cohere-rerank",
inference_config={
"service": "cohere",
"service_settings": {
"api_key": "",
"model_id": "rerank-english-v3.0"
},
"task_settings": {
"top_n": 10,
"return_documents": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/861f5f61409dc87f3671293b87839ff7.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026260 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/stats.asciidoc:1542
[source, python]
----
resp = client.cluster.stats(
human=True,
pretty=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8621c05cc7cf3880bde751f6670a0c3a.asciidoc 0000664 0000000 0000000 00000000455 15176617013 0026510 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/86280dcb49aa89083be4b2644daf1b7c.asciidoc 0000664 0000000 0000000 00000000305 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-job.asciidoc:240
[source, python]
----
resp = client.ml.get_jobs(
job_id="high_sum_total_sales",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/862907653d1c18d2e80eff7f421200e2.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026267 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/saml-guide.asciidoc:677
[source, python]
----
resp = client.security.put_role_mapping(
name="saml-example",
roles=[
"example_role"
],
enabled=True,
rules={
"field": {
"realm.name": "saml1"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/863253bf0ab7d227ff72a0a384f4de8c.asciidoc 0000664 0000000 0000000 00000000373 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:673
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"indices.lifecycle.poll_interval": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8634c9993485d622fb12d24f4f242264.asciidoc 0000664 0000000 0000000 00000001100 15176617013 0026137 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:433
[source, python]
----
resp = client.indices.modify_data_stream(
actions=[
{
"remove_backing_index": {
"data_stream": "my-data-stream",
"index": ".ds-my-data-stream-2023.07.26-000001"
}
},
{
"add_backing_index": {
"data_stream": "my-data-stream",
"index": ".ds-my-data-stream-2023.07.26-000001-downsample"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/867f7d43a78066731ead2e223960fc07.asciidoc 0000664 0000000 0000000 00000000365 15176617013 0026310 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:408
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"action.destructive_requires_name": False
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8684589e31d96ab229e8c4feb4d704bb.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/enrich/get-enrich-policy.asciidoc:130
[source, python]
----
resp = client.enrich.get_policy(
name="my-policy,other-policy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/86926bcebf213ac182d4373027554858.asciidoc 0000664 0000000 0000000 00000000476 15176617013 0026227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/unsigned_long.asciidoc:13
[source, python]
----
resp = client.indices.create(
index="my_index",
mappings={
"properties": {
"my_counter": {
"type": "unsigned_long"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8696ba08ca6cc4992110c331732e5f47.asciidoc 0000664 0000000 0000000 00000000543 15176617013 0026276 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/boxplot-aggregation.asciidoc:205
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"grade_boxplot": {
"boxplot": {
"field": "grade",
"missing": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8699d35269a47ba867fa8cc766287413.asciidoc 0000664 0000000 0000000 00000000241 15176617013 0026250 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/start-basic.asciidoc:48
[source, python]
----
resp = client.license.post_start_basic()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/86c5594c4ec551391096c1abcd652b50.asciidoc 0000664 0000000 0000000 00000000605 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/unsigned_long.asciidoc:125
[source, python]
----
resp = client.search(
index="my_index",
query={
"match_all": {}
},
script_fields={
"count10": {
"script": {
"source": "Long.divideUnsigned(doc['my_counter'].value, 10)"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8703f3b1b3895543abc36e2a7a0013d3.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026333 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/allocation/prioritization.asciidoc:17
[source, python]
----
resp = client.indices.create(
index="index_1",
)
print(resp)
resp1 = client.indices.create(
index="index_2",
)
print(resp1)
resp2 = client.indices.create(
index="index_3",
settings={
"index.priority": 10
},
)
print(resp2)
resp3 = client.indices.create(
index="index_4",
settings={
"index.priority": 5
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/871154d08efd7251cf3272e758f06acf.asciidoc 0000664 0000000 0000000 00000001415 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/common-grams-tokenfilter.asciidoc:126
[source, python]
----
resp = client.indices.create(
index="common_grams_example",
settings={
"analysis": {
"analyzer": {
"index_grams": {
"tokenizer": "whitespace",
"filter": [
"common_grams"
]
}
},
"filter": {
"common_grams": {
"type": "common_grams",
"common_words": [
"a",
"is",
"the"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8731188553e14134b0a533010318f91a.asciidoc 0000664 0000000 0000000 00000000713 15176617013 0025751 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significantterms-aggregation.asciidoc:70
[source, python]
----
resp = client.search(
query={
"terms": {
"force": [
"British Transport Police"
]
}
},
aggregations={
"significant_crime_types": {
"significant_terms": {
"field": "crime_type"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8739fad1fb2323950b673acf0c9f2ff5.asciidoc 0000664 0000000 0000000 00000000261 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/open-close.asciidoc:126
[source, python]
----
resp = client.indices.open(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/873e2333734b1cf5ed066596e5f74b0a.asciidoc 0000664 0000000 0000000 00000003742 15176617013 0026367 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geocentroid-aggregation.asciidoc:13
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"location": "POINT (4.912350 52.374081)",
"city": "Amsterdam",
"name": "NEMO Science Museum"
},
{
"index": {
"_id": 2
}
},
{
"location": "POINT (4.901618 52.369219)",
"city": "Amsterdam",
"name": "Museum Het Rembrandthuis"
},
{
"index": {
"_id": 3
}
},
{
"location": "POINT (4.914722 52.371667)",
"city": "Amsterdam",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {
"_id": 4
}
},
{
"location": "POINT (4.405200 51.222900)",
"city": "Antwerp",
"name": "Letterenhuis"
},
{
"index": {
"_id": 5
}
},
{
"location": "POINT (2.336389 48.861111)",
"city": "Paris",
"name": "Musée du Louvre"
},
{
"index": {
"_id": 6
}
},
{
"location": "POINT (2.327000 48.860000)",
"city": "Paris",
"name": "Musée d'Orsay"
}
],
)
print(resp1)
resp2 = client.search(
index="museums",
size="0",
aggs={
"centroid": {
"geo_centroid": {
"field": "location"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/873fbbc6ab81409058591385fd602736.asciidoc 0000664 0000000 0000000 00000001745 15176617013 0026234 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/nested-query.asciidoc:171
[source, python]
----
resp = client.index(
index="drivers",
id="1",
document={
"driver": {
"last_name": "McQueen",
"vehicle": [
{
"make": "Powell Motors",
"model": "Canyonero"
},
{
"make": "Miller-Meteor",
"model": "Ecto-1"
}
]
}
},
)
print(resp)
resp1 = client.index(
index="drivers",
id="2",
refresh=True,
document={
"driver": {
"last_name": "Hudson",
"vehicle": [
{
"make": "Mifune",
"model": "Mach Five"
},
{
"make": "Miller-Meteor",
"model": "Ecto-1"
}
]
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/87416e6a1ca2da324dbed6deb05303eb.asciidoc 0000664 0000000 0000000 00000000736 15176617013 0026714 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/count.asciidoc:112
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"user.id": "kimchy"
},
)
print(resp)
resp1 = client.count(
index="my-index-000001",
q="user:kimchy",
)
print(resp1)
resp2 = client.count(
index="my-index-000001",
query={
"term": {
"user.id": "kimchy"
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/8743887d9b89ea1a2d5e780c349972cf.asciidoc 0000664 0000000 0000000 00000000777 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/collapse-search-results.asciidoc:263
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"message": "GET /search"
}
},
collapse={
"field": "geo.country_name",
"inner_hits": {
"name": "by_location",
"collapse": {
"field": "user.id"
},
"size": 3
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/87457bb3467484bec3e9df4e25942ba6.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/multivalued-fields.asciidoc:275
[source, python]
----
resp = client.esql.query(
query="FROM mv | EVAL b=MV_MIN(b) | EVAL b + 2, a + b | LIMIT 4",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/87469f8b7e9b965408479d276c3ce8aa.asciidoc 0000664 0000000 0000000 00000000344 15176617013 0026422 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// behavioral-analytics/apis/list-analytics-collection.asciidoc:111
[source, python]
----
resp = client.search_application.get_behavioral_analytics(
name="my*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc 0000664 0000000 0000000 00000000263 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// health/health.asciidoc:479
[source, python]
----
resp = client.health_report(
feature="shards_availability",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/877ea90c663b5df9efe95717646a666f.asciidoc 0000664 0000000 0000000 00000002145 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:159
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"group": {
"type": "keyword"
},
"user": {
"type": "nested",
"properties": {
"first": {
"type": "keyword"
},
"last": {
"type": "keyword"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"group": "fans",
"user": [
{
"first": "John",
"last": "Smith"
},
{
"first": "Alice",
"last": "White"
}
]
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
fields=[
"*"
],
source=False,
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/87846c3ddacab1da4af626ae8099e4be.asciidoc 0000664 0000000 0000000 00000000537 15176617013 0027023 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/mapping-roles.asciidoc:190
[source, python]
----
resp = client.security.put_role_mapping(
name="basic_user",
roles=[
"user"
],
rules={
"field": {
"dn": "cn=John Doe,ou=example,o=com"
}
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/87b0b496747ad6c1e4ab4b462128fa1c.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/nodeattrs.asciidoc:119
[source, python]
----
resp = client.cat.nodeattrs(
v=True,
h="name,pid,attr,value",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/87c3e9963400a3e4b296ef8d1c86fae3.asciidoc 0000664 0000000 0000000 00000000332 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-roles-cache.asciidoc:55
[source, python]
----
resp = client.security.clear_cached_roles(
name="my_admin_role,my_test_role",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/87c42ef733a50954e4d757fc0a08decc.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:261
[source, python]
----
resp = client.security.create_api_key(
name="my-api-key-1",
metadata={
"application": "my-application"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/87d970b4944b6d742c484d7184996c8a.asciidoc 0000664 0000000 0000000 00000000474 15176617013 0026260 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:708
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
params={
"query_string": "Where is the best place for mountain climbing?"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/87f854393d715aabf4d45e90a8eb74ce.asciidoc 0000664 0000000 0000000 00000000614 15176617013 0026614 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/median-absolute-deviation-aggregation.asciidoc:173
[source, python]
----
resp = client.search(
index="reviews",
size=0,
aggs={
"review_variability": {
"median_absolute_deviation": {
"field": "rating",
"missing": 5
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/88195d87a350e7fff200131f410c3e88.asciidoc 0000664 0000000 0000000 00000001220 15176617013 0026272 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-aggregation.asciidoc:70
[source, python]
----
resp = client.search(
index="sales",
aggs={
"price_ranges": {
"range": {
"field": "price",
"keyed": True,
"ranges": [
{
"to": 100
},
{
"from": 100,
"to": 200
},
{
"from": 200
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/88341b4eba71ec722f3e38fa1696fe87.asciidoc 0000664 0000000 0000000 00000002534 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:40
[source, python]
----
resp = client.transform.preview_transform(
source={
"index": "kibana_sample_data_ecommerce"
},
dest={
"index": "sample_ecommerce_orders_by_customer"
},
pivot={
"group_by": {
"user": {
"terms": {
"field": "user"
}
},
"customer_id": {
"terms": {
"field": "customer_id"
}
}
},
"aggregations": {
"order_count": {
"value_count": {
"field": "order_id"
}
},
"total_order_amt": {
"sum": {
"field": "taxful_total_price"
}
},
"avg_amt_per_order": {
"avg": {
"field": "taxful_total_price"
}
},
"avg_unique_products_per_order": {
"avg": {
"field": "total_unique_products"
}
},
"total_unique_products": {
"cardinality": {
"field": "products.product_id"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/88554b79dba8fd79991855a692b69ff9.asciidoc 0000664 0000000 0000000 00000002304 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// graph/explore.asciidoc:315
[source, python]
----
resp = client.graph.explore(
index="clicklogs",
query={
"match": {
"query.raw": "midi"
}
},
controls={
"use_significance": False,
"sample_size": 2000,
"timeout": 2000,
"sample_diversity": {
"field": "category.raw",
"max_docs_per_value": 500
}
},
vertices=[
{
"field": "product",
"size": 5,
"min_doc_count": 10,
"shard_min_doc_count": 3
}
],
connections={
"query": {
"bool": {
"filter": [
{
"range": {
"query_time": {
"gte": "2015-10-01 00:00:00"
}
}
}
]
}
},
"vertices": [
{
"field": "query.raw",
"size": 5,
"min_doc_count": 10,
"shard_min_doc_count": 3
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/88a08d0b15ef41324f5c23db533d47d1.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026413 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/standard-tokenizer.asciidoc:16
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/88a283dfccc481f1afba79d9b3c61f51.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-user.asciidoc:117
[source, python]
----
resp = client.perform_request(
"GET",
"/_security/_query/user",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/88b19973b970adf9b73fca82017d4951.asciidoc 0000664 0000000 0000000 00000000422 15176617013 0026373 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-multiple-indices.asciidoc:36
[source, python]
----
resp = client.search(
index="my-index-*",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/88cecae3f0363fc186d955dd8616b5d4.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026607 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/get-async-eql-status-api.asciidoc:90
[source, python]
----
resp = client.eql.get_status(
id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
keep_alive="5d",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/88cf60d3310a56d8ae12704abc05b565.asciidoc 0000664 0000000 0000000 00000000246 15176617013 0026416 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/get-trial-status.asciidoc:46
[source, python]
----
resp = client.license.get_trial_status()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/894fce12d8f0d01e4c4083885a0c0077.asciidoc 0000664 0000000 0000000 00000000567 15176617013 0026360 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:183
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "mistral-embeddings",
"pipeline": "mistral_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8963fb1e3d0900ba3b68be212e8972ee.asciidoc 0000664 0000000 0000000 00000001312 15176617013 0026511 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/position-increment-gap.asciidoc:53
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"names": {
"type": "text",
"position_increment_gap": 0
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"names": [
"John Abraham",
"Lincoln Smith"
]
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"match_phrase": {
"names": "Abraham Lincoln"
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/897668edcbb0785fa5229aeb2dfc963e.asciidoc 0000664 0000000 0000000 00000000517 15176617013 0026703 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:51
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"query": {
"match": {
"message": "bonsai tree"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/89a6b24618cafd60de1702a5b9f28a8d.asciidoc 0000664 0000000 0000000 00000002032 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/phrase-suggest.asciidoc:221
[source, python]
----
resp = client.search(
index="test",
suggest={
"text": "noble prize",
"simple_phrase": {
"phrase": {
"field": "title.trigram",
"size": 1,
"direct_generator": [
{
"field": "title.trigram",
"suggest_mode": "always",
"min_word_length": 1
}
],
"collate": {
"query": {
"source": {
"match": {
"{{field_name}}": "{{suggestion}}"
}
}
},
"params": {
"field_name": "title"
},
"prune": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/89aed93f641a5e243bdc3ee5cdc2acc6.asciidoc 0000664 0000000 0000000 00000006337 15176617013 0027102 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:484
[source, python]
----
resp = client.search_application.put(
name="my_search_application",
search_application={
"indices": [
"index1",
"index2"
],
"template": {
"script": {
"lang": "mustache",
"source": "\n {\n \"query\": {\n \"bool\": {\n \"should\": [\n {{#text}}\n {\n \"multi_match\": {\n \"query\": \"{{query_string}}\",\n \"fields\": [{{#text_fields}}\"{{name}}^{{boost}}\",{{/text_fields}}],\n \"boost\": \"{{text_query_boost}}\"\n }\n },\n {{/text}}\n {{#elser}}\n {{#elser_fields}}\n {\n \"sparse_vector\": {\n \"field\": \"ml.inference.{{.}}_expanded.predicted_value\",\n \"inference_id\": \"\",\n \"query\": \"{{query_string}}\"\n }\n },\n {{/elser_fields}}\n { \"bool\": { \"must\": [] } },\n {{/elser}}\n {{^text}}\n {{^elser}}\n {\n \"query_string\": {\n \"query\": \"{{query_string}}\",\n \"default_field\": \"{{default_field}}\",\n \"default_operator\": \"{{default_operator}}\",\n \"boost\": \"{{text_query_boost}}\"\n }\n },\n {{/elser}}\n {{/text}}\n { \"bool\": { \"must\": [] } }\n ],\n \"minimum_should_match\": 1\n }\n },\n \"min_score\": \"{{min_score}}\",\n \"explain\": \"{{explain}}\",\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n ",
"params": {
"text": False,
"elser": False,
"elser_fields": [
{
"name": "title",
"boost": 1
},
{
"name": "description",
"boost": 1
}
],
"text_fields": [
{
"name": "title",
"boost": 10
},
{
"name": "description",
"boost": 5
},
{
"name": "state",
"boost": 1
}
],
"query_string": "*",
"text_query_boost": 4,
"default_field": "*",
"default_operator": "OR",
"explain": False,
"from": 0,
"size": 10,
"min_score": 0
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/89b72dd7f747f6297c2b089e8bc807be.asciidoc 0000664 0000000 0000000 00000000506 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/put-repo-api.asciidoc:16
[source, python]
----
resp = client.snapshot.create_repository(
name="my_repository",
repository={
"type": "fs",
"settings": {
"location": "my_backup_location"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/89c57917bc7bd2e6387b5eb54ece37b1.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:174
[source, python]
----
resp = client.count(
index="my-index-000001",
query={
"exists": {
"field": "my-field"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/89d2a3748dc14c6d5d4c6f94b9b03938.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/split-index.asciidoc:50
[source, python]
----
resp = client.indices.add_block(
index="my_source_index",
block="write",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/89dee10a24ea2727af5b00039a4271bd.asciidoc 0000664 0000000 0000000 00000010066 15176617013 0026472 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geoline-aggregation.asciidoc:159
[source, python]
----
resp = client.indices.create(
index="tour",
mappings={
"properties": {
"city": {
"type": "keyword",
"time_series_dimension": True
},
"category": {
"type": "keyword"
},
"route": {
"type": "long"
},
"name": {
"type": "keyword"
},
"location": {
"type": "geo_point"
},
"@timestamp": {
"type": "date"
}
}
},
settings={
"index": {
"mode": "time_series",
"routing_path": [
"city"
],
"time_series": {
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2024-01-01T00:00:00Z"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="tour",
refresh=True,
operations=[
{
"index": {}
},
{
"@timestamp": "2023-01-02T09:00:00Z",
"route": 0,
"location": "POINT(4.889187 52.373184)",
"city": "Amsterdam",
"category": "Attraction",
"name": "Royal Palace Amsterdam"
},
{
"index": {}
},
{
"@timestamp": "2023-01-02T10:00:00Z",
"route": 1,
"location": "POINT(4.885057 52.370159)",
"city": "Amsterdam",
"category": "Attraction",
"name": "The Amsterdam Dungeon"
},
{
"index": {}
},
{
"@timestamp": "2023-01-02T13:00:00Z",
"route": 2,
"location": "POINT(4.901618 52.369219)",
"city": "Amsterdam",
"category": "Museum",
"name": "Museum Het Rembrandthuis"
},
{
"index": {}
},
{
"@timestamp": "2023-01-02T16:00:00Z",
"route": 3,
"location": "POINT(4.912350 52.374081)",
"city": "Amsterdam",
"category": "Museum",
"name": "NEMO Science Museum"
},
{
"index": {}
},
{
"@timestamp": "2023-01-03T12:00:00Z",
"route": 4,
"location": "POINT(4.914722 52.371667)",
"city": "Amsterdam",
"category": "Museum",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {}
},
{
"@timestamp": "2023-01-04T09:00:00Z",
"route": 5,
"location": "POINT(4.401384 51.220292)",
"city": "Antwerp",
"category": "Attraction",
"name": "Cathedral of Our Lady"
},
{
"index": {}
},
{
"@timestamp": "2023-01-04T12:00:00Z",
"route": 6,
"location": "POINT(4.405819 51.221758)",
"city": "Antwerp",
"category": "Museum",
"name": "Snijders&Rockoxhuis"
},
{
"index": {}
},
{
"@timestamp": "2023-01-04T15:00:00Z",
"route": 7,
"location": "POINT(4.405200 51.222900)",
"city": "Antwerp",
"category": "Museum",
"name": "Letterenhuis"
},
{
"index": {}
},
{
"@timestamp": "2023-01-05T10:00:00Z",
"route": 8,
"location": "POINT(2.336389 48.861111)",
"city": "Paris",
"category": "Museum",
"name": "Musée du Louvre"
},
{
"index": {}
},
{
"@timestamp": "2023-01-05T14:00:00Z",
"route": 9,
"location": "POINT(2.327000 48.860000)",
"city": "Paris",
"category": "Museum",
"name": "Musée dOrsay"
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/89f547649895176c246bb8c41313ff21.asciidoc 0000664 0000000 0000000 00000000575 15176617013 0026167 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/89f8eac24f3ec6a7668d580aaf0eeefa.asciidoc 0000664 0000000 0000000 00000000455 15176617013 0027115 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:292
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"snowball"
],
text="detailed output",
explain=True,
attributes=[
"keyword"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8a0b5f759de3f27f0801c1176e616117.asciidoc 0000664 0000000 0000000 00000000540 15176617013 0026272 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/8a12cd824404d74f098d854716a26899.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026155 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-datafeed.asciidoc:49
[source, python]
----
resp = client.ml.delete_datafeed(
datafeed_id="datafeed-total-requests",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8a1b6eae4893c5dd27b3d81fd8d70f5b.asciidoc 0000664 0000000 0000000 00000000255 15176617013 0026745 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// migration/migrate_9_0.asciidoc:467
[source, python]
----
resp = client.tasks.get(
task_id="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8a1f6cffa653800282c0ae160ee375bc.asciidoc 0000664 0000000 0000000 00000000617 15176617013 0026563 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:161
[source, python]
----
resp = client.update(
index="test",
id="1",
script={
"source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }",
"lang": "painless",
"params": {
"tag": "blue"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8a4941cae0b32d68b22bec2d12c82860.asciidoc 0000664 0000000 0000000 00000000534 15176617013 0026474 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:356
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n sequence by process.pid with maxspan=1h\n [ process where process.name == \"regsvr32.exe\" ]\n [ file where stringContains(file.name, \"scrobj.dll\") ]\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8a617dbfe5887f8ecc8815de132b6eb0.asciidoc 0000664 0000000 0000000 00000000516 15176617013 0026674 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:268
[source, python]
----
resp = client.security.put_user(
username="cross-cluster-kibana",
password="l0ng-r4nd0m-p@ssw0rd",
roles=[
"logstash-reader",
"kibana-access"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8aa17bd25a3f2d634e5253b4b72fec4c.asciidoc 0000664 0000000 0000000 00000000536 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/explain-dfanalytics.asciidoc:126
[source, python]
----
resp = client.ml.explain_data_frame_analytics(
source={
"index": "houses_sold_last_10_yrs"
},
analysis={
"regression": {
"dependent_variable": "price"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8aa74aee3dcf4b34028e4c5e1c1ed27b.asciidoc 0000664 0000000 0000000 00000001441 15176617013 0026777 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:35
[source, python]
----
resp = client.indices.create(
index="bug_reports",
mappings={
"properties": {
"title": {
"type": "text"
},
"labels": {
"type": "flattened"
}
}
},
)
print(resp)
resp1 = client.index(
index="bug_reports",
id="1",
document={
"title": "Results are not sorted correctly.",
"labels": {
"priority": "urgent",
"release": [
"v1.2.5",
"v1.3.0"
],
"timestamp": {
"created": 1541458026,
"closed": 1541457010
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/8ab11a25e017124a70484781ca11fb52.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0026245 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/detect-threats-with-eql.asciidoc:94
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
filter_path="-hits.events",
query="\n any where process.name == \"regsvr32.exe\" \n ",
size=200,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8b07372a21a10a16b52e70fc0c87ad4e.asciidoc 0000664 0000000 0000000 00000000600 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/object.asciidoc:11
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"region": "US",
"manager": {
"age": 30,
"name": {
"first": "John",
"last": "Smith"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8b301122cbf42be6eafeda714a36559e.asciidoc 0000664 0000000 0000000 00000001455 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/logstash/put-pipeline.asciidoc:80
[source, python]
----
resp = client.logstash.put_pipeline(
id="my_pipeline",
pipeline={
"description": "Sample pipeline for illustration purposes",
"last_modified": "2021-01-02T02:50:51.250Z",
"pipeline_metadata": {
"type": "logstash_pipeline",
"version": "1"
},
"username": "elastic",
"pipeline": "input {}\n filter { grok {} }\n output {}",
"pipeline_settings": {
"pipeline.workers": 1,
"pipeline.batch.size": 125,
"pipeline.batch.delay": 50,
"queue.type": "memory",
"queue.max_bytes": "1gb",
"queue.checkpoint.writes": 1024
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8b38eeb41eb388ee6d92f26b5c0cc48d.asciidoc 0000664 0000000 0000000 00000001424 15176617013 0026747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:868
[source, python]
----
resp = client.put_script(
id="my-prod-tag-script",
script={
"lang": "painless",
"source": "\n Collection tags = ctx.tags;\n if(tags != null){\n for (String tag : tags) {\n if (tag.toLowerCase().contains('prod')) {\n return false;\n }\n }\n }\n return true;\n "
},
)
print(resp)
resp1 = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"drop": {
"description": "Drop documents that don't contain 'prod' tag",
"if": {
"id": "my-prod-tag-script"
}
}
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/8b3a94495127efd9d56b2cd7f3eecdca.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0027026 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-role-mappings.asciidoc:70
[source, python]
----
resp = client.security.get_role_mapping(
name="mapping1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8b5bc6e217b0d33e4c88d84f5c1a0712.asciidoc 0000664 0000000 0000000 00000000515 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/missing-aggregation.asciidoc:12
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"products_without_a_price": {
"missing": {
"field": "price"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8b652e3205a5e9e0187f56ce3c36ae4e.asciidoc 0000664 0000000 0000000 00000000553 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/categorize-text-aggregation.asciidoc:158
[source, python]
----
resp = client.search(
index="log-messages",
filter_path="aggregations",
aggs={
"categories": {
"categorize_text": {
"field": "message"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8b7956a2b88fd798a895d3466d671b58.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/network/tracers.asciidoc:29
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"http.tracer.include": "*",
"http.tracer.exclude": ""
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8b8b6aac2111b2d8b93758ac737e6543.asciidoc 0000664 0000000 0000000 00000001217 15176617013 0026434 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/8bf1e7a6d529547906ba8b1d6501fa0c.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026510 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/set-connector-sync-job-error-api.asciidoc:63
[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/_sync_job/my-connector-sync-job/_error",
headers={"Content-Type": "application/json"},
body={
"error": "some-error"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8c2060b0272556457f4871c5d7a589fd.asciidoc 0000664 0000000 0000000 00000000656 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:244
[source, python]
----
resp = client.security.put_role(
name="logstash-reader",
indices=[
{
"names": [
"logstash-*"
],
"privileges": [
"read",
"view_index_metadata"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8c47c80139f40f25db44f5781ca2dfbe.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026575 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/8c5d48252cd6d1ee26a2bb817f89c78e.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026607 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-filter.asciidoc:46
[source, python]
----
resp = client.ml.delete_filter(
filter_id="safe_domains",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8c619666488927dac6ecb7dcebca44c2.asciidoc 0000664 0000000 0000000 00000000751 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:4
[source, python]
----
resp = client.indices.create(
index="cohere-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 1024,
"element_type": "byte"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8c639d3eef5c2de29e12bd9c6a42d3d4.asciidoc 0000664 0000000 0000000 00000001701 15176617013 0026740 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/8c693e057f6e85fbf2b56ca442719362.asciidoc 0000664 0000000 0000000 00000001405 15176617013 0026374 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/aggregate-metric-double.asciidoc:161
[source, python]
----
resp = client.search(
index="stats-index",
size="0",
aggs={
"metric_min": {
"min": {
"field": "agg_metric"
}
},
"metric_max": {
"max": {
"field": "agg_metric"
}
},
"metric_value_count": {
"value_count": {
"field": "agg_metric"
}
},
"metric_sum": {
"sum": {
"field": "agg_metric"
}
},
"metric_avg": {
"avg": {
"field": "agg_metric"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8c6f3bb8abae9ff1d21e776f16ad1c86.asciidoc 0000664 0000000 0000000 00000001750 15176617013 0027025 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/put-dfanalytics.asciidoc:580
[source, python]
----
resp = client.ml.put_data_frame_analytics(
id="model-flight-delays-pre",
source={
"index": [
"kibana_sample_data_flights"
],
"query": {
"range": {
"DistanceKilometers": {
"gt": 0
}
}
},
"_source": {
"includes": [],
"excludes": [
"FlightDelay",
"FlightDelayType"
]
}
},
dest={
"index": "df-flight-delays",
"results_field": "ml-results"
},
analysis={
"regression": {
"dependent_variable": "FlightDelayMin",
"training_percent": 90
}
},
analyzed_fields={
"includes": [],
"excludes": [
"FlightNum"
]
},
model_memory_limit="100mb",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8c8b5224befab7804461c7e7b6086d9a.asciidoc 0000664 0000000 0000000 00000001121 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/id-field.asciidoc:14
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"text": "Document with ID 1"
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"text": "Document with ID 2"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"terms": {
"_id": [
"1",
"2"
]
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/8c9081dc738d1290fd76071b283fcaec.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:98
[source, python]
----
resp = client.get(
index="my-index-000001",
id="2",
routing="user1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8c92c5e87facbae8dc4f58376ec21815.asciidoc 0000664 0000000 0000000 00000000365 15176617013 0026700 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1038
[source, python]
----
resp = client.search(
index="my-index-000001",
fields=[
"voltage_corrected",
"node"
],
size=2,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8cbf9b46ce3ccc966c4902d2e0c56317.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc:156
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"keyword_repeat",
"stemmer"
],
text="fox running and jumping",
explain=True,
attributes="keyword",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8cd00a3aba7c3c158277bc032aac2830.asciidoc 0000664 0000000 0000000 00000003154 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/bulk.asciidoc:620
[source, python]
----
resp = client.bulk(
operations=[
{
"update": {
"_id": "1",
"_index": "index1",
"retry_on_conflict": 3
}
},
{
"doc": {
"field": "value"
}
},
{
"update": {
"_id": "0",
"_index": "index1",
"retry_on_conflict": 3
}
},
{
"script": {
"source": "ctx._source.counter += params.param1",
"lang": "painless",
"params": {
"param1": 1
}
},
"upsert": {
"counter": 1
}
},
{
"update": {
"_id": "2",
"_index": "index1",
"retry_on_conflict": 3
}
},
{
"doc": {
"field": "value"
},
"doc_as_upsert": True
},
{
"update": {
"_id": "3",
"_index": "index1",
"_source": True
}
},
{
"doc": {
"field": "value"
}
},
{
"update": {
"_id": "4",
"_index": "index1"
}
},
{
"doc": {
"field": "value"
},
"_source": True
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8cef2b98f3fe3a85874f1b48ebe6ec63.asciidoc 0000664 0000000 0000000 00000001674 15176617013 0026774 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/elision-tokenfilter.asciidoc:165
[source, python]
----
resp = client.indices.create(
index="elision_case_insensitive_example",
settings={
"analysis": {
"analyzer": {
"default": {
"tokenizer": "whitespace",
"filter": [
"elision_case_insensitive"
]
}
},
"filter": {
"elision_case_insensitive": {
"type": "elision",
"articles": [
"l",
"m",
"t",
"qu",
"n",
"s",
"j"
],
"articles_case": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8d05862be1f9e7edaba162b1888b5677.asciidoc 0000664 0000000 0000000 00000002526 15176617013 0026536 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/8d064eda2199de52e5be9ee68a5b7c68.asciidoc 0000664 0000000 0000000 00000001127 15176617013 0026701 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/semantic-search/generate-embeddings.asciidoc:17
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-text-embeddings-pipeline",
description="Text embedding pipeline",
processors=[
{
"inference": {
"model_id": ".elser_model_2",
"input_output": [
{
"input_field": "my_text_field",
"output_field": "my_tokens"
}
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8d421c5bec38eecce4679b219cacc9db.asciidoc 0000664 0000000 0000000 00000001353 15176617013 0027101 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-rank-aggregation.asciidoc:128
[source, python]
----
resp = client.search(
index="latency",
size=0,
runtime_mappings={
"load_time.seconds": {
"type": "long",
"script": {
"source": "emit(doc['load_time'].value / params.timeUnit)",
"params": {
"timeUnit": 1000
}
}
}
},
aggs={
"load_time_ranks": {
"percentile_ranks": {
"values": [
500,
600
],
"field": "load_time.seconds"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8d4ca17349e7e82c329cdd854cc670a1.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:184
[source, python]
----
resp = client.security.put_role(
name="remote-search",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8d4dda5d988d568f4f4210a6387e026f.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/saml-logout-api.asciidoc:72
[source, python]
----
resp = client.security.saml_logout(
token="46ToAxZVaXVVZTVKOVF5YU04ZFJVUDVSZlV3",
refresh_token="mJdXLtmvTUSpoLwMvdBt_w",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8d6631b622f9bfb8fa70154f6fb8b153.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/uni-directional-disaster-recovery.asciidoc:188
[source, python]
----
resp = client.search(
index="kibana_sample_data_ecommerce",
q="kimchy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8d7193902a353872740a3324c60c5001.asciidoc 0000664 0000000 0000000 00000000656 15176617013 0025762 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/index-sorting.asciidoc:113
[source, python]
----
resp = client.indices.create(
index="events",
settings={
"index": {
"sort.field": "timestamp",
"sort.order": "desc"
}
},
mappings={
"properties": {
"timestamp": {
"type": "date"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8d9b04f2a97f4229dec9e620126de049.asciidoc 0000664 0000000 0000000 00000000360 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-s3.asciidoc:609
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.com.amazonaws.request": "DEBUG"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8db799543eb084ec71547980863d60b9.asciidoc 0000664 0000000 0000000 00000001265 15176617013 0026252 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/sum-bucket-aggregation.asciidoc:42
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"sum_monthly_sales": {
"sum_bucket": {
"buckets_path": "sales_per_month>sales"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8de6fed6ba2b94ce6a12ce076be2b4d7.asciidoc 0000664 0000000 0000000 00000000232 15176617013 0027067 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/segments.asciidoc:132
[source, python]
----
resp = client.cat.segments(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e06d8b2b737c43806018eae2ca061c1.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0026412 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/string-stats-aggregation.asciidoc:178
[source, python]
----
resp = client.search(
index="my-index-000001",
size="0",
aggs={
"message_stats": {
"string_stats": {
"field": "message.keyword",
"missing": "[empty message]"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e0f43829df9af20547ea6896f4c0124.asciidoc 0000664 0000000 0000000 00000001072 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:327
[source, python]
----
resp = client.ilm.put_lifecycle(
name="rollover_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_size": "50gb"
}
}
},
"delete": {
"min_age": "1d",
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e208098a0156c4c92afe0a06960b230.asciidoc 0000664 0000000 0000000 00000000635 15176617013 0026260 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/saml-authenticate-api.asciidoc:89
[source, python]
----
resp = client.security.saml_authenticate(
content="PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....",
ids=[
"4fee3b046395c4e751011e97f8900b5273d56685"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e286a205a1f84f888a6d99f2620c80e.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0026377 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/logging-config.asciidoc:272
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.deprecation": "OFF"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e2bbef535fef688d397e60e09aefa7f.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0027042 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/hotspotting.asciidoc:206
[source, python]
----
resp = client.indices.stats(
metric="indexing,search",
level="shards",
human=True,
expand_wildcards="all",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e42a17edace2bc6e42c6a1532779937.asciidoc 0000664 0000000 0000000 00000000467 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/max-aggregation.asciidoc:17
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"max_price": {
"max": {
"field": "price"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e43bb5b7946143e69d397bb81d87df0.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/get-follow-stats.asciidoc:225
[source, python]
----
resp = client.ccr.follow_stats(
index="follower_index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e68cdfad45e7e6dff254d931eea29d4.asciidoc 0000664 0000000 0000000 00000005344 15176617013 0027046 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:687
[source, python]
----
resp = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {}
},
{
"@timestamp": "2020-06-21T15:00:01-05:00",
"message": "211.11.9.0 - - [2020-06-21T15:00:01-05:00] \"GET /english/index.html HTTP/1.0\" 304 0"
},
{
"index": {}
},
{
"@timestamp": "2020-06-21T15:00:01-05:00",
"message": "211.11.9.0 - - [2020-06-21T15:00:01-05:00] \"GET /english/index.html HTTP/1.0\" 304 0"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:30:17-05:00",
"message": "40.135.0.0 - - [2020-04-30T14:30:17-05:00] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:30:53-05:00",
"message": "232.0.0.0 - - [2020-04-30T14:30:53-05:00] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:31:12-05:00",
"message": "26.1.0.0 - - [2020-04-30T14:31:12-05:00] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:31:19-05:00",
"message": "247.37.0.0 - - [2020-04-30T14:31:19-05:00] \"GET /french/splash_inet.html HTTP/1.0\" 200 3781"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:31:27-05:00",
"message": "252.0.0.0 - - [2020-04-30T14:31:27-05:00] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:31:29-05:00",
"message": "247.37.0.0 - - [2020-04-30T14:31:29-05:00] \"GET /images/hm_brdl.gif HTTP/1.0\" 304 0"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:31:29-05:00",
"message": "247.37.0.0 - - [2020-04-30T14:31:29-05:00] \"GET /images/hm_arw.gif HTTP/1.0\" 304 0"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:31:32-05:00",
"message": "247.37.0.0 - - [2020-04-30T14:31:32-05:00] \"GET /images/nav_bg_top.gif HTTP/1.0\" 200 929"
},
{
"index": {}
},
{
"@timestamp": "2020-04-30T14:31:43-05:00",
"message": "247.37.0.0 - - [2020-04-30T14:31:43-05:00] \"GET /french/images/nav_venue_off.gif HTTP/1.0\" 304 0"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e89fee0be6a436c4e3d7c152659c47e.asciidoc 0000664 0000000 0000000 00000001053 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-scheduling-api.asciidoc:96
[source, python]
----
resp = client.connector.update_scheduling(
connector_id="my-connector",
scheduling={
"access_control": {
"enabled": True,
"interval": "0 10 0 * * ?"
},
"full": {
"enabled": True,
"interval": "0 20 0 * * ?"
},
"incremental": {
"enabled": False,
"interval": "0 30 0 * * ?"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e92b10ebcfedc76562ab52d0e46b916.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:234
[source, python]
----
resp = client.delete_script(
id="my-search-template",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e9e7dc5fad2b2b8e74ab4dc225d9c53.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0027021 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/common/apis/set-upgrade-mode.asciidoc:102
[source, python]
----
resp = client.ml.set_upgrade_mode(
enabled=False,
timeout="10m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8e9f7261af6264c92d0eb4d586a176f9.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026463 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/lowercase-tokenfilter.asciidoc:82
[source, python]
----
resp = client.indices.create(
index="lowercase_example",
settings={
"analysis": {
"analyzer": {
"whitespace_lowercase": {
"tokenizer": "whitespace",
"filter": [
"lowercase"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8eac28d2e9b6482b413d61817456a14f.asciidoc 0000664 0000000 0000000 00000001056 15176617013 0026360 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:272
[source, python]
----
resp = client.search(
aggs={
"genres": {
"terms": {
"field": "genre",
"order": {
"max_play_count": "desc"
}
},
"aggs": {
"max_play_count": {
"max": {
"field": "play_count"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8ecefdcf8f153cf91588e9fdde8f3e6b.asciidoc 0000664 0000000 0000000 00000000565 15176617013 0027225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:299
[source, python]
----
resp = client.search(
query={
"query_string": {
"fields": [
"content",
"name^5"
],
"query": "this AND that OR thus",
"tie_breaker": 0
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8ed31628081db2b6e9106d61d1e142be.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/simple-query-string-query.asciidoc:291
[source, python]
----
resp = client.search(
query={
"simple_query_string": {
"query": "ny city",
"auto_generate_synonyms_phrase_query": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8edcd80d9b545a222dcc2f25ca4c6d5f.asciidoc 0000664 0000000 0000000 00000001132 15176617013 0027003 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:455
[source, python]
----
resp = client.search_application.search(
name="my-search-app",
params={
"query_string": "What is the most popular brand of coffee sold in the United States?",
"elser_fields": [
"title",
"meta_description"
],
"text_fields": [
"title",
"meta_description"
],
"rrf": {
"rank_window_size": 50,
"rank_constant": 25
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8ee9521f57661a050efb614f02b4a090.asciidoc 0000664 0000000 0000000 00000000426 15176617013 0026343 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:58
[source, python]
----
resp = client.search(
aggs={
"genres": {
"terms": {
"field": "genre"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8f0c5c81cdb902c136db821947ee70a1.asciidoc 0000664 0000000 0000000 00000001115 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/min-aggregation.asciidoc:53
[source, python]
----
resp = client.search(
index="sales",
size=0,
runtime_mappings={
"price.adjusted": {
"type": "double",
"script": "\n double price = doc['price'].value;\n if (doc['promoted'].value) {\n price *= 0.8;\n }\n emit(price);\n "
}
},
aggs={
"min_price": {
"min": {
"field": "price.adjusted"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8f2875d976332cf5da8fb7764097a307.asciidoc 0000664 0000000 0000000 00000000746 15176617013 0026334 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-data-stream-retention.asciidoc:112
[source, python]
----
resp = client.indices.put_index_template(
name="template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
priority=500,
template={
"lifecycle": {
"data_retention": "7d"
}
},
meta={
"description": "Template with data stream lifecycle"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8f4a7f68f2ca3698abdf20026a2d8c5f.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/high-cpu-usage.asciidoc:81
[source, python]
----
resp = client.tasks.list(
actions="*search",
detailed=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8f6f7ea5abf56152b4a5639ddf40848f.asciidoc 0000664 0000000 0000000 00000001056 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/jwt-realm.asciidoc:471
[source, python]
----
resp = client.security.put_role_mapping(
name="native1_users",
refresh=True,
roles=[
"user"
],
rules={
"all": [
{
"field": {
"realm.name": "native1"
}
},
{
"field": {
"username": "principalname1"
}
}
]
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8f7936f219500305e5b2518dbbf949ea.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026365 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:742
[source, python]
----
resp = client.async_search.status(
id="FmpwbThueVB4UkRDeUxqb1l4akIza3cbWEJyeVBPQldTV3FGZGdIeUVabXBldzoyMDIw",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8f9a3fcd17a111f63caa3bef6e5f00f2.asciidoc 0000664 0000000 0000000 00000000475 15176617013 0027005 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:782
[source, python]
----
resp = client.search(
aggs={
"tags": {
"terms": {
"field": "tags",
"execution_hint": "map"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8f9f88cf9a27c1138226efb94ac09e73.asciidoc 0000664 0000000 0000000 00000000400 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/ip.asciidoc:112
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"term": {
"ip_addr": "192.168.0.0/16"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8fe128323a944765f525c76d85af7a2f.asciidoc 0000664 0000000 0000000 00000001127 15176617013 0026376 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/random-sampler-aggregation.asciidoc:25
[source, python]
----
resp = client.search(
index="kibana_sample_data_ecommerce",
size="0",
track_total_hits=False,
aggregations={
"sampling": {
"random_sampler": {
"probability": 0.1
},
"aggs": {
"price_percentiles": {
"percentiles": {
"field": "taxful_total_price"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/8fec06a98d0151c1d717a01491d0b8f0.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-migrate-data-stream-from-ilm-to-dsl.asciidoc:79
[source, python]
----
resp = client.index(
index="dsl-data-stream",
document={
"@timestamp": "2023-10-18T16:21:15.000Z",
"message": "192.0.2.42 - - [06/May/2099:16:21:15 +0000] \"GET /images/bg.jpg HTTP/1.0\" 200 24736"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/90083d93e46fad2524755b8d4d1306fc.asciidoc 0000664 0000000 0000000 00000001003 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/set-connector-sync-job-stats-api.asciidoc:81
[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/_sync_job/my-connector-sync-job/_stats",
headers={"Content-Type": "application/json"},
body={
"deleted_document_count": 10,
"indexed_document_count": 20,
"indexed_document_volume": 1000,
"total_document_count": 2000,
"last_seen": "2023-01-02T10:00:00Z"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/901d66919e584515717bf78ab5ca2cbb.asciidoc 0000664 0000000 0000000 00000001277 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/daterange-aggregation.asciidoc:276
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"range": {
"date_range": {
"field": "date",
"time_zone": "CET",
"ranges": [
{
"to": "2016/02/01"
},
{
"from": "2016/02/01",
"to": "now/d"
},
{
"from": "now/d"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/902cfd5aeec2f65b3adf55f5e38b21f0.asciidoc 0000664 0000000 0000000 00000000372 15176617013 0027011 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/uni-directional-disaster-recovery.asciidoc:117
[source, python]
----
resp = client.index(
index="kibana_sample_data_ecommerce2",
document={
"user": "kimchy"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9054187cbab5c9e1c4ca2a4dba6a5db0.asciidoc 0000664 0000000 0000000 00000000213 15176617013 0026761 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/info.asciidoc:57
[source, python]
----
resp = client.xpack.info()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/90631797c7fbda43902abf2cc0ea8304.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shard-request-cache.asciidoc:132
[source, python]
----
resp = client.nodes.stats(
metric="indices",
index_metric="request_cache",
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/908326e14ad76c2ff04a9b6d8365751f.asciidoc 0000664 0000000 0000000 00000001125 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:872
[source, python]
----
resp = client.search(
index="passage_vectors",
fields=[
"creation_time",
"full_text"
],
source=False,
knn={
"query_vector": [
0.45,
45
],
"field": "paragraph.vector",
"k": 2,
"num_candidates": 2,
"inner_hits": {
"_source": False,
"fields": [
"paragraph.text"
],
"size": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/909a032a9c1f7095b798444705b09ad6.asciidoc 0000664 0000000 0000000 00000000435 15176617013 0026224 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:443
[source, python]
----
resp = client.index(
index="example",
document={
"location": "GEOMETRYCOLLECTION (POINT (100.0 0.0), LINESTRING (101.0 0.0, 102.0 1.0))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/90c087560ea6c0b7405f710971c86ef0.asciidoc 0000664 0000000 0000000 00000001425 15176617013 0026275 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/put-auto-follow-pattern.asciidoc:119
[source, python]
----
resp = client.ccr.put_auto_follow_pattern(
name="my_auto_follow_pattern",
remote_cluster="remote_cluster",
leader_index_patterns=[
"leader_index*"
],
follow_index_pattern="{{leader_index}}-follower",
settings={
"index.number_of_replicas": 0
},
max_read_request_operation_count=1024,
max_outstanding_read_requests=16,
max_read_request_size="1024k",
max_write_request_operation_count=32768,
max_write_request_size="16k",
max_outstanding_write_requests=8,
max_write_buffer_count=512,
max_write_buffer_size="512k",
max_retry_delay="10s",
read_poll_timeout="30s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/90e06d5ec5e454832d8fbd2e73ec2248.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/delete-autoscaling-policy.asciidoc:85
[source, python]
----
resp = client.autoscaling.delete_autoscaling_policy(
name="*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/90f1f5304922fb6d097846dd1444c075.asciidoc 0000664 0000000 0000000 00000001164 15176617013 0026222 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:137
[source, python]
----
resp = client.watcher.put_watch(
id="cluster_health_watch",
trigger={
"schedule": {
"interval": "10s"
}
},
input={
"http": {
"request": {
"host": "localhost",
"port": 9200,
"path": "/_cluster/health"
}
}
},
condition={
"compare": {
"ctx.payload.status": {
"eq": "red"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9116ee8a5b00cc877291ed5559563f24.asciidoc 0000664 0000000 0000000 00000001253 15176617013 0026310 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/ack-watch.asciidoc:68
[source, python]
----
resp = client.watcher.put_watch(
id="my_watch",
trigger={
"schedule": {
"yearly": {
"in": "february",
"on": 29,
"at": "noon"
}
}
},
input={
"simple": {
"payload": {
"send": "yes"
}
}
},
condition={
"always": {}
},
actions={
"test_index": {
"throttle_period": "15m",
"index": {
"index": "test"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/911c56114e50ce7440eb83efc91d28b8.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0026440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:223
[source, python]
----
resp = client.indices.put_mapping(
index="my-data-stream",
properties={
"host": {
"properties": {
"ip": {
"type": "ip",
"ignore_malformed": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9120b6a49ec39a1571339fddf8e1a26f.asciidoc 0000664 0000000 0000000 00000000472 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:466
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"set": {
"field": "my-long-field",
"value": 10
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/91270cef57ac455547ffd47839420887.asciidoc 0000664 0000000 0000000 00000002110 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/rate-aggregation.asciidoc:175
[source, python]
----
resp = client.search(
index="sales",
filter_path="aggregations",
size="0",
aggs={
"buckets": {
"composite": {
"sources": [
{
"month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
}
}
},
{
"type": {
"terms": {
"field": "type"
}
}
}
]
},
"aggs": {
"avg_price": {
"rate": {
"field": "price",
"unit": "day"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9129dec88d35571b3166c6677297f03b.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026234 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/get-transform.asciidoc:115
[source, python]
----
resp = client.transform.get_transform(
transform_id="ecommerce_transform1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9138550002cb26ab64918cce427963b8.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026216 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template.asciidoc:277
[source, python]
----
resp = client.indices.put_index_template(
name="template_1",
index_patterns=[
"foo",
"bar"
],
priority=0,
template={
"settings": {
"number_of_shards": 1
}
},
version=123,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/913c163c197802078a8af72150178061.asciidoc 0000664 0000000 0000000 00000001560 15176617013 0025770 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/derivative-aggregation.asciidoc:136
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
},
"sales_deriv": {
"derivative": {
"buckets_path": "sales"
}
},
"sales_2nd_deriv": {
"derivative": {
"buckets_path": "sales_deriv"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9143be4f137574271953a7a8107e175b.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026137 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-user-profile.asciidoc:69
[source, python]
----
resp = client.security.get_user_profile(
uid="u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9169d19a80175ec94f80865d0f9bef4c.asciidoc 0000664 0000000 0000000 00000002171 15176617013 0026464 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/91750571c195718f0ff246e058e4bc63.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:73
[source, python]
----
resp = client.search(
index="twitter",
query={
"match": {
"title": "elasticsearch"
}
},
sort=[
{
"date": "asc"
},
{
"tie_breaker_id": "asc"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/91c01fcad9bf341d039a15dfc593dcd7.asciidoc 0000664 0000000 0000000 00000000475 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/field-caps.asciidoc:310
[source, python]
----
resp = client.field_caps(
index="my-index-*",
fields="rating",
index_filter={
"range": {
"@timestamp": {
"gte": "2018"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/91c925fc71abe0ddfe52457e9130363b.asciidoc 0000664 0000000 0000000 00000000526 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/grant-api-keys.asciidoc:178
[source, python]
----
resp = client.security.grant_api_key(
grant_type="password",
username="test_admin",
password="x-pack-test-password",
run_as="test_user",
api_key={
"name": "another-api-key"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/91cbeeda86b4e4e393fc79d4e3a4a781.asciidoc 0000664 0000000 0000000 00000001121 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/sampler-aggregation.asciidoc:91
[source, python]
----
resp = client.search(
index="stackoverflow",
size="0",
query={
"query_string": {
"query": "tags:kibana OR tags:javascript"
}
},
aggs={
"low_quality_keywords": {
"significant_terms": {
"field": "tags",
"size": 3,
"exclude": [
"kibana",
"javascript"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/91e106a2affbc8df32cd940684a779ed.asciidoc 0000664 0000000 0000000 00000000517 15176617013 0026665 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/91ed08faaed54cb5ace9a295af937439.asciidoc 0000664 0000000 0000000 00000001002 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations.asciidoc:337
[source, python]
----
resp = client.search(
index="my-index-000001",
size="0",
runtime_mappings={
"message.length": {
"type": "long",
"script": "emit(doc['message.keyword'].value.length())"
}
},
aggs={
"message_length": {
"histogram": {
"interval": 10,
"field": "message.length"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9200ed8d5f798a158def4c526e41269e.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/field-caps.asciidoc:191
[source, python]
----
resp = client.field_caps(
index="my-index-000001",
fields="rating",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/92035a2a62d01a511662af65606d5fc6.asciidoc 0000664 0000000 0000000 00000001131 15176617013 0026245 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/bucket-sort-aggregation.asciidoc:142
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"bucket_truncate": {
"bucket_sort": {
"from": 1,
"size": 1
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9216e8e544e6d193eda1f59e9160a225.asciidoc 0000664 0000000 0000000 00000001275 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-near-query.asciidoc:12
[source, python]
----
resp = client.search(
query={
"span_near": {
"clauses": [
{
"span_term": {
"field": "value1"
}
},
{
"span_term": {
"field": "value2"
}
},
{
"span_term": {
"field": "value3"
}
}
],
"slop": 12,
"in_order": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/922529276f87cb9d116be2468d108466.asciidoc 0000664 0000000 0000000 00000000553 15176617013 0026157 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/specify-analyzer.asciidoc:74
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"default": {
"type": "simple"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9225841fdcddaf83ebdb90c2b0399e20.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026656 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/get-trained-models-stats.asciidoc:412
[source, python]
----
resp = client.ml.get_trained_models_stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/92284d24bbb80ce6943f2ddcbf74b833.asciidoc 0000664 0000000 0000000 00000001216 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:136
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"flattened_field": {
"type": "flattened"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"flattened_field": {
"subfield": "value"
}
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
fields=[
"flattened_field.subfield"
],
source=False,
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/923aee95078219ee6eb321a252e1121b.asciidoc 0000664 0000000 0000000 00000000735 15176617013 0026343 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/ngram-tokenfilter.asciidoc:161
[source, python]
----
resp = client.indices.create(
index="ngram_example",
settings={
"analysis": {
"analyzer": {
"standard_ngram": {
"tokenizer": "standard",
"filter": [
"ngram"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9250ac57ec81d5192e8ad4c462438489.asciidoc 0000664 0000000 0000000 00000002226 15176617013 0026312 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/926c0134aeaad53bd0f3bdad9c430217.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:769
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"text": "words words",
"flag": "foo"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9270964d35d172ea5b193c5fc7a473dd.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/templates.asciidoc:67
[source, python]
----
resp = client.cat.templates(
name="my-template-*",
v=True,
s="name",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/927b20a221f975b75d1227b67d0eb7e2.asciidoc 0000664 0000000 0000000 00000000646 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:268
[source, python]
----
resp = client.esql.query(
query="\n FROM library\n | EVAL year = DATE_EXTRACT(\"year\", release_date)\n | WHERE page_count > ? AND author == ?\n | STATS count = COUNT(*) by year\n | WHERE count > ?\n | LIMIT 5\n ",
params=[
300,
"Frank Herbert",
0
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9298aaf8232a819e79b3bf8471245e98.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026324 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-job-stats.asciidoc:381
[source, python]
----
resp = client.ml.get_job_stats(
job_id="low_request_rate",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/92d0c12d53a900308150d572c3f2f82f.asciidoc 0000664 0000000 0000000 00000000745 15176617013 0026261 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:477
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"strings_as_keywords": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/92d343eb755971c44a939d0660bf5ac2.asciidoc 0000664 0000000 0000000 00000000546 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/refresh.asciidoc:87
[source, python]
----
resp = client.index(
index="test",
id="1",
refresh=True,
document={
"test": "test"
},
)
print(resp)
resp1 = client.index(
index="test",
id="2",
refresh=True,
document={
"test": "test"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/92f073762634a4b2274f71002494192e.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0025770 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/add-nodes.asciidoc:152
[source, python]
----
resp = client.cluster.state(
filter_path="metadata.cluster_coordination.voting_config_exclusions",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/92fa6608673cec5a2ed568a07e80d36b.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026527 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1549
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"range": {
"timestamp": {
"gte": "2020-04-30T14:31:27-05:00"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/92fe53019958ba466d1272da0834cf53.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0026300 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/stats.asciidoc:17
[source, python]
----
resp = client.indices.stats(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/930a3c5667e3bf47b4e8cc28e7bf8d5f.asciidoc 0000664 0000000 0000000 00000001405 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/run-as-privilege.asciidoc:114
[source, python]
----
resp = client.security.put_role(
name="my_admin_role",
refresh=True,
cluster=[
"manage"
],
indices=[
{
"names": [
"index1",
"index2"
],
"privileges": [
"manage"
]
}
],
applications=[
{
"application": "myapp",
"privileges": [
"admin",
"read"
],
"resources": [
"*"
]
}
],
run_as=[
"analyst_user"
],
metadata={
"version": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/930ba37af73dd5ff0342ecfe6c60a4e9.asciidoc 0000664 0000000 0000000 00000000515 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/extendedstats-aggregation.asciidoc:14
[source, python]
----
resp = client.search(
index="exams",
size=0,
aggs={
"grades_stats": {
"extended_stats": {
"field": "grade"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9313f534e1aa266cde7d4af74665497f.asciidoc 0000664 0000000 0000000 00000000526 15176617013 0026454 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/931817b168e055ecf738785c721125dd.asciidoc 0000664 0000000 0000000 00000002242 15176617013 0026227 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/931da02a06953a768f4ad3fecfd7b2df.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/total-shards-per-node.asciidoc:147
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
name="index.routing.allocation.total_shards_per_node",
flat_settings=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9326e323f7ffde678fa04d2d1de3d3bc.asciidoc 0000664 0000000 0000000 00000001077 15176617013 0026744 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:603
[source, python]
----
resp = client.search(
index="alibabacloud-ai-search-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "alibabacloud_ai_search_embeddings",
"model_text": "Calculate fuel cost"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9334ccd09548b585cd637d7c66c5ae65.asciidoc 0000664 0000000 0000000 00000002347 15176617013 0026464 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/filter-search-results.asciidoc:244
[source, python]
----
resp = client.search(
query={
"match": {
"message": {
"operator": "or",
"query": "the quick brown"
}
}
},
rescore=[
{
"window_size": 100,
"query": {
"rescore_query": {
"match_phrase": {
"message": {
"query": "the quick brown",
"slop": 2
}
}
},
"query_weight": 0.7,
"rescore_query_weight": 1.2
}
},
{
"window_size": 10,
"query": {
"score_mode": "multiply",
"rescore_query": {
"function_score": {
"script_score": {
"script": {
"source": "Math.log10(doc.count.value + 2)"
}
}
}
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/93429d2bfbc0a9b7a4854b27e34658cf.asciidoc 0000664 0000000 0000000 00000000602 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:23
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"message": {
"type": "text"
},
"query": {
"type": "percolator"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/93444b445446c1a6033347d6267253d6.asciidoc 0000664 0000000 0000000 00000000454 15176617013 0025775 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-phrase-prefix-query.asciidoc:22
[source, python]
----
resp = client.search(
query={
"match_phrase_prefix": {
"message": {
"query": "quick brown f"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/934aa38c3adcc4cf74ea40cd8736876c.asciidoc 0000664 0000000 0000000 00000000533 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-index.asciidoc:178
[source, python]
----
resp = client.indices.create(
index="test",
settings={
"number_of_shards": 1
},
mappings={
"properties": {
"field1": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/934ced0998552cc95a28e48554147e8b.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026321 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:582
[source, python]
----
resp = client.cluster.allocation_explain(
index="my-index",
shard=0,
primary=False,
current_node="my-node",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/935566d5426d44ade486a49ec5289741.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0026240 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-text-hybrid-search:76
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 10
},
dest={
"index": "semantic-embeddings"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/935ee7c1b86ba9592604834bb673c7a3.asciidoc 0000664 0000000 0000000 00000003517 15176617013 0026374 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geotilegrid-aggregation.asciidoc:38
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"location": "POINT (4.912350 52.374081)",
"name": "NEMO Science Museum"
},
{
"index": {
"_id": 2
}
},
{
"location": "POINT (4.901618 52.369219)",
"name": "Museum Het Rembrandthuis"
},
{
"index": {
"_id": 3
}
},
{
"location": "POINT (4.914722 52.371667)",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {
"_id": 4
}
},
{
"location": "POINT (4.405200 51.222900)",
"name": "Letterenhuis"
},
{
"index": {
"_id": 5
}
},
{
"location": "POINT (2.336389 48.861111)",
"name": "Musée du Louvre"
},
{
"index": {
"_id": 6
}
},
{
"location": "POINT (2.327000 48.860000)",
"name": "Musée d'Orsay"
}
],
)
print(resp1)
resp2 = client.search(
index="museums",
size="0",
aggregations={
"large-grid": {
"geotile_grid": {
"field": "location",
"precision": 8
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/936d809c848f8b77d5b55f57f0aab89a.asciidoc 0000664 0000000 0000000 00000000574 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/field-mapping.asciidoc:81
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"date_detection": False
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"create_date": "2015/09/02"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/937089157fc82cf08b68a954d0e6d52c.asciidoc 0000664 0000000 0000000 00000000515 15176617013 0026377 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:240
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n sequence with maxspan=1h\n [ process where process.name == \"regsvr32.exe\" ]\n [ file where stringContains(file.name, \"scrobj.dll\") ]\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9370e4935ab6678571d3227973b8c830.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026100 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:37
[source, python]
----
resp = client.indices.get(
index="_all",
filter_path="*.aliases",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/937ffc65cbb20505a8aba25b37a796a5.asciidoc 0000664 0000000 0000000 00000001145 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/boolean.asciidoc:22
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"is_published": {
"type": "boolean"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"is_published": "true"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"term": {
"is_published": True
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/9382f022086c692ba05efb0acae65946.asciidoc 0000664 0000000 0000000 00000000522 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/synthetic-source.asciidoc:63
[source, python]
----
resp = client.index(
index="idx",
id="1",
document={
"foo": [
{
"bar": 1
},
{
"bar": 2
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9399cbbd133ec2b7aad2820fa617ae3a.asciidoc 0000664 0000000 0000000 00000000634 15176617013 0026720 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/children-aggregation.asciidoc:16
[source, python]
----
resp = client.indices.create(
index="child_example",
mappings={
"properties": {
"join": {
"type": "join",
"relations": {
"question": "answer"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/93bd651aff81daa2b86f9f2089e6d088.asciidoc 0000664 0000000 0000000 00000001141 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:49
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"my_id": "1",
"text": "This is a question",
"my_join_field": {
"name": "question"
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"my_id": "2",
"text": "This is another question",
"my_join_field": {
"name": "question"
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/93cd0fdd5ca22838db06aa1cabdbe8bd.asciidoc 0000664 0000000 0000000 00000001057 15176617013 0027213 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:139
[source, python]
----
resp = client.search(
index="hugging-face-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "hugging_face_embeddings",
"model_text": "What's margin of error?"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/93d7ba4130722cae04f9690e52a8f54f.asciidoc 0000664 0000000 0000000 00000000717 15176617013 0026440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:459
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "envelope",
"coordinates": [
[
100,
1
],
[
101,
0
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/93fb59d3204f37af952198b331fb6bb7.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:223
[source, python]
----
resp = client.tasks.get(
task_id="oTUltX4IQMOUUVeiohTt8A:12345",
wait_for_completion=True,
timeout="10s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9403764e6eccad7b321b65e9a10c5727.asciidoc 0000664 0000000 0000000 00000000543 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:543
[source, python]
----
resp = client.search(
aggs={
"tags": {
"terms": {
"field": "tags",
"include": ".*sport.*",
"exclude": "water_.*"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/940e8c2c7ff92d71f489bdb7183c1ce6.asciidoc 0000664 0000000 0000000 00000000250 15176617013 0026612 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/segments.asciidoc:116
[source, python]
----
resp = client.indices.segments(
index="test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9410af79177dd1df9b7b16229a581e18.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/change-password.asciidoc:76
[source, python]
----
resp = client.security.change_password(
username="jacknich",
password="new-test-password",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/941c8d05486200e835d97642e4ee05d5.asciidoc 0000664 0000000 0000000 00000002117 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:183
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"text": {
"type": "text",
"term_vector": "with_positions_offsets_payloads",
"store": True,
"analyzer": "fulltext_analyzer"
},
"fullname": {
"type": "text",
"term_vector": "with_positions_offsets_payloads",
"analyzer": "fulltext_analyzer"
}
}
},
settings={
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"analysis": {
"analyzer": {
"fulltext_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"type_as_payload"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/94246f45025ed394cd6415ed8d7a0588.asciidoc 0000664 0000000 0000000 00000000255 15176617013 0026314 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/delete-job.asciidoc:85
[source, python]
----
resp = client.rollup.delete_job(
id="sensor",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/944806221eb89f5af2298ccdf2902277.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026311 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-caps.asciidoc:171
[source, python]
----
resp = client.rollup.get_rollup_caps(
id="_all",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/944a2dc22dae2a8503299926326a9c18.asciidoc 0000664 0000000 0000000 00000001115 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/ip.asciidoc:11
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"ip_addr": {
"type": "ip"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"ip_addr": "192.168.1.1"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"term": {
"ip_addr": "192.168.0.0/16"
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/946522c26d02bebf5c527ba28e55c724.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:358
[source, python]
----
resp = client.update_by_query(
index="my-index-000001",
routing="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9467e52087a13b63b02d78c35ff6f798.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026325 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-phrase-query.asciidoc:11
[source, python]
----
resp = client.search(
query={
"match_phrase": {
"message": "this is a test"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/947efe87db7f8813c0878f8affc3e2d1.asciidoc 0000664 0000000 0000000 00000000242 15176617013 0026710 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/resolve-cluster.asciidoc:83
[source, python]
----
resp = client.indices.resolve_cluster()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/948418e0ef1b7e7cfee2f11be715d7d2.asciidoc 0000664 0000000 0000000 00000004541 15176617013 0026667 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/94cd66bf93f99881c1bda547283a0357.asciidoc 0000664 0000000 0000000 00000001617 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:306
[source, python]
----
resp = client.bulk(
index="quantized-image-index",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"image-vector": [
0.1,
-2
],
"title": "moose family"
},
{
"index": {
"_id": "2"
}
},
{
"image-vector": [
0.75,
-1
],
"title": "alpine lake"
},
{
"index": {
"_id": "3"
}
},
{
"image-vector": [
1.2,
0.1
],
"title": "full moon"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9501e6c8e95c21838653ea15b9b7ed5f.asciidoc 0000664 0000000 0000000 00000000364 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:791
[source, python]
----
resp = client.search(
query={
"term": {
"query.extraction_result": "failed"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/950f1230536422567f99a205ff4165ec.asciidoc 0000664 0000000 0000000 00000000526 15176617013 0026142 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/rollover-index.asciidoc:405
[source, python]
----
resp = client.indices.rollover(
alias="my-write-alias",
conditions={
"max_age": "7d",
"max_docs": 1000,
"max_primary_shard_size": "50gb",
"max_primary_shard_docs": "2000"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/95414139c7b1203e3c2d99a354415801.asciidoc 0000664 0000000 0000000 00000000231 15176617013 0026036 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/recovery.asciidoc:89
[source, python]
----
resp = client.cat.recovery(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9559de0c2190f99fcc344887fc7b232a.asciidoc 0000664 0000000 0000000 00000001263 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:480
[source, python]
----
resp = client.indices.create(
index="bicycles",
mappings={
"properties": {
"cycle_type": {
"type": "constant_keyword",
"value": "bicycle"
},
"name": {
"type": "text"
}
}
},
)
print(resp)
resp1 = client.indices.create(
index="other_cycles",
mappings={
"properties": {
"cycle_type": {
"type": "keyword"
},
"name": {
"type": "text"
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/956cb470258024af964cd2dabbaf7c7c.asciidoc 0000664 0000000 0000000 00000000557 15176617013 0026660 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-management/migrate-index-allocation-filters.asciidoc:220
[source, python]
----
resp = client.indices.put_settings(
index="my-index",
settings={
"index.routing.allocation.require.data": None,
"index.routing.allocation.include._tier_preference": "data_warm,data_hot"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/957d2e6ddbb9a9b16549c5e67b93b41b.asciidoc 0000664 0000000 0000000 00000000515 15176617013 0026613 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:267
[source, python]
----
resp = client.search(
query={
"query_string": {
"fields": [
"content",
"name"
],
"query": "this AND that"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9584b042223982e0bfde8d12d42c9705.asciidoc 0000664 0000000 0000000 00000000561 15176617013 0026276 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/configuring-kerberos-realm.asciidoc:179
[source, python]
----
resp = client.security.put_role_mapping(
name="kerbrolemapping",
roles=[
"monitoring_user"
],
enabled=True,
rules={
"field": {
"username": "user@REALM"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/95b3f53f2065737bbeba6199e8a12df3.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-query.asciidoc:152
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"color": [
"blue",
"green"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/95c03bdef4faf6bef039c986f4cb3aba.asciidoc 0000664 0000000 0000000 00000000470 15176617013 0027157 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:259
[source, python]
----
resp = client.search(
index=".watcher-history*",
pretty=True,
query={
"match": {
"result.condition.met": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/95c1b376652533c352bbf793c74d1b08.asciidoc 0000664 0000000 0000000 00000000463 15176617013 0026277 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-role.asciidoc:247
[source, python]
----
resp = client.security.query_role(
query={
"match": {
"description": {
"query": "user access"
}
}
},
size=1,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9606c271921cb800d5ea395b16d6ceaf.asciidoc 0000664 0000000 0000000 00000002134 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:843
[source, python]
----
resp = client.indices.create(
index="galician_example",
settings={
"analysis": {
"filter": {
"galician_stop": {
"type": "stop",
"stopwords": "_galician_"
},
"galician_keywords": {
"type": "keyword_marker",
"keywords": [
"exemplo"
]
},
"galician_stemmer": {
"type": "stemmer",
"language": "galician"
}
},
"analyzer": {
"rebuilt_galician": {
"tokenizer": "standard",
"filter": [
"lowercase",
"galician_stop",
"galician_keywords",
"galician_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9608820dbeac261ba53fb89bb9400560.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026421 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:239
[source, python]
----
resp = client.security.get_api_key(
owner=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/962e6187bbd71c5749376efed04b65ba.asciidoc 0000664 0000000 0000000 00000001077 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/field-level-security.asciidoc:142
[source, python]
----
resp = client.security.put_role(
name="test_role6",
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
],
"field_security": {
"except": [
"customer.handle"
],
"grant": [
"customer.*"
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/966ff3a4c5b61ed1a36d44c17ce06157.asciidoc 0000664 0000000 0000000 00000001756 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/normalizers.asciidoc:27
[source, python]
----
resp = client.indices.create(
index="index",
settings={
"analysis": {
"char_filter": {
"quote": {
"type": "mapping",
"mappings": [
"« => \"",
"» => \""
]
}
},
"normalizer": {
"my_normalizer": {
"type": "custom",
"char_filter": [
"quote"
],
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
mappings={
"properties": {
"foo": {
"type": "keyword",
"normalizer": "my_normalizer"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9684e5fa8c22a07a372feb6fc1f5f7c0.asciidoc 0000664 0000000 0000000 00000001556 15176617013 0026670 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/has-privileges.asciidoc:75
[source, python]
----
resp = client.security.has_privileges(
cluster=[
"monitor",
"manage"
],
index=[
{
"names": [
"suppliers",
"products"
],
"privileges": [
"read"
]
},
{
"names": [
"inventory"
],
"privileges": [
"read",
"write"
]
}
],
application=[
{
"application": "inventory_manager",
"privileges": [
"read",
"data:write/inventory"
],
"resources": [
"product/1852563"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/968fb5b92aa65af09544f7c002b0953e.asciidoc 0000664 0000000 0000000 00000000550 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-search-semantic-text.asciidoc:144
[source, python]
----
resp = client.search(
index="semantic-embeddings",
query={
"semantic": {
"field": "content",
"query": "How to avoid muscle soreness while running?"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/96b9289c3c4c6b135ab3386562c4ee8d.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/troubleshooting-shards-capacity.asciidoc:174
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.max_shards_per_node": 1200
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/96e137e42d12c180e2c702db30714a9e.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/text.asciidoc:39
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"full_name": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/96e88611f99e6834bd64b58dc8a282c1.asciidoc 0000664 0000000 0000000 00000000600 15176617013 0026402 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/semantic-text.asciidoc:42
[source, python]
----
resp = client.indices.create(
index="my-index-000002",
mappings={
"properties": {
"inference_field": {
"type": "semantic_text",
"inference_id": "my-openai-endpoint"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/96ea0e80323d6d2d99964625c004a44d.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026275 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-migrate-data-stream-from-ilm-to-dsl.asciidoc:394
[source, python]
----
resp = client.indices.put_data_lifecycle(
name="dsl-data-stream",
data_retention="7d",
enabled=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/971c7a36ee79f2b3aa82c64ea338de70.asciidoc 0000664 0000000 0000000 00000000526 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:345
[source, python]
----
resp = client.indices.create(
index="index",
mappings={
"properties": {
"foo": {
"type": "keyword",
"eager_global_ordinals": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/971fd23adb81bb5842c7750e0379336a.asciidoc 0000664 0000000 0000000 00000001174 15176617013 0026356 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/973a3ff47fc4ce036ecd9bd363fef9f7.asciidoc 0000664 0000000 0000000 00000000631 15176617013 0027043 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:849
[source, python]
----
resp = client.reindex(
source={
"index": "metricbeat-*"
},
dest={
"index": "metricbeat"
},
script={
"lang": "painless",
"source": "ctx._index = 'metricbeat-' + (ctx._index.substring('metricbeat-'.length(), ctx._index.length())) + '-1'"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/975b4b92464d52068516aa2f0f955cc1.asciidoc 0000664 0000000 0000000 00000000257 15176617013 0026302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/segments.asciidoc:125
[source, python]
----
resp = client.indices.segments(
index="test1,test2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/976e5f9baf81bd6ca0e9f80916a0a4f9.asciidoc 0000664 0000000 0000000 00000001057 15176617013 0026676 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/field-level-security.asciidoc:18
[source, python]
----
resp = client.security.put_role(
name="test_role1",
indices=[
{
"names": [
"events-*"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"category",
"@timestamp",
"message"
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/97916243f245478b735471a9e37f33d1.asciidoc 0000664 0000000 0000000 00000001036 15176617013 0026075 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/iprange-aggregation.asciidoc:12
[source, python]
----
resp = client.search(
index="ip_addresses",
size=10,
aggs={
"ip_ranges": {
"ip_range": {
"field": "ip",
"ranges": [
{
"to": "10.0.0.5"
},
{
"from": "10.0.0.5"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/97a3216af3d4b4d805d467d9c715cb3e.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/get-desired-balance.asciidoc:27
[source, python]
----
resp = client.perform_request(
"GET",
"/_internal/desired_balance",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/97ae2b62aa372a955278be6f660356ba.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/combined-fields-query.asciidoc:57
[source, python]
----
resp = client.search(
query={
"combined_fields": {
"query": "distributed consensus",
"fields": [
"title^2",
"body"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/97babc8d19ef0866774576716eb6d19e.asciidoc 0000664 0000000 0000000 00000000567 15176617013 0026500 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:781
[source, python]
----
resp = client.update_by_query(
index="test",
refresh=True,
conflicts="proceed",
)
print(resp)
resp1 = client.search(
index="test",
filter_path="hits.total",
query={
"match": {
"flag": "foo"
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/97c6c07f46f4177f0565a04bc50924a3.asciidoc 0000664 0000000 0000000 00000002160 15176617013 0026274 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/97da68c09c9f1a97a21780fd404e213a.asciidoc 0000664 0000000 0000000 00000000637 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/ipprefix-aggregation.asciidoc:279
[source, python]
----
resp = client.search(
index="network-traffic",
size=0,
aggs={
"ipv4-subnets": {
"ip_prefix": {
"field": "ipv4",
"prefix_length": 24,
"append_prefix_length": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/97ea5ab17213cb1faaf6f3ea13607098.asciidoc 0000664 0000000 0000000 00000000227 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/start.asciidoc:49
[source, python]
----
resp = client.watcher.start()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/97f5df84efec655f479fad78bc392d4d.asciidoc 0000664 0000000 0000000 00000001442 15176617013 0027001 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/profile.asciidoc:835
[source, python]
----
resp = client.search(
index="my-index-000001",
profile=True,
query={
"term": {
"user.id": {
"value": "elkbee"
}
}
},
aggs={
"my_scoped_agg": {
"terms": {
"field": "http.response.status_code"
}
},
"my_global_agg": {
"global": {},
"aggs": {
"my_level_agg": {
"terms": {
"field": "http.response.status_code"
}
}
}
}
},
post_filter={
"match": {
"message": "search"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/983fbb78e57e8fe98db38cf2d217e943.asciidoc 0000664 0000000 0000000 00000002173 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-inner-hits.asciidoc:212
[source, python]
----
resp = client.indices.create(
index="test",
mappings={
"properties": {
"comments": {
"type": "nested"
}
}
},
)
print(resp)
resp1 = client.index(
index="test",
id="1",
refresh=True,
document={
"title": "Test title",
"comments": [
{
"author": "kimchy",
"text": "comment text"
},
{
"author": "nik9000",
"text": "words words words"
}
]
},
)
print(resp1)
resp2 = client.search(
index="test",
query={
"nested": {
"path": "comments",
"query": {
"match": {
"comments.text": "words"
}
},
"inner_hits": {
"_source": False,
"docvalue_fields": [
"comments.text.keyword"
]
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/9851f5225150bc032fb3b195cd447f4f.asciidoc 0000664 0000000 0000000 00000001624 15176617013 0026351 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:213
[source, python]
----
resp = client.bulk(
index="byte-image-index",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"byte-image-vector": [
5,
-20
],
"title": "moose family"
},
{
"index": {
"_id": "2"
}
},
{
"byte-image-vector": [
8,
-15
],
"title": "alpine lake"
},
{
"index": {
"_id": "3"
}
},
{
"byte-image-vector": [
11,
23
],
"title": "full moon"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/98574a419b6be603a0af8f7f22a92d23.asciidoc 0000664 0000000 0000000 00000000240 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/grok.asciidoc:258
[source, python]
----
resp = client.ingest.processor_grok()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/98621bea4765b1b838cc9daa914bf5c5.asciidoc 0000664 0000000 0000000 00000000553 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:340
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n sequence with maxspan=1h\n [ process where process.name == \"regsvr32.exe\" ] by process.pid\n [ file where stringContains(file.name, \"scrobj.dll\") ] by process.pid\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/986f892bfa4dfdf1da8455fdf84a4b0c.asciidoc 0000664 0000000 0000000 00000001077 15176617013 0027041 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-alibabacloud-ai-search.asciidoc:228
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="alibabacloud_ai_search_embeddings",
inference_config={
"service": "alibabacloud-ai-search",
"service_settings": {
"api_key": "",
"service_id": "ops-text-embedding-001",
"host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
"workspace": "default"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/98855f4bda8726d5d123aeebf7869e47.asciidoc 0000664 0000000 0000000 00000000233 15176617013 0026546 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/nodeattrs.asciidoc:88
[source, python]
----
resp = client.cat.nodeattrs(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9887f65af249bbf09190b1153ea2597b.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:615
[source, python]
----
resp = client.sql.get_async_status(
id="FnR0TDhyWUVmUmVtWXRWZER4MXZiNFEad2F5UDk2ZVdTVHV1S0xDUy00SklUdzozMTU=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/98b403c356a9b14544e9b9f646845e9f.asciidoc 0000664 0000000 0000000 00000000776 15176617013 0026340 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:848
[source, python]
----
resp = client.put_script(
id="my-search-template",
script={
"lang": "mustache",
"source": {
"query": {
"multi_match": {
"query": "{{query_string}}",
"fields": "[{{#text_fields}}{{user_name}}{{^last}},{{/last}}{{/text_fields}}]"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/98c1080d8630d3a18d564312300d020f.asciidoc 0000664 0000000 0000000 00000001232 15176617013 0026102 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/network-direction.asciidoc:66
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"network_direction": {
"internal_networks": [
"private"
]
}
}
]
},
docs=[
{
"_source": {
"source": {
"ip": "128.232.110.120"
},
"destination": {
"ip": "192.168.1.1"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/98f43710cedd28a464e8abf4b09bcc9a.asciidoc 0000664 0000000 0000000 00000000675 15176617013 0026747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations.asciidoc:95
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"range": {
"@timestamp": {
"gte": "now-1d/d",
"lt": "now/d"
}
}
},
aggs={
"my-agg-name": {
"terms": {
"field": "my-field"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/98f7525ec0bc8945eafa008a5a9c50c0.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1253
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
wait_for_completion_timeout="2s",
query="\n process where process.name == \"cmd.exe\"\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/990c0d794ed6f05d1620b5d49f7aff6e.asciidoc 0000664 0000000 0000000 00000000347 15176617013 0026616 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-data-stream-retention.asciidoc:183
[source, python]
----
resp = client.indices.get_data_lifecycle(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/99160b7c3c3fc1fac98aeb426dbcb3cb.asciidoc 0000664 0000000 0000000 00000001517 15176617013 0027067 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/fields.asciidoc:244
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"first_name": {
"type": "text"
},
"last_name": {
"type": "text"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"first_name": "Barry",
"last_name": "White"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
script_fields={
"full_name": {
"script": {
"lang": "painless",
"source": "params._source.first_name + ' ' + params._source.last_name"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/991b9ba53f0eccec8ec5a42f8d9b655c.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0027025 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:628
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"fields": {
"body": {},
"blog.title": {
"number_of_fragments": 0
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/99474a7e7979816c874aeac4403be5d0.asciidoc 0000664 0000000 0000000 00000001107 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/rate-aggregation.asciidoc:104
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"by_date": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"avg_price": {
"rate": {
"field": "price",
"unit": "day"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/996521cef7803ef363a49ac6321ea1de.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:256
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n sequence with maxspan=1d\n [ process where process.name == \"cmd.exe\" ]\n ![ process where stringContains(process.command_line, \"ocx\") ]\n [ file where stringContains(file.name, \"scrobj.dll\") ]\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/996f320a0f537c24b9cd0d71b5f7c1f8.asciidoc 0000664 0000000 0000000 00000001172 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/function-score-query.asciidoc:175
[source, python]
----
resp = client.search(
query={
"function_score": {
"query": {
"match": {
"message": "elasticsearch"
}
},
"script_score": {
"script": {
"params": {
"a": 5,
"b": 1.2
},
"source": "params.a / Math.pow(params.b, doc['my-int'].value)"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/99803d7b111b862c0c82e9908e549b16.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026232 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-mistral.asciidoc:113
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="mistral-embeddings-test",
inference_config={
"service": "mistral",
"service_settings": {
"api_key": "",
"model": "mistral-embed"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/998651b98e152add530084a631a4ab5a.asciidoc 0000664 0000000 0000000 00000000373 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:528
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"indices.lifecycle.poll_interval": "1m"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/998c8479c8704bca0e121d5969859517.asciidoc 0000664 0000000 0000000 00000000264 15176617013 0026175 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/docs/connectors-API-tutorial.asciidoc:417
[source, python]
----
resp = client.count(
index="music",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/99a56f423df3a0e57b7f20146f0d33b5.asciidoc 0000664 0000000 0000000 00000000605 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/match-only-text.asciidoc:26
[source, python]
----
resp = client.indices.create(
index="logs",
mappings={
"properties": {
"@timestamp": {
"type": "date"
},
"message": {
"type": "match_only_text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/99b617a0a83fcfbe5755ccc724a4ce62.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/context-suggest.asciidoc:118
[source, python]
----
resp = client.index(
index="place_path_category",
id="1",
document={
"suggest": [
"timmy's",
"starbucks",
"dunkin donuts"
],
"cat": [
"cafe",
"food"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/99c1cfe60f3ccf5bf3abd24c31ed9034.asciidoc 0000664 0000000 0000000 00000000731 15176617013 0027006 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/put-auto-follow-pattern.asciidoc:20
[source, python]
----
resp = client.ccr.put_auto_follow_pattern(
name="",
remote_cluster="",
leader_index_patterns=[
""
],
leader_index_exclusion_patterns=[
""
],
follow_index_pattern="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/99fb82d49ac477e6a9dfdd71f9465374.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026557 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/9a02bd47c000a3d9a8911233c37c890f.asciidoc 0000664 0000000 0000000 00000001272 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:367
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"date": "2015-10-01T00:30:00Z"
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"date": "2015-10-01T01:30:00Z"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
size="0",
aggs={
"by_day": {
"date_histogram": {
"field": "date",
"calendar_interval": "day"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/9a036a792be1d39af9fd0d1adb5f3402.asciidoc 0000664 0000000 0000000 00000000665 15176617013 0026650 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keep-words-tokenfilter.asciidoc:26
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "keep",
"keep_words": [
"dog",
"elephant",
"fox"
]
}
],
text="the quick fox jumps over the lazy dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9a05cc10eea1251e23b82a4549913536.asciidoc 0000664 0000000 0000000 00000000400 15176617013 0026245 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/hotspotting.asciidoc:108
[source, python]
----
resp = client.cat.allocation(
v=True,
s="node",
h="node,shards,disk.percent,disk.indices,disk.used",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9a09d33ec11e20b6081cae882282ca60.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-privileges-cache.asciidoc:63
[source, python]
----
resp = client.security.clear_cached_privileges(
application="*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc 0000664 0000000 0000000 00000000701 15176617013 0026413 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-cohere.asciidoc:196
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="cohere-embeddings",
inference_config={
"service": "cohere",
"service_settings": {
"api_key": "",
"model_id": "embed-english-light-v3.0",
"embedding_type": "byte"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9a49b7572d571e00e20dbebdd30f9368.asciidoc 0000664 0000000 0000000 00000002331 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-vector-tile-api.asciidoc:119
[source, python]
----
resp = client.search(
index="my-index",
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
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9a4d5e41c52c20635d1fd9c6e13f6c7a.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0026575 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:833
[source, python]
----
resp = client.index(
index="metricbeat-2016.05.30",
id="1",
refresh=True,
document={
"system.cpu.idle.pct": 0.908
},
)
print(resp)
resp1 = client.index(
index="metricbeat-2016.05.31",
id="1",
refresh=True,
document={
"system.cpu.idle.pct": 0.105
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/9a743b6575c6fe5acdf46024a7fda8a1.asciidoc 0000664 0000000 0000000 00000000551 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:542
[source, python]
----
resp = client.search(
index="my_test_scores_2",
query={
"term": {
"grad_year": "2099"
}
},
sort=[
{
"total_score": {
"order": "desc"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9ab351893dae65ec97fd8cb6832950fb.asciidoc 0000664 0000000 0000000 00000001642 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:1288
[source, python]
----
resp = client.search(
index="product-index",
query={
"script_score": {
"query": {
"bool": {
"filter": {
"range": {
"price": {
"gte": 1000
}
}
}
}
},
"script": {
"source": "cosineSimilarity(params.queryVector, 'product-vector') + 1.0",
"params": {
"queryVector": [
-0.5,
90,
-10,
14.8,
-156
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9ad14a9d7bf2699e2d86b6a607d410c0.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:112
[source, python]
----
resp = client.search_application.get(
name="my_search_application",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9ad38ab4d9c3983e97e8c38fec611f10.asciidoc 0000664 0000000 0000000 00000000606 15176617013 0026617 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/getting-started.asciidoc:107
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"leader": {
"seeds": [
"127.0.0.1:9300"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9ae268058c0ea32ef8926568e011c728.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-features-api.asciidoc:129
[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/my-connector/_features",
headers={"Content-Type": "application/json"},
body={
"features": {
"document_level_security": {
"enabled": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9aedc45f83e022732789e8d796f5a43c.asciidoc 0000664 0000000 0000000 00000001012 15176617013 0026455 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/reroute.asciidoc:200
[source, python]
----
resp = client.cluster.reroute(
commands=[
{
"move": {
"index": "test",
"shard": 0,
"from_node": "node1",
"to_node": "node2"
}
},
{
"allocate_replica": {
"index": "test",
"shard": 1,
"node": "node3"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9af44592fb2e78fb17ad3e834bbef7a7.asciidoc 0000664 0000000 0000000 00000000236 15176617013 0026752 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/geoip-stats.asciidoc:17
[source, python]
----
resp = client.ingest.geo_ip_stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9afa0844883b7471883aa378a8dd10b4.asciidoc 0000664 0000000 0000000 00000002102 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// 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",
payload={
"session": {
"id": "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9"
},
"user": {
"id": "5f26f01a-bbee-4202-9298-81261067abbd"
},
"search": {
"query": "search term",
"results": {
"items": [
{
"document": {
"id": "123",
"index": "products"
}
}
],
"total_results": 10
},
"sort": {
"name": "relevance"
},
"search_application": "website"
},
"document": {
"id": "123",
"index": "products"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9b0f34d122a4b348dc86df7410d6ebb6.asciidoc 0000664 0000000 0000000 00000000371 15176617013 0026565 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/cancel-connector-sync-job-api.asciidoc:57
[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/_sync_job/my-connector-sync-job-id/_cancel",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9b30a69fec54cf01f7af1b04a6e15239.asciidoc 0000664 0000000 0000000 00000000224 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/get-ccr-stats.asciidoc:109
[source, python]
----
resp = client.ccr.stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9b345e0bfd45f3a37194585ec9193478.asciidoc 0000664 0000000 0000000 00000000267 15176617013 0026324 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/forcemerge.asciidoc:179
[source, python]
----
resp = client.indices.forcemerge(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9b68748c061b768c0153c1f2508ce207.asciidoc 0000664 0000000 0000000 00000001156 15176617013 0026217 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/uni-directional-disaster-recovery.asciidoc:49
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"clusterA": {
"mode": "proxy",
"skip_unavailable": "true",
"server_name": "clustera.es.region-a.gcp.elastic-cloud.com",
"proxy_socket_connections": "18",
"proxy_address": "clustera.es.region-a.gcp.elastic-cloud.com:9400"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9b92266d87170e93a84f9700596d9035.asciidoc 0000664 0000000 0000000 00000001147 15176617013 0026110 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-shape-query.asciidoc:30
[source, python]
----
resp = client.indices.create(
index="example",
mappings={
"properties": {
"location": {
"type": "geo_shape"
}
}
},
)
print(resp)
resp1 = client.index(
index="example",
refresh=True,
document={
"name": "Wind & Wetter, Berlin, Germany",
"location": {
"type": "point",
"coordinates": [
13.400544,
52.530286
]
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/9ba6f1e64c1dfff5aac26eaa1d093f48.asciidoc 0000664 0000000 0000000 00000001526 15176617013 0027073 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc:57
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"custom_stems",
"porter_stem"
]
}
},
"filter": {
"custom_stems": {
"type": "stemmer_override",
"rules": [
"running, runs => run",
"stemmer => stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9ba868784f417a8d3679b3c8ed5939ad.asciidoc 0000664 0000000 0000000 00000000635 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:176
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_size": "100gb"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9bae72e974bdeb56007d9104e73eff92.asciidoc 0000664 0000000 0000000 00000000323 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:188
[source, python]
----
resp = client.update(
index="test",
id="1",
script="ctx._source.remove('new_field')",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9bb24fe09e3d1c73a71d00b994ba8cfb.asciidoc 0000664 0000000 0000000 00000000242 15176617013 0026723 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/shards.asciidoc:352
[source, python]
----
resp = client.cat.shards(
index="my-index-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9bd5a470ee6d2b4a1f5280adc39675d2.asciidoc 0000664 0000000 0000000 00000001405 15176617013 0026570 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/9beb260834f8cfb240f6308950dbb9c2.asciidoc 0000664 0000000 0000000 00000000663 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:523
[source, python]
----
resp = client.search(
sort=[
{
"_geo_distance": {
"pin.location": "drm3btev3e86",
"order": "asc",
"unit": "km"
}
}
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9bfdda207b701028a3439e495e800c02.asciidoc 0000664 0000000 0000000 00000000644 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:288
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sales_over_time": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M",
"format": "yyyy-MM-dd"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9c01db07c9ac395b6370e3b33965c21f.asciidoc 0000664 0000000 0000000 00000000732 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/oidc-authenticate-api.asciidoc:74
[source, python]
----
resp = client.security.oidc_authenticate(
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)
----
python-elasticsearch-9.4.0/docs/examples/9c021836acf7c0370e289f611325868d.asciidoc 0000664 0000000 0000000 00000000653 15176617013 0026225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-configuration-api.asciidoc:315
[source, python]
----
resp = client.connector.update_configuration(
connector_id="my-spo-connector",
values={
"tenant_id": "my-tenant-id",
"tenant_name": "my-sharepoint-site",
"client_id": "foo",
"secret_value": "bar",
"site_collections": "*"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9c2ce0132e4527077443f007d27b1158.asciidoc 0000664 0000000 0000000 00000001226 15176617013 0026121 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:422
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"flattened": {
"type": "flattened"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"flattened": {
"field": [
"foo"
]
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/9c4ac64e73141f6cbf2fb6da0743d9b7.asciidoc 0000664 0000000 0000000 00000000524 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/specify-analyzer.asciidoc:130
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"message": {
"query": "Quick foxes",
"analyzer": "stop"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9c5cbbdbe0075ab9c2611627fe4748fb.asciidoc 0000664 0000000 0000000 00000001000 15176617013 0026641 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/decimal-digit-tokenfilter.asciidoc:75
[source, python]
----
resp = client.indices.create(
index="decimal_digit_example",
settings={
"analysis": {
"analyzer": {
"whitespace_decimal_digit": {
"tokenizer": "whitespace",
"filter": [
"decimal_digit"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9c6ea5fe2339d6c7e5e4bf1b98990248.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0026552 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:132
[source, python]
----
resp = client.search(
index="image-index",
knn={
"field": "image-vector",
"query_vector": [
-5,
9,
-12
],
"k": 10,
"num_candidates": 100
},
fields=[
"title",
"file-type"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9c7c8051592b6af3adb5d7c490849068.asciidoc 0000664 0000000 0000000 00000000712 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/put-datafeed.asciidoc:168
[source, python]
----
resp = client.ml.put_datafeed(
datafeed_id="datafeed-test-job",
pretty=True,
indices=[
"kibana_sample_data_logs"
],
query={
"bool": {
"must": [
{
"match_all": {}
}
]
}
},
job_id="test-job",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9cb150d67dfa0947f29aa809bcc93c6e.asciidoc 0000664 0000000 0000000 00000000400 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// datatiers.asciidoc:240
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
filter_path="*.settings.index.routing.allocation.include._tier_preference",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9cbb097e5498a9fde39e3b1d3b62a4d2.asciidoc 0000664 0000000 0000000 00000001036 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/infer-trained-model.asciidoc:1052
[source, python]
----
resp = client.ml.infer_trained_model(
model_id="model2",
docs=[
{
"text_field": "This is a very happy person"
}
],
inference_config={
"zero_shot_classification": {
"labels": [
"glad",
"sad",
"bad",
"rad"
],
"multi_label": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9cc64ab2f60f995f5dbfaca67aa6dd41.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-query-api.asciidoc:16
[source, python]
----
resp = client.esql.query(
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 ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9cc952d4a03264b700136cbc45abc8c6.asciidoc 0000664 0000000 0000000 00000001243 15176617013 0026473 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/9cd37d0ccbc66ad47ddb626564b27cc8.asciidoc 0000664 0000000 0000000 00000002105 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/execute-watch.asciidoc:333
[source, python]
----
resp = client.watcher.execute_watch(
watch={
"trigger": {
"schedule": {
"interval": "10s"
}
},
"input": {
"search": {
"request": {
"indices": [
"logs"
],
"body": {
"query": {
"match": {
"message": "error"
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"log_error": {
"logging": {
"text": "Found {{ctx.payload.hits.total}} errors in the logs"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9cf6c7012a4f2bb562bc256aa28c3409.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/execute-watch.asciidoc:320
[source, python]
----
resp = client.watcher.execute_watch(
id="my_watch",
action_modes={
"_all": "force_execute"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9cfbc41bb7b6fbdb26550dd2789c274e.asciidoc 0000664 0000000 0000000 00000000531 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:521
[source, python]
----
resp = client.delete_by_query(
index="my-index-000001",
refresh=True,
slices="5",
query={
"range": {
"http.response.bytes": {
"lt": 2000000
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9d1fb129ac783355a20097effded1845.asciidoc 0000664 0000000 0000000 00000001563 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:12
[source, python]
----
resp = client.bulk(
index="test",
refresh=True,
operations=[
{
"index": {}
},
{
"s": 1,
"m": 3.1415
},
{
"index": {}
},
{
"s": 2,
"m": 1
},
{
"index": {}
},
{
"s": 3,
"m": 2.71828
}
],
)
print(resp)
resp1 = client.search(
index="test",
filter_path="aggregations",
aggs={
"tm": {
"top_metrics": {
"metrics": {
"field": "m"
},
"sort": {
"s": "desc"
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/9d31c7eaf8c6b56cee2fdfdde8a442bb.asciidoc 0000664 0000000 0000000 00000000646 15176617013 0027247 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-shrink.asciidoc:90
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"shrink": {
"max_primary_shard_size": "50gb"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9d396afad93782699d7a929578c85284.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0026267 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:192
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="google_vertex_ai_embeddings",
inference_config={
"service": "googlevertexai",
"service_settings": {
"service_account_json": "",
"model_id": "text-embedding-004",
"location": "",
"project_id": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9d461ae140ddc018efd2650559800cd1.asciidoc 0000664 0000000 0000000 00000001021 15176617013 0026411 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-allocate.asciidoc:147
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"allocate": {
"number_of_replicas": 1,
"require": {
"box_type": "cold"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9d5855075e7008270459cc88c189043d.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0026104 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:112
[source, python]
----
resp = client.security.put_user(
username="cross-cluster-user",
password="l0ng-r4nd0m-p@ssw0rd",
roles=[
"remote-replication"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9d662fc9f943c287b7144f5e4e2ae358.asciidoc 0000664 0000000 0000000 00000000621 15176617013 0026462 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/median-absolute-deviation-aggregation.asciidoc:90
[source, python]
----
resp = client.search(
index="reviews",
size=0,
aggs={
"review_variability": {
"median_absolute_deviation": {
"field": "rating",
"compression": 100
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9d66cb59711f24e6b4ff85608c9b5a1b.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0026531 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/9d67db8370a98854812d38ae73ee2a12.asciidoc 0000664 0000000 0000000 00000001215 15176617013 0026367 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:302
[source, python]
----
resp = client.search(
index="index2",
query={
"query_string": {
"query": "running with scissors",
"fields": [
"comment",
"comment.english"
]
}
},
highlight={
"order": "score",
"fields": {
"comment": {
"type": "fvh",
"matched_fields": [
"comment",
"comment.english"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc 0000664 0000000 0000000 00000000217 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// health/health.asciidoc:471
[source, python]
----
resp = client.health_report()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9d9c8d715b72ce336e604c2c8a2b540e.asciidoc 0000664 0000000 0000000 00000001707 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/bucket-sort-aggregation.asciidoc:54
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"total_sales": {
"sum": {
"field": "price"
}
},
"sales_bucket_sort": {
"bucket_sort": {
"sort": [
{
"total_sales": {
"order": "desc"
}
}
],
"size": 3
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9de10a59a5f56dd0906be627896cc789.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0026463 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:543
[source, python]
----
resp = client.search(
index="bicycles,other_cycles",
query={
"match": {
"description": "dutch"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9de4704d2f047dae1259249112488697.asciidoc 0000664 0000000 0000000 00000000471 15176617013 0026153 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-azure.asciidoc:72
[source, python]
----
resp = client.snapshot.create_repository(
name="my_backup",
repository={
"type": "azure",
"settings": {
"client": "secondary"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9de4ea9d5f3d427a71ee07d998cb5611.asciidoc 0000664 0000000 0000000 00000000313 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/blocks.asciidoc:138
[source, python]
----
resp = client.indices.add_block(
index="my-index-000001",
block="write",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9de4edafd22a8b9cb557632b2c8779cd.asciidoc 0000664 0000000 0000000 00000000651 15176617013 0026753 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:309
[source, python]
----
resp = client.esql.query(
query="\n FROM library\n | EVAL year = DATE_EXTRACT(\"year\", release_date)\n | WHERE page_count > ?1 AND author == ?2\n | STATS count = COUNT(*) by year\n | WHERE count > ?3\n | LIMIT 5\n ",
params=[
300,
"Frank Herbert",
0
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9e0e3ce27967f164f4585c5231ba9c75.asciidoc 0000664 0000000 0000000 00000000437 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/search-as-you-type.asciidoc:71
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"my_field": "quick brown fox jump lazy dog"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9e3c28d5820c38ea117eb2e9a5061089.asciidoc 0000664 0000000 0000000 00000000545 15176617013 0026360 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rank-feature-query.asciidoc:321
[source, python]
----
resp = client.search(
index="test",
query={
"rank_feature": {
"field": "pagerank",
"sigmoid": {
"pivot": 7,
"exponent": 0.6
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9e563b8d5a7845f644db8d5bbf453eb6.asciidoc 0000664 0000000 0000000 00000000704 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/put-synonyms-set.asciidoc:67
[source, python]
----
resp = client.synonyms.put_synonym(
id="my-synonyms-set",
synonyms_set=[
{
"id": "test-1",
"synonyms": "hello, hi"
},
{
"synonyms": "bye, goodbye"
},
{
"id": "test-2",
"synonyms": "test => check"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9e5ae957fd0663662bfbed9d1effe99e.asciidoc 0000664 0000000 0000000 00000000644 15176617013 0027060 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:559
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"set": {
"description": "Set '_routing' to 'geoip.country_iso_code' value",
"field": "_routing",
"value": "{{{geoip.country_iso_code}}}"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9e962baf1fb407c21d6c47dcd37cec29.asciidoc 0000664 0000000 0000000 00000000720 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:255
[source, python]
----
resp = client.render_search_template(
source={
"query": {
"match": {
"message": "{{query_string}}"
}
},
"from": "{{from}}{{^from}}0{{/from}}",
"size": "{{size}}{{^size}}10{{/size}}"
},
params={
"query_string": "hello world"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9e9717d9108ae1425bfacf71c7c44539.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat.asciidoc:127
[source, python]
----
resp = client.cat.indices(
bytes="b",
s="store.size:desc,index:asc",
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9eda9c39428b0c2c53cbd8ee7ae0f888.asciidoc 0000664 0000000 0000000 00000000542 15176617013 0026753 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/saml-guide.asciidoc:1016
[source, python]
----
resp = client.security.saml_authenticate(
content="PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMD.....",
ids=[],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9eef31d85ebaf6c27054d7375715dbe0.asciidoc 0000664 0000000 0000000 00000001745 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/actions.asciidoc:228
[source, python]
----
resp = client.watcher.put_watch(
id="log_event_watch",
trigger={
"schedule": {
"interval": "5m"
}
},
input={
"search": {
"request": {
"indices": "log-events",
"body": {
"query": {
"match": {
"status": "error"
}
}
}
}
}
},
condition={
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
actions={
"log_hits": {
"foreach": "ctx.payload.hits.hits",
"max_iterations": 500,
"logging": {
"text": "Found id {{ctx.payload._id}} with field {{ctx.payload._source.my_field}}"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9f04cc1a0c6cdb3ed2247f1399713767.asciidoc 0000664 0000000 0000000 00000000463 15176617013 0026437 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/keyword.asciidoc:31
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"tags": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9f0a0029982d9b3423a2a3de1f1b5136.asciidoc 0000664 0000000 0000000 00000003753 15176617013 0026343 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cartesian-centroid-aggregation.asciidoc:13
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "point"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"location": "POINT (491.2350 5237.4081)",
"city": "Amsterdam",
"name": "NEMO Science Museum"
},
{
"index": {
"_id": 2
}
},
{
"location": "POINT (490.1618 5236.9219)",
"city": "Amsterdam",
"name": "Museum Het Rembrandthuis"
},
{
"index": {
"_id": 3
}
},
{
"location": "POINT (491.4722 5237.1667)",
"city": "Amsterdam",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {
"_id": 4
}
},
{
"location": "POINT (440.5200 5122.2900)",
"city": "Antwerp",
"name": "Letterenhuis"
},
{
"index": {
"_id": 5
}
},
{
"location": "POINT (233.6389 4886.1111)",
"city": "Paris",
"name": "Musée du Louvre"
},
{
"index": {
"_id": 6
}
},
{
"location": "POINT (232.7000 4886.0000)",
"city": "Paris",
"name": "Musée d'Orsay"
}
],
)
print(resp1)
resp2 = client.search(
index="museums",
size="0",
aggs={
"centroid": {
"cartesian_centroid": {
"field": "location"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/9f22a0920cc763eefa233ced963d9624.asciidoc 0000664 0000000 0000000 00000000454 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-term-query.asciidoc:34
[source, python]
----
resp = client.search(
query={
"span_term": {
"user.id": {
"term": "kimchy",
"boost": 2
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9f286416f1b18940f13cb27ab5c8458e.asciidoc 0000664 0000000 0000000 00000001403 15176617013 0026361 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/pattern_replace-tokenfilter.asciidoc:133
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"filter": [
"my_pattern_replace_filter"
]
}
},
"filter": {
"my_pattern_replace_filter": {
"type": "pattern_replace",
"pattern": "[£|€]",
"replacement": "",
"all": False
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9f3341489fefd38c4e439c29f6dcb86c.asciidoc 0000664 0000000 0000000 00000001122 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-set-query.asciidoc:224
[source, python]
----
resp = client.search(
index="job-candidates",
query={
"terms_set": {
"programming_languages": {
"terms": [
"c++",
"java",
"php"
],
"minimum_should_match_script": {
"source": "Math.min(params.num_terms, doc['required_matches'].value)"
},
"boost": 1
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9f66b5243050f71ed51bc787a7ac1218.asciidoc 0000664 0000000 0000000 00000001020 15176617013 0026342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:215
[source, python]
----
resp = client.bulk(
index="index2",
refresh=True,
operations=[
{
"index": {
"_id": "doc1"
}
},
{
"comment": "run with scissors"
},
{
"index": {
"_id": "doc2"
}
},
{
"comment": "running with scissors"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9f7671119236423e0e40801ef6485af1.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026132 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/uppercase-tokenfilter.asciidoc:30
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"uppercase"
],
text="the Quick FoX JUMPs",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9f99be2d58c48a6bf8e892aa24604197.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/update-dfanalytics.asciidoc:98
[source, python]
----
resp = client.ml.update_data_frame_analytics(
id="loganalytics",
model_memory_limit="200mb",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9fa55fc76ec4bd81f372e9389f1da851.asciidoc 0000664 0000000 0000000 00000000450 15176617013 0026621 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:318
[source, python]
----
resp = client.indices.put_settings(
index="my-data-stream",
settings={
"index": {
"refresh_interval": "30s"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9fda516a5dc60ba477b970eaad4429db.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/apis/get-lifecycle.asciidoc:148
[source, python]
----
resp = client.indices.get_data_lifecycle(
name="my-data-stream*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9feff356f302ea4915347ab71cc4887a.asciidoc 0000664 0000000 0000000 00000000561 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/simulate-template.asciidoc:241
[source, python]
----
resp = client.indices.simulate_template(
index_patterns=[
"my-index-*"
],
composed_of=[
"ct2"
],
priority=10,
template={
"settings": {
"index.number_of_replicas": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9ff9b2a73419a6c82f17a358b4991499.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026324 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/point-in-time-api.asciidoc:165
[source, python]
----
resp = client.close_point_in_time(
id="46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/9ffe41322c095af1b6ea45a79b640a6f.asciidoc 0000664 0000000 0000000 00000001563 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-within-query.asciidoc:11
[source, python]
----
resp = client.search(
query={
"span_within": {
"little": {
"span_term": {
"field1": "foo"
}
},
"big": {
"span_near": {
"clauses": [
{
"span_term": {
"field1": "bar"
}
},
{
"span_term": {
"field1": "baz"
}
}
],
"slop": 5,
"in_order": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a00311843b5f8f3e9f7d511334a828b1.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026265 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-caps.asciidoc:98
[source, python]
----
resp = client.rollup.get_rollup_caps(
id="sensor-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a008f42379930edc354b4074e0a33344.asciidoc 0000664 0000000 0000000 00000000367 15176617013 0026203 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:116
[source, python]
----
resp = client.index(
index="index",
id="1",
document={
"designation": "spoon",
"price": 13
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a01753fa7b4ba6dc19054f4f42d91cd9.asciidoc 0000664 0000000 0000000 00000001005 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:620
[source, python]
----
resp = client.render_search_template(
source="{ \"query\": { \"bool\": { \"filter\": [ { \"range\": { \"@timestamp\": { \"gte\": {{#year_scope}} \"now-1y/d\" {{/year_scope}} {{^year_scope}} \"now-1d/d\" {{/year_scope}} , \"lt\": \"now/d\" }}}, { \"term\": { \"user.id\": \"{{user_id}}\" }}]}}}",
params={
"year_scope": True,
"user_id": "kimchy"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a037beb3d02296e1d36dd43ef5c935dd.asciidoc 0000664 0000000 0000000 00000000515 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keyword-repeat-tokenfilter.asciidoc:49
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"keyword_repeat"
],
text="fox running and jumping",
explain=True,
attributes="keyword",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a0497157fdefecd04e597edb800a1a95.asciidoc 0000664 0000000 0000000 00000000420 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:513
[source, python]
----
resp = client.search(
source="obj.*",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a04a8d90f8245ff5f30a9983909faa1d.asciidoc 0000664 0000000 0000000 00000002274 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:427
[source, python]
----
resp = client.indices.create(
index="my_queries1",
settings={
"analysis": {
"analyzer": {
"wildcard_prefix": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"wildcard_edge_ngram"
]
}
},
"filter": {
"wildcard_edge_ngram": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 32
}
}
}
},
mappings={
"properties": {
"query": {
"type": "percolator"
},
"my_field": {
"type": "text",
"fields": {
"prefix": {
"type": "text",
"analyzer": "wildcard_prefix",
"search_analyzer": "standard"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a0871be90badeecd2f8d8ec90230e248.asciidoc 0000664 0000000 0000000 00000002165 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/pattern-replace-charfilter.asciidoc:104
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"char_filter": [
"my_char_filter"
],
"filter": [
"lowercase"
]
}
},
"char_filter": {
"my_char_filter": {
"type": "pattern_replace",
"pattern": "(?<=\\p{Lower})(?=\\p{Upper})",
"replacement": " "
}
}
}
},
mappings={
"properties": {
"text": {
"type": "text",
"analyzer": "my_analyzer"
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="The fooBarBaz method",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a0a7557bb7e2aff7918557cd648f41af.asciidoc 0000664 0000000 0000000 00000001136 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:127
[source, python]
----
resp = client.search(
index="index",
aggs={
"price_ranges": {
"range": {
"field": "price",
"ranges": [
{
"to": 10
},
{
"from": 10,
"to": 100
},
{
"from": 100
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a0c64894f14d28b7e0c902add71d2e9a.asciidoc 0000664 0000000 0000000 00000000365 15176617013 0026573 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:511
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"xpack.profiling.templates.enabled": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a0c868282c0514a342ad04998cdc2175.asciidoc 0000664 0000000 0000000 00000000372 15176617013 0026264 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:367
[source, python]
----
resp = client.delete_by_query(
index="my-index-000001",
conflicts="proceed",
query={
"match_all": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a0d53dcb3df938fc0a01d248571a41e4.asciidoc 0000664 0000000 0000000 00000001567 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:246
[source, python]
----
resp = client.search(
runtime_mappings={
"price.discounted": {
"type": "double",
"script": "\n double price = doc['price'].value;\n if (doc['product'].value == 'mad max') {\n price *= 0.8;\n }\n emit(price);\n "
}
},
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"price": {
"histogram": {
"interval": 5,
"field": "price.discounted"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a0f4e902d18460337684d74ea932fbe9.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:263
[source, python]
----
resp = client.update(
index="test",
id="1",
doc={
"name": "new_name"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1070cf2f5969d42d71cda057223f152.asciidoc 0000664 0000000 0000000 00000000243 15176617013 0026336 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:248
[source, python]
----
resp = client.cat.shards(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1377b32d7fe3680079ae0df73009b0e.asciidoc 0000664 0000000 0000000 00000001374 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/tophits-aggregation.asciidoc:293
[source, python]
----
resp = client.search(
index="sales",
query={
"term": {
"tags": "car"
}
},
aggs={
"by_sale": {
"nested": {
"path": "comments"
},
"aggs": {
"by_user": {
"terms": {
"field": "comments.username",
"size": 1
},
"aggs": {
"by_nested": {
"top_hits": {}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1490f71d705053951870fd2d3bceb39.asciidoc 0000664 0000000 0000000 00000000754 15176617013 0026355 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/enabled.asciidoc:99
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"session_data": {
"type": "object",
"enabled": False
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="session_1",
document={
"session_data": "foo bar"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a159143bb578403bb9c7ff37d635d7ad.asciidoc 0000664 0000000 0000000 00000000670 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/predicate-tokenfilter.asciidoc:20
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "predicate_token_filter",
"script": {
"source": "\n token.term.length() > 3\n "
}
}
],
text="the fox jumps the lazy dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a159e1ce0cba7a35ce44db9bebad22f3.asciidoc 0000664 0000000 0000000 00000000226 15176617013 0027127 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// slm/apis/slm-get.asciidoc:132
[source, python]
----
resp = client.slm.get_lifecycle()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a162eb50853331c80596f5994e9d1c38.asciidoc 0000664 0000000 0000000 00000000441 15176617013 0026226 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:212
[source, python]
----
resp = client.search_application.render_query(
name="my_search_application",
params={
"query_string": "rock climbing"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a180c97f8298fb2388fdcaf7b2e1b81e.asciidoc 0000664 0000000 0000000 00000001063 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:440
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="nightly-snapshots",
schedule="0 30 2 * * ?",
name="",
repository="my_repository",
config={
"indices": "*",
"include_global_state": True,
"feature_states": [
"kibana",
"security"
]
},
retention={
"expire_after": "30d",
"min_count": 5,
"max_count": 50
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1879930c1dac36a57d7f094a680420b.asciidoc 0000664 0000000 0000000 00000001336 15176617013 0026351 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geohashgrid-aggregation.asciidoc:130
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggregations={
"zoomed-in": {
"filter": {
"geo_bounding_box": {
"location": {
"top_left": "u17",
"bottom_right": "u17"
}
}
},
"aggregations": {
"zoom1": {
"geohash_grid": {
"field": "location",
"precision": 8
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a197076e0e74951ea88f20309ec257e2.asciidoc 0000664 0000000 0000000 00000001533 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/condition-tokenfilter.asciidoc:125
[source, python]
----
resp = client.indices.create(
index="palindrome_list",
settings={
"analysis": {
"analyzer": {
"whitespace_reverse_first_token": {
"tokenizer": "whitespace",
"filter": [
"reverse_first_token"
]
}
},
"filter": {
"reverse_first_token": {
"type": "condition",
"filter": [
"reverse"
],
"script": {
"source": "token.getPosition() === 0"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1acf454bd6477183ce27ace872deb46.asciidoc 0000664 0000000 0000000 00000001735 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/field-level-security.asciidoc:169
[source, python]
----
resp = client.security.put_role(
name="test_role7",
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"a.*"
],
"except": [
"a.b*"
]
}
}
],
)
print(resp)
resp1 = client.security.put_role(
name="test_role8",
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"a.b*"
],
"except": [
"a.b.c*"
]
}
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a1b668795243398f5bc40bcc9bead884.asciidoc 0000664 0000000 0000000 00000001643 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:254
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"my_range": {
"type": "long_range"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"my_range": [
{
"gte": 200,
"lte": 300
},
{
"gte": 1,
"lte": 100
},
{
"gte": 200,
"lte": 300
},
{
"gte": 200,
"lte": 500
}
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a1ccd51eef37e43c935a047b0ee15daa.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026764 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:401
[source, python]
----
resp = client.indices.rollover(
alias="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1d0603b24a5b048f0959975d8057534.asciidoc 0000664 0000000 0000000 00000000545 15176617013 0026136 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:360
[source, python]
----
resp = client.termvectors(
index="my-index-000001",
doc={
"fullname": "John Doe",
"text": "test test test"
},
fields=[
"fullname"
],
per_field_analyzer={
"fullname": "keyword"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1dcc6668d13271c8207ff5ff1d35492.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/index-mgmt.asciidoc:215
[source, python]
----
resp = client.indices.get(
index="my-index-000001,my-index-000002",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1dda7e7c01be96a4acf7b725d70385f.asciidoc 0000664 0000000 0000000 00000001305 15176617013 0026727 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/a1e5884051755b5a5f4d7549f319f4c7.asciidoc 0000664 0000000 0000000 00000001065 15176617013 0026315 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/nested-aggregation.asciidoc:13
[source, python]
----
resp = client.indices.create(
index="products",
mappings={
"properties": {
"resellers": {
"type": "nested",
"properties": {
"reseller": {
"type": "keyword"
},
"price": {
"type": "double"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1e5f3956f9a697e79478fc9a6e30e1f.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026555 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/thai-tokenizer.asciidoc:20
[source, python]
----
resp = client.indices.analyze(
tokenizer="thai",
text="การที่ได้ต้องแสดงว่างานดี",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a1f70bc71b763b58206814c40a7440e7.asciidoc 0000664 0000000 0000000 00000000471 15176617013 0026260 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/update-settings.asciidoc:47
[source, python]
----
resp = client.perform_request(
"PUT",
"/_watcher/settings",
headers={"Content-Type": "application/json"},
body={
"index.auto_expand_replicas": "0-4"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a21319c9eff1ac47d7fe7490f1ef2efa.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0027021 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/decimal-digit-tokenfilter.asciidoc:20
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"decimal_digit"
],
text="१-one two-२ ३",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a21a7bf052b41f5b996dc58f7b69770f.asciidoc 0000664 0000000 0000000 00000000274 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:323
[source, python]
----
resp = client.ml.set_upgrade_mode(
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a253a1712953f7292bdd646c48ec7fd2.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:240
[source, python]
----
resp = client.search(
index="my-index-000001",
sort="@timestamp:desc",
size="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a28111cdd9b5aaea96c779cbfbf38780.asciidoc 0000664 0000000 0000000 00000002100 15176617013 0026731 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:482
[source, python]
----
resp = client.indices.create(
index="czech_example",
settings={
"analysis": {
"filter": {
"czech_stop": {
"type": "stop",
"stopwords": "_czech_"
},
"czech_keywords": {
"type": "keyword_marker",
"keywords": [
"příklad"
]
},
"czech_stemmer": {
"type": "stemmer",
"language": "czech"
}
},
"analyzer": {
"rebuilt_czech": {
"tokenizer": "standard",
"filter": [
"lowercase",
"czech_stop",
"czech_keywords",
"czech_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a2abd6b6b6b6df7c574a557b5468b5e1.asciidoc 0000664 0000000 0000000 00000001231 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:191
[source, python]
----
resp = client.indices.create(
index="index2",
mappings={
"properties": {
"comment": {
"type": "text",
"analyzer": "standard",
"term_vector": "with_positions_offsets",
"fields": {
"english": {
"type": "text",
"analyzer": "english",
"term_vector": "with_positions_offsets"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a2b2ce031120dac49b5120b26eea8758.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/indices.asciidoc:119
[source, python]
----
resp = client.cat.indices(
index="my-index-*",
v=True,
s="index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a2bab367f0e598ae27a2f4ec82e778e9.asciidoc 0000664 0000000 0000000 00000001445 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/migrating-to-downsampling.asciidoc:25
[source, python]
----
resp = client.rollup.put_job(
id="sensor",
index_pattern="sensor-*",
rollup_index="sensor_rollup",
cron="0 0 * * * *",
page_size=1000,
groups={
"date_histogram": {
"field": "timestamp",
"fixed_interval": "60m"
},
"terms": {
"fields": [
"node"
]
}
},
metrics=[
{
"field": "temperature",
"metrics": [
"min",
"max",
"sum"
]
},
{
"field": "voltage",
"metrics": [
"avg"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a2bd0782aadfd0a902d7f590ee7f49fe.asciidoc 0000664 0000000 0000000 00000000636 15176617013 0027022 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-search-elser.asciidoc:44
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"content_embedding": {
"type": "sparse_vector"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a2c3e284354e8d49cf51bb8dd5ef3613.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/upgrade-transforms.asciidoc:103
[source, python]
----
resp = client.transform.upgrade_transforms()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a2dabdcbb661e7690166ae6d0de27e46.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026716 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/alias.asciidoc:55
[source, python]
----
resp = client.field_caps(
index="trips",
fields="route_*,transit_mode",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a322c8c73d6f2f5e1e375588ed20b636.asciidoc 0000664 0000000 0000000 00000000657 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:149
[source, python]
----
resp = client.security.put_role(
name="remote-search",
indices=[
{
"names": [
"target-indices"
],
"privileges": [
"read",
"read_cross_cluster"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a325f31e94fb1e8739258910593504a8.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026141 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/oidc-guide.asciidoc:610
[source, python]
----
resp = client.security.put_role(
name="facilitator-role",
cluster=[
"manage_oidc",
"manage_token"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3464bd6f0a61623562162859566b078.asciidoc 0000664 0000000 0000000 00000000477 15176617013 0026066 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/uni-directional-disaster-recovery.asciidoc:75
[source, python]
----
resp = client.ccr.follow(
index="kibana_sample_data_ecommerce2",
wait_for_active_shards="1",
remote_cluster="clusterA",
leader_index="kibana_sample_data_ecommerce",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a34d70d7022eb4ba48909d440c80390f.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0026340 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// api-conventions.asciidoc:164
[source, python]
----
resp = client.search(
index=",,",
query={
"match": {
"test": "data"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a34e758e019f563d323ca90ad9fd6e3e.asciidoc 0000664 0000000 0000000 00000000250 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:268
[source, python]
----
resp = client.indices.get_alias(
index="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3646b59da66b9ab68bdbc8dc2e6a9be.asciidoc 0000664 0000000 0000000 00000001356 15176617013 0027107 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/a3779f21f132787c48681bfb50453592.asciidoc 0000664 0000000 0000000 00000001117 15176617013 0026150 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/a38f29375eabd0103f8d7c00b17bb0ab.asciidoc 0000664 0000000 0000000 00000000242 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/allocation/delayed.asciidoc:82
[source, python]
----
resp = client.cluster.health()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3a14f7f0e80725f695a901a7e1d579d.asciidoc 0000664 0000000 0000000 00000000370 15176617013 0026441 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/trim-tokenfilter.asciidoc:65
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
filter=[
"trim"
],
text=" fox ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3a2856ac2338a624a1fa5f31aec4db4.asciidoc 0000664 0000000 0000000 00000000417 15176617013 0026625 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:98
[source, python]
----
resp = client.security.create_api_key(
name="my-api-key",
role_descriptors={},
metadata={
"application": "myapp"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3a64d568fe93a22b042a8b31b9905b0.asciidoc 0000664 0000000 0000000 00000001561 15176617013 0026420 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/simulate-pipeline.asciidoc:309
[source, python]
----
resp = client.ingest.simulate(
verbose=True,
pipeline={
"description": "_description",
"processors": [
{
"set": {
"field": "field2",
"value": "_value2"
}
},
{
"set": {
"field": "field3",
"value": "_value3"
}
}
]
},
docs=[
{
"_index": "index",
"_id": "id",
"_source": {
"foo": "bar"
}
},
{
"_index": "index",
"_id": "id",
"_source": {
"foo": "rab"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3c8f474b0700711a356682f37e62b39.asciidoc 0000664 0000000 0000000 00000001042 15176617013 0026206 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:174
[source, python]
----
resp = client.indices.create(
index="azure-ai-studio-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 1536,
"element_type": "float",
"similarity": "dot_product"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3ce0cfe2176f3d8a36959a5916995f0.asciidoc 0000664 0000000 0000000 00000000242 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:283
[source, python]
----
resp = client.tasks.list(
group_by="none",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3cfd350c73a104b99a998c6be931408.asciidoc 0000664 0000000 0000000 00000000245 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/state.asciidoc:164
[source, python]
----
resp = client.cluster.state(
metric="blocks",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3d13833714f9bb918e5e0f62a49bd0e.asciidoc 0000664 0000000 0000000 00000001075 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/iprange-aggregation.asciidoc:114
[source, python]
----
resp = client.search(
index="ip_addresses",
size=0,
aggs={
"ip_ranges": {
"ip_range": {
"field": "ip",
"ranges": [
{
"to": "10.0.0.5"
},
{
"from": "10.0.0.5"
}
],
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3d943ac9d45b4eff4aa0c679b4eceb3.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0027072 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/dangling-index-import.asciidoc:19
[source, python]
----
resp = client.dangling_indices.import_dangling_index(
index_uuid="",
accept_data_loss=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3e79d6c626a490341c5b731acbb4a5d.asciidoc 0000664 0000000 0000000 00000000264 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:313
[source, python]
----
resp = client.exists_source(
index="my-index-000001",
id="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3f19f3787cb331f230cdac67ff578e8.asciidoc 0000664 0000000 0000000 00000000524 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significantterms-aggregation.asciidoc:660
[source, python]
----
resp = client.search(
aggs={
"tags": {
"significant_terms": {
"field": "tags",
"execution_hint": "map"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3f3c1f3f31dbd225da5fd14633bc4a0.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026704 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/geo-match-enrich-policy-type-ex.asciidoc:131
[source, python]
----
resp = client.get(
index="users",
id="0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3f56fa16c6cc67c2db31a4ba9ca11a7.asciidoc 0000664 0000000 0000000 00000000550 15176617013 0026766 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/range-enrich-policy-type-ex.asciidoc:56
[source, python]
----
resp = client.enrich.put_policy(
name="networks-policy",
range={
"indices": "networks",
"match_field": "range",
"enrich_fields": [
"name",
"department"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a3f66deb467df86edbf66e1dca31da51.asciidoc 0000664 0000000 0000000 00000000607 15176617013 0027100 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/completion-suggest.asciidoc:189
[source, python]
----
resp = client.search(
index="music",
source="suggest",
suggest={
"song-suggest": {
"prefix": "nir",
"completion": {
"field": "suggest",
"size": 5
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a412fe22a74900c72434391ed75139dc.asciidoc 0000664 0000000 0000000 00000001367 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geohexgrid-aggregation.asciidoc:105
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggregations={
"zoomed-in": {
"filter": {
"geo_bounding_box": {
"location": {
"top_left": "POINT (4.9 52.4)",
"bottom_right": "POINT (5.0 52.3)"
}
}
},
"aggregations": {
"zoom1": {
"geohex_grid": {
"field": "location",
"precision": 12
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a425fcab60f603504becee7d001f0a4b.asciidoc 0000664 0000000 0000000 00000000367 15176617013 0026702 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/allocation/prioritization.asciidoc:48
[source, python]
----
resp = client.indices.put_settings(
index="index_4",
settings={
"index.priority": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a428d518162918733d49261ffd65cfc1.asciidoc 0000664 0000000 0000000 00000000751 15176617013 0026307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/unique-tokenfilter.asciidoc:95
[source, python]
----
resp = client.indices.create(
index="custom_unique_example",
settings={
"analysis": {
"analyzer": {
"standard_truncate": {
"tokenizer": "standard",
"filter": [
"unique"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a43954d055f042d625a905513821f5f0.asciidoc 0000664 0000000 0000000 00000000747 15176617013 0026132 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:824
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
params={
"knn_field": "image-vector",
"query_vector": [
-5,
9,
-12
],
"k": 10,
"num_candidates": 100,
"fields": [
"title",
"file-type"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a45244aa3adbf3c793fede100786d1f5.asciidoc 0000664 0000000 0000000 00000000570 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/autodatehistogram-aggregation.asciidoc:17
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sales_over_time": {
"auto_date_histogram": {
"field": "date",
"buckets": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a45605347d6438e7aecdf3b37198616d.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/move-to-step.asciidoc:156
[source, python]
----
resp = client.ilm.move_to_step(
index="my-index-000001",
current_step={
"phase": "new",
"action": "complete",
"name": "complete"
},
next_step={
"phase": "warm",
"action": "forcemerge",
"name": "forcemerge"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a45810722dc4f468f81b1e8a451d21be.asciidoc 0000664 0000000 0000000 00000000364 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/network/tracers.asciidoc:16
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.http.HttpTracer": "TRACE"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a45d80a3fdba70c1b1ba493e51652c8a.asciidoc 0000664 0000000 0000000 00000000725 15176617013 0026631 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:284
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "multipoint",
"coordinates": [
[
1002,
1002
],
[
1003,
2000
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a45eb0cdd138d9c894ca2de9352549a1.asciidoc 0000664 0000000 0000000 00000001172 15176617013 0026575 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/getting-started.asciidoc:27
[source, python]
----
resp = client.watcher.put_watch(
id="log_error_watch",
trigger={
"schedule": {
"interval": "10s"
}
},
input={
"search": {
"request": {
"indices": [
"logs"
],
"body": {
"query": {
"match": {
"message": "error"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a46f566ca031375658c22f89b87dc6d2.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026372 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/a49acb27f56fe799a9b1342f85cba0f3.asciidoc 0000664 0000000 0000000 00000000771 15176617013 0026670 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/word-delimiter-graph-tokenfilter.asciidoc:137
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"filter": [
"word_delimiter_graph"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a4a3c3cd09efa75168dab90105afb2e9.asciidoc 0000664 0000000 0000000 00000000336 15176617013 0026720 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/get-inference.asciidoc:74
[source, python]
----
resp = client.inference.get(
task_type="sparse_embedding",
inference_id="my-elser-model",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a4bae4d956bc0a663f42cfec36bf8e0b.asciidoc 0000664 0000000 0000000 00000000737 15176617013 0027073 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:150
[source, python]
----
resp = client.indices.create(
index="index",
mappings={
"properties": {
"price_range": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.index(
index="index",
id="1",
document={
"designation": "spoon",
"price": 13,
"price_range": "10-100"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a4bd9bf52b4f098838d12bcb8dfc3482.asciidoc 0000664 0000000 0000000 00000001265 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/min-bucket-aggregation.asciidoc:42
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"min_monthly_sales": {
"min_bucket": {
"buckets_path": "sales_per_month>sales"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a4dbd52004f3ab1580eb73997f77dcab.asciidoc 0000664 0000000 0000000 00000002717 15176617013 0026654 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/ecommerce-tutorial.asciidoc:165
[source, python]
----
resp = client.transform.put_transform(
transform_id="ecommerce-customer-transform",
source={
"index": [
"kibana_sample_data_ecommerce"
],
"query": {
"bool": {
"filter": {
"term": {
"currency": "EUR"
}
}
}
}
},
pivot={
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id"
}
}
},
"aggregations": {
"total_quantity.sum": {
"sum": {
"field": "total_quantity"
}
},
"taxless_total_price.sum": {
"sum": {
"field": "taxless_total_price"
}
},
"total_quantity.max": {
"max": {
"field": "total_quantity"
}
},
"order_id.cardinality": {
"cardinality": {
"field": "order_id"
}
}
}
},
dest={
"index": "ecommerce-customers"
},
retention_policy={
"time": {
"field": "order_date",
"max_age": "60d"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a4e510aa9145ccedae151c4a6634f0a4.asciidoc 0000664 0000000 0000000 00000000423 15176617013 0026617 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stemmer-tokenfilter.asciidoc:23
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"stemmer"
],
text="the foxes jumping quickly",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a4ee2214d621bcfaf768c46d21325958.asciidoc 0000664 0000000 0000000 00000000654 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:74
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="hugging_face_embeddings",
inference_config={
"service": "hugging_face",
"service_settings": {
"api_key": "",
"url": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a4f259522b4dc10a0323aff58236c2c2.asciidoc 0000664 0000000 0000000 00000000572 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/completion-suggest.asciidoc:47
[source, python]
----
resp = client.index(
index="music",
id="1",
refresh=True,
document={
"suggest": {
"input": [
"Nevermind",
"Nirvana"
],
"weight": 34
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a512e4dd8880ce0395937db1bab1d205.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026500 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/edgengram-tokenizer.asciidoc:28
[source, python]
----
resp = client.indices.analyze(
tokenizer="edge_ngram",
text="Quick Fox",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a520168c1c8b454a8f102d6a13027c73.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/get-follow-info.asciidoc:149
[source, python]
----
resp = client.ccr.follow_info(
index="follower_index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5217a93efabceee9be19949e484f930.asciidoc 0000664 0000000 0000000 00000000700 15176617013 0026672 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/completion-suggest.asciidoc:83
[source, python]
----
resp = client.index(
index="music",
id="1",
refresh=True,
document={
"suggest": [
{
"input": "Nevermind",
"weight": 10
},
{
"input": "Nirvana",
"weight": 3
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a547bb926c25f670078b98fbe67de3cc.asciidoc 0000664 0000000 0000000 00000000347 15176617013 0026616 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/delete-synonym-rule.asciidoc:108
[source, python]
----
resp = client.synonyms.delete_synonym_rule(
set_id="my-synonyms-set",
rule_id="test-1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a56c20a733a350673d41829c8daaafbe.asciidoc 0000664 0000000 0000000 00000000753 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/deciders/fixed-decider.asciidoc:37
[source, python]
----
resp = client.autoscaling.put_autoscaling_policy(
name="my_autoscaling_policy",
policy={
"roles": [
"data_hot"
],
"deciders": {
"fixed": {
"storage": "1tb",
"memory": "32gb",
"processors": 2.3,
"nodes": 8
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a594f05459d9eecc8050c73fc8da336f.asciidoc 0000664 0000000 0000000 00000001013 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:129
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="azure_openai_embeddings",
inference_config={
"service": "azureopenai",
"service_settings": {
"api_key": "",
"resource_name": "",
"deployment_id": "",
"api_version": "2024-02-01"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5a58e8ad66afe831bc295500e3e8739.asciidoc 0000664 0000000 0000000 00000000533 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-unfollow.asciidoc:45
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"unfollow": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5a5fb129de2f492e8fd33043a73439c.asciidoc 0000664 0000000 0000000 00000001475 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/dictionary-decompounder-tokenfilter.asciidoc:152
[source, python]
----
resp = client.indices.create(
index="dictionary_decompound_example",
settings={
"analysis": {
"analyzer": {
"standard_dictionary_decompound": {
"tokenizer": "standard",
"filter": [
"22_char_dictionary_decompound"
]
}
},
"filter": {
"22_char_dictionary_decompound": {
"type": "dictionary_decompounder",
"word_list_path": "analysis/example_word_list.txt",
"max_subword_size": 22
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5aeb2c8bdf91f6146026ec8edc476b6.asciidoc 0000664 0000000 0000000 00000001242 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/date_nanos.asciidoc:155
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"date": {
"type": "date_nanos"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"date": [
"2015-01-01T12:10:30.000Z",
"2014-01-01T12:10:30.000Z"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a5b59f0170a2feaa39e40243fd7ae359.asciidoc 0000664 0000000 0000000 00000001716 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-client.asciidoc:196
[source, python]
----
resp = client.search_application.put(
name="my-example-app",
search_application={
"indices": [
"my-example-app"
],
"template": {
"script": {
"lang": "mustache",
"source": "\n {\n \"query\": {\n \"bool\": {\n \"must\": [\n {{#query}}\n {\n \"query_string\": {\n \"query\": \"{{query}}\",\n \"search_fields\": {{#toJson}}search_fields{{/toJson}}\n }\n }\n {{/query}}\n ]\n }\n }\n }\n ",
"params": {
"query": "",
"search_fields": ""
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5dfcfd1cfb3558e7912456669c92eee.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026701 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/saml-prepare-authentication-api.asciidoc:85
[source, python]
----
resp = client.security.saml_prepare_authentication(
realm="saml1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5e2b3588258430f2e595abda98e3943.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-cache.asciidoc:60
[source, python]
----
resp = client.security.clear_cached_realms(
realms="default_file",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5e6ad9e65615f6f92ae6a19674dd742.asciidoc 0000664 0000000 0000000 00000001210 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:595
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"percolate": {
"field": "query",
"documents": [
{
"message": "Japanse art"
},
{
"message": "Holand culture"
},
{
"message": "Japanese art and Holand culture"
},
{
"message": "no-match"
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5e6ccfb6019238e6db602373b9af147.asciidoc 0000664 0000000 0000000 00000000345 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-existing-data-stream.asciidoc:19
[source, python]
----
resp = client.indices.put_data_lifecycle(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5e793d82a4455cf4105dac82a156617.asciidoc 0000664 0000000 0000000 00000000540 15176617013 0026347 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/validate.asciidoc:214
[source, python]
----
resp = client.indices.validate_query(
index="my-index-000001",
rewrite=True,
query={
"more_like_this": {
"like": {
"_id": "2"
},
"boost_terms": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5ebcd70c34d1ece77a4fb27cc050917.asciidoc 0000664 0000000 0000000 00000000732 15176617013 0026722 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-rank-aggregation.asciidoc:76
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_ranks": {
"percentile_ranks": {
"field": "load_time",
"values": [
500,
600
],
"keyed": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a5f9eb40087921e67d820775acf71522.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026310 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:218
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"city": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a60aaed30d7d26eaacbb2c0ed4ddc66d.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0027254 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/a6169bc057ce8654bd306ff4b062081b.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0026422 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/completion-suggest.asciidoc:279
[source, python]
----
resp = client.search(
index="music",
pretty=True,
suggest={
"song-suggest": {
"prefix": "nor",
"completion": {
"field": "suggest",
"skip_duplicates": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a6204edaa0bcf7b82a89ab4f6bda0914.asciidoc 0000664 0000000 0000000 00000000324 15176617013 0026770 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/open-job.asciidoc:74
[source, python]
----
resp = client.ml.open_job(
job_id="low_request_rate",
timeout="35m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a62833baf15f2c9ac094a9289e56a012.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-tutorial.asciidoc:166
[source, python]
----
resp = client.index(
index="timeseries",
document={
"message": "logged the request",
"@timestamp": "1591890611"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a63e0d0504e0c9313814b7f4e2641353.asciidoc 0000664 0000000 0000000 00000004066 15176617013 0026200 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-aggregation.asciidoc:340
[source, python]
----
resp = client.indices.create(
index="metrics_index",
mappings={
"properties": {
"network": {
"properties": {
"name": {
"type": "keyword"
}
}
},
"latency_histo": {
"type": "histogram"
}
}
},
)
print(resp)
resp1 = client.index(
index="metrics_index",
id="1",
refresh=True,
document={
"network.name": "net-1",
"latency_histo": {
"values": [
1,
3,
8,
12,
15
],
"counts": [
3,
7,
23,
12,
6
]
}
},
)
print(resp1)
resp2 = client.index(
index="metrics_index",
id="2",
refresh=True,
document={
"network.name": "net-2",
"latency_histo": {
"values": [
1,
6,
8,
12,
14
],
"counts": [
8,
17,
8,
7,
6
]
}
},
)
print(resp2)
resp3 = client.search(
index="metrics_index",
size="0",
filter_path="aggregations",
aggs={
"latency_ranges": {
"range": {
"field": "latency_histo",
"ranges": [
{
"to": 2
},
{
"from": 2,
"to": 3
},
{
"from": 3,
"to": 10
},
{
"from": 10
}
]
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/a669e9d56e34c95ef4c780e92ed307f1.asciidoc 0000664 0000000 0000000 00000000324 15176617013 0026543 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1425
[source, python]
----
resp = client.eql.get(
id="FjlmbndxNmJjU0RPdExBTGg0elNOOEEaQk9xSjJBQzBRMldZa1VVQ2pPa01YUToxMDY=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a675fafa7c688cb3ea1be09bf887ebf0.asciidoc 0000664 0000000 0000000 00000000451 15176617013 0027105 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/a692b4c0ca7825c467880b346841f5a5.asciidoc 0000664 0000000 0000000 00000000636 15176617013 0026304 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:162
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"name": {
"properties": {
"first": {
"type": "text"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a699189c8d1a7573beeaea768f2fc618.asciidoc 0000664 0000000 0000000 00000000547 15176617013 0026631 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:436
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="snapshot-20200617",
indices="kibana_sample_data_flights,.ds-my-data-stream-2022.06.17-000001",
include_aliases=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a69b1ce5cc9528fb3639185eaf241ae3.asciidoc 0000664 0000000 0000000 00000000352 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/clear-scroll-api.asciidoc:31
[source, python]
----
resp = client.clear_scroll(
scroll_id="DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a6b2815d54df34b6b8d00226e9a1af0c.asciidoc 0000664 0000000 0000000 00000000711 15176617013 0026551 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/semantic-search/field-mappings.asciidoc:59
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"my_embeddings.predicted_value": {
"type": "dense_vector",
"dims": 384
},
"my_text_field": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a6bb306ca250cf651f19cae808b97012.asciidoc 0000664 0000000 0000000 00000000256 15176617013 0026476 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-index.asciidoc:17
[source, python]
----
resp = client.indices.get(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a6be6c1cb4a556866fdccb0dee2f1dea.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0027216 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/index-template-exists-v1.asciidoc:23
[source, python]
----
resp = client.indices.exists_template(
name="template_1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a6ccac9f80c5e5efdaab992f3a32d919.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0027102 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-migrate-data-stream-from-ilm-to-dsl.asciidoc:407
[source, python]
----
resp = client.indices.get_data_stream(
name="dsl-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a6ef8cd8c8218d547727ffc5485bfbd7.asciidoc 0000664 0000000 0000000 00000001276 15176617013 0026714 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/daterange-aggregation.asciidoc:85
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"range": {
"date_range": {
"field": "date",
"missing": "1976/11/30",
"ranges": [
{
"key": "Older",
"to": "2016/02/01"
},
{
"key": "Newer",
"from": "2016/02/01",
"to": "now/d"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a6fdd0100cd362df54af6c95d1055c96.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-mapping.asciidoc:17
[source, python]
----
resp = client.indices.get_mapping(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a71154ea11a5214f409ecfd118e9b5e3.asciidoc 0000664 0000000 0000000 00000001574 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/saml-guide.asciidoc:1049
[source, python]
----
resp = client.security.saml_invalidate(
query="SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D",
realm="saml1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a72613de3774571ba24def4b495161b5.asciidoc 0000664 0000000 0000000 00000000463 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:428
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"user_id": {
"type": "alias",
"path": "user_identifier"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a735081e715d385b4d471eea0f2b57da.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:249
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"slm.retention_schedule": "0 30 1 * * ?"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a73a9a6f19516b8ead63182a9ae5b540.asciidoc 0000664 0000000 0000000 00000000614 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:330
[source, python]
----
resp = client.index(
index="example",
document={
"location": "MULTILINESTRING ((1002.0 200.0, 1003.0 200.0, 1003.0 300.0, 1002.0 300.0), (1000.0 100.0, 1001.0 100.0, 1001.0 100.0, 1000.0 100.0), (1000.2 0.2, 1000.8 100.2, 1000.8 100.8, 1000.2 100.8))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a75765e3fb130421dde6c3c2f12e8acb.asciidoc 0000664 0000000 0000000 00000000545 15176617013 0026641 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/claim-connector-sync-job-api.asciidoc:69
[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/_sync_job/my-connector-sync-job-id/_claim",
headers={"Content-Type": "application/json"},
body={
"worker_hostname": "some-machine"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a769d696bf12f5e9de4b3250646d250c.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:229
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "alibabacloud-ai-search-embeddings",
"pipeline": "alibabacloud_ai_search_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a78dfb844d385405d4b0fb0e09b4a5a4.asciidoc 0000664 0000000 0000000 00000000342 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:211
[source, python]
----
resp = client.update(
index="test",
id="1",
script="ctx._source['my-object'].remove('my-subfield')",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a799477dff04578b200788a63f9cff71.asciidoc 0000664 0000000 0000000 00000001225 15176617013 0026410 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/iprange-aggregation.asciidoc:162
[source, python]
----
resp = client.search(
index="ip_addresses",
size=0,
aggs={
"ip_ranges": {
"ip_range": {
"field": "ip",
"ranges": [
{
"key": "infinity",
"to": "10.0.0.5"
},
{
"key": "and-beyond",
"from": "10.0.0.5"
}
],
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a7cf31f4b907e4c00132aca75f55790c.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/delete-pipeline.asciidoc:79
[source, python]
----
resp = client.ingest.delete_pipeline(
id="pipeline-one",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a7d814caf2a995d2aeadecc3495011be.asciidoc 0000664 0000000 0000000 00000001226 15176617013 0027001 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/boolean.asciidoc:248
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"bool": {
"type": "boolean"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"bool": [
True,
False,
True,
False
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a7e58d4dc477a84c1306fd5749aafd8b.asciidoc 0000664 0000000 0000000 00000000701 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/explicit-mapping.asciidoc:20
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"age": {
"type": "integer"
},
"email": {
"type": "keyword"
},
"name": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a7fb1c0d0827d66bfa66016f2564b10c.asciidoc 0000664 0000000 0000000 00000000446 15176617013 0026477 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/detect-threats-with-eql.asciidoc:139
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n process where process.name == \"regsvr32.exe\" and process.command_line.keyword != null\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a8019280dab5b04211ae3b21e5e08223.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0026306 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/register-fs-repo.asciidoc:107
[source, python]
----
resp = client.snapshot.create_repository(
name="my_fs_backup",
repository={
"type": "fs",
"settings": {
"location": "My_fs_backup_location"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a810da963d3b28d79dcd17be829bb271.asciidoc 0000664 0000000 0000000 00000000672 15176617013 0026601 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:620
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"user.id": "kimchy"
}
},
docvalue_fields=[
"user.id",
"http.response.*",
{
"field": "date",
"format": "epoch_millis"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a811b82ba4632bdd9065829085188bc9.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0026277 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-api.asciidoc:50
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="my_snapshot",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a84bc239eb2f607e8bed1fdb70d63823.asciidoc 0000664 0000000 0000000 00000000652 15176617013 0026656 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/deciders/proactive-storage-decider.asciidoc:28
[source, python]
----
resp = client.autoscaling.put_autoscaling_policy(
name="my_autoscaling_policy",
policy={
"roles": [
"data_hot"
],
"deciders": {
"proactive_storage": {
"forecast_window": "10m"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a861a89f52008610e813b9f073951c58.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0026143 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/stats.asciidoc:135
[source, python]
----
resp = client.indices.stats(
metric="merge,refresh",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a89052bcdfe40e604a98d12be6ae59d2.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:474
[source, python]
----
resp = client.index(
index="example",
document={
"location": "BBOX (100.0, 102.0, 2.0, 0.0)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a8add749c3f41ad1308a45308df14103.asciidoc 0000664 0000000 0000000 00000001340 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/tophits-aggregation.asciidoc:277
[source, python]
----
resp = client.index(
index="sales",
id="1",
refresh=True,
document={
"tags": [
"car",
"auto"
],
"comments": [
{
"username": "baddriver007",
"comment": "This car could have better brakes"
},
{
"username": "dr_who",
"comment": "Where's the autopilot? Can't find it"
},
{
"username": "ilovemotorbikes",
"comment": "This car has two extra wheels"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a8dff54362184b2732b9bd248cf6df8a.asciidoc 0000664 0000000 0000000 00000001167 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:418
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"my_range": {
"type": "integer_range"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"my_range": {
"lte": 2147483647
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a9280b55a7284952f604ec7bece712f6.asciidoc 0000664 0000000 0000000 00000000633 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1186
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"range": {
"voltage_corrected": {
"gte": 16,
"lte": 20,
"boost": 1
}
}
},
fields=[
"voltage_corrected",
"node"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a941fd568f2e20e13df909ab24506073.asciidoc 0000664 0000000 0000000 00000000437 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// monitoring/production.asciidoc:52
[source, python]
----
resp = client.cluster.get_settings()
print(resp)
resp1 = client.cluster.put_settings(
persistent={
"xpack.monitoring.collection.enabled": False
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/a9541c64512ebc5fcff2dc48487dc0b7.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:16
[source, python]
----
resp = client.esql.query(
format="txt",
query="FROM library | KEEP author, name, page_count, release_date | SORT page_count DESC | LIMIT 5",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a9554396506888e392a1aee0ca28e6fc.asciidoc 0000664 0000000 0000000 00000001756 15176617013 0026461 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:329
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"add": {
"index": "my-index-2099.05.06-000001",
"alias": "my-alias",
"filter": {
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"gte": "now-1d/d",
"lt": "now/d"
}
}
},
{
"term": {
"user.id": "kimchy"
}
}
]
}
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a95a123b9f862e52ab1e8f875961c852.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026376 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-multiple-indices.asciidoc:124
[source, python]
----
resp = client.search(
indices_boost=[
{
"my-index-000001": 1.4
},
{
"my-index-000002": 1.3
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a95ae76fca7c3e273e4bd10323b3caa6.asciidoc 0000664 0000000 0000000 00000001015 15176617013 0026710 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:119
[source, python]
----
resp = client.ingest.put_pipeline(
id="azure_openai_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "azure_openai_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a960b43e720b4934edb74ab4b085ca77.asciidoc 0000664 0000000 0000000 00000000244 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connectors-api.asciidoc:88
[source, python]
----
resp = client.connector.list()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a97aace57c6442bbb90e1e14effbcda3.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0027140 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:118
[source, python]
----
resp = client.sql.query(
format="csv",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a97f984c01fa1d96e6d33a0e8e2cb90f.asciidoc 0000664 0000000 0000000 00000000577 15176617013 0026673 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:20
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"query": {
"type": "percolator"
},
"field": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a985e6b7b2ead9c3f30a9bc97d8b598e.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0026763 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/field-caps.asciidoc:201
[source, python]
----
resp = client.field_caps(
fields="rating,title",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a98692a565904ec0783884d81a7b71fc.asciidoc 0000664 0000000 0000000 00000000225 15176617013 0026317 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/health.asciidoc:87
[source, python]
----
resp = client.cat.health(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a999b5661bebb802bbbfe04faacf1971.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0027004 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:511
[source, python]
----
resp = client.reindex(
source={
"index": "my-index-2099.10.*"
},
dest={
"index": "my-index-2099.10"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a99bc141066ef673e35f306157750ec9.asciidoc 0000664 0000000 0000000 00000000413 15176617013 0026302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/lowercase-tokenizer.asciidoc:20
[source, python]
----
resp = client.indices.analyze(
tokenizer="lowercase",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a99bf70ae38bdf1c6f350140b25e0422.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026500 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-shard-routing.asciidoc:125
[source, python]
----
resp = client.search(
index="my-index-000001",
routing="my-routing-value",
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a9c08023354aa9b9023807962df71d13.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026204 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/forcemerge.asciidoc:189
[source, python]
----
resp = client.indices.forcemerge(
index="my-index-000001,my-index-000002",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a9d44463dcea3cb0ea4c8f8460cea524.asciidoc 0000664 0000000 0000000 00000001024 15176617013 0026717 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geohexgrid-aggregation.asciidoc:176
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggregations={
"tiles-in-bounds": {
"geohex_grid": {
"field": "location",
"precision": 12,
"bounds": {
"top_left": "POINT (4.9 52.4)",
"bottom_right": "POINT (5.0 52.3)"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a9dd5cd3f2b31e7c8129ea63bab868b4.asciidoc 0000664 0000000 0000000 00000002623 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:656
[source, python]
----
resp = client.search_application.put(
name="my_search_application",
search_application={
"indices": [
"index1",
"index2"
],
"template": {
"script": {
"lang": "mustache",
"source": "\n {\n \"query\": {\n \"bool\": {\n \"should\": [\n {{#elser_fields}}\n {\n \"sparse_vector\": {\n \"field\": \"ml.inference.{{.}}_expanded.predicted_value\",\n \"inference_id\": \"\",\n \"query\": \"{{query_string}}\"\n }\n },\n {{/elser_fields}}\n ]\n }\n },\n \"min_score\": \"{{min_score}}\"\n }\n ",
"params": {
"query_string": "*",
"min_score": "10",
"elser_fields": [
{
"name": "title"
},
{
"name": "description"
}
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a9dd9595e96c307b8c798beaeb571521.asciidoc 0000664 0000000 0000000 00000000453 15176617013 0026543 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/upgrade-job-model-snapshot.asciidoc:83
[source, python]
----
resp = client.ml.upgrade_job_snapshot(
job_id="low_request_rate",
snapshot_id="1828371",
timeout="45m",
wait_for_completion=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/a9f14efc26fdd3c37a71f06c310163d9.asciidoc 0000664 0000000 0000000 00000001302 15176617013 0026561 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/a9fe70387d9c96a07830e1859c57efbb.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026540 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-index.asciidoc:154
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"number_of_shards": 3,
"number_of_replicas": 2
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa1771b702f4b771491ba4ab743a9197.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/increase-tier-capacity.asciidoc:245
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
name="index.number_of_replicas",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa3284717241ed79d3d1d3bdbbdce598.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/lowercase-tokenfilter.asciidoc:20
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"lowercase"
],
text="THE Quick FoX JUMPs",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa5c0fa51a3553ce7caa763c3832120d.asciidoc 0000664 0000000 0000000 00000000745 15176617013 0026545 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:603
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="monthly-snapshots",
name="",
schedule="0 56 23 1 * ?",
repository="my_repository",
config={
"indices": "*",
"include_global_state": True
},
retention={
"expire_after": "366d",
"min_count": 1,
"max_count": 12
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa5fbb68d3a8e0d0c894791cb6cf0b13.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0026726 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/reverse-tokenfilter.asciidoc:79
[source, python]
----
resp = client.indices.create(
index="reverse_example",
settings={
"analysis": {
"analyzer": {
"whitespace_reverse": {
"tokenizer": "whitespace",
"filter": [
"reverse"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa6282d4bc92c753c4bd7a5b166abece.asciidoc 0000664 0000000 0000000 00000000501 15176617013 0026774 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/start-trained-model-deployment.asciidoc:166
[source, python]
----
resp = client.ml.start_trained_model_deployment(
model_id="elastic__distilbert-base-uncased-finetuned-conll03-english",
wait_for="started",
timeout="1m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa676d54a59dee87ecd28bcc1edce59b.asciidoc 0000664 0000000 0000000 00000001064 15176617013 0027170 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-alibabacloud-ai-search.asciidoc:192
[source, python]
----
resp = client.inference.put(
task_type="rerank",
inference_id="alibabacloud_ai_search_rerank",
inference_config={
"service": "alibabacloud-ai-search",
"service_settings": {
"api_key": "",
"service_id": "ops-bge-reranker-larger",
"host": "default-j01.platform-cn-shanghai.opensearch.aliyuncs.com",
"workspace": "default"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa699ff3234f54d091575a38e859a627.asciidoc 0000664 0000000 0000000 00000000536 15176617013 0026324 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations.asciidoc:287
[source, python]
----
resp = client.search(
index="my-index-000001",
typed_keys=True,
aggs={
"my-agg-name": {
"histogram": {
"field": "my-field",
"interval": 1000
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa7cf5df36b867aee5e3314ac4b4fa68.asciidoc 0000664 0000000 0000000 00000001051 15176617013 0027012 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// slm/apis/slm-put.asciidoc:124
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="daily-snapshots",
schedule="0 30 1 * * ?",
name="",
repository="my_repository",
config={
"indices": [
"data-*",
"important"
],
"ignore_unavailable": False,
"include_global_state": False
},
retention={
"expire_after": "30d",
"min_count": 5,
"max_count": 50
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa7f62279b487989440d423c1ed4a1c0.asciidoc 0000664 0000000 0000000 00000000510 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/restore-snapshot-api.asciidoc:94
[source, python]
----
resp = client.indices.get_index_template(
name="*",
filter_path="index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.data_stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aa814309ad5f1630886ba75255b444f5.asciidoc 0000664 0000000 0000000 00000000272 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/task-queue-backlog.asciidoc:104
[source, python]
----
resp = client.cluster.pending_tasks()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aaa7a61b07861235fb6e489b946c705c.asciidoc 0000664 0000000 0000000 00000000452 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/index_.asciidoc:487
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
version="2",
version_type="external",
document={
"user": {
"id": "elkbee"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aab3de5a8a3fefbe012fc2ed50dfe4d6.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0027302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// searchable-snapshots/apis/node-cache-stats.asciidoc:102
[source, python]
----
resp = client.searchable_snapshots.cache_stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aab810de3314d5e11bd564ea096785b8.asciidoc 0000664 0000000 0000000 00000000642 15176617013 0026504 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/aaba346e0becdf12db13658296e0b8a1.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026707 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/error-handling.asciidoc:42
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index.number_of_shards": 2,
"index.lifecycle.name": "shrink-index"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aac5996a8398cc8f7701a063df0b2346.asciidoc 0000664 0000000 0000000 00000001036 15176617013 0026440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/saml-guide.asciidoc:716
[source, python]
----
resp = client.security.put_role_mapping(
name="saml-finance",
roles=[
"finance_data"
],
enabled=True,
rules={
"all": [
{
"field": {
"realm.name": "saml1"
}
},
{
"field": {
"groups": "finance-team"
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aad7d80990a6a3c391ff555ce09ae9dc.asciidoc 0000664 0000000 0000000 00000001154 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/numeric.asciidoc:295
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"f": {
"type": "scaled_float",
"scaling_factor": 0.01
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"f": 123
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/aadf36ae37460a735e06b953b4cee494.asciidoc 0000664 0000000 0000000 00000002127 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/frequent-item-sets-aggregation.asciidoc:301
[source, python]
----
resp = client.search(
index="kibana_sample_data_ecommerce",
runtime_mappings={
"price_range": {
"type": "keyword",
"script": {
"source": "\n def bucket_start = (long) Math.floor(doc['taxful_total_price'].value / 50) * 50;\n def bucket_end = bucket_start + 50;\n emit(bucket_start.toString() + \"-\" + bucket_end.toString());\n "
}
}
},
size=0,
aggs={
"my_agg": {
"frequent_item_sets": {
"minimum_set_size": 4,
"fields": [
{
"field": "category.keyword"
},
{
"field": "price_range"
},
{
"field": "geoip.city_name"
}
],
"size": 3
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ab0fd1908c9957cc7f63165c156e48cd.asciidoc 0000664 0000000 0000000 00000002216 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/enabled.asciidoc:17
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"user_id": {
"type": "keyword"
},
"last_updated": {
"type": "date"
},
"session_data": {
"type": "object",
"enabled": False
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="session_1",
document={
"user_id": "kimchy",
"session_data": {
"arbitrary_object": {
"some_array": [
"foo",
"bar",
{
"baz": 2
}
]
}
},
"last_updated": "2015-12-06T18:20:22"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="session_2",
document={
"user_id": "jpountz",
"session_data": "none",
"last_updated": "2015-12-06T18:22:13"
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ab1372270c11bcd6f36d1a13e6c69276.asciidoc 0000664 0000000 0000000 00000000734 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:414
[source, python]
----
resp = client.async_search.submit(
index="my-index-000001,cluster_one:my-index-000001,cluster_two:my-index-000001",
ccs_minimize_roundtrips=True,
query={
"match": {
"user.id": "kimchy"
}
},
source=[
"user.id",
"message",
"http.response.status_code"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ab1a989958c1d345a9dc3dd36ad90c27.asciidoc 0000664 0000000 0000000 00000000562 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:242
[source, python]
----
resp = client.index(
index="example",
document={
"location": "POLYGON ((1000.0 1000.0, 1001.0 1000.0, 1001.0 1001.0, 1000.0 1001.0, 1000.0 1000.0), (1000.2 1000.2, 1000.8 1000.2, 1000.8 1000.8, 1000.2 1000.8, 1000.2 1000.2))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ab24bfdfd8c1c7b3044b21a3b4684370.asciidoc 0000664 0000000 0000000 00000001114 15176617013 0026543 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/fields.asciidoc:167
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"cost_price": 100
},
)
print(resp)
resp1 = client.search(
index="my-index-000001",
script_fields={
"sales_price": {
"script": {
"lang": "expression",
"source": "doc['cost_price'] * markup",
"params": {
"markup": 0.2
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/ab29bfbd35ee482cf54052b03d62cd31.asciidoc 0000664 0000000 0000000 00000001333 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geodistance-aggregation.asciidoc:96
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggs={
"rings": {
"geo_distance": {
"field": "location",
"origin": "POINT (4.894 52.3760)",
"unit": "km",
"ranges": [
{
"to": 100
},
{
"from": 100,
"to": 300
},
{
"from": 300
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ab317aa09c4bd44abbf02517141e37ef.asciidoc 0000664 0000000 0000000 00000001325 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/term-vector.asciidoc:35
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"text": {
"type": "text",
"term_vector": "with_positions_offsets"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"text": "Quick brown fox"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"match": {
"text": "brown fox"
}
},
highlight={
"fields": {
"text": {}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ab3c36b70459093beafbfd3a7ae75b9b.asciidoc 0000664 0000000 0000000 00000002040 15176617013 0027002 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:386
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"date": "2015-10-01T05:30:00Z"
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh=True,
document={
"date": "2015-10-01T06:30:00Z"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
size="0",
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"date": {
"date_histogram": {
"field": "date",
"calendar_interval": "day",
"offset": "+6h",
"format": "iso8601"
}
}
}
]
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ab8b4537fad80107bc88f633d4039a52.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-index.asciidoc:216
[source, python]
----
resp = client.indices.create(
index="logs",
aliases={
"": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ab8de34fcfc0277901cb39618ecfc9d5.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026746 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/allocation-explain.asciidoc:108
[source, python]
----
resp = client.cluster.allocation_explain(
index="my-index-000001",
shard=0,
primary=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/abb4a58089574211d434946a923e5725.asciidoc 0000664 0000000 0000000 00000005237 15176617013 0026145 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/inference-bucket-aggregation.asciidoc:95
[source, python]
----
resp = client.search(
index="kibana_sample_data_logs",
size=0,
aggs={
"client_ip": {
"composite": {
"sources": [
{
"client_ip": {
"terms": {
"field": "clientip"
}
}
}
]
},
"aggs": {
"url_dc": {
"cardinality": {
"field": "url.keyword"
}
},
"bytes_sum": {
"sum": {
"field": "bytes"
}
},
"geo_src_dc": {
"cardinality": {
"field": "geo.src"
}
},
"geo_dest_dc": {
"cardinality": {
"field": "geo.dest"
}
},
"responses_total": {
"value_count": {
"field": "timestamp"
}
},
"success": {
"filter": {
"term": {
"response": "200"
}
}
},
"error404": {
"filter": {
"term": {
"response": "404"
}
}
},
"error503": {
"filter": {
"term": {
"response": "503"
}
}
},
"malicious_client_ip": {
"inference": {
"model_id": "malicious_clients_model",
"buckets_path": {
"response_count": "responses_total",
"url_dc": "url_dc",
"bytes_sum": "bytes_sum",
"geo_src_dc": "geo_src_dc",
"geo_dest_dc": "geo_dest_dc",
"success": "success._count",
"error404": "error404._count",
"error503": "error503._count"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/abc280775734daa6cf2c28868e155d10.asciidoc 0000664 0000000 0000000 00000001222 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/weighted-avg-aggregation.asciidoc:101
[source, python]
----
resp = client.index(
index="exams",
refresh=True,
document={
"grade": [
1,
2,
3
],
"weight": 2
},
)
print(resp)
resp1 = client.search(
index="exams",
size=0,
aggs={
"weighted_grade": {
"weighted_avg": {
"value": {
"field": "grade"
},
"weight": {
"field": "weight"
}
}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/abc496de5fd013099a134db369b34a8b.asciidoc 0000664 0000000 0000000 00000001007 15176617013 0026563 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/sum-aggregation.asciidoc:109
[source, python]
----
resp = client.search(
index="sales",
size="0",
query={
"constant_score": {
"filter": {
"match": {
"type": "hat"
}
}
}
},
aggs={
"hat_prices": {
"sum": {
"field": "price",
"missing": 100
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/abc7a670a47516b58b6b07d7497b140c.asciidoc 0000664 0000000 0000000 00000002365 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/search-speed.asciidoc:272
[source, python]
----
resp = client.search(
index="index",
query={
"constant_score": {
"filter": {
"bool": {
"should": [
{
"range": {
"my_date": {
"gte": "now-1h",
"lte": "now-1h/m"
}
}
},
{
"range": {
"my_date": {
"gt": "now-1h/m",
"lt": "now/m"
}
}
},
{
"range": {
"my_date": {
"gte": "now/m",
"lte": "now"
}
}
}
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/abd4fc3ce7784413a56fe2dcfe2809b5.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:754
[source, python]
----
resp = client.search(
index="test",
filter_path="hits.total",
query={
"match": {
"flag": "foo"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/abdbc81e799e28c833556b1c29f03ba6.asciidoc 0000664 0000000 0000000 00000000241 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-users.asciidoc:118
[source, python]
----
resp = client.security.get_user()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ac22cc2b0f4ad659055feed2852a2d59.asciidoc 0000664 0000000 0000000 00000002474 15176617013 0026651 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ac366b9dda7040e743dee85335354094.asciidoc 0000664 0000000 0000000 00000000570 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/shingle-tokenfilter.asciidoc:116
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
{
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 3
}
],
text="quick brown fox jumps",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ac483996d479946d57c374c3a86b2621.asciidoc 0000664 0000000 0000000 00000000515 15176617013 0026243 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/search-as-you-type.asciidoc:18
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_field": {
"type": "search_as_you_type"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ac497917ef707538198a8458ae3d5c6b.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-query.asciidoc:165
[source, python]
----
resp = client.search(
query={
"match": {
"message": "this is a test"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ac5b91aa75696f9880451c9439fd9eec.asciidoc 0000664 0000000 0000000 00000001443 15176617013 0026550 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:461
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"my_range": {
"type": "date_range"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"my_range": [
{
"gte": 1504224000000,
"lte": 1504569600000
},
{
"gte": "2017-09-01",
"lte": "2017-09-10"
}
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/ac73895ca1882cd1ac65b1facfbb5c63.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0027002 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:10
[source, python]
----
resp = client.delete_by_query(
index="my-index-000001",
query={
"match": {
"user.id": "elkbee"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ac8328bc51fd396b3ce5f7ef3e1e73df.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0027026 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:64
[source, python]
----
resp = client.snapshot.get_repository()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ac85e05c0bf2fd5099fbcb9c492f447e.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/update-settings.asciidoc:73
[source, python]
----
resp = client.cluster.put_settings(
flat_settings=True,
transient={
"indices.recovery.max_bytes_per_sec": "20mb"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ac9fe9b64891095bcf84066f719b3dc4.asciidoc 0000664 0000000 0000000 00000000575 15176617013 0026547 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-source-only.asciidoc:41
[source, python]
----
resp = client.snapshot.create_repository(
name="my_src_only_repository",
repository={
"type": "source",
"settings": {
"delegate_type": "fs",
"location": "my_backup_repository"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/acb10091ad335ddd15d71021aaf23c62.asciidoc 0000664 0000000 0000000 00000000730 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:631
[source, python]
----
resp = client.search(
track_scores=True,
sort=[
{
"post_date": {
"order": "desc"
}
},
{
"name": "desc"
},
{
"age": "desc"
}
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/acb850c08f51226eadb75be09e336076.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/async-search.asciidoc:259
[source, python]
----
resp = client.async_search.status(
id="FmRldE8zREVEUzA2ZVpUeGs2ejJFUFEaMkZ5QTVrSTZSaVN3WlNFVmtlWHJsdzoxMDc=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/acc44366a9908684b2c8c2b119a4fb2b.asciidoc 0000664 0000000 0000000 00000001305 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-using-query-rules.asciidoc:202
[source, python]
----
resp = client.search(
index="my-index-000001",
retriever={
"rule": {
"retriever": {
"standard": {
"query": {
"query_string": {
"query": "puggles"
}
}
}
},
"match_criteria": {
"query_string": "puggles",
"user_country": "us"
},
"ruleset_ids": [
"my-ruleset"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/acc52da725a996ae696b00d9f818dfde.asciidoc 0000664 0000000 0000000 00000000723 15176617013 0026751 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pathhierarchy-tokenizer.asciidoc:328
[source, python]
----
resp = client.indices.analyze(
index="file-path-test",
analyzer="custom_path_tree",
text="/User/alice/photos/2017/05/16/my_photo1.jpg",
)
print(resp)
resp1 = client.indices.analyze(
index="file-path-test",
analyzer="custom_path_tree_reversed",
text="/User/alice/photos/2017/05/16/my_photo1.jpg",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/acc6cd860032167e34fa5e0c043ab3b0.asciidoc 0000664 0000000 0000000 00000000407 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:335
[source, python]
----
resp = client.search(
query={
"query_string": {
"query": "city.\\*:(this AND that OR thus)"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad0dcbc7fc619e952c8825b8f307b7b2.asciidoc 0000664 0000000 0000000 00000000636 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:410
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "Jon",
"type": "cross_fields",
"fields": [
"first",
"first.edge",
"last",
"last.edge"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad2416ca0581316cee6c63129685bca5.asciidoc 0000664 0000000 0000000 00000000574 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:498
[source, python]
----
resp = client.search(
query={
"query_string": {
"fields": [
"title",
"content"
],
"query": "this OR that OR thus",
"minimum_should_match": 2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad2b8aed84c67cdc295917b47a12d3dc.asciidoc 0000664 0000000 0000000 00000002031 15176617013 0026726 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/knn-query.asciidoc:43
[source, python]
----
resp = client.bulk(
index="my-image-index",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"image-vector": [
1,
5,
-20
],
"file-type": "jpg",
"title": "mountain lake"
},
{
"index": {
"_id": "2"
}
},
{
"image-vector": [
42,
8,
-15
],
"file-type": "png",
"title": "frozen lake"
},
{
"index": {
"_id": "3"
}
},
{
"image-vector": [
15,
11,
23
],
"file-type": "jpg",
"title": "mountain lake lodge"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad3b159657d4bcb373623fdc61acc3bf.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026720 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/count.asciidoc:16
[source, python]
----
resp = client.count(
index="my-index-000001",
q="user:kimchy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad57ccba0a060da4f5313692fa26a235.asciidoc 0000664 0000000 0000000 00000002433 15176617013 0026542 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/date_nanos.asciidoc:30
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"date": {
"type": "date_nanos"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"date": "2015-01-01"
},
{
"index": {
"_id": "2"
}
},
{
"date": "2015-01-01T12:10:30.123456789Z"
},
{
"index": {
"_id": "3"
}
},
{
"date": 1420070400000
}
],
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
sort={
"date": "asc"
},
runtime_mappings={
"date_has_nanos": {
"type": "boolean",
"script": "emit(doc['date'].value.nano != 0)"
}
},
fields=[
{
"field": "date",
"format": "strict_date_optional_time_nanos"
},
{
"field": "date_has_nanos"
}
],
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ad63eca6829a25293c9be589c1870547.asciidoc 0000664 0000000 0000000 00000001430 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:298
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_moving_sum": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.sum(values)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad6d81be5fad4bad87486b699454dce5.asciidoc 0000664 0000000 0000000 00000001004 15176617013 0026747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/t-test-aggregation.asciidoc:32
[source, python]
----
resp = client.search(
index="node_upgrade",
size=0,
aggs={
"startup_time_ttest": {
"t_test": {
"a": {
"field": "startup_time_before"
},
"b": {
"field": "startup_time_after"
},
"type": "paired"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad88e46bb06739991498dee248850223.asciidoc 0000664 0000000 0000000 00000000223 15176617013 0026237 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/thread_pool.asciidoc:142
[source, python]
----
resp = client.cat.thread_pool()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad92a1a8bb1b0f26d1536fe8ba4ffd17.asciidoc 0000664 0000000 0000000 00000000453 15176617013 0027000 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/render-search-template-api.asciidoc:39
[source, python]
----
resp = client.render_search_template(
id="my-search-template",
params={
"query_string": "hello world",
"from": 20,
"size": 10
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ad9889fd8a4b5930e312a51f3bc996dc.asciidoc 0000664 0000000 0000000 00000001115 15176617013 0026607 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ada2675a9c631da2bfe627fc2618f5ed.asciidoc 0000664 0000000 0000000 00000000654 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/script-score-query.asciidoc:18
[source, python]
----
resp = client.search(
query={
"script_score": {
"query": {
"match": {
"message": "elasticsearch"
}
},
"script": {
"source": "doc['my-int'].value / 10 "
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/adc18ca0c344d81d68ec3b9422b54ff5.asciidoc 0000664 0000000 0000000 00000001123 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/multi-search.asciidoc:318
[source, python]
----
resp = client.msearch(
index="my-index-000001",
searches=[
{},
{
"query": {
"match_all": {}
},
"from": 0,
"size": 10
},
{},
{
"query": {
"match_all": {}
}
},
{
"index": "my-index-000002"
},
{
"query": {
"match_all": {}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/adced6e22ef03c2ae3b14aa5bdd24fd9.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0027207 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/add240aa149d8b11139947502b279ee0.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:403
[source, python]
----
resp = client.scroll(
scroll="1m",
scroll_id="DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/add82cbe7cd95c4be5ce1c9958f2f208.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0027033 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/adf36e2d8fc05c3719c91912481c4e19.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026432 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/enable-users.asciidoc:50
[source, python]
----
resp = client.security.enable_user(
username="jacknich",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/adf728b0c11c5c309c730205609a379d.asciidoc 0000664 0000000 0000000 00000000624 15176617013 0026340 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:532
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"set": {
"description": "Set dynamic '' field to 'code' value",
"field": "{{{service}}}",
"value": "{{{code}}}"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ae0d20c2ebb59278e08a26c9634d90c9.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026511 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:290
[source, python]
----
resp = client.snapshot.create(
repository="my_repository",
snapshot="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ae3473adaf1515afcf7773f26c018e5c.asciidoc 0000664 0000000 0000000 00000000551 15176617013 0026650 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ae398a6b6494e7982ef2549fc2cd2d8e.asciidoc 0000664 0000000 0000000 00000002306 15176617013 0026627 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:353
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"full_name": {
"path_match": [
"name.*",
"user.name.*"
],
"path_unmatch": [
"*.middle",
"*.midinitial"
],
"mapping": {
"type": "text",
"copy_to": "full_name"
}
}
}
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"name": {
"first": "John",
"middle": "Winston",
"last": "Lennon"
}
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"user": {
"name": {
"first": "Jane",
"midinitial": "M",
"last": "Salazar"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ae4aa368617637a390074535df86e64b.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026300 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/common/apis/set-upgrade-mode.asciidoc:80
[source, python]
----
resp = client.ml.set_upgrade_mode(
enabled=True,
timeout="10m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ae591d49e54b838c15cdcf64a8dee9c2.asciidoc 0000664 0000000 0000000 00000000654 15176617013 0026757 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:222
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_docs": 10000000
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ae82eb17c23cb8e5761cb6240a5ed0a6.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0026630 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/put-dfanalytics.asciidoc:793
[source, python]
----
resp = client.ml.put_data_frame_analytics(
id="student_performance_mathematics_0.3",
source={
"index": "student_performance_mathematics"
},
dest={
"index": "student_performance_mathematics_reg"
},
analysis={
"regression": {
"dependent_variable": "G3",
"training_percent": 70,
"randomize_seed": 19673948271
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ae9ccfaa146731ab9176df90670db1c2.asciidoc 0000664 0000000 0000000 00000001474 15176617013 0026650 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/bulk.asciidoc:509
[source, python]
----
resp = client.bulk(
operations=[
{
"index": {
"_index": "test",
"_id": "1"
}
},
{
"field1": "value1"
},
{
"delete": {
"_index": "test",
"_id": "2"
}
},
{
"create": {
"_index": "test",
"_id": "3"
}
},
{
"field1": "value3"
},
{
"update": {
"_id": "1",
"_index": "test"
}
},
{
"doc": {
"field2": "value2"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aeaa97939a05f5b2f3f2c43b771f35e3.asciidoc 0000664 0000000 0000000 00000000543 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:316
[source, python]
----
resp = client.termvectors(
index="my-index-000001",
id="1",
fields=[
"text",
"some_field_without_term_vectors"
],
offsets=True,
positions=True,
term_statistics=True,
field_statistics=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aebf9cc593fcf0d4ca08f8b61b67bf17.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-azure.asciidoc:206
[source, python]
----
resp = client.snapshot.create_repository(
name="my_backup",
repository={
"type": "azure",
"settings": {
"client": "secondary",
"container": "my_container",
"base_path": "snapshots_prefix"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aee26dd62fbb6d614a0798f3344c0598.asciidoc 0000664 0000000 0000000 00000002003 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/reverse-nested-aggregation.asciidoc:57
[source, python]
----
resp = client.search(
index="issues",
query={
"match_all": {}
},
aggs={
"comments": {
"nested": {
"path": "comments"
},
"aggs": {
"top_usernames": {
"terms": {
"field": "comments.username"
},
"aggs": {
"comment_to_issue": {
"reverse_nested": {},
"aggs": {
"top_tags_per_comment": {
"terms": {
"field": "tags"
}
}
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/aee4734ee63dbbbd12a21ee886f7a829.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0026741 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:548
[source, python]
----
resp = client.search(
sort=[
{
"_geo_distance": {
"pin.location": [
-70,
40
],
"order": "asc",
"unit": "km"
}
}
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af00a58d9171d32f6efe52d94e51e526.asciidoc 0000664 0000000 0000000 00000002320 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:992
[source, python]
----
resp = client.indices.create(
index="hindi_example",
settings={
"analysis": {
"filter": {
"hindi_stop": {
"type": "stop",
"stopwords": "_hindi_"
},
"hindi_keywords": {
"type": "keyword_marker",
"keywords": [
"उदाहरण"
]
},
"hindi_stemmer": {
"type": "stemmer",
"language": "hindi"
}
},
"analyzer": {
"rebuilt_hindi": {
"tokenizer": "standard",
"filter": [
"lowercase",
"decimal_digit",
"hindi_keywords",
"indic_normalization",
"hindi_normalization",
"hindi_stop",
"hindi_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af18f5c5fb2364ae23c6a14431820aba.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/enrich/get-enrich-policy.asciidoc:94
[source, python]
----
resp = client.enrich.get_policy(
name="my-policy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af44cc7fb0c435d4497c77baf904bf5e.asciidoc 0000664 0000000 0000000 00000000577 15176617013 0026752 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:103
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sales_over_time": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af517b6936fa41d124d68b107b2efdc3.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/delete-lifecycle.asciidoc:82
[source, python]
----
resp = client.ilm.delete_lifecycle(
name="my_policy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af607715d0693587dd12962266359a96.asciidoc 0000664 0000000 0000000 00000000553 15176617013 0026102 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-s3.asciidoc:232
[source, python]
----
resp = client.snapshot.create_repository(
name="my_s3_repository",
repository={
"type": "s3",
"settings": {
"bucket": "my-bucket",
"another_setting": "setting-value"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af746266a49a693ff6170c88da8a8c04.asciidoc 0000664 0000000 0000000 00000001472 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stop-tokenfilter.asciidoc:210
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"default": {
"tokenizer": "whitespace",
"filter": [
"my_custom_stop_words_filter"
]
}
},
"filter": {
"my_custom_stop_words_filter": {
"type": "stop",
"ignore_case": True,
"stopwords": [
"and",
"is",
"the"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af7c5add165b005aefb552d79130fed6.asciidoc 0000664 0000000 0000000 00000000456 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-grid-query.asciidoc:232
[source, python]
----
resp = client.search(
index="my_locations",
query={
"geo_grid": {
"location": {
"geotile": "6/32/22"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af84b3995564a7ca84360a526a4ac896.asciidoc 0000664 0000000 0000000 00000001224 15176617013 0026365 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/truncate-tokenfilter.asciidoc:128
[source, python]
----
resp = client.indices.create(
index="5_char_words_example",
settings={
"analysis": {
"analyzer": {
"lowercase_5_char": {
"tokenizer": "lowercase",
"filter": [
"5_char_trunc"
]
}
},
"filter": {
"5_char_trunc": {
"type": "truncate",
"length": 5
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af85ad2551d1cc6742c6521d71c889cc.asciidoc 0000664 0000000 0000000 00000000537 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/specify-analyzer.asciidoc:50
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"title": {
"type": "text",
"analyzer": "whitespace"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af91019991bee136df5460e2fd4ac72a.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/rollover-index.asciidoc:243
[source, python]
----
resp = client.indices.rollover(
alias="my-data-stream",
lazy=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/af970eb8b93cdea52209e1256eba9d8c.asciidoc 0000664 0000000 0000000 00000000267 15176617013 0026744 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shard-stores.asciidoc:130
[source, python]
----
resp = client.indices.shard_stores(
index="test1,test2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afa11ebb493ebbfd77acbbe50d2ce6db.asciidoc 0000664 0000000 0000000 00000002324 15176617013 0027352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:591
[source, python]
----
resp = client.search(
index="my-data-stream",
size=0,
aggs={
"tsid": {
"terms": {
"field": "_tsid"
},
"aggs": {
"over_time": {
"date_histogram": {
"field": "@timestamp",
"fixed_interval": "1d"
},
"aggs": {
"min": {
"min": {
"field": "kubernetes.container.memory.usage.bytes"
}
},
"max": {
"max": {
"field": "kubernetes.container.memory.usage.bytes"
}
},
"avg": {
"avg": {
"field": "kubernetes.container.memory.usage.bytes"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afa24b7d72c2d9f586023a49bd655ec7.asciidoc 0000664 0000000 0000000 00000002324 15176617013 0026601 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/use-elasticsearch-for-time-series-data.asciidoc:158
[source, python]
----
resp = client.async_search.submit(
index="my-data-stream",
runtime_mappings={
"source.ip": {
"type": "ip",
"script": "\n String sourceip=grok('%{IPORHOST:sourceip} .*').extract(doc[ \"message\" ].value)?.sourceip;\n if (sourceip != null) emit(sourceip);\n "
}
},
query={
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"gte": "now-2y/d",
"lt": "now/d"
}
}
},
{
"range": {
"source.ip": {
"gte": "192.0.2.0",
"lte": "192.0.2.255"
}
}
}
]
}
},
fields=[
"*"
],
source=False,
sort=[
{
"@timestamp": "desc"
},
{
"source.ip": "desc"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afadb6bb7d0fa5a4531708af1ea8f9f8.asciidoc 0000664 0000000 0000000 00000000423 15176617013 0027067 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-with-existing-indices.asciidoc:159
[source, python]
----
resp = client.reindex(
source={
"index": "mylogs-*"
},
dest={
"index": "mylogs",
"op_type": "create"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afbea723c4ba0d50c67d04ebb73a4101.asciidoc 0000664 0000000 0000000 00000000322 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search-application/apis/delete-search-application.asciidoc:75
[source, python]
----
resp = client.search_application.delete(
name="my-app",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afc0a9cffc0100797a3f093094394763.asciidoc 0000664 0000000 0000000 00000001604 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/saml-invalidate-api.asciidoc:88
[source, python]
----
resp = client.security.saml_invalidate(
query_string="SAMLRequest=nZFda4MwFIb%2FiuS%2BmviRpqFaClKQdbvo2g12M2KMraCJ9cRR9utnW4Wyi13sMie873MeznJ1aWrnS3VQGR0j4mLkKC1NUeljjA77zYyhVbIE0dR%2By7fmaHq7U%2BdegXWGpAZ%2B%2F4pR32luBFTAtWgUcCv56%2Fp5y30X87Yz1khTIycdgpUW9kY7WdsC9zxoXTvMvWuVV98YyMnSGH2SYE5pwALBIr9QKiwDGpW0oGVUznGeMyJZKFkQ4jBf5HnhUymjIhzCAL3KNFihbYx8TBYzzGaY7EnIyZwHzCWMfiDnbRIftkSjJr%2BFu0e9v%2B0EgOquRiiZjKpiVFp6j50T4WXoyNJ%2FEWC9fdqc1t%2F1%2B2F3aUpjzhPiXpqMz1%2FHSn4A&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=MsAYz2NFdovMG2mXf6TSpu5vlQQyEJAg%2B4KCwBqJTmrb3yGXKUtIgvjqf88eCAK32v3eN8vupjPC8LglYmke1ZnjK0%2FKxzkvSjTVA7mMQe2AQdKbkyC038zzRq%2FYHcjFDE%2Bz0qISwSHZY2NyLePmwU7SexEXnIz37jKC6NMEhus%3D",
realm="saml1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afcacd742d18bf220e02f0bc6891526d.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026635 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/autodatehistogram-aggregation.asciidoc:270
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sale_date": {
"auto_date_histogram": {
"field": "date",
"buckets": 10,
"minimum_interval": "minute"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afd90d268187f995dc002abc189f818d.asciidoc 0000664 0000000 0000000 00000001233 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:345
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d",
"format": "yyyy-MM-dd"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afdb19ad1ebb4f64e235528b640817b6.asciidoc 0000664 0000000 0000000 00000000573 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:793
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"drop": {
"description": "Drop documents with 'network.name' of 'Guest'",
"if": "ctx?.network?.name == 'Guest'"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afe30f159937b38d74c869570cfcd369.asciidoc 0000664 0000000 0000000 00000000543 15176617013 0026466 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/restore-snapshot-api.asciidoc:274
[source, python]
----
resp = client.indices.close(
index="index_1",
)
print(resp)
resp1 = client.snapshot.restore(
repository="my_repository",
snapshot="snapshot_2",
wait_for_completion=True,
indices="index_1",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/afe5aeb9317f0ae470b28e85a8d98274.asciidoc 0000664 0000000 0000000 00000001371 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/null-value.asciidoc:12
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"status_code": {
"type": "keyword",
"null_value": "NULL"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"status_code": None
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"status_code": []
},
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
query={
"term": {
"status_code": "NULL"
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/afe87a2850326e0328fbebbefec2e839.asciidoc 0000664 0000000 0000000 00000000313 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-shards.asciidoc:177
[source, python]
----
resp = client.search_shards(
index="my-index-000001",
routing="foo,bar",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/afef5cac988592b97ae289ab39c2f437.asciidoc 0000664 0000000 0000000 00000000702 15176617013 0026702 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/text.asciidoc:307
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_field": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/affc7ff234dc3acccb2bf7dc51f54813.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0027144 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/charfilters/htmlstrip-charfilter.asciidoc:21
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
char_filter=[
"html_strip"
],
text="I'm so happy!
",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b00ac39faf96785e89be8d4205fb984d.asciidoc 0000664 0000000 0000000 00000001175 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:572
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
params={
"text": True,
"size": 5,
"query_string": "mountain climbing",
"text_fields": [
{
"name": "title",
"boost": 10
},
{
"name": "description",
"boost": 5
},
{
"name": "state",
"boost": 1
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b00d74eed431a272c829c0f798e3a539.asciidoc 0000664 0000000 0000000 00000003137 15176617013 0026441 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:89
[source, python]
----
resp = client.indices.create(
index="test",
mappings={
"properties": {
"d": {
"type": "date"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="test",
refresh=True,
operations=[
{
"index": {}
},
{
"s": 1,
"m": 3.1415,
"i": 1,
"d": "2020-01-01T00:12:12Z",
"t": "cat"
},
{
"index": {}
},
{
"s": 2,
"m": 1,
"i": 6,
"d": "2020-01-02T00:12:12Z",
"t": "dog"
},
{
"index": {}
},
{
"s": 3,
"m": 2.71828,
"i": -12,
"d": "2019-12-31T00:12:12Z",
"t": "chicken"
}
],
)
print(resp1)
resp2 = client.search(
index="test",
filter_path="aggregations",
aggs={
"tm": {
"top_metrics": {
"metrics": [
{
"field": "m"
},
{
"field": "i"
},
{
"field": "d"
},
{
"field": "t.keyword"
}
],
"sort": {
"s": "desc"
}
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b00f3bc0e47905aaa2124d6a025c75d4.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:21
[source, python]
----
resp = client.sql.query(
format="txt",
query="SELECT * FROM library ORDER BY page_count DESC LIMIT 5",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b02e4907c9936c1adc16ccce9d49900d.asciidoc 0000664 0000000 0000000 00000000221 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/health.asciidoc:165
[source, python]
----
resp = client.cluster.health()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b09f155602f9b2a6c40fe7c4a5436b7a.asciidoc 0000664 0000000 0000000 00000001420 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:151
[source, python]
----
resp = client.search(
runtime_mappings={
"day_of_week": {
"type": "keyword",
"script": "\n emit(doc['timestamp'].value.dayOfWeekEnum\n .getDisplayName(TextStyle.FULL, Locale.ENGLISH))\n "
}
},
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"dow": {
"terms": {
"field": "day_of_week"
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b0b1ae9582599f501f3b3ed8a42ea2af.asciidoc 0000664 0000000 0000000 00000000527 15176617013 0026650 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/circle.asciidoc:66
[source, python]
----
resp = client.index(
index="circles",
id="1",
pipeline="polygonize_circles",
document={
"circle": "CIRCLE (30 10 40)"
},
)
print(resp)
resp1 = client.get(
index="circles",
id="1",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b0bddf2ffaa83049b195829c06b875cd.asciidoc 0000664 0000000 0000000 00000000345 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:187
[source, python]
----
resp = client.search_application.render_query(
name="my_search_application",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b0ce54ff4fec0b0c712506eb81e633f4.asciidoc 0000664 0000000 0000000 00000001157 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/date-index-name.asciidoc:78
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"description": "monthly date-time index naming",
"processors": [
{
"date_index_name": {
"field": "date1",
"index_name_prefix": "my-index-",
"date_rounding": "M"
}
}
]
},
docs=[
{
"_source": {
"date1": "2016-04-25T12:02:01.789Z"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b0d3f839237fabf8cdc2221734c668ad.asciidoc 0000664 0000000 0000000 00000001535 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/distance-feature-query.asciidoc:62
[source, python]
----
resp = client.index(
index="items",
id="1",
refresh=True,
document={
"name": "chocolate",
"production_date": "2018-02-01",
"location": [
-71.34,
41.12
]
},
)
print(resp)
resp1 = client.index(
index="items",
id="2",
refresh=True,
document={
"name": "chocolate",
"production_date": "2018-01-01",
"location": [
-71.3,
41.15
]
},
)
print(resp1)
resp2 = client.index(
index="items",
id="3",
refresh=True,
document={
"name": "chocolate",
"production_date": "2017-12-01",
"location": [
-71.3,
41.12
]
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b0eaf67e5cce24ef8889bf20951ccec1.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0027017 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:131
[source, python]
----
resp = client.search(
query={
"dis_max": {
"queries": [
{
"match": {
"subject": "brown fox"
}
},
{
"match": {
"message": "brown fox"
}
}
],
"tie_breaker": 0.3
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b0ee6f19875fe5bad8aab02d60e3532c.asciidoc 0000664 0000000 0000000 00000001067 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/geoip.asciidoc:85
[source, python]
----
resp = client.ingest.put_pipeline(
id="geoip",
description="Add ip geolocation info",
processors=[
{
"geoip": {
"field": "ip"
}
}
],
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="my_id",
pipeline="geoip",
document={
"ip": "89.160.20.128"
},
)
print(resp1)
resp2 = client.get(
index="my-index-000001",
id="my_id",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b0fa301cd3c6b9db128e34114f0c1e8f.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:111
[source, python]
----
resp = client.index(
index="test",
id="1",
document={
"counter": 1,
"tags": [
"red"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b0fe9a7c8e519995258786be4bef36c4.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026543 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-search-elser.asciidoc:170
[source, python]
----
resp = client.tasks.cancel(
task_id="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b109d0141ec8a0aed5d3805abc349a20.asciidoc 0000664 0000000 0000000 00000001442 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:438
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_movavg": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.linearWeightedAvg(values)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b11a0675e49df0709be693297ca73a2c.asciidoc 0000664 0000000 0000000 00000000256 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/info.asciidoc:199
[source, python]
----
resp = client.xpack.info(
categories="build,features",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b14122481ae1f158f1a9a1bfbc4a41b1.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/secure-settings.asciidoc:39
[source, python]
----
resp = client.nodes.reload_secure_settings(
secure_settings_password="keystore-password",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b16700002af3aa70639f3e88c733bf35.asciidoc 0000664 0000000 0000000 00000000371 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/point-in-time-api.asciidoc:101
[source, python]
----
resp = client.open_point_in_time(
index="my-index-000001",
keep_alive="1m",
allow_partial_search_results=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b17143780e9904bfc1e1c53436497fa1.asciidoc 0000664 0000000 0000000 00000000430 15176617013 0026270 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:574
[source, python]
----
resp = client.sql.query(
format="json",
wait_for_completion_timeout="2s",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b176e0d428726705298184ef39ad5cb2.asciidoc 0000664 0000000 0000000 00000000640 15176617013 0026303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:153
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping2",
roles=[
"user",
"admin"
],
enabled=True,
rules={
"field": {
"username": [
"esadmin01",
"esadmin02"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b195068563b1dc0f721f5f8c8d172312.asciidoc 0000664 0000000 0000000 00000000371 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:299
[source, python]
----
resp = client.index(
index="example",
document={
"location": "MULTIPOINT (1002.0 2000.0, 1003.0 2000.0)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b1e81b70b874a1f0cf75a0ec6e430ddc.asciidoc 0000664 0000000 0000000 00000000367 15176617013 0026721 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/b1ee1b0b5f7af596e5f81743cfd3755f.asciidoc 0000664 0000000 0000000 00000000344 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/rollover-index.asciidoc:375
[source, python]
----
resp = client.search(
index=",,",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b1efa1c51a34dd5ab5511b71a399f5b1.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:456
[source, python]
----
resp = client.reindex(
source={
"index": "source"
},
dest={
"index": "dest",
"pipeline": "some_ingest_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b1f7cb4157b13368373383abd7d2b8cb.asciidoc 0000664 0000000 0000000 00000001014 15176617013 0026500 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/remote-clusters-connect.asciidoc:168
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"cluster_two": {
"transport.compress": False
},
"cluster_three": {
"transport.compress": True,
"transport.ping_schedule": "60s"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b22559a7c319f90bc63a41cac1c39b4c.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-api-keys.asciidoc:162
[source, python]
----
resp = client.security.invalidate_api_key(
ids=[
"VuaCfGcBCdbkQm-e5aOx"
],
owner=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b23ed357dce8ec0014708b7b2850a8fb.asciidoc 0000664 0000000 0000000 00000000223 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/tasks.asciidoc:84
[source, python]
----
resp = client.cat.tasks(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b2440b492149b705ef107137fdccb0c2.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/get-follow-info.asciidoc:34
[source, python]
----
resp = client.ccr.follow_info(
index="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b24a374c0ad264abbcacb5686f5ed61c.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026766 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc:246
[source, python]
----
resp = client.termvectors(
index="text_payloads",
id="1",
fields=[
"text"
],
payloads=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b25256ed615cd837461b0bfa590526b7.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0026347 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/pause-auto-follow-pattern.asciidoc:85
[source, python]
----
resp = client.ccr.pause_auto_follow_pattern(
name="my_auto_follow_pattern",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b2652b1763a5fd31e95c983869b433bd.asciidoc 0000664 0000000 0000000 00000002305 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/avg-aggregation.asciidoc:118
[source, python]
----
resp = client.index(
index="metrics_index",
id="1",
document={
"network.name": "net-1",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
3,
7,
23,
12,
6
]
}
},
)
print(resp)
resp1 = client.index(
index="metrics_index",
id="2",
document={
"network.name": "net-2",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
8,
17,
8,
7,
6
]
}
},
)
print(resp1)
resp2 = client.search(
index="metrics_index",
size="0",
aggs={
"avg_latency": {
"avg": {
"field": "latency_histo"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b2b26f8568c5dba7649e79f09b859272.asciidoc 0000664 0000000 0000000 00000000435 15176617013 0026412 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/saml-guide.asciidoc:944
[source, python]
----
resp = client.security.put_user(
username="saml-service-user",
password="",
roles=[
"saml-service-role"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b2dec193082462c775169db438308bc3.asciidoc 0000664 0000000 0000000 00000000723 15176617013 0026274 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:46
[source, python]
----
resp = client.security.put_role(
name="remote-replication",
cluster=[
"read_ccr"
],
indices=[
{
"names": [
"leader-index-name"
],
"privileges": [
"monitor",
"read"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b2e1e802fc3c5fbeb4190af7d598c23e.asciidoc 0000664 0000000 0000000 00000000524 15176617013 0026731 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/index_.asciidoc:277
[source, python]
----
resp = client.index(
index="my-index-000001",
document={
"@timestamp": "2099-11-15T13:12:00",
"message": "GET /search HTTP/1.1 200 1070000",
"user": {
"id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b2e20bca1846d7d584626b12eae9f6dc.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/disk/increase-other-node-capacity.asciidoc:80
[source, python]
----
resp = client.cat.nodes(
v=True,
h="name,node.role,disk.used_percent,disk.used,disk.avail,disk.total",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b2e4f3257c0e0aa3311f7270034bbc42.asciidoc 0000664 0000000 0000000 00000000545 15176617013 0026375 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-management/migrate-index-allocation-filters.asciidoc:175
[source, python]
----
resp = client.indices.put_settings(
index="my-index",
settings={
"index.routing.allocation.require.data": None,
"index.routing.allocation.include._tier_preference": "data_hot"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b3479ee4586c15020549afae58d94d65.asciidoc 0000664 0000000 0000000 00000001370 15176617013 0026373 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-point.asciidoc:225
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"point": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"point": [
{
"lat": -90,
"lon": -80
},
{
"lat": 10,
"lon": 30
}
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b3623b8c7f3e7650f52b6fb8b050f583.asciidoc 0000664 0000000 0000000 00000000250 15176617013 0026434 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:405
[source, python]
----
resp = client.features.get_features()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b3685560cb328f179d96ffe7c2668f72.asciidoc 0000664 0000000 0000000 00000001520 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:611
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_movavg": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "if (values.length > 5*2) {MovingFunctions.holtWinters(values, 0.3, 0.1, 0.1, 5, false)}"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b3756e700d0f6c7e8919003bdf26bc8f.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-unbalanced-cluster.asciidoc:76
[source, python]
----
resp = client.perform_request(
"DELETE",
"/_internal/desired_balance",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b37919cc438b47477343833b4e522408.asciidoc 0000664 0000000 0000000 00000001070 15176617013 0026062 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:424
[source, python]
----
resp = client.termvectors(
index="imdb",
doc={
"plot": "When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil."
},
term_statistics=True,
field_statistics=True,
positions=False,
offsets=False,
filter={
"max_num_terms": 3,
"min_term_freq": 1,
"min_doc_freq": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b3a1c4220617ded67ed43fff2051d324.asciidoc 0000664 0000000 0000000 00000000506 15176617013 0026473 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/eager-global-ordinals.asciidoc:51
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"tags": {
"type": "keyword",
"eager_global_ordinals": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b3a711c3deddcdb8a3f6623184a8b794.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0026645 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:124
[source, python]
----
resp = client.update(
index="test",
id="1",
script={
"source": "ctx._source.counter += params.count",
"lang": "painless",
"params": {
"count": 4
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b3cd07f02059165fd62a2f148be3dc58.asciidoc 0000664 0000000 0000000 00000001217 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/numeric.asciidoc:259
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"long": {
"type": "long"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"long": [
0,
0,
-123466,
87612
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b3ed567d2c0915a280b6b15f7a37539b.asciidoc 0000664 0000000 0000000 00000001505 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/percentiles-bucket-aggregation.asciidoc:43
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"percentiles_monthly_sales": {
"percentiles_bucket": {
"buckets_path": "sales_per_month>sales",
"percents": [
25,
50,
75
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b3f442a7d9eb391121dcab991787f9d6.asciidoc 0000664 0000000 0000000 00000001231 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/binary.asciidoc:68
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"binary": {
"type": "binary",
"doc_values": True
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"binary": [
"IAA=",
"EAA="
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b3fffd96fdb118cd059b5f1d67d928de.asciidoc 0000664 0000000 0000000 00000000721 15176617013 0027035 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:330
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "MultiPoint",
"coordinates": [
[
102,
2
],
[
103,
2
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b42e7d627cd79e4c5e7a4a3cd8b19ce0.asciidoc 0000664 0000000 0000000 00000002062 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:948
[source, python]
----
resp = client.ingest.put_pipeline(
id="one-pipeline-to-rule-them-all",
processors=[
{
"pipeline": {
"description": "If 'service.name' is 'apache_httpd', use 'httpd_pipeline'",
"if": "ctx.service?.name == 'apache_httpd'",
"name": "httpd_pipeline"
}
},
{
"pipeline": {
"description": "If 'service.name' is 'syslog', use 'syslog_pipeline'",
"if": "ctx.service?.name == 'syslog'",
"name": "syslog_pipeline"
}
},
{
"fail": {
"description": "If 'service.name' is not 'apache_httpd' or 'syslog', return a failure message",
"if": "ctx.service?.name != 'apache_httpd' && ctx.service?.name != 'syslog'",
"message": "This pipeline requires service.name to be either `syslog` or `apache_httpd`"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b430122345d560bbd2a77826f5c475f7.asciidoc 0000664 0000000 0000000 00000001570 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:272
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"ip_fields": {
"match": [
"ip_*",
"*_ip"
],
"unmatch": [
"one*",
"*two"
],
"mapping": {
"type": "ip"
}
}
}
]
},
)
print(resp)
resp1 = client.index(
index="my-index",
id="1",
document={
"one_ip": "will not match",
"ip_two": "will not match",
"three_ip": "12.12.12.12",
"ip_four": "13.13.13.13"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b45a8c6fc746e9c90fd181e69a605fad.asciidoc 0000664 0000000 0000000 00000000407 15176617013 0026672 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/post-inference.asciidoc:107
[source, python]
----
resp = client.inference.inference(
task_type="completion",
inference_id="openai_chat_completions",
input="What is Elastic?",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b45c60f908b329835ab40609423f378e.asciidoc 0000664 0000000 0000000 00000000311 15176617013 0026213 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/increase-tier-capacity.asciidoc:272
[source, python]
----
resp = client.cat.nodes(
h="node.role",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b4693f2aa9fa65db04ab2499355c54fc.asciidoc 0000664 0000000 0000000 00000001037 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:4
[source, python]
----
resp = client.search(
index="cohere-embeddings",
knn={
"field": "content_embedding",
"query_vector_builder": {
"text_embedding": {
"model_id": "cohere_embeddings",
"model_text": "Muscles in human body"
}
},
"k": 10,
"num_candidates": 100
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b47945c7db8868dd36ba079b742f2a90.asciidoc 0000664 0000000 0000000 00000000446 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search-application/apis/put-search-application.asciidoc:202
[source, python]
----
resp = client.search_application.search(
name="my-app",
params={
"default_field": "author",
"query_string": "Jane"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b4946ecc9101b97102a1c5bcb19e5607.asciidoc 0000664 0000000 0000000 00000000731 15176617013 0026420 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:534
[source, python]
----
resp = client.render_search_template(
source="{ \"query\": { \"bool\": { \"filter\": [ {{#year_scope}} { \"range\": { \"@timestamp\": { \"gte\": \"now-1y/d\", \"lt\": \"now/d\" } } }, {{/year_scope}} { \"term\": { \"user.id\": \"{{user_id}}\" }}]}}}",
params={
"year_scope": True,
"user_id": "kimchy"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b4aec2a1d353852507c091bdb629b765.asciidoc 0000664 0000000 0000000 00000000461 15176617013 0026421 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/put-filter.asciidoc:57
[source, python]
----
resp = client.ml.put_filter(
filter_id="safe_domains",
description="A list of safe domains",
items=[
"*.google.com",
"wikipedia.org"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b4d1fc887e40885cdf6ac2d01487cb76.asciidoc 0000664 0000000 0000000 00000000646 15176617013 0026613 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-multi-term-query.asciidoc:28
[source, python]
----
resp = client.search(
query={
"span_multi": {
"match": {
"prefix": {
"user.id": {
"value": "ki",
"boost": 1.08
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b4d9d5017d42f27281e734e969949623.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0026156 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/snapshot/corrupt-repository.asciidoc:140
[source, python]
----
resp = client.snapshot.get_repository(
name="my-repo",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b4da132cb934c33d61e2b60988c6d4a3.asciidoc 0000664 0000000 0000000 00000001352 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/serial-diff-aggregation.asciidoc:69
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "day"
},
"aggs": {
"the_sum": {
"sum": {
"field": "lemmings"
}
},
"thirtieth_difference": {
"serial_diff": {
"buckets_path": "the_sum",
"lag": 30
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b4f3165e873f551fbaa03945877eb370.asciidoc 0000664 0000000 0000000 00000000671 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/field-mapping.asciidoc:126
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_date_formats": [
"yyyy/MM",
"MM/dd/yyyy"
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"create_date": "09/25/2015"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b4f4c9ad3301c97fb3c38d108a3bc453.asciidoc 0000664 0000000 0000000 00000001642 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/remote-clusters-connect.asciidoc:125
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"cluster_one": {
"seeds": [
"127.0.0.1:{remote-interface-default-port}"
]
},
"cluster_two": {
"mode": "sniff",
"seeds": [
"127.0.0.1:{remote-interface-default-port-plus1}"
],
"transport.compress": True,
"skip_unavailable": True
},
"cluster_three": {
"mode": "proxy",
"proxy_address": "127.0.0.1:{remote-interface-default-port-plus2}"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b504119238b44cddd3b5944da20a498d.asciidoc 0000664 0000000 0000000 00000000452 15176617013 0026422 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:214
[source, python]
----
resp = client.index(
index="example",
document={
"location": "POLYGON ((1000.0 -1001.0, 1001.0 -1001.0, 1001.0 -1000.0, 1000.0 -1000.0, 1000.0 -1001.0))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b515427f8685ca7d79176def672d19fa.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:618
[source, python]
----
resp = client.indices.refresh()
print(resp)
resp1 = client.search(
index="my-index-000001",
size="0",
q="extra:test",
filter_path="hits.total",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b52951b78cd5fb2f9353d1c7e6d37070.asciidoc 0000664 0000000 0000000 00000000536 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/wildcard-query.asciidoc:21
[source, python]
----
resp = client.search(
query={
"wildcard": {
"user.id": {
"value": "ki*y",
"boost": 1,
"rewrite": "constant_score_blended"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b557f114e21dbc6f531d4e7621a08e8f.asciidoc 0000664 0000000 0000000 00000001674 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/source-field.asciidoc:80
[source, python]
----
resp = client.indices.create(
index="logs",
mappings={
"_source": {
"includes": [
"*.count",
"meta.*"
],
"excludes": [
"meta.description",
"meta.other.*"
]
}
},
)
print(resp)
resp1 = client.index(
index="logs",
id="1",
document={
"requests": {
"count": 10,
"foo": "bar"
},
"meta": {
"name": "Some metric",
"description": "Some metric description",
"other": {
"foo": "one",
"baz": "two"
}
}
},
)
print(resp1)
resp2 = client.search(
index="logs",
query={
"match": {
"meta.other.foo": "one"
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b573e893de0d5f92d67f4f5eb7f0c353.asciidoc 0000664 0000000 0000000 00000001273 15176617013 0026621 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/stats-bucket-aggregation.asciidoc:41
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"stats_monthly_sales": {
"stats_bucket": {
"buckets_path": "sales_per_month>sales"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b583bf8d3a2f49d633aa2cfed5606418.asciidoc 0000664 0000000 0000000 00000001126 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-component-template.asciidoc:196
[source, python]
----
resp = client.cluster.put_component_template(
name="template_1",
template={
"settings": {
"number_of_shards": 1
},
"aliases": {
"alias1": {},
"alias2": {
"filter": {
"term": {
"user.id": "kimchy"
}
},
"routing": "shard-1"
},
"{index}-alias": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b58b17975bbce307b2ccce5051a449e8.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:538
[source, python]
----
resp = client.search(
index="my-index-000001",
size="0",
filter_path="hits.total",
query={
"range": {
"http.response.bytes": {
"lt": 2000000
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b590241c4296299b836fbb5a95bdd2dc.asciidoc 0000664 0000000 0000000 00000000524 15176617013 0026521 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/b5bc1bb7278f2f95bc54790c78c928e0.asciidoc 0000664 0000000 0000000 00000001566 15176617013 0026541 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/get-job.asciidoc:170
[source, python]
----
resp = client.rollup.put_job(
id="sensor2",
index_pattern="sensor-*",
rollup_index="sensor_rollup",
cron="*/30 * * * * ?",
page_size=1000,
groups={
"date_histogram": {
"field": "timestamp",
"fixed_interval": "1h",
"delay": "7d"
},
"terms": {
"fields": [
"node"
]
}
},
metrics=[
{
"field": "temperature",
"metrics": [
"min",
"max",
"sum"
]
},
{
"field": "voltage",
"metrics": [
"avg"
]
}
],
)
print(resp)
resp1 = client.rollup.get_jobs(
id="_all",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b5e5cd4eccc40d7c5f2a1fcb654bd4a4.asciidoc 0000664 0000000 0000000 00000001426 15176617013 0027140 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/diversified-sampler-aggregation.asciidoc:33
[source, python]
----
resp = client.search(
index="stackoverflow",
size="0",
query={
"query_string": {
"query": "tags:elasticsearch"
}
},
aggs={
"my_unbiased_sample": {
"diversified_sampler": {
"shard_size": 200,
"field": "author"
},
"aggs": {
"keywords": {
"significant_terms": {
"field": "tags",
"exclude": [
"elasticsearch"
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b601bc78fb69e15a42e0783219ddc38d.asciidoc 0000664 0000000 0000000 00000001265 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/max-bucket-aggregation.asciidoc:42
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"max_monthly_sales": {
"max_bucket": {
"buckets_path": "sales_per_month>sales"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b607eea422295a3e9acd75f9ed1c8cb7.asciidoc 0000664 0000000 0000000 00000000547 15176617013 0026747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:372
[source, python]
----
resp = client.search(
sort=[
{
"price": {
"missing": "_last"
}
}
],
query={
"term": {
"product": "chocolate"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b61afb7ca29a11243232ffcc8b5a43cf.asciidoc 0000664 0000000 0000000 00000000323 15176617013 0026704 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-field-mapping.asciidoc:171
[source, python]
----
resp = client.indices.get_field_mapping(
index="publications",
fields="a*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b620ef4400d2f660fe2c67835938442c.asciidoc 0000664 0000000 0000000 00000000346 15176617013 0026277 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/delete-autoscaling-policy.asciidoc:68
[source, python]
----
resp = client.autoscaling.delete_autoscaling_policy(
name="my_autoscaling_policy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b62eaa20c4e0e48134a6d1d1b3c30b26.asciidoc 0000664 0000000 0000000 00000013200 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// text-structure/apis/find-field-structure.asciidoc:95
[source, python]
----
resp = client.bulk(
refresh=True,
operations=[
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:36,256][INFO ][o.a.l.u.VectorUtilPanamaProvider] [laptop] Java vector incubator API enabled; uses preferredBitSize=128"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,038][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-url]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,042][INFO ][o.e.p.PluginsService ] [laptop] loaded module [rest-root]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-core]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-redact]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,043][INFO ][o.e.p.PluginsService ] [laptop] loaded module [ingest-user-agent]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-monitoring]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [repository-s3]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-analytics]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-ent-search]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-autoscaling]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,044][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-painless]]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [lang-expression]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:41,059][INFO ][o.e.p.PluginsService ] [laptop] loaded module [x-pack-eql]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:43,291][INFO ][o.e.e.NodeEnvironment ] [laptop] heap size [16gb], compressed ordinary object pointers [true]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:46,098][INFO ][o.e.x.s.Security ] [laptop] Security is enabled"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:47,227][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] Profiling is enabled"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:47,259][INFO ][o.e.x.p.ProfilingPlugin ] [laptop] profiling index templates will not be installed or reinstalled"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[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]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:47,787][INFO ][o.e.d.DiscoveryModule ] [laptop] using discovery type [multi-node] and seed hosts providers [settings]"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:49,188][INFO ][o.e.n.Node ] [laptop] initialized"
},
{
"index": {
"_index": "test-logs"
}
},
{
"message": "[2024-03-05T10:52:49,199][INFO ][o.e.n.Node ] [laptop] starting ..."
}
],
)
print(resp)
resp1 = client.text_structure.find_field_structure(
index="test-logs",
field="message",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b638e11d6a8a084290f8934d224abd52.asciidoc 0000664 0000000 0000000 00000000420 15176617013 0026342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/troubleshooting-shards-capacity.asciidoc:450
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.max_shards_per_node.frozen": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b63ce79ce4fa1bb9b99a789f4dcfef4e.asciidoc 0000664 0000000 0000000 00000000402 15176617013 0027201 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:272
[source, python]
----
resp = client.indices.put_settings(
index="test",
settings={
"top_metrics_max_size": 100
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b65dbb51ddd496189c65a9326a53480c.asciidoc 0000664 0000000 0000000 00000000556 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-read-only-url.asciidoc:14
[source, python]
----
resp = client.snapshot.create_repository(
name="my_read_only_url_repository",
repository={
"type": "url",
"settings": {
"url": "file:/mount/backups/my_fs_backup_location"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b66be1daf6c220eb66d94e708b2fae39.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/state.asciidoc:150
[source, python]
----
resp = client.cluster.state(
metric="metadata,routing_table",
index="foo,bar",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b67fa8c560dd10a8e6f226048cd21562.asciidoc 0000664 0000000 0000000 00000001044 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:472
[source, python]
----
resp = client.render_search_template(
source="{ \"query\": { \"bool\": { \"must\": {{#toJson}}clauses{{/toJson}} }}}",
params={
"clauses": [
{
"term": {
"user.id": "kimchy"
}
},
{
"term": {
"url.domain": "example.com"
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b68ed7037042719945a2452d23e64c78.asciidoc 0000664 0000000 0000000 00000000516 15176617013 0026146 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:343
[source, python]
----
resp = client.index(
index="my-index-000001",
id="3",
refresh=True,
document={
"query": {
"match": {
"message": "brown fox"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b691d41f84b5b46e9051b51db22a46af.asciidoc 0000664 0000000 0000000 00000000724 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/rare-terms-aggregation.asciidoc:308
[source, python]
----
resp = client.search(
aggs={
"genres": {
"rare_terms": {
"field": "genre",
"include": [
"swing",
"rock"
],
"exclude": [
"jazz"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b6a6aa9ba20e9a019371ae268488833f.asciidoc 0000664 0000000 0000000 00000000337 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/cluster/remote-clusters-migration.asciidoc:97
[source, python]
----
resp = client.cluster.get_settings(
filter_path="persistent.cluster.remote",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b6a7ffd2003c38f4aa321f067d162be5.asciidoc 0000664 0000000 0000000 00000001434 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-search-elser.asciidoc:260
[source, python]
----
resp = client.search(
index="my-index",
query={
"bool": {
"should": [
{
"sparse_vector": {
"field": "content_embedding",
"inference_id": "my-elser-endpoint",
"query": "How to avoid muscle soreness after running?",
"boost": 1
}
},
{
"query_string": {
"query": "toxins",
"boost": 4
}
}
]
}
},
min_score=10,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b6c872d04eabb39d1947cde6b29d4ae1.asciidoc 0000664 0000000 0000000 00000000471 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:419
[source, python]
----
resp = client.search(
aggs={
"tags": {
"terms": {
"field": "tags",
"min_doc_count": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b6d278737d27973e498ac61cda9e5126.asciidoc 0000664 0000000 0000000 00000000714 15176617013 0026402 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/b6e29a0e14b611d4aaafb3051220ea56.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/specify-analyzer.asciidoc:158
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"title": {
"type": "text",
"analyzer": "whitespace",
"search_analyzer": "simple"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b6e385760e036e36827f719b540d9c11.asciidoc 0000664 0000000 0000000 00000000564 15176617013 0026231 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/profile.asciidoc:1186
[source, python]
----
resp = client.search(
index="my-dfs-index",
search_type="dfs_query_then_fetch",
pretty=True,
size="0",
profile=True,
query={
"term": {
"my-keyword": {
"value": "a"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b6f690896001f8f9ad5bf24e1304a552.asciidoc 0000664 0000000 0000000 00000000743 15176617013 0026361 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:162
[source, python]
----
resp = client.indices.create(
index="my-byte-quantized-index",
mappings={
"properties": {
"my_vector": {
"type": "dense_vector",
"dims": 4,
"index": True,
"index_options": {
"type": "int4_hnsw"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b717a583b5165e5c6caafc42fdfd9086.asciidoc 0000664 0000000 0000000 00000003526 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cartesian-bounds-aggregation.asciidoc:97
[source, python]
----
resp = client.indices.create(
index="places",
mappings={
"properties": {
"geometry": {
"type": "shape"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="places",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"name": "NEMO Science Museum",
"geometry": "POINT(491.2350 5237.4081)"
},
{
"index": {
"_id": 2
}
},
{
"name": "Sportpark De Weeren",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
496.5305328369141,
5239.347642069457
],
[
496.6979026794433,
5239.172175893484
],
[
496.9425201416015,
5239.238958618537
],
[
496.7944622039794,
5239.420969150824
],
[
496.5305328369141,
5239.347642069457
]
]
]
}
}
],
)
print(resp1)
resp2 = client.search(
index="places",
size="0",
aggs={
"viewport": {
"cartesian_bounds": {
"field": "geometry"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b724f547c5d67e95bbc0a9920e47033c.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0026437 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pathhierarchy-tokenizer.asciidoc:289
[source, python]
----
resp = client.search(
index="file-path-test",
query={
"term": {
"file_path.tree": "/User/alice/photos/2017/05/16"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b728d6ba226dba719aadcd8b8099cc74.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:177
[source, python]
----
resp = client.cat.allocation(
v=True,
h="node,shards,disk.*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b7a4f5b9a93eff44268a1ee38ee1c6d3.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026745 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:199
[source, python]
----
resp = client.reindex(
source={
"index": "archive"
},
dest={
"index": "my-data-stream",
"op_type": "create"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b7a9f60b3646efe3834ca8381f8aa560.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/logging-config.asciidoc:193
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"logger.org.elasticsearch.discovery": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b7ad394975863a8f5ee29627c3ab738b.asciidoc 0000664 0000000 0000000 00000000577 15176617013 0026473 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/histogram-aggregation.asciidoc:248
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"prices": {
"histogram": {
"field": "price",
"interval": 50,
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b7bb5503e64bd869b2ac1c46c434a079.asciidoc 0000664 0000000 0000000 00000001117 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:226
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"histo": {
"histogram": {
"field": "price",
"interval": 5
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b7c99eb38d4b37e22de1ffcb0e88ae4c.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:279
[source, python]
----
resp = client.index(
index="my-index-000001",
id="2",
document={
"message": "A new bonsai tree in the office"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b7df0848b2dc3093f931976db5b8cfff.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026676 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:38
[source, python]
----
resp = client.cluster.health(
filter_path="status,*_shards",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b7f8bd33c22f3c93336ab57c2e091f73.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-rules/apis/delete-query-rule.asciidoc:78
[source, python]
----
resp = client.query_rules.delete_rule(
ruleset_id="my-ruleset",
rule_id="my-rule1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b80e1f5b26bae4f3c2f8a604b7caaf17.asciidoc 0000664 0000000 0000000 00000001061 15176617013 0026773 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:290
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping7",
roles=[
"ldap-example-user"
],
enabled=True,
rules={
"all": [
{
"field": {
"dn": "*,ou=subtree,dc=example,dc=com"
}
},
{
"field": {
"realm.name": "ldap1"
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b81a7b5f5ef19553f9cd49196f31018c.asciidoc 0000664 0000000 0000000 00000000720 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/distance-feature-query.asciidoc:37
[source, python]
----
resp = client.indices.create(
index="items",
mappings={
"properties": {
"name": {
"type": "keyword"
},
"production_date": {
"type": "date"
},
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b82b156c7b9d1d78054577a6947a6cdd.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/geo-grid.asciidoc:91
[source, python]
----
resp = client.index(
index="geocells",
id="1",
pipeline="geotile2shape",
document={
"geocell": "4/8/5"
},
)
print(resp)
resp1 = client.get(
index="geocells",
id="1",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b839f79a5d58506baed5714f1876ab55.asciidoc 0000664 0000000 0000000 00000000363 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql-search-api.asciidoc:30
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n process where process.name == \"regsvr32.exe\"\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b8400dbe39215705060500f0e569f452.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026114 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/b84932030e60a2cd58884b9dc6d3147f.asciidoc 0000664 0000000 0000000 00000000337 15176617013 0026362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:644
[source, python]
----
resp = client.search_application.search(
name="my_search_application",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b85716ba42a57096452665c38995da7d.asciidoc 0000664 0000000 0000000 00000000626 15176617013 0026240 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/preview-dfanalytics.asciidoc:75
[source, python]
----
resp = client.ml.preview_data_frame_analytics(
config={
"source": {
"index": "houses_sold_last_10_yrs"
},
"analysis": {
"regression": {
"dependent_variable": "price"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b857abedc64e367def172bd07075e5c7.asciidoc 0000664 0000000 0000000 00000001163 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/fingerprint-analyzer.asciidoc:89
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_fingerprint_analyzer": {
"type": "fingerprint",
"stopwords": "_english_"
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_fingerprint_analyzer",
text="Yes yes, Gödel said this sentence is consistent and.",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/b87438263ccd68624b1d69d8750f9432.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0026243 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/doc-values.asciidoc:37
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"status_code": {
"type": "long"
},
"session_id": {
"type": "long",
"index": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b87bc8a521995051c7e7395f9c047e1c.asciidoc 0000664 0000000 0000000 00000001402 15176617013 0026367 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/ignore-malformed.asciidoc:16
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"number_one": {
"type": "integer",
"ignore_malformed": True
},
"number_two": {
"type": "integer"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"text": "Some text value",
"number_one": "foo"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"text": "Some text value",
"number_two": "foo"
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b88a2d96da1401d548a4540cca223d27.asciidoc 0000664 0000000 0000000 00000001344 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-vector-tile-api.asciidoc:707
[source, python]
----
resp = client.search_mvt(
index="museums",
field="location",
zoom="13",
x="4207",
y="2692",
grid_agg="geotile",
grid_precision=2,
fields=[
"name",
"price"
],
query={
"term": {
"included": True
}
},
aggs={
"min_price": {
"min": {
"field": "price"
}
},
"max_price": {
"max": {
"field": "price"
}
},
"avg_price": {
"avg": {
"field": "price"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b8c03bbd917d0cf5474a3e46ebdd7aad.asciidoc 0000664 0000000 0000000 00000000447 15176617013 0027067 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc:22
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"cjk_bigram"
],
text="東京都は、日本の首都であり",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b8cc74a92bac837bfd8ba6d5935350ed.asciidoc 0000664 0000000 0000000 00000001355 15176617013 0026744 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:317
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"enabled": False
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"user_id": "kimchy",
"session_data": {
"object": {
"some_field": "some_value"
}
}
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
fields=[
"user_id",
{
"field": "session_data.object.*",
"include_unmapped": True
}
],
source=False,
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b8dc3764c4467922474b2cdec74bb86b.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:445
[source, python]
----
resp = client.transform.start_transform(
transform_id="last-log-from-clientip",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b8e6e320a19936f6edfc242ccb5cde43.asciidoc 0000664 0000000 0000000 00000001346 15176617013 0026737 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/position-increment-gap.asciidoc:15
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"names": [
"John Abraham",
"Lincoln Smith"
]
},
)
print(resp)
resp1 = client.search(
index="my-index-000001",
query={
"match_phrase": {
"names": {
"query": "Abraham Lincoln"
}
}
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"match_phrase": {
"names": {
"query": "Abraham Lincoln",
"slop": 101
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/b9370fa1aa18fe4bc00cf81ef0c0d45b.asciidoc 0000664 0000000 0000000 00000000474 15176617013 0026771 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:318
[source, python]
----
resp = client.search(
query={
"query_string": {
"fields": [
"city.*"
],
"query": "this AND that OR thus"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b94cee0f74f57742b3948f9b784dfdd4.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0026633 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:537
[source, python]
----
resp = client.clear_scroll(
scroll_id="DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==,DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b968853454b4416f7baa3209eb335957.asciidoc 0000664 0000000 0000000 00000001021 15176617013 0026220 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cartesian-centroid-aggregation.asciidoc:79
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggs={
"cities": {
"terms": {
"field": "city.keyword"
},
"aggs": {
"centroid": {
"cartesian_centroid": {
"field": "location"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b96f465abb658fe32889c3d183f159a3.asciidoc 0000664 0000000 0000000 00000000762 15176617013 0026464 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/limit-token-count-tokenfilter.asciidoc:96
[source, python]
----
resp = client.indices.create(
index="limit_example",
settings={
"analysis": {
"analyzer": {
"standard_one_token_limit": {
"tokenizer": "standard",
"filter": [
"limit"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b9a8f39ab9b1ed18c6c1db61ac4e6a9e.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0027071 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:317
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="_current",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/b9ba66209b7fcc111a7bcef0b3e00052.asciidoc 0000664 0000000 0000000 00000000441 15176617013 0026616 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/b9f716219359a6c973dafc50b348de33.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/source-field.asciidoc:24
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"_source": {
"enabled": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ba07330ed3291b3970f4eb01dacd8086.asciidoc 0000664 0000000 0000000 00000004264 15176617013 0026500 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geodistance-aggregation.asciidoc:10
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"location": "POINT (4.912350 52.374081)",
"name": "NEMO Science Museum"
},
{
"index": {
"_id": 2
}
},
{
"location": "POINT (4.901618 52.369219)",
"name": "Museum Het Rembrandthuis"
},
{
"index": {
"_id": 3
}
},
{
"location": "POINT (4.914722 52.371667)",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {
"_id": 4
}
},
{
"location": "POINT (4.405200 51.222900)",
"name": "Letterenhuis"
},
{
"index": {
"_id": 5
}
},
{
"location": "POINT (2.336389 48.861111)",
"name": "Musée du Louvre"
},
{
"index": {
"_id": 6
}
},
{
"location": "POINT (2.327000 48.860000)",
"name": "Musée d'Orsay"
}
],
)
print(resp1)
resp2 = client.search(
index="museums",
size="0",
aggs={
"rings_around_amsterdam": {
"geo_distance": {
"field": "location",
"origin": "POINT (4.894 52.3760)",
"ranges": [
{
"to": 100000
},
{
"from": 100000,
"to": 300000
},
{
"from": 300000
}
]
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ba0e7e0b18fc9ec6c623d40186d1f61b.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026636 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// 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)
----
python-elasticsearch-9.4.0/docs/examples/ba10b644a4e9a2e7d78744ca607355d0.asciidoc 0000664 0000000 0000000 00000000546 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/put-follow.asciidoc:91
[source, python]
----
resp = client.ccr.follow(
index=".ds-logs-mysql-default_copy-2022-01-01-000001",
remote_cluster="remote_cluster",
leader_index=".ds-logs-mysql-default-2022-01-01-000001",
data_stream_name="logs-mysql-default_copy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ba21a7fbb74180ff138d97032f28ace7.asciidoc 0000664 0000000 0000000 00000000571 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-user-profile-data.asciidoc:106
[source, python]
----
resp = client.security.update_user_profile_data(
uid="u_P_0BMHgaOK3p7k-PFWUCbw9dQ-UFjt01oWJ_Dp2PmPc_0",
labels={
"direction": "east"
},
data={
"app1": {
"theme": "default"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ba3b9783aa188c6841e1926c5ab1472d.asciidoc 0000664 0000000 0000000 00000000506 15176617013 0026432 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:101
[source, python]
----
resp = client.search_application.put(
name="my_search_application",
search_application={
"indices": [
"index1",
"index2"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ba5dc6fb9bbe1406714da5d641462a23.asciidoc 0000664 0000000 0000000 00000000775 15176617013 0026563 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:96
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"strings_as_ip": {
"match_mapping_type": "string",
"match": "ip*",
"runtime": {
"type": "ip"
}
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ba6040de55afb2c8fb9e5b24bb038820.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-index-template-v1.asciidoc:94
[source, python]
----
resp = client.indices.get_template(
name="temp*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ba650046f9063f6c43d76f47e0f94403.asciidoc 0000664 0000000 0000000 00000001216 15176617013 0026300 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/date.asciidoc:244
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"date": {
"type": "date"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"date": [
"2015-01-01T12:10:30Z",
"2014-01-01T12:10:30Z"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/ba66768ed04f7b87906badff40ff40ed.asciidoc 0000664 0000000 0000000 00000000652 15176617013 0026752 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:153
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50gb"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ba8c3578613ae0bf890f6a05706ce776.asciidoc 0000664 0000000 0000000 00000000655 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1024
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
filter_path="-hits.events._source",
query="\n process where process.name == \"regsvr32.exe\"\n ",
fields=[
"event.type",
"process.*",
{
"field": "@timestamp",
"format": "epoch_millis"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ba9a5f66a6148612de0ad2491fd6c90d.asciidoc 0000664 0000000 0000000 00000001344 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/classic-tokenizer.asciidoc:148
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "classic",
"max_token_length": 5
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/baadbfffcd0c16f51eb3537f516dc3ed.asciidoc 0000664 0000000 0000000 00000000363 15176617013 0027222 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/disable-user-profile.asciidoc:65
[source, python]
----
resp = client.security.disable_user_profile(
uid="u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bab4c3b22c1768fcc7153345e4096dfb.asciidoc 0000664 0000000 0000000 00000000510 15176617013 0026557 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/remove-duplicates-tokenfilter.asciidoc:79
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"keyword_repeat",
"stemmer",
"remove_duplicates"
],
text="jumping dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bb067c049331cc850a77b18bdfff81b5.asciidoc 0000664 0000000 0000000 00000002162 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1311
[source, python]
----
resp = client.indices.create(
index="lithuanian_example",
settings={
"analysis": {
"filter": {
"lithuanian_stop": {
"type": "stop",
"stopwords": "_lithuanian_"
},
"lithuanian_keywords": {
"type": "keyword_marker",
"keywords": [
"pavyzdys"
]
},
"lithuanian_stemmer": {
"type": "stemmer",
"language": "lithuanian"
}
},
"analyzer": {
"rebuilt_lithuanian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"lithuanian_stop",
"lithuanian_keywords",
"lithuanian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bb28d1f7f3f09f5061d7f4351aee89fc.asciidoc 0000664 0000000 0000000 00000000751 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/field-level-security.asciidoc:96
[source, python]
----
resp = client.security.put_role(
name="test_role4",
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"customer.*"
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bb293e1bdf0c6f6d9069eeb7edc9d399.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0027032 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/disable-users.asciidoc:51
[source, python]
----
resp = client.security.disable_user(
username="jacknich",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bb2ba5d1885f87506f90dbb002e518f4.asciidoc 0000664 0000000 0000000 00000002430 15176617013 0026506 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bb5a67e3d2d9cd3016e487e627769fe8.asciidoc 0000664 0000000 0000000 00000006733 15176617013 0026552 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bb64a7228a479f6aeeaccaf7560e11ee.asciidoc 0000664 0000000 0000000 00000001371 15176617013 0027012 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:394
[source, python]
----
resp = client.transform.put_transform(
transform_id="last-log-from-clientip",
source={
"index": [
"kibana_sample_data_logs"
]
},
latest={
"unique_key": [
"clientip"
],
"sort": "timestamp"
},
frequency="1m",
dest={
"index": "last-log-from-clientip"
},
sync={
"time": {
"field": "timestamp",
"delay": "60s"
}
},
retention_policy={
"time": {
"field": "timestamp",
"max_age": "30d"
}
},
settings={
"max_page_search_size": 500
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bb792e64a4c1f872296073b457aa03c8.asciidoc 0000664 0000000 0000000 00000000352 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:366
[source, python]
----
resp = client.snapshot.delete(
repository="my_repository",
snapshot="my_snapshot_2099.05.06",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bb975b342de7e838ebf6a36aaa1a8749.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:477
[source, python]
----
resp = client.index(
index="my-index-000001",
id="3",
routing="1",
refresh=True,
document={
"text": "This is a vote",
"my_join_field": {
"name": "vote",
"parent": "2"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bb9e268ec62d19ca2a6366cbb48fae68.asciidoc 0000664 0000000 0000000 00000000223 15176617013 0026737 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/count.asciidoc:95
[source, python]
----
resp = client.cat.count(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bc01aee2ab2ce1690986374bd836e1c7.asciidoc 0000664 0000000 0000000 00000000621 15176617013 0026564 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bc4d308069af23929a49d856f6bc3008.asciidoc 0000664 0000000 0000000 00000001406 15176617013 0026362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geodistance-aggregation.asciidoc:122
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggs={
"rings": {
"geo_distance": {
"field": "location",
"origin": "POINT (4.894 52.3760)",
"unit": "km",
"distance_type": "plane",
"ranges": [
{
"to": 100
},
{
"from": 100,
"to": 300
},
{
"from": 300
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bcae0f00ae1e6f08fa395ca741fe84f9.asciidoc 0000664 0000000 0000000 00000000753 15176617013 0027015 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rank-eval.asciidoc:403
[source, python]
----
resp = client.rank_eval(
index="my-index-000001",
requests=[
{
"id": "JFK query",
"request": {
"query": {
"match_all": {}
}
},
"ratings": []
}
],
metric={
"dcg": {
"k": 20,
"normalize": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bcb572658986d69ae17c28ddd7e4bfd8.asciidoc 0000664 0000000 0000000 00000000305 15176617013 0026704 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/field-usage-stats.asciidoc:172
[source, python]
----
resp = client.indices.field_usage_stats(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bcbd4d4749126837723438ff4faeb0f6.asciidoc 0000664 0000000 0000000 00000000606 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:192
[source, python]
----
resp = client.search(
index="my-index-000001",
filter_path="aggregations",
size=0,
aggs={
"top_values": {
"terms": {
"field": "my-field",
"size": 10
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc 0000664 0000000 0000000 00000000251 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// quickstart/getting-started.asciidoc:419
[source, python]
----
resp = client.search(
index="books",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bccd4eb26b1a325d103b12e198a13c08.asciidoc 0000664 0000000 0000000 00000000373 15176617013 0026535 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bcd1afb793240b1dddd9fa5d3f21192b.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026770 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bcdfaa4487747249699a86a0dcd22f5e.asciidoc 0000664 0000000 0000000 00000001320 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/simulate-ingest.asciidoc:352
[source, python]
----
resp = client.simulate.ingest(
docs=[
{
"_index": "my-index",
"_id": "123",
"_source": {
"foo": "bar"
}
},
{
"_index": "my-index",
"_id": "456",
"_source": {
"foo": "rab"
}
}
],
pipeline_substitutions={
"my-pipeline": {
"processors": [
{
"uppercase": {
"field": "foo"
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd0d30a7683037e1ebadd163514765d4.asciidoc 0000664 0000000 0000000 00000001132 15176617013 0026412 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/configuring-active-directory-realm.asciidoc:192
[source, python]
----
resp = client.security.put_role_mapping(
name="basic_users",
roles=[
"user"
],
rules={
"any": [
{
"field": {
"groups": "cn=users,dc=example,dc=com"
}
},
{
"field": {
"dn": "cn=John Doe,cn=contractors,dc=example,dc=com"
}
}
]
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd1e55b8cb2ca9e496e223e717d76640.asciidoc 0000664 0000000 0000000 00000001124 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-polygon-query.asciidoc:93
[source, python]
----
resp = client.search(
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_polygon": {
"person.location": {
"points": [
"40, -70",
"30, -80",
"20, -90"
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd23c3a03907b1238dcb07ab9eecae7b.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026765 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:367
[source, python]
----
resp = client.update_by_query(
index="my-index-000001",
scroll_size="100",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd298b11933605c641626750c981d70b.asciidoc 0000664 0000000 0000000 00000001562 15176617013 0026136 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/simulate-multi-component-templates.asciidoc:50
[source, python]
----
resp = client.cluster.put_component_template(
name="ct1",
template={
"settings": {
"index.number_of_shards": 2
}
},
)
print(resp)
resp1 = client.cluster.put_component_template(
name="ct2",
template={
"settings": {
"index.number_of_replicas": 0
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
},
)
print(resp1)
resp2 = client.indices.simulate_template(
index_patterns=[
"my*"
],
template={
"settings": {
"index.number_of_shards": 3
}
},
composed_of=[
"ct1",
"ct2"
],
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/bd2a387e8c21bf01a1039e81d7602921.asciidoc 0000664 0000000 0000000 00000000754 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:788
[source, python]
----
resp = client.put_script(
id="my-search-template",
script={
"lang": "mustache",
"source": {
"query": {
"multi_match": {
"query": "{{query_string}}",
"fields": "[{{#text_fields}}{{user_name}},{{/text_fields}}]"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd3d710ec50a151453e141691163af72.asciidoc 0000664 0000000 0000000 00000000245 15176617013 0026245 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:276
[source, python]
----
resp = client.tasks.list(
group_by="parents",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd458073196a19ecdeb24a8016488c20.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/delete-index-template.asciidoc:32
[source, python]
----
resp = client.indices.delete_index_template(
name="my-index-template",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd57976bc93ca64b2d3e001df9f06c82.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/resolve.asciidoc:107
[source, python]
----
resp = client.indices.resolve_index(
name="f*,remoteCluster1:bar*",
expand_wildcards="all",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd5bd5d8b3d81241335fe1e5747080ac.asciidoc 0000664 0000000 0000000 00000000674 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/error-handling.asciidoc:122
[source, python]
----
resp = client.ilm.put_lifecycle(
name="shrink-index",
policy={
"phases": {
"warm": {
"min_age": "5d",
"actions": {
"shrink": {
"number_of_shards": 1
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd68666ca2e0be12f7624016317a62bc.asciidoc 0000664 0000000 0000000 00000000400 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-stats.asciidoc:2573
[source, python]
----
resp = client.nodes.stats(
groups="_all",
)
print(resp)
resp1 = client.nodes.stats(
metric="indices",
groups="foo,bar",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/bd6f30e3caa3632260da42d9ff82c98c.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-api-key-cache.asciidoc:63
[source, python]
----
resp = client.security.clear_api_key_cache(
ids="*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd7330af2609bdd8aa10958f5e640b93.asciidoc 0000664 0000000 0000000 00000000513 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:649
[source, python]
----
resp = client.index(
index="my_queries2",
id="2",
refresh=True,
document={
"query": {
"match": {
"my_field.suffix": "xyz"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd767ea03171fe71c73f58f16d5da92f.asciidoc 0000664 0000000 0000000 00000000447 15176617013 0026611 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pathhierarchy-tokenizer.asciidoc:273
[source, python]
----
resp = client.search(
index="file-path-test",
query={
"match": {
"file_path": "/User/bob/photos/2017/05"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd7a1417fc27b5a801334ec44462b376.asciidoc 0000664 0000000 0000000 00000000237 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/datafeeds.asciidoc:130
[source, python]
----
resp = client.cat.ml_datafeeds(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bd7fa2f122ab861cd00e0b9154d120b3.asciidoc 0000664 0000000 0000000 00000000706 15176617013 0026534 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/common-script-uses.asciidoc:29
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"@timestamp": {
"format": "strict_date_optional_time||epoch_second",
"type": "date"
},
"message": {
"type": "wildcard"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bdaf00d791706d7fde25fd65d3735b94.asciidoc 0000664 0000000 0000000 00000001226 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/keyword.asciidoc:184
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"kwd": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"kwd": [
"foo",
"foo",
"bar",
"baz"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/bdb30dd52d32f50994008f4f9c0da5f0.asciidoc 0000664 0000000 0000000 00000000356 15176617013 0026565 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:571
[source, python]
----
resp = client.update_by_query_rethrottle(
task_id="r1A2WoRbTwKZ516z6NEs5A:36619",
requests_per_second="-1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bdc1afd2181154bb78797360f9dbb1a0.asciidoc 0000664 0000000 0000000 00000000430 15176617013 0026555 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/ack-watch.asciidoc:140
[source, python]
----
resp = client.watcher.execute_watch(
id="my_watch",
record_execution=True,
)
print(resp)
resp1 = client.watcher.get_watch(
id="my_watch",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/bdc55256fa5f701680631a149dbb75a9.asciidoc 0000664 0000000 0000000 00000000704 15176617013 0026431 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bdc68012c121062628d6d73468bf4866.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026215 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/register-repository.asciidoc:215
[source, python]
----
resp = client.snapshot.cleanup_repository(
name="my_repository",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bdd28276618235487ac96bd6679bc206.asciidoc 0000664 0000000 0000000 00000001350 15176617013 0026311 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bde74dbbcef8ebf8541cae2c1711255f.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0027064 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search-application/apis/get-search-application.asciidoc:93
[source, python]
----
resp = client.search_application.get(
name="my-app",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bdfb86cdfffb9d2ee6e3d399f00a57b0.asciidoc 0000664 0000000 0000000 00000001737 15176617013 0027175 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/top-metrics-aggregation.asciidoc:499
[source, python]
----
resp = client.search(
index="test*",
filter_path="aggregations",
aggs={
"ip": {
"terms": {
"field": "ip"
},
"aggs": {
"tm": {
"top_metrics": {
"metrics": {
"field": "m"
},
"sort": {
"s": "desc"
},
"size": 1
}
},
"having_tm": {
"bucket_selector": {
"buckets_path": {
"top_m": "tm[m]"
},
"script": "params.top_m < 1000"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be285eef1d2df0dfcf876e2d4b361f1e.asciidoc 0000664 0000000 0000000 00000001552 15176617013 0027102 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/common-grams-tokenfilter.asciidoc:206
[source, python]
----
resp = client.indices.create(
index="common_grams_example",
settings={
"analysis": {
"analyzer": {
"index_grams": {
"tokenizer": "whitespace",
"filter": [
"common_grams_query"
]
}
},
"filter": {
"common_grams_query": {
"type": "common_grams",
"common_words": [
"a",
"is",
"the"
],
"ignore_case": True,
"query_mode": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be3a6431d01846950dc1a39a7a6a1faa.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:532
[source, python]
----
resp = client.tasks.get(
task_id="r1A2WoRbTwKZ516z6NEs5A:36619",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be5b415d7f33d6f0397ac2f8b5c10521.asciidoc 0000664 0000000 0000000 00000000436 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:647
[source, python]
----
resp = client.update_by_query(
index="my-index-000001",
refresh=True,
slices="5",
script={
"source": "ctx._source['extra'] = 'test'"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be5c5a9c25901737585e4fff9195da3c.asciidoc 0000664 0000000 0000000 00000000657 15176617013 0026544 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:435
[source, python]
----
resp = client.search(
index="my-bit-vectors",
filter_path="hits.hits",
query={
"knn": {
"query_vector": [
127,
-127,
0,
1,
42
],
"field": "my_vector"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be5d62e7c8f63687c585305fbe70d7d0.asciidoc 0000664 0000000 0000000 00000000652 15176617013 0026537 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:288
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_outlier": {
"percentiles": {
"field": "load_time",
"tdigest": {
"compression": 200
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be5fef0640c3a650ee96f84e3376a1be.asciidoc 0000664 0000000 0000000 00000000710 15176617013 0026654 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:335
[source, python]
----
resp = client.update(
index="test",
id="1",
scripted_upsert=True,
script={
"source": "\n if ( ctx.op == 'create' ) {\n ctx._source.counter = params.count\n } else {\n ctx._source.counter += params.count\n }\n ",
"params": {
"count": 4
}
},
upsert={},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be6b0bfcdce1ef100af89f74da5d4748.asciidoc 0000664 0000000 0000000 00000000573 15176617013 0027077 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/put-trained-model-definition-part.asciidoc:70
[source, python]
----
resp = client.ml.put_trained_model_definition_part(
model_id="elastic__distilbert-base-uncased-finetuned-conll03-english",
part="0",
definition="...",
total_definition_length=265632637,
total_parts=64,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be9376b1e354ad9c6bdad83f6a0ce5ad.asciidoc 0000664 0000000 0000000 00000003031 15176617013 0027066 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:129
[source, python]
----
resp = client.transform.preview_transform(
source={
"index": "kibana_sample_data_flights",
"query": {
"bool": {
"filter": [
{
"term": {
"Cancelled": False
}
}
]
}
}
},
dest={
"index": "sample_flight_delays_by_carrier"
},
pivot={
"group_by": {
"carrier": {
"terms": {
"field": "Carrier"
}
}
},
"aggregations": {
"flights_count": {
"value_count": {
"field": "FlightNum"
}
},
"delay_mins_total": {
"sum": {
"field": "FlightDelayMin"
}
},
"flight_mins_total": {
"sum": {
"field": "FlightTimeMin"
}
},
"delay_time_percentage": {
"bucket_script": {
"buckets_path": {
"delay_time": "delay_mins_total.value",
"flight_time": "flight_mins_total.value"
},
"script": "(params.delay_time / params.flight_time) * 100"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/be9836fe55c5fada404a2adc1663d832.asciidoc 0000664 0000000 0000000 00000001202 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1435
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
runtime={
"http": {
"type": "composite",
"script": "emit(grok(\"%{COMMONAPACHELOG}\").extract(doc[\"message\"].value))",
"fields": {
"clientip": {
"type": "ip"
},
"verb": {
"type": "keyword"
},
"response": {
"type": "long"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/beaf43b274b0f32cf3cf48f59e5cb1f2.asciidoc 0000664 0000000 0000000 00000000437 15176617013 0027013 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-api.asciidoc:751
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="snapshot_*",
sort="start_time",
from_sort_value="1577833200000",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/beb0b9ff4f68672273fcff1b7bae706b.asciidoc 0000664 0000000 0000000 00000000475 15176617013 0027030 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:411
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"user_identifier": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/beba2a9795c8a13653e1edf64eec4357.asciidoc 0000664 0000000 0000000 00000000504 15176617013 0026660 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/allocation/filtering.asciidoc:74
[source, python]
----
resp = client.indices.put_settings(
index="test",
settings={
"index.routing.allocation.require.size": "big",
"index.routing.allocation.require.rack": "rack1"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bed14cc152522ca0726ac3746ebc31db.asciidoc 0000664 0000000 0000000 00000001433 15176617013 0026620 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/unsigned_long.asciidoc:31
[source, python]
----
resp = client.bulk(
index="my_index",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"my_counter": 0
},
{
"index": {
"_id": 2
}
},
{
"my_counter": 9223372036854776000
},
{
"index": {
"_id": 3
}
},
{
"my_counter": 18446744073709552000
},
{
"index": {
"_id": 4
}
},
{
"my_counter": 18446744073709552000
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/befa73a8a419fcf3b7798548b54a20bf.asciidoc 0000664 0000000 0000000 00000002266 15176617013 0026671 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bf17440ac178d2ef5f5be643d033920b.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-search-elser.asciidoc:138
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "my-index",
"pipeline": "elser-v2-test"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bf1de9fa1b825fa875d27fa08821a6d1.asciidoc 0000664 0000000 0000000 00000000374 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-across-clusters.asciidoc:119
[source, python]
----
resp = client.security.put_user(
username="remote_user",
password="",
roles=[
"remote1"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bf2e6ea2bae621b9b2fee7003e891f86.asciidoc 0000664 0000000 0000000 00000000474 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/recipes/stemming.asciidoc:58
[source, python]
----
resp = client.search(
index="index",
query={
"simple_query_string": {
"fields": [
"body"
],
"query": "ski"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bf3c3bc41c593a80faebef1df353e483.asciidoc 0000664 0000000 0000000 00000000775 15176617013 0027015 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/bf3f520b47581d861e802730aaf2a519.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:35
[source, python]
----
resp = client.indices.update_aliases(
actions=[
{
"add": {
"index": "logs-nginx.access-prod",
"alias": "logs"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bf448c3889c18266e2e6d3af4f614da2.asciidoc 0000664 0000000 0000000 00000000676 15176617013 0026537 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:336
[source, python]
----
resp = client.index(
index=".ds-my-data-stream-2099-03-08-000003",
id="bfspvnIBr7VVZlfp2lqX",
if_seq_no="0",
if_primary_term="1",
document={
"@timestamp": "2099-03-08T11:06:07.000Z",
"user": {
"id": "8a4f500d"
},
"message": "Login successful"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bf639275d0818be04317ee5ab6075da6.asciidoc 0000664 0000000 0000000 00000000701 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/has-parent-query.asciidoc:52
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"has_parent": {
"parent_type": "parent",
"query": {
"term": {
"tag": {
"value": "Elasticsearch"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bf8680d940c84e43a9483a25548dea57.asciidoc 0000664 0000000 0000000 00000002472 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/search-analyzer.asciidoc:16
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
},
mappings={
"properties": {
"text": {
"type": "text",
"analyzer": "autocomplete",
"search_analyzer": "standard"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"text": "Quick Brown Fox"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"match": {
"text": {
"query": "Quick Br",
"operator": "and"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/bf9f13dc6c24cc225a72e32177e9ee02.asciidoc 0000664 0000000 0000000 00000003465 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-distance-query.asciidoc:17
[source, python]
----
resp = client.indices.create(
index="my_locations",
mappings={
"properties": {
"pin": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="my_locations",
id="1",
document={
"pin": {
"location": {
"lat": 40.12,
"lon": -71.34
}
}
},
)
print(resp1)
resp2 = client.indices.create(
index="my_geoshapes",
mappings={
"properties": {
"pin": {
"properties": {
"location": {
"type": "geo_shape"
}
}
}
}
},
)
print(resp2)
resp3 = client.index(
index="my_geoshapes",
id="1",
document={
"pin": {
"location": {
"type": "polygon",
"coordinates": [
[
[
13,
51.5
],
[
15,
51.5
],
[
15,
54
],
[
13,
54
],
[
13,
51.5
]
]
]
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/bfb0db2a72f22c9c2046119777efbb43.asciidoc 0000664 0000000 0000000 00000000714 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-search.asciidoc:78
[source, python]
----
resp = client.search(
index="elser-embeddings",
query={
"sparse_vector": {
"field": "content_embedding",
"inference_id": "elser_embeddings",
"query": "How to avoid muscle soreness after running?"
}
},
source=[
"id",
"content"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bfb1aa83da8e3f414d50b5ed7894ed33.asciidoc 0000664 0000000 0000000 00000000663 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:165
[source, python]
----
resp = client.search(
index="my-index-000001",
script_fields={
"my_doubled_field": {
"script": {
"source": "field('my_field').get(null) * params['multiplier']",
"params": {
"multiplier": 2
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bfb8a15cd05b43094ffbce8078bad3e1.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0027001 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-api.asciidoc:357
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="snapshot_2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bfd6fa3f44e6165f8999102f5a8e24d6.asciidoc 0000664 0000000 0000000 00000000745 15176617013 0026545 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:41
[source, python]
----
resp = client.search(
index="index1",
query={
"query_string": {
"query": "running with scissors",
"fields": [
"comment",
"comment.english"
]
}
},
highlight={
"order": "score",
"fields": {
"comment": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/bfdad8a928ea30d7cf60d0a0a6bc6e2e.asciidoc 0000664 0000000 0000000 00000001467 15176617013 0027144 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/bulk.asciidoc:721
[source, python]
----
resp = client.bulk(
filter_path="items.*.error",
operations=[
{
"update": {
"_id": "5",
"_index": "index1"
}
},
{
"doc": {
"my_field": "baz"
}
},
{
"update": {
"_id": "6",
"_index": "index1"
}
},
{
"doc": {
"my_field": "baz"
}
},
{
"update": {
"_id": "7",
"_index": "index1"
}
},
{
"doc": {
"my_field": "baz"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c00c9412609832ebceb9e786dd9542df.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-name-description-api.asciidoc:85
[source, python]
----
resp = client.connector.update_name(
connector_id="my-connector",
name="Custom connector",
description="This is my customized connector",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c012f42b26eb8dd9b197644c3ed954cf.asciidoc 0000664 0000000 0000000 00000000642 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:400
[source, python]
----
resp = client.index(
index="my-index-000001",
id="2",
document={
"name": {
"first": "Paul",
"last": "McCartney",
"title": {
"value": "Sir",
"category": "order of chivalry"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c03ce952de42eae4b522cedc9fd3d14a.asciidoc 0000664 0000000 0000000 00000000516 15176617013 0027061 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:269
[source, python]
----
resp = client.index(
index="example",
document={
"location": "POLYGON ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c065a200c00e2005d88ec2f0c10c908a.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026363 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/shingle-tokenfilter.asciidoc:31
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"shingle"
],
text="quick brown fox jumps",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c067182d385f59ce5952fb9a716fbf05.asciidoc 0000664 0000000 0000000 00000001215 15176617013 0026453 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/post-calendar-event.asciidoc:85
[source, python]
----
resp = client.ml.post_calendar_events(
calendar_id="planned-outages",
events=[
{
"description": "event 1",
"start_time": 1513641600000,
"end_time": 1513728000000
},
{
"description": "event 2",
"start_time": 1513814400000,
"end_time": 1513900800000
},
{
"description": "event 3",
"start_time": 1514160000000,
"end_time": 1514246400000
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c088ce5291ae28650b6091cdec489398.asciidoc 0000664 0000000 0000000 00000000740 15176617013 0026373 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/point-in-time-api.asciidoc:55
[source, python]
----
resp = client.search(
size=100,
query={
"match": {
"title": "elasticsearch"
}
},
pit={
"id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==",
"keep_alive": "1m"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c0a4b0c1c6eff14da8b152ceb19c1c31.asciidoc 0000664 0000000 0000000 00000000274 15176617013 0026757 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/restart-cluster.asciidoc:93
[source, python]
----
resp = client.cat.health()
print(resp)
resp1 = client.cat.nodes()
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/c0c638e3d218b0ecbe5c4d77c964ae9e.asciidoc 0000664 0000000 0000000 00000000443 15176617013 0026741 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/term-query.asciidoc:28
[source, python]
----
resp = client.search(
query={
"term": {
"user.id": {
"value": "kimchy",
"boost": 1
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c0ddfb2e6315f5bcf0d3ef414b5bbed3.asciidoc 0000664 0000000 0000000 00000000440 15176617013 0027130 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-configuration-api.asciidoc:342
[source, python]
----
resp = client.connector.update_configuration(
connector_id="my-spo-connector",
values={
"secret_value": "foo-bar"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c0ebaa33e750b87555dc352073f692e8.asciidoc 0000664 0000000 0000000 00000001064 15176617013 0026434 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/update-settings.asciidoc:187
[source, python]
----
resp = client.indices.close(
index="my-index-000001",
)
print(resp)
resp1 = client.indices.put_settings(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"content": {
"type": "custom",
"tokenizer": "whitespace"
}
}
}
},
)
print(resp1)
resp2 = client.indices.open(
index="my-index-000001",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/c0ff8b3db994c4736f7579dde18097d2.asciidoc 0000664 0000000 0000000 00000000355 15176617013 0026551 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:303
[source, python]
----
resp = client.get_source(
index="my-index-000001",
id="1",
source_includes="*.id",
source_excludes="entities",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c10a486a28cbc5b2f15c3474ae31a431.asciidoc 0000664 0000000 0000000 00000000737 15176617013 0026467 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:187
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="nightly-snapshots",
schedule="0 30 1 * * ?",
name="",
repository="my_repository",
config={
"indices": "*",
"include_global_state": True
},
retention={
"expire_after": "30d",
"min_count": 5,
"max_count": 50
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c11c4d6b30e882871bf0074f407149bd.asciidoc 0000664 0000000 0000000 00000000467 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/parent-id-query.asciidoc:47
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"text": "This is a parent document.",
"my-join-field": "my-parent"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c12d6e962f083c728f9397932f05202e.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connector-sync-jobs-api.asciidoc:78
[source, python]
----
resp = client.perform_request(
"GET",
"/_connector/_sync_job",
params={
"connector_id": "connector-1"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c1409f591a01589638d9b00436ce42c0.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026206 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-cache.asciidoc:67
[source, python]
----
resp = client.security.clear_cached_realms(
realms="default_file",
usernames="rdeniro,alpacino",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c147de68fd6da032ad4a3c1bf626f5d6.asciidoc 0000664 0000000 0000000 00000000554 15176617013 0026731 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:422
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"fields": {
"comment": {
"type": "plain"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c155d2670ff82b135c7dcec0fc8a3f23.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1378
[source, python]
----
resp = client.eql.delete(
id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c18100d62ed31bc9e05f62900156e6a8.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026334 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connectors-api.asciidoc:102
[source, python]
----
resp = client.connector.list(
index_name="search-google-drive",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c186ecf6f799ddff7add1abdecea5821.asciidoc 0000664 0000000 0000000 00000001637 15176617013 0027257 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/fields.asciidoc:287
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"full_name": {
"type": "text",
"store": True
},
"title": {
"type": "text",
"store": True
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"full_name": "Alice Ball",
"title": "Professor"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
script_fields={
"name_with_title": {
"script": {
"lang": "painless",
"source": "params._fields['title'].value + ' ' + params._fields['full_name'].value"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/c187b52646cedeebe0716327add65642.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/apis/get-async-sql-search-api.asciidoc:18
[source, python]
----
resp = client.sql.get_async(
id="FmdMX2pIang3UWhLRU5QS0lqdlppYncaMUpYQ05oSkpTc3kwZ21EdC1tbFJXQToxOTI=",
format="json",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c1a39c2628ada04c3ddd61a303b65d44.asciidoc 0000664 0000000 0000000 00000001432 15176617013 0026542 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// vectors/vector-functions.asciidoc:200
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"script_score": {
"query": {
"bool": {
"filter": {
"term": {
"status": "published"
}
}
}
},
"script": {
"source": "(24 - hamming(params.queryVector, 'my_byte_dense_vector')) / 24",
"params": {
"queryVector": [
4,
3,
0
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c1a895497066a3dac674d4b1a119048d.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/term-query.asciidoc:137
[source, python]
----
resp = client.search(
index="my-index-000001",
pretty=True,
query={
"term": {
"full_text": "Quick Brown Foxes!"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c1ac9e53b04f7acee4b4933969d6b574.asciidoc 0000664 0000000 0000000 00000001202 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/preview-transform.asciidoc:296
[source, python]
----
resp = client.transform.preview_transform(
source={
"index": "kibana_sample_data_ecommerce"
},
pivot={
"group_by": {
"customer_id": {
"terms": {
"field": "customer_id",
"missing_bucket": True
}
}
},
"aggregations": {
"max_price": {
"max": {
"field": "taxful_total_price"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c1ad9ff64728a5bfeeb485e60ec694a1.asciidoc 0000664 0000000 0000000 00000001004 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rank-eval.asciidoc:459
[source, python]
----
resp = client.rank_eval(
index="my-index-000001",
requests=[
{
"id": "JFK query",
"request": {
"query": {
"match_all": {}
}
},
"ratings": []
}
],
metric={
"expected_reciprocal_rank": {
"maximum_relevance": 3,
"k": 20
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c1efc5cfcb3c29711bfe118f1baa28b0.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0027053 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/keyword-analyzer.asciidoc:71
[source, python]
----
resp = client.indices.create(
index="keyword_example",
settings={
"analysis": {
"analyzer": {
"rebuilt_keyword": {
"tokenizer": "keyword",
"filter": []
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c208a06212dc0cf6ac413d4f2c154296.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/flush.asciidoc:137
[source, python]
----
resp = client.indices.flush(
index="my-index-000001,my-index-000002",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c208de54369379e8d78ab201be18b6be.asciidoc 0000664 0000000 0000000 00000001310 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:234
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"longs_as_strings": {
"match_mapping_type": "string",
"match": "long_*",
"unmatch": "*_text",
"mapping": {
"type": "long"
}
}
}
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"long_num": "5",
"long_text": "foo"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/c21aaedb5752a83489476fa3b5e2e9ff.asciidoc 0000664 0000000 0000000 00000001243 15176617013 0026663 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-rules/apis/put-query-rule.asciidoc:120
[source, python]
----
resp = client.query_rules.put_rule(
ruleset_id="my-ruleset",
rule_id="my-rule1",
type="pinned",
criteria=[
{
"type": "contains",
"metadata": "user_query",
"values": [
"pugs",
"puggles"
]
},
{
"type": "exact",
"metadata": "user_country",
"values": [
"us"
]
}
],
actions={
"ids": [
"id1",
"id2"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c21eb4bc30087188241cbba6b6b89999.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-service-type-api.asciidoc:84
[source, python]
----
resp = client.connector.update_service_type(
connector_id="my-connector",
service_type="sharepoint_online",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c23e32775340d7bc6f46820313014d8a.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026174 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:525
[source, python]
----
resp = client.index(
index="my_test_scores_2",
pipeline="my_test_scores_pipeline",
document={
"student": "kimchy",
"grad_year": "2099",
"math_score": 1200,
"verbal_score": 800
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c267e90b7873a7c8c8af06f01e958e69.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/bi-directional-disaster-recovery.asciidoc:185
[source, python]
----
resp = client.search(
index="logs*",
size="0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c26b185952ddf9842e18493aca2de147.asciidoc 0000664 0000000 0000000 00000000501 15176617013 0026437 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// quickstart/getting-started.asciidoc:102
[source, python]
----
resp = client.index(
index="books",
document={
"name": "Snow Crash",
"author": "Neal Stephenson",
"release_date": "1992-06-01",
"page_count": 470
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c27b7d9836aa4ea756f59e9c42911721.asciidoc 0000664 0000000 0000000 00000000336 15176617013 0026374 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/scroll-api.asciidoc:35
[source, python]
----
resp = client.scroll(
scroll_id="DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c28f0b0dd3246cb91d6facb3295a61d7.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026640 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:409
[source, python]
----
resp = client.indices.close(
index="kibana_sample_data_flights,.ds-my-data-stream-2022.06.17-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c2c21e2824fbf6b7198ede30419da82b.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:529
[source, python]
----
resp = client.clear_scroll(
scroll_id="_all",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c2d7c36daac8608d2515c549b2c82436.asciidoc 0000664 0000000 0000000 00000001460 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:491
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"tile": {
"geotile_grid": {
"field": "location",
"precision": 22,
"bounds": {
"top_left": "POINT (4.9 52.4)",
"bottom_right": "POINT (5.0 52.3)"
}
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c318fde926842722825a51e5c9c326a9.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/trim-tokenfilter.asciidoc:34
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
text=" fox ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c38c882c642dd412e8fa4c3eed49d12f.asciidoc 0000664 0000000 0000000 00000000431 15176617013 0026656 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/search-as-you-type.asciidoc:162
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match_phrase_prefix": {
"my_field": "brown f"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c3b77e11b16e37e9e37e28dec922432e.asciidoc 0000664 0000000 0000000 00000000431 15176617013 0026517 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/c4272ad0309ffbcbe9ce96bf9fb4352a.asciidoc 0000664 0000000 0000000 00000001065 15176617013 0027016 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/context-suggest.asciidoc:140
[source, python]
----
resp = client.search(
index="place",
pretty=True,
suggest={
"place_suggestion": {
"prefix": "tim",
"completion": {
"field": "suggest",
"size": 10,
"contexts": {
"place_type": [
"cafe",
"restaurants"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c42bc6e74afc3d43cd032ec2bfd77385.asciidoc 0000664 0000000 0000000 00000000455 15176617013 0026731 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/word-delimiter-tokenfilter.asciidoc:58
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
filter=[
"word_delimiter"
],
text="Neil's-Super-Duper-XL500--42+AutoCoder",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c4607ca79b2bcde39305d6f4f21cad37.asciidoc 0000664 0000000 0000000 00000000613 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:226
[source, python]
----
resp = client.esql.query(
locale="fr-FR",
query="\n ROW birth_date_string = \"2023-01-15T00:00:00.000Z\"\n | EVAL birth_date = date_parse(birth_date_string)\n | EVAL month_of_birth = DATE_FORMAT(\"MMMM\",birth_date)\n | LIMIT 5\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c464ed2001d66a1446f37659dc9efc2a.asciidoc 0000664 0000000 0000000 00000001101 15176617013 0026504 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/daterange-aggregation.asciidoc:19
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"range": {
"date_range": {
"field": "date",
"format": "MM-yyyy",
"ranges": [
{
"to": "now-10M/M"
},
{
"from": "now-10M/M"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c47f030216a3c89f92f31787fc4d5df5.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/plugins.asciidoc:56
[source, python]
----
resp = client.cat.plugins(
v=True,
s="component",
h="name,component,version,description",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c48b8bcd6f41e0d12b58e854e09ea893.asciidoc 0000664 0000000 0000000 00000000670 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:361
[source, python]
----
resp = client.index(
index="example",
document={
"location": "MULTIPOLYGON (((1002.0 200.0, 1003.0 200.0, 1003.0 300.0, 1002.0 300.0, 102.0 200.0)), ((1000.0 100.0, 1001.0 100.0, 1001.0 100.0, 1000.0 100.0, 1000.0 100.0), (1000.2 100.2, 1000.8 100.2, 1000.8 100.8, 1000.2 100.8, 1000.2 100.2)))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c4a1d03dcfb82913d0724a42b0a89f20.asciidoc 0000664 0000000 0000000 00000000232 15176617013 0026460 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/clearcache.asciidoc:158
[source, python]
----
resp = client.indices.clear_cache()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c4b727723b57052b6504bb74fe09abc6.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026421 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template.asciidoc:18
[source, python]
----
resp = client.indices.put_index_template(
name="template_1",
index_patterns=[
"template*"
],
priority=1,
template={
"settings": {
"number_of_shards": 2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c4c1a87414741a678f6cb91804daf095.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rank-feature-query.asciidoc:348
[source, python]
----
resp = client.search(
index="test",
query={
"rank_feature": {
"field": "pagerank",
"linear": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c4fadbb7f61e5f83ab3fc9cd4b82b5e5.asciidoc 0000664 0000000 0000000 00000000514 15176617013 0027156 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:246
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="my_snapshot_2099.05.06",
feature_states=[
"geoip"
],
include_global_state=False,
indices="-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c526fca1609b4c3c1d12dfd218d69a50.asciidoc 0000664 0000000 0000000 00000000400 15176617013 0026546 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:383
[source, python]
----
resp = client.reindex(
source={
"index": "my-index-000001"
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c54597143ac86540726f6422fd98b22e.asciidoc 0000664 0000000 0000000 00000001026 15176617013 0026225 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-settings.asciidoc:56
[source, python]
----
resp = client.perform_request(
"PUT",
"/_security/settings",
headers={"Content-Type": "application/json"},
body={
"security": {
"index.auto_expand_replicas": "0-all"
},
"security-tokens": {
"index.auto_expand_replicas": "0-all"
},
"security-profile": {
"index.auto_expand_replicas": "0-all"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c554a1791f29bbbcddda84c64deaba6f.asciidoc 0000664 0000000 0000000 00000000361 15176617013 0027146 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:229
[source, python]
----
resp = client.sql.query(
format="txt",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c580092fd3d36c32b09d63921708a67b.asciidoc 0000664 0000000 0000000 00000001027 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/dis-max-query.asciidoc:18
[source, python]
----
resp = client.search(
query={
"dis_max": {
"queries": [
{
"term": {
"title": "Quick pets"
}
},
{
"term": {
"body": "Quick pets"
}
}
],
"tie_breaker": 0.7
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c5802e9f3f4068fcecb6937b867b270d.asciidoc 0000664 0000000 0000000 00000000551 15176617013 0026535 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:400
[source, python]
----
resp = client.search(
aggs={
"genres": {
"terms": {
"field": "genre",
"order": {
"_count": "asc"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c580990a70028bb49cca8a6bde86bbf6.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-update-api-keys.asciidoc:242
[source, python]
----
resp = client.security.bulk_update_api_keys(
ids=[
"VuaCfGcBCdbkQm-e5aOx",
"H3_AhoIBA9hmeQJdg7ij"
],
role_descriptors={},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c5ba7c4badb5ef5ca32740106e4aa6b6.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026765 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:42
[source, python]
----
resp = client.termvectors(
index="my-index-000001",
id="1",
fields="message",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c5bc577ff92f889225b0d2617adcb48c.asciidoc 0000664 0000000 0000000 00000000341 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/sysconfig/file-descriptors.asciidoc:29
[source, python]
----
resp = client.nodes.stats(
metric="process",
filter_path="**.max_file_descriptors",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c5cc19e48549fbc5327a9d46874bbeee.asciidoc 0000664 0000000 0000000 00000000613 15176617013 0026676 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:321
[source, python]
----
resp = client.search(
index="quantized-image-index",
knn={
"field": "image-vector",
"query_vector": [
0.1,
-2
],
"k": 10,
"num_candidates": 100
},
fields=[
"title"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c5ed7d83ade97a417aef28b9e2871e5d.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026756 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/common-log-format-example.asciidoc:189
[source, python]
----
resp = client.search(
index="my-data-stream",
filter_path="hits.hits._source",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6151a0788a10a7f40da684d72c3255c.asciidoc 0000664 0000000 0000000 00000002620 15176617013 0026336 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/flattened.asciidoc:225
[source, python]
----
resp = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {}
},
{
"title": "Something really urgent",
"labels": {
"priority": "urgent",
"release": [
"v1.2.5",
"v1.3.0"
],
"timestamp": {
"created": 1541458026,
"closed": 1541457010
}
}
},
{
"index": {}
},
{
"title": "Somewhat less urgent",
"labels": {
"priority": "high",
"release": [
"v1.3.0"
],
"timestamp": {
"created": 1541458026,
"closed": 1541457010
}
}
},
{
"index": {}
},
{
"title": "Not urgent",
"labels": {
"priority": "low",
"release": [
"v1.2.0"
],
"timestamp": {
"created": 1541458026,
"closed": 1541457010
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c630a1f891aa9aa651f9982b832a42e1.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:923
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"drop": {
"description": "Drop documents that contain 'network.name' of 'Guest'",
"if": "ctx.network?.name != null && ctx.network.name.contains('Guest')"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6339d09f85000a6432304b0ec63b8f6.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026263 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-component-template.asciidoc:236
[source, python]
----
resp = client.cluster.put_component_template(
name="template_1",
template={
"settings": {
"number_of_shards": 1
}
},
version=123,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c639036b87d02fb864e27c4ca29ef833.asciidoc 0000664 0000000 0000000 00000001704 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/diversified-sampler-aggregation.asciidoc:99
[source, python]
----
resp = client.search(
index="stackoverflow",
size="0",
query={
"query_string": {
"query": "tags:kibana"
}
},
runtime_mappings={
"tags.hash": {
"type": "long",
"script": "emit(doc['tags'].hashCode())"
}
},
aggs={
"my_unbiased_sample": {
"diversified_sampler": {
"shard_size": 200,
"max_docs_per_value": 3,
"field": "tags.hash"
},
"aggs": {
"keywords": {
"significant_terms": {
"field": "tags",
"exclude": [
"kibana"
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c64b61bedb21b9def8fce5092e677af9.asciidoc 0000664 0000000 0000000 00000000705 15176617013 0027032 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters.asciidoc:52
[source, python]
----
resp = client.search(
suggest={
"my-suggest-1": {
"text": "tring out Elasticsearch",
"term": {
"field": "message"
}
},
"my-suggest-2": {
"text": "kmichy",
"term": {
"field": "user.id"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c654b09be981be12fc7be0ba33f8652b.asciidoc 0000664 0000000 0000000 00000003172 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:313
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "multilinestring",
"coordinates": [
[
[
1002,
200
],
[
1003,
200
],
[
1003,
300
],
[
1002,
300
]
],
[
[
1000,
100
],
[
1001,
100
],
[
1001,
100
],
[
1000,
100
]
],
[
[
1000.2,
100.2
],
[
1000.8,
100.2
],
[
1000.8,
100.8
],
[
1000.2,
100.8
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c65b00a285f510dcd2865aa3539b4e03.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026410 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/apis/get-transform.asciidoc:106
[source, python]
----
resp = client.transform.get_transform(
size="10",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c66dab0b114fa3e228e1c0e0e5a99b60.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0026623 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:247
[source, python]
----
resp = client.search(
index="my-index-000001",
fields=[
"user.first"
],
source=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c67b0f00c2e690303c0e5af2f51e0fea.asciidoc 0000664 0000000 0000000 00000000672 15176617013 0026630 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters.asciidoc:13
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match": {
"message": "tring out Elasticsearch"
}
},
suggest={
"my-suggestion": {
"text": "tring out Elasticsearch",
"term": {
"field": "message"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6abe91b5527870face2b826f37ba1da.asciidoc 0000664 0000000 0000000 00000001051 15176617013 0026721 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:438
[source, python]
----
resp = client.search(
index="image-index",
query={
"match": {
"title": {
"query": "mountain lake",
"boost": 0.9
}
}
},
knn={
"field": "image-vector",
"query_vector": [
54,
10,
-2
],
"k": 5,
"num_candidates": 50,
"boost": 0.1
},
size=10,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6b365c7da97d7e50f36820a7d36f548.asciidoc 0000664 0000000 0000000 00000000451 15176617013 0026453 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/disk/decrease-data-node-disk-usage.asciidoc:127
[source, python]
----
resp = client.indices.put_settings(
index="my_index,my_other_index",
settings={
"index.number_of_replicas": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6b5c695a9b757b5e7325345b206bde5.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/delete-pipeline.asciidoc:88
[source, python]
----
resp = client.ingest.delete_pipeline(
id="pipeline-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6b8713bd49661d69d6b868f5b991d17.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-set-query.asciidoc:85
[source, python]
----
resp = client.index(
index="job-candidates",
id="1",
refresh=True,
document={
"name": "Jane Smith",
"programming_languages": [
"c++",
"java"
],
"required_matches": 2
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6bdd5c7de79d6d9ac8e33a397b511e8.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026756 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:327
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"user_id": {
"type": "long"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6d39d22188dc7bbfdad811a94cbcc2b.asciidoc 0000664 0000000 0000000 00000000407 15176617013 0027064 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/classic-tokenizer.asciidoc:25
[source, python]
----
resp = client.indices.analyze(
tokenizer="classic",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c6d5e3b6ff9c665ec5344a4bfa7add80.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0027022 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// modules/network/tracers.asciidoc:106
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"transport.tracer.include": "*",
"transport.tracer.exclude": "internal:coordination/fault_detection/*"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c733f20641b20e124f26198534755d6d.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026130 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations.asciidoc:149
[source, python]
----
resp = client.search(
index="my-index-000001",
aggs={
"my-first-agg-name": {
"terms": {
"field": "my-field"
}
},
"my-second-agg-name": {
"avg": {
"field": "my-other-field"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c765ce78f3605c0e70d213f22aac8a53.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/put-autoscaling-policy.asciidoc:73
[source, python]
----
resp = client.autoscaling.put_autoscaling_policy(
name="my_autoscaling_policy",
policy={
"roles": [
"data_hot"
],
"deciders": {
"fixed": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c76cb6a080959b0d87afd780cf814be2.asciidoc 0000664 0000000 0000000 00000001172 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/match-bool-prefix-query.asciidoc:28
[source, python]
----
resp = client.search(
query={
"bool": {
"should": [
{
"term": {
"message": "quick"
}
},
{
"term": {
"message": "brown"
}
},
{
"prefix": {
"message": "f"
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c793efe7280e9b6e09981c4d4f832348.asciidoc 0000664 0000000 0000000 00000001321 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/ip.asciidoc:166
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"ip": {
"type": "ip"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"ip": [
"192.168.0.1",
"192.168.0.1",
"10.10.12.123",
"2001:db8::1:0:0:1",
"::afff:4567:890a"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/c79b284fa7a5d7421c6daae62bc697f9.asciidoc 0000664 0000000 0000000 00000000323 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/uni-directional-disaster-recovery.asciidoc:163
[source, python]
----
resp = client.indices.delete(
index="kibana_sample_data_ecommerce",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c79e8ee86b332302b25c5c1f5f4f89d7.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/document-level-security.asciidoc:67
[source, python]
----
resp = client.security.put_role(
name="dept_role",
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
],
"query": {
"term": {
"department_id": 12
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c8210f23c10d0642f24c1e43faa4deda.asciidoc 0000664 0000000 0000000 00000001752 15176617013 0026621 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-a-data-stream.asciidoc:144
[source, python]
----
resp = client.cluster.put_component_template(
name="my-mappings",
template={
"mappings": {
"properties": {
"@timestamp": {
"type": "date",
"format": "date_optional_time||epoch_millis"
},
"message": {
"type": "wildcard"
}
}
}
},
meta={
"description": "Mappings for @timestamp and message fields",
"my-custom-meta-field": "More arbitrary metadata"
},
)
print(resp)
resp1 = client.cluster.put_component_template(
name="my-settings",
template={
"settings": {
"index.lifecycle.name": "my-lifecycle-policy"
}
},
meta={
"description": "Settings for ILM",
"my-custom-meta-field": "More arbitrary metadata"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/c87038b96ab06d9a741a130f94de4f02.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026422 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete.asciidoc:144
[source, python]
----
resp = client.delete(
index="my-index-000001",
id="1",
timeout="5m",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c873f9cd093e26515148f052e28c7805.asciidoc 0000664 0000000 0000000 00000000360 15176617013 0026227 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-snapshot.asciidoc:248
[source, python]
----
resp = client.ml.get_model_snapshots(
job_id="high_sum_total_sales",
start="1575402236000",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c8aa8e8c0ac160b8c4efd1ac3b9f48f3.asciidoc 0000664 0000000 0000000 00000000776 15176617013 0027101 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/c8bbf362f06a0d8dab33ec0d99743343.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0026573 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/classic-tokenfilter.asciidoc:21
[source, python]
----
resp = client.indices.analyze(
tokenizer="classic",
filter=[
"classic"
],
text="The 2 Q.U.I.C.K. Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c8e2109b19d50467ab83a40006462e9f.asciidoc 0000664 0000000 0000000 00000000347 15176617013 0026270 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/enrich/execute-enrich-policy.asciidoc:45
[source, python]
----
resp = client.enrich.execute_policy(
name="my-policy",
wait_for_completion=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c92b761c18d8e1c3df75c04a21503e16.asciidoc 0000664 0000000 0000000 00000001147 15176617013 0026423 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:360
[source, python]
----
resp = client.cluster.put_component_template(
name="logs-my_app-settings",
template={
"settings": {
"index.default_pipeline": "logs-my_app-default",
"index.lifecycle.name": "logs"
}
},
)
print(resp)
resp1 = client.indices.put_index_template(
name="logs-my_app-template",
index_patterns=[
"logs-my_app-*"
],
data_stream={},
priority=500,
composed_of=[
"logs-my_app-settings",
"logs-my_app-mappings"
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/c956bf1f0829a5f0357c0494ed8b6ca3.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-template-api.asciidoc:43
[source, python]
----
resp = client.search_template(
index="my-index",
id="my-search-template",
params={
"query_string": "hello world",
"from": 0,
"size": 10
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c95d5317525c2ff625e6971c277247af.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026313 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/keyword-tokenizer.asciidoc:61
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
filter=[
"lowercase"
],
text="john.SMITH@example.COM",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c96669604d0e66a097ddf3093b025ccd.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations.asciidoc:126
[source, python]
----
resp = client.search(
index="my-index-000001",
size=0,
aggs={
"my-agg-name": {
"terms": {
"field": "my-field"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c96e5740b79f703c5b77e3ddc9fdf3a0.asciidoc 0000664 0000000 0000000 00000000770 15176617013 0026676 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-a-data-stream.asciidoc:210
[source, python]
----
resp = client.indices.put_index_template(
name="my-index-template",
index_patterns=[
"my-data-stream*"
],
data_stream={},
composed_of=[
"my-mappings",
"my-settings"
],
priority=500,
meta={
"description": "Template for my time series data",
"my-custom-meta-field": "More arbitrary metadata"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c97fd95ebdcf56cc973582e37f732ed2.asciidoc 0000664 0000000 0000000 00000000252 15176617013 0026706 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/enrich/get-enrich-policy.asciidoc:182
[source, python]
----
resp = client.enrich.get_policy()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c9a6ab0a56bb0177f158277185f68302.asciidoc 0000664 0000000 0000000 00000002242 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/subobjects.asciidoc:20
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"metrics": {
"type": "object",
"subobjects": False,
"properties": {
"time": {
"type": "long"
},
"time.min": {
"type": "long"
},
"time.max": {
"type": "long"
}
}
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="metric_1",
document={
"metrics.time": 100,
"metrics.time.min": 10,
"metrics.time.max": 900
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="metric_2",
document={
"metrics": {
"time": 100,
"time.min": 10,
"time.max": 900
}
},
)
print(resp2)
resp3 = client.indices.get_mapping(
index="my-index-000001",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/c9afa715021f2e6450e72ac73271960c.asciidoc 0000664 0000000 0000000 00000001114 15176617013 0026336 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/parent-aggregation.asciidoc:39
[source, python]
----
resp = client.index(
index="parent_example",
id="1",
document={
"join": {
"name": "question"
},
"body": "I have Windows 2003 server and i bought a new Windows 2008 server...",
"title": "Whats the best way to file transfer my site from server to a newer one?",
"tags": [
"windows-server-2003",
"windows-server-2008",
"file-transfer"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c9b6cbe93c8bd23e3f658c3af4e70092.asciidoc 0000664 0000000 0000000 00000003014 15176617013 0026660 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/edgengram-tokenizer.asciidoc:264
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"autocomplete": {
"tokenizer": "autocomplete",
"filter": [
"lowercase"
]
},
"autocomplete_search": {
"tokenizer": "lowercase"
}
},
"tokenizer": {
"autocomplete": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 10,
"token_chars": [
"letter"
]
}
}
}
},
mappings={
"properties": {
"title": {
"type": "text",
"analyzer": "autocomplete",
"search_analyzer": "autocomplete_search"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"title": "Quick Foxes"
},
)
print(resp1)
resp2 = client.indices.refresh(
index="my-index-000001",
)
print(resp2)
resp3 = client.search(
index="my-index-000001",
query={
"match": {
"title": {
"query": "Quick Fo",
"operator": "and"
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/c9c396b94bb88098477e2b08b55a12ee.asciidoc 0000664 0000000 0000000 00000002207 15176617013 0026454 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/bulk.asciidoc:774
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"dynamic_templates": [
{
"geo_point": {
"mapping": {
"type": "geo_point"
}
}
}
]
},
)
print(resp)
resp1 = client.bulk(
operations=[
{
"index": {
"_index": "my_index",
"_id": "1",
"dynamic_templates": {
"work_location": "geo_point"
}
}
},
{
"field": "value1",
"work_location": "41.12,-71.34",
"raw_location": "41.12,-71.34"
},
{
"create": {
"_index": "my_index",
"_id": "2",
"dynamic_templates": {
"home_location": "geo_point"
}
}
},
{
"field": "value2",
"home_location": "41.12,-71.34"
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/c9ce07a7d3d8a317f08535bdd3aa69a3.asciidoc 0000664 0000000 0000000 00000000575 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:224
[source, python]
----
resp = client.update(
index="test",
id="1",
script={
"source": "if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'noop' }",
"lang": "painless",
"params": {
"tag": "green"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/c9d9a1d751f20f6197c825cb4378fe9f.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026543 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-query.asciidoc:21
[source, python]
----
resp = client.search(
query={
"terms": {
"user.id": [
"kimchy",
"elkbee"
],
"boost": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ca06db2aa4747910278f96315f7be94b.asciidoc 0000664 0000000 0000000 00000001142 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:356
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_bounding_box": {
"pin.location": {
"top": 40.73,
"left": -74.1,
"bottom": 40.01,
"right": -71.12
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ca08e511e5907d258081b10a1a9f0072.asciidoc 0000664 0000000 0000000 00000001240 15176617013 0026242 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:454
[source, python]
----
resp = client.indices.put_index_template(
name="new-data-stream-template",
index_patterns=[
"new-data-stream*"
],
data_stream={},
priority=500,
template={
"mappings": {
"properties": {
"@timestamp": {
"type": "date_nanos"
}
}
},
"settings": {
"sort.field": [
"@timestamp"
],
"sort.order": [
"desc"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ca1cc4bcef22fdf9153833bfe6a55294.asciidoc 0000664 0000000 0000000 00000001154 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:367
[source, python]
----
resp = client.bulk(
refresh=True,
operations=[
{
"index": {
"_index": ".ds-my-data-stream-2099.03.08-000003",
"_id": "bfspvnIBr7VVZlfp2lqX",
"if_seq_no": 0,
"if_primary_term": 1
}
},
{
"@timestamp": "2099-03-08T11:06:07.000Z",
"user": {
"id": "8a4f500d"
},
"message": "Login successful"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ca3bcd6278510ebced5f74484033cb36.asciidoc 0000664 0000000 0000000 00000000257 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/apis/get-script-languages-api.asciidoc:17
[source, python]
----
resp = client.get_script_languages()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ca5ae0eb7709f3807bc6239cd4bd9141.asciidoc 0000664 0000000 0000000 00000000247 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:246
[source, python]
----
resp = client.security.get_api_key()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ca5dda98e977125d40a7fe1e178e213f.asciidoc 0000664 0000000 0000000 00000000555 15176617013 0026607 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/sparse-vector-query.asciidoc:134
[source, python]
----
resp = client.search(
index="my-index",
query={
"sparse_vector": {
"field": "ml.tokens",
"inference_id": "my-elser-model",
"query": "How is the weather in Jamaica?"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ca98afbd6a90f63e02f62239d225313b.asciidoc 0000664 0000000 0000000 00000000374 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/dangling-index-import.asciidoc:65
[source, python]
----
resp = client.dangling_indices.import_dangling_index(
index_uuid="zmM4e0JtBkeUjiHD-MihPQ",
accept_data_loss=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/caaafef1a76c2bec677704c2dc233218.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026713 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/simulate-index.asciidoc:39
[source, python]
----
resp = client.indices.simulate_index_template(
name="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/caab99520d3fe41f6154d74a7f696057.asciidoc 0000664 0000000 0000000 00000000264 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/delete-index.asciidoc:16
[source, python]
----
resp = client.indices.delete(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cac74a85c6b352a6e23d8673abae126f.asciidoc 0000664 0000000 0000000 00000001437 15176617013 0026650 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/frequent-item-sets-aggregation.asciidoc:257
[source, python]
----
resp = client.async_search.submit(
index="kibana_sample_data_ecommerce",
size=0,
aggs={
"my_agg": {
"frequent_item_sets": {
"minimum_set_size": 3,
"fields": [
{
"field": "category.keyword"
},
{
"field": "geoip.city_name"
}
],
"size": 3,
"filter": {
"term": {
"geoip.continent_name": "Europe"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cafed0e2c2b1d1574eb4a5ecd514a97a.asciidoc 0000664 0000000 0000000 00000000420 15176617013 0027045 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/split-index.asciidoc:16
[source, python]
----
resp = client.indices.split(
index="my-index-000001",
target="split-my-index-000001",
settings={
"index.number_of_shards": 2
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cb0c3223fd45148497df73adfba2e9ce.asciidoc 0000664 0000000 0000000 00000000537 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:674
[source, python]
----
resp = client.reindex(
source={
"index": "my-index-000001",
"query": {
"term": {
"user.id": "kimchy"
}
}
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cb16f1ff85399ddaa418834be580c9de.asciidoc 0000664 0000000 0000000 00000000671 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:136
[source, python]
----
resp = client.security.put_role(
name="slm-admin",
cluster=[
"manage_slm",
"cluster:admin/snapshot/*"
],
indices=[
{
"names": [
".slm-history-*"
],
"privileges": [
"all"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cb1d2a787bbe88974cfc5f132556a51c.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:421
[source, python]
----
resp = client.indices.delete_data_stream(
name="*",
expand_wildcards="all",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cb2f70601cb004b9ece9b0b43a9dc21a.asciidoc 0000664 0000000 0000000 00000000332 15176617013 0026674 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shard-request-cache.asciidoc:49
[source, python]
----
resp = client.indices.clear_cache(
index="my-index-000001,my-index-000002",
request=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cb3c483816b6ea150ff6c559fa144d32.asciidoc 0000664 0000000 0000000 00000001154 15176617013 0026510 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-tutorial.asciidoc:75
[source, python]
----
resp = client.ilm.put_lifecycle(
name="timeseries_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "50GB",
"max_age": "30d"
}
}
},
"delete": {
"min_age": "90d",
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cb4388b72d41c431ec9ca8255b2f65fb.asciidoc 0000664 0000000 0000000 00000001144 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/shape-query.asciidoc:27
[source, python]
----
resp = client.indices.create(
index="example",
mappings={
"properties": {
"geometry": {
"type": "shape"
}
}
},
)
print(resp)
resp1 = client.index(
index="example",
id="1",
refresh="wait_for",
document={
"name": "Lucky Landing",
"geometry": {
"type": "point",
"coordinates": [
1355.400544,
5255.530286
]
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/cb71332115c92cfb89375abd30b8bbbb.asciidoc 0000664 0000000 0000000 00000000216 15176617013 0026631 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat.asciidoc:42
[source, python]
----
resp = client.cat.master(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cb71c6ecfb8b19725c374572444e5d32.asciidoc 0000664 0000000 0000000 00000000623 15176617013 0026440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:366
[source, python]
----
resp = client.search(
index="my-index-000001",
aggs={
"avg_start": {
"avg": {
"field": "measures.start"
}
},
"avg_end": {
"avg": {
"field": "measures.end"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cba3462a307e2483c14e3e198f6960e3.asciidoc 0000664 0000000 0000000 00000001442 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/put-lifecycle.asciidoc:66
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"_meta": {
"description": "used for nginx log",
"project": {
"name": "myProject",
"department": "myDepartment"
}
},
"phases": {
"warm": {
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
}
}
},
"delete": {
"min_age": "30d",
"actions": {
"delete": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cbc2b5595890f87165aab1a741b1d22c.asciidoc 0000664 0000000 0000000 00000001540 15176617013 0026477 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/downsampling-manual.asciidoc:224
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-timestamp-pipeline",
description="Shifts the @timestamp to the last 15 minutes",
processors=[
{
"set": {
"field": "ingest_time",
"value": "{{_ingest.timestamp}}"
}
},
{
"script": {
"lang": "painless",
"source": "\n def delta = ChronoUnit.SECONDS.between(\n ZonedDateTime.parse(\"2022-06-21T15:49:00Z\"),\n ZonedDateTime.parse(ctx[\"ingest_time\"])\n );\n ctx[\"@timestamp\"] = ZonedDateTime.parse(ctx[\"@timestamp\"]).plus(delta,ChronoUnit.SECONDS).toString();\n "
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cbfd6f23f8283e64ec3157c65bb722c4.asciidoc 0000664 0000000 0000000 00000000265 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat.asciidoc:218
[source, python]
----
resp = client.cat.templates(
v=True,
s="order:desc,index_patterns",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cc0cca5556ec6224c7134c233734beed.asciidoc 0000664 0000000 0000000 00000000233 15176617013 0026552 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/getting-started.asciidoc:132
[source, python]
----
resp = client.cluster.remote_info()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cc56be758d5d75febbd975786187c861.asciidoc 0000664 0000000 0000000 00000000356 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-service-token.asciidoc:103
[source, python]
----
resp = client.security.create_service_token(
namespace="elastic",
service="fleet-server",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cc5eefcc2102aae7e87b0c87b4af10b8.asciidoc 0000664 0000000 0000000 00000001454 15176617013 0027061 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/multivalued-fields.asciidoc:54
[source, python]
----
resp = client.indices.create(
index="mv",
mappings={
"properties": {
"b": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="mv",
refresh=True,
operations=[
{
"index": {}
},
{
"a": 1,
"b": [
"foo",
"foo",
"bar"
]
},
{
"index": {}
},
{
"a": 2,
"b": [
"bar",
"bar"
]
}
],
)
print(resp1)
resp2 = client.esql.query(
query="FROM mv | LIMIT 2",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/cc7f1c74ede6810e2c9db19256d6b653.asciidoc 0000664 0000000 0000000 00000000455 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/common-script-uses.asciidoc:193
[source, python]
----
resp = client.search(
index="my-index",
query={
"match": {
"http.response": "304"
}
},
fields=[
"http.response"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cc90639f2e65bd89cb73296cac6135cf.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026607 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/delete-trained-models.asciidoc:60
[source, python]
----
resp = client.ml.delete_trained_model(
model_id="regression-job-one-1574775307356",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cc9dac8db7a1482e2fbe3235197c3de1.asciidoc 0000664 0000000 0000000 00000000715 15176617013 0026732 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/restore-snapshot-api.asciidoc:248
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="snapshot_2",
wait_for_completion=True,
indices="index_1,index_2",
ignore_unavailable=True,
include_global_state=False,
rename_pattern="index_(.+)",
rename_replacement="restored_index_$1",
include_aliases=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ccc613951c61f0b17e1ed8a2d3ae54a2.asciidoc 0000664 0000000 0000000 00000003320 15176617013 0026626 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ccec66fb20d5ede6c691e0890cfe402a.asciidoc 0000664 0000000 0000000 00000000342 15176617013 0027007 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-job.asciidoc:91
[source, python]
----
resp = client.ml.delete_job(
job_id="total-requests",
wait_for_completion=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ccf84c1e5e5602a9e841cb8f7e3bb29f.asciidoc 0000664 0000000 0000000 00000000743 15176617013 0026750 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/standard-analyzer.asciidoc:284
[source, python]
----
resp = client.indices.create(
index="standard_example",
settings={
"analysis": {
"analyzer": {
"rebuilt_standard": {
"tokenizer": "standard",
"filter": [
"lowercase"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cd16538654e0f834ff19fe6cf329c398.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026470 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:65
[source, python]
----
resp = client.indices.create(
index="hugging-face-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 768,
"element_type": "float"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cd373a6eb1ef4748616500b26fab3006.asciidoc 0000664 0000000 0000000 00000000722 15176617013 0026415 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/async-search.asciidoc:21
[source, python]
----
resp = client.async_search.submit(
index="sales*",
size="0",
sort=[
{
"date": {
"order": "asc"
}
}
],
aggs={
"sale_date": {
"date_histogram": {
"field": "date",
"calendar_interval": "1d"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cd38c601ab293a6ec0e2df71d0c96b58.asciidoc 0000664 0000000 0000000 00000001306 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template.asciidoc:353
[source, python]
----
resp = client.cluster.put_component_template(
name="template_with_2_shards",
template={
"settings": {
"index.number_of_shards": 2
}
},
)
print(resp)
resp1 = client.cluster.put_component_template(
name="template_with_3_shards",
template={
"settings": {
"index.number_of_shards": 3
}
},
)
print(resp1)
resp2 = client.indices.put_index_template(
name="template_1",
index_patterns=[
"t*"
],
composed_of=[
"template_with_2_shards",
"template_with_3_shards"
],
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/cd67ad2c09fafef2d441c3502d0bb3d7.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0026774 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/apis/put-lifecycle.asciidoc:84
[source, python]
----
resp = client.indices.put_data_lifecycle(
name="my-data-stream",
data_retention="7d",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cd6eee201a233b989ac1f2794fa6d640.asciidoc 0000664 0000000 0000000 00000001001 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1107
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
filter_path="-hits.events._source",
runtime_mappings={
"day_of_week": {
"type": "keyword",
"script": "emit(doc['@timestamp'].value.dayOfWeekEnum.toString())"
}
},
query="\n process where process.name == \"regsvr32.exe\"\n ",
fields=[
"@timestamp",
"day_of_week"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cd6fa7f63c93bb04824acd3a7d1f8de3.asciidoc 0000664 0000000 0000000 00000001563 15176617013 0027017 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-not-query.asciidoc:13
[source, python]
----
resp = client.search(
query={
"span_not": {
"include": {
"span_term": {
"field1": "hoya"
}
},
"exclude": {
"span_near": {
"clauses": [
{
"span_term": {
"field1": "la"
}
},
{
"span_term": {
"field1": "hoya"
}
}
],
"slop": 0,
"in_order": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cd7da0c3769682f546cc1888e569382e.asciidoc 0000664 0000000 0000000 00000001007 15176617013 0026405 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:776
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match_phrase": {
"message": "number 1"
}
},
highlight={
"fields": {
"message": {
"type": "plain",
"fragment_size": 15,
"number_of_fragments": 3,
"fragmenter": "span"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cd8006165ac64f1ef99af48e5a35a25b.asciidoc 0000664 0000000 0000000 00000000332 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-app-privileges.asciidoc:64
[source, python]
----
resp = client.security.get_privileges(
application="myapp",
name="read",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cd93919e13f656ad2e6629f45c579b93.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026405 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shard-stores.asciidoc:120
[source, python]
----
resp = client.indices.shard_stores(
index="test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cda045dfd79acd160ed8668f2ee17ea7.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0027024 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/term-query.asciidoc:170
[source, python]
----
resp = client.search(
index="my-index-000001",
pretty=True,
query={
"match": {
"full_text": "Quick Brown Foxes!"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cdb68b3f565df7c85e52a55864b37d40.asciidoc 0000664 0000000 0000000 00000000471 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:364
[source, python]
----
resp = client.indices.create(
index="my-new-index-000001",
mappings={
"properties": {
"user_id": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cdb7613b445e6ed6e8b473f9cae1af90.asciidoc 0000664 0000000 0000000 00000001707 15176617013 0026747 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/cdc04e6d3d37f036c7045ee4a582ef06.asciidoc 0000664 0000000 0000000 00000001367 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:610
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"strings_as_keywords": {
"match_mapping_type": "string",
"mapping": {
"type": "text",
"norms": False,
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cdc38c98320a0df705ec8d173c725375.asciidoc 0000664 0000000 0000000 00000000532 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-grid-query.asciidoc:287
[source, python]
----
resp = client.search(
index="my_locations",
size=0,
aggs={
"grouped": {
"geohex_grid": {
"field": "location",
"precision": 1
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cdce7bc083dfb36e6f1d465a5c9d5049.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026743 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connector-sync-jobs-api.asciidoc:56
[source, python]
----
resp = client.perform_request(
"GET",
"/_connector/_sync_job",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cdd29b01e730b3996de68a2788050021.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026266 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/enrich/delete-enrich-policy.asciidoc:42
[source, python]
----
resp = client.enrich.delete_policy(
name="my-policy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cdd7127681254f4d614cc075f9e6fbcf.asciidoc 0000664 0000000 0000000 00000000425 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:427
[source, python]
----
resp = client.delete_by_query(
index="my-index-000001",
query={
"term": {
"user.id": "kimchy"
}
},
max_docs=1,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cde19d110a58317610033ea3dcb0eb80.asciidoc 0000664 0000000 0000000 00000001473 15176617013 0026461 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:737
[source, python]
----
resp = client.render_search_template(
source="\n {\n \"query\": {\n \"match\": {\n {{#query_message}}\n {{#query_string}}\n \"message\": \"Hello {{#first_name_section}}{{first_name}}{{/first_name_section}} {{#last_name_section}}{{last_name}}{{/last_name_section}}\"\n {{/query_string}}\n {{/query_message}}\n }\n }\n }\n ",
params={
"query_message": {
"query_string": {
"first_name_section": {
"first_name": "John"
},
"last_name_section": {
"last_name": "kimchy"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cde4104a29dfe942d55863cdd8718627.asciidoc 0000664 0000000 0000000 00000000254 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/start-slm.asciidoc:76
[source, python]
----
resp = client.slm.get_status()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cdf400299acd1c7b1b7bb42e284e3d08.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0026634 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:141
[source, python]
----
resp = client.update(
index="test",
id="1",
script={
"source": "ctx._source.tags.add(params.tag)",
"lang": "painless",
"params": {
"tag": "blue"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cdfd4fef983c1c0fe8d7417f67d01eae.asciidoc 0000664 0000000 0000000 00000000375 15176617013 0027114 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/red-yellow-cluster-status.asciidoc:157
[source, python]
----
resp = client.indices.put_settings(
settings={
"index.number_of_replicas": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce0a1aba713b0448b0c6a504af7b3a08.asciidoc 0000664 0000000 0000000 00000000240 15176617013 0026601 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:339
[source, python]
----
resp = client.slm.get_stats()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce0c3d7330727f7673cf68fc9a1cfb86.asciidoc 0000664 0000000 0000000 00000000267 15176617013 0026616 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/clearcache.asciidoc:17
[source, python]
----
resp = client.indices.clear_cache(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce247fc08371e1b30cb52195e521c076.asciidoc 0000664 0000000 0000000 00000001324 15176617013 0026335 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:219
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_bounding_box": {
"pin.location": {
"top_left": [
-74.1,
40.73
],
"bottom_right": [
-71.12,
40.01
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce2c2e8f5a2e4daf051b6e10122e5aae.asciidoc 0000664 0000000 0000000 00000000614 15176617013 0026762 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:519
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"text_embedding": {
"type": "dense_vector",
"dims": 384,
"index_options": {
"type": "int4_hnsw"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce3c391c2b1915cfc44a2917bca71d19.asciidoc 0000664 0000000 0000000 00000001035 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/put-dfanalytics.asciidoc:650
[source, python]
----
resp = client.ml.put_data_frame_analytics(
id="loganalytics",
description="Outlier detection on log data",
source={
"index": "logdata"
},
dest={
"index": "logdata_out"
},
analysis={
"outlier_detection": {
"compute_feature_influence": True,
"outlier_fraction": 0.05,
"standardization_enabled": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce725697f93b3eebb3a266314568565a.asciidoc 0000664 0000000 0000000 00000001073 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/fingerprint-analyzer.asciidoc:159
[source, python]
----
resp = client.indices.create(
index="fingerprint_example",
settings={
"analysis": {
"analyzer": {
"rebuilt_fingerprint": {
"tokenizer": "standard",
"filter": [
"lowercase",
"asciifolding",
"fingerprint"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce8471d31e5d60309e142feb040fd2f8.asciidoc 0000664 0000000 0000000 00000000247 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/query-watches.asciidoc:73
[source, python]
----
resp = client.watcher.query_watches()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce899fcf55da72fc32e623d1ad88b301.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/ignore-missing-component-templates.asciidoc:72
[source, python]
----
resp = client.cluster.put_component_template(
name="logs-foo_component2",
template={
"mappings": {
"properties": {
"host.ip": {
"type": "ip"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ce8eebfb810335803630abe83278bee7.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0026601 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:253
[source, python]
----
resp = client.security.get_api_key(
active_only=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cecfaa659af6646b3b67d7b311586fa0.asciidoc 0000664 0000000 0000000 00000002165 15176617013 0026661 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/attachment.asciidoc:396
[source, python]
----
resp = client.ingest.put_pipeline(
id="attachment",
description="Extract attachment information from arrays",
processors=[
{
"foreach": {
"field": "attachments",
"processor": {
"attachment": {
"target_field": "_ingest._value.attachment",
"field": "_ingest._value.data",
"remove_binary": True
}
}
}
}
],
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="my_id",
pipeline="attachment",
document={
"attachments": [
{
"filename": "ipsum.txt",
"data": "dGhpcyBpcwpqdXN0IHNvbWUgdGV4dAo="
},
{
"filename": "test.txt",
"data": "VGhpcyBpcyBhIHRlc3QK"
}
]
},
)
print(resp1)
resp2 = client.get(
index="my-index-000001",
id="my_id",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc 0000664 0000000 0000000 00000000600 15176617013 0026464 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-elser.asciidoc:157
[source, python]
----
resp = client.inference.put(
task_type="sparse_embedding",
inference_id="my-elser-model",
inference_config={
"service": "elser",
"service_settings": {
"num_allocations": 1,
"num_threads": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cee491dd0a8d10ed0cb11a2faa0c99f0.asciidoc 0000664 0000000 0000000 00000001020 15176617013 0027031 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/infer-trained-model.asciidoc:1185
[source, python]
----
resp = client.ml.infer_trained_model(
model_id="model2",
docs=[
{
"text_field": "The Amazon rainforest covers most of the Amazon basin in South America"
}
],
inference_config={
"ner": {
"tokenization": {
"bert": {
"truncate": "first"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cee591c1fc70d4f180c623a3a6d07755.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-tokens.asciidoc:78
[source, python]
----
resp = client.security.get_token(
grant_type="client_credentials",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cf23f18761df33f08bc6f6d1875496fd.asciidoc 0000664 0000000 0000000 00000000453 15176617013 0026541 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:399
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"routing.allocation.total_shards_per_node": 5
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cf47cd4a39cd62a3ecad919e54a67bca.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0027073 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/ignored-field.asciidoc:36
[source, python]
----
resp = client.search(
query={
"term": {
"_ignored": "@timestamp"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cf5dab4334783ca9b8942eab68fb7174.asciidoc 0000664 0000000 0000000 00000002171 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/nested-aggregation.asciidoc:114
[source, python]
----
resp = client.search(
index="products",
size="0",
query={
"match": {
"name": "led tv"
}
},
aggs={
"resellers": {
"nested": {
"path": "resellers"
},
"aggs": {
"filter_reseller": {
"filter": {
"bool": {
"filter": [
{
"term": {
"resellers.reseller": "companyB"
}
}
]
}
},
"aggs": {
"min_price": {
"min": {
"field": "resellers.price"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cf75a880c749a2f2010a8ec3f348e5c3.asciidoc 0000664 0000000 0000000 00000000450 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1391
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
keep_on_completion=True,
wait_for_completion_timeout="2s",
query="\n process where process.name == \"cmd.exe\"\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cf8ca470156698dbf47fdc822d0a714f.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/get-desired-nodes.asciidoc:70
[source, python]
----
resp = client.perform_request(
"GET",
"/_internal/desired_nodes/_latest",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cf9f51d719a2e90ffe36ed6fe56a4a69.asciidoc 0000664 0000000 0000000 00000001027 15176617013 0026761 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:83
[source, python]
----
resp = client.security.put_role(
name="remote-replication",
cluster=[
"manage_ccr"
],
indices=[
{
"names": [
"follower-index-name"
],
"privileges": [
"monitor",
"read",
"write",
"manage_follow_index"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cfad3631be0634ee49c424f9ccec62d9.asciidoc 0000664 0000000 0000000 00000000306 15176617013 0026735 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-api-keys.asciidoc:174
[source, python]
----
resp = client.security.invalidate_api_key(
owner=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cfd4b34f35e531a20739a3b308d57134.asciidoc 0000664 0000000 0000000 00000000637 15176617013 0026344 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:199
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_docs": 100000000
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/cffce059425d3d21e7f9571500d63524.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/delete-roles.asciidoc:46
[source, python]
----
resp = client.security.delete_role(
name="my_admin_role",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d003ee256d24aa6000bd9dbf1d608dc5.asciidoc 0000664 0000000 0000000 00000001036 15176617013 0026623 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-search-elser.asciidoc:78
[source, python]
----
resp = client.ingest.put_pipeline(
id="elser-v2-test",
processors=[
{
"inference": {
"model_id": ".elser_model_2",
"input_output": [
{
"input_field": "content",
"output_field": "content_embedding"
}
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d003f9110e5a474230abe11f36da9297.asciidoc 0000664 0000000 0000000 00000001133 15176617013 0026327 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/redact.asciidoc:50
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"description": "Hide my IP",
"processors": [
{
"redact": {
"field": "message",
"patterns": [
"%{IP:client}"
]
}
}
]
},
docs=[
{
"_source": {
"message": "55.3.244.1 GET /index.html 15824 0.043"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d01d309b0257d6fbca6d0941adeb3256.asciidoc 0000664 0000000 0000000 00000001620 15176617013 0026547 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/simulate-index.asciidoc:151
[source, python]
----
resp = client.cluster.put_component_template(
name="ct1",
template={
"settings": {
"index.number_of_shards": 2
}
},
)
print(resp)
resp1 = client.cluster.put_component_template(
name="ct2",
template={
"settings": {
"index.number_of_replicas": 0
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
},
)
print(resp1)
resp2 = client.indices.put_index_template(
name="final-template",
index_patterns=[
"my-index-*"
],
composed_of=[
"ct1",
"ct2"
],
priority=5,
)
print(resp2)
resp3 = client.indices.simulate_index_template(
name="my-index-000001",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/d03139a851888db53f8b7affd85eb495.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026537 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/check-in-connector-api.asciidoc:75
[source, python]
----
resp = client.connector.check_in(
connector_id="my-connector",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d0378fe5e3aad05a2fd2e6e81213374f.asciidoc 0000664 0000000 0000000 00000002153 15176617013 0026565 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:331
[source, python]
----
resp = client.indices.create(
index="bulgarian_example",
settings={
"analysis": {
"filter": {
"bulgarian_stop": {
"type": "stop",
"stopwords": "_bulgarian_"
},
"bulgarian_keywords": {
"type": "keyword_marker",
"keywords": [
"пример"
]
},
"bulgarian_stemmer": {
"type": "stemmer",
"language": "bulgarian"
}
},
"analyzer": {
"rebuilt_bulgarian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"bulgarian_stop",
"bulgarian_keywords",
"bulgarian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d03b0e2f0f3f5ac8d53287c445007a89.asciidoc 0000664 0000000 0000000 00000000667 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/similarity.asciidoc:32
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"default_field": {
"type": "text"
},
"boolean_sim_field": {
"type": "text",
"similarity": "boolean"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc 0000664 0000000 0000000 00000002713 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// quickstart/getting-started.asciidoc:155
[source, python]
----
resp = client.bulk(
operations=[
{
"index": {
"_index": "books"
}
},
{
"name": "Revelation Space",
"author": "Alastair Reynolds",
"release_date": "2000-03-15",
"page_count": 585
},
{
"index": {
"_index": "books"
}
},
{
"name": "1984",
"author": "George Orwell",
"release_date": "1985-06-01",
"page_count": 328
},
{
"index": {
"_index": "books"
}
},
{
"name": "Fahrenheit 451",
"author": "Ray Bradbury",
"release_date": "1953-10-15",
"page_count": 227
},
{
"index": {
"_index": "books"
}
},
{
"name": "Brave New World",
"author": "Aldous Huxley",
"release_date": "1932-06-01",
"page_count": 268
},
{
"index": {
"_index": "books"
}
},
{
"name": "The Handmaids Tale",
"author": "Margaret Atwood",
"release_date": "1985-06-01",
"page_count": 311
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d050c6fa7d806457a5f32d30b07e9521.asciidoc 0000664 0000000 0000000 00000001121 15176617013 0026335 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:504
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"dot_expander": {
"description": "Expand 'my-object-field.my-property'",
"field": "my-object-field.my-property"
}
},
{
"set": {
"description": "Set 'my-object-field.my-property' to 10",
"field": "my-object-field.my-property",
"value": 10
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d0546f047359b85a7e98207dc8de896a.asciidoc 0000664 0000000 0000000 00000001342 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/coerce.asciidoc:60
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index.mapping.coerce": False
},
mappings={
"properties": {
"number_one": {
"type": "integer",
"coerce": True
},
"number_two": {
"type": "integer"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"number_one": "10"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"number_two": "10"
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/d05b2a37106fce0ebbd41e2fd6bd26c2.asciidoc 0000664 0000000 0000000 00000002734 15176617013 0026770 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/min-aggregation.asciidoc:126
[source, python]
----
resp = client.indices.create(
index="metrics_index",
mappings={
"properties": {
"latency_histo": {
"type": "histogram"
}
}
},
)
print(resp)
resp1 = client.index(
index="metrics_index",
id="1",
refresh=True,
document={
"network.name": "net-1",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
3,
7,
23,
12,
6
]
}
},
)
print(resp1)
resp2 = client.index(
index="metrics_index",
id="2",
refresh=True,
document={
"network.name": "net-2",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
8,
17,
8,
7,
6
]
}
},
)
print(resp2)
resp3 = client.search(
index="metrics_index",
size="0",
filter_path="aggregations",
aggs={
"min_latency": {
"min": {
"field": "latency_histo"
}
}
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/d06a649bc38aa9a6433b64efa78d8cb5.asciidoc 0000664 0000000 0000000 00000003367 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/common-script-uses.asciidoc:52
[source, python]
----
resp = client.bulk(
index="my-index",
refresh=True,
operations=[
{
"index": {}
},
{
"timestamp": "2020-04-30T14:30:17-05:00",
"message": "40.135.0.0 - - [30/Apr/2020:14:30:17 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:30:53-05:00",
"message": "232.0.0.0 - - [30/Apr/2020:14:30:53 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:12-05:00",
"message": "26.1.0.0 - - [30/Apr/2020:14:31:12 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:19-05:00",
"message": "247.37.0.0 - - [30/Apr/2020:14:31:19 -0500] \"GET /french/splash_inet.html HTTP/1.0\" 200 3781"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:22-05:00",
"message": "247.37.0.0 - - [30/Apr/2020:14:31:22 -0500] \"GET /images/hm_nbg.jpg HTTP/1.0\" 304 0"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:27-05:00",
"message": "252.0.0.0 - - [30/Apr/2020:14:31:27 -0500] \"GET /images/hm_bg.jpg HTTP/1.0\" 200 24736"
},
{
"index": {}
},
{
"timestamp": "2020-04-30T14:31:28-05:00",
"message": "not a valid apache log"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d095b422d9803c02b62c01adffc85376.asciidoc 0000664 0000000 0000000 00000000250 15176617013 0026416 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/get-job.asciidoc:94
[source, python]
----
resp = client.rollup.get_jobs(
id="sensor",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d0dee031197214b59ff9ac7540527d2c.asciidoc 0000664 0000000 0000000 00000001434 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:43
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_movfn": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "MovingFunctions.unweightedAvg(values)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d0fad375f6e074e9067ed93d3faa07bd.asciidoc 0000664 0000000 0000000 00000004064 15176617013 0026743 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/cartesian-bounds-aggregation.asciidoc:12
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "point"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"location": "POINT (491.2350 5237.4081)",
"city": "Amsterdam",
"name": "NEMO Science Museum"
},
{
"index": {
"_id": 2
}
},
{
"location": "POINT (490.1618 5236.9219)",
"city": "Amsterdam",
"name": "Museum Het Rembrandthuis"
},
{
"index": {
"_id": 3
}
},
{
"location": "POINT (491.4722 5237.1667)",
"city": "Amsterdam",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {
"_id": 4
}
},
{
"location": "POINT (440.5200 5122.2900)",
"city": "Antwerp",
"name": "Letterenhuis"
},
{
"index": {
"_id": 5
}
},
{
"location": "POINT (233.6389 4886.1111)",
"city": "Paris",
"name": "Musée du Louvre"
},
{
"index": {
"_id": 6
}
},
{
"location": "POINT (232.7000 4886.0000)",
"city": "Paris",
"name": "Musée d'Orsay"
}
],
)
print(resp1)
resp2 = client.search(
index="museums",
size="0",
query={
"match": {
"name": "musée"
}
},
aggs={
"viewport": {
"cartesian_bounds": {
"field": "location"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/d0fde00ef381e61b8a9e99f18cb5970a.asciidoc 0000664 0000000 0000000 00000000453 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/simple-query-string-query.asciidoc:181
[source, python]
----
resp = client.search(
query={
"simple_query_string": {
"query": "foo | bar + baz*",
"flags": "OR|AND|PREFIX"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d11ea753a5d86f7e630fd69a069948b1.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:168
[source, python]
----
resp = client.sql.query(
format="json",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d1299b9ae1e621d2fdd0b8644c142ace.asciidoc 0000664 0000000 0000000 00000002126 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/categorize-text-aggregation.asciidoc:334
[source, python]
----
resp = client.search(
index="log-messages",
filter_path="aggregations",
aggs={
"daily": {
"date_histogram": {
"field": "time",
"fixed_interval": "1d"
},
"aggs": {
"categories": {
"categorize_text": {
"field": "message",
"categorization_filters": [
"\\w+\\_\\d{3}"
]
},
"aggs": {
"hit": {
"top_hits": {
"size": 1,
"sort": [
"time"
],
"_source": "message"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d12df43ffcdcd937bae9b26fb475e239.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0027017 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/uaxurlemail-tokenizer.asciidoc:14
[source, python]
----
resp = client.indices.analyze(
tokenizer="uax_url_email",
text="Email me at john.smith@global-international.com",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d133b5d82238f7d4778c341cbe0bc969.asciidoc 0000664 0000000 0000000 00000000705 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-termvectors.asciidoc:141
[source, python]
----
resp = client.mtermvectors(
docs=[
{
"_index": "my-index-000001",
"doc": {
"message": "test test test"
}
},
{
"_index": "my-index-000001",
"doc": {
"message": "Another test ..."
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d13c7cdfc976e0c7b70737cd6a7becb8.asciidoc 0000664 0000000 0000000 00000001517 15176617013 0027027 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/rate-aggregation.asciidoc:411
[source, python]
----
resp = client.search(
index="sales",
size=0,
runtime_mappings={
"price.adjusted": {
"type": "double",
"script": {
"source": "emit(doc['price'].value * params.adjustment)",
"params": {
"adjustment": 0.9
}
}
}
},
aggs={
"by_date": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"avg_price": {
"rate": {
"field": "price.adjusted"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d14fe5838fc02224f4b5ade2626d6026.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/apis/explain.asciidoc:106
[source, python]
----
resp = client.ilm.explain_lifecycle(
index="my-index-000001",
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d1b53bc9794e8609bd6f2245624bf977.asciidoc 0000664 0000000 0000000 00000001306 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/estimate-model-memory.asciidoc:60
[source, python]
----
resp = client.ml.estimate_model_memory(
analysis_config={
"bucket_span": "5m",
"detectors": [
{
"function": "sum",
"field_name": "bytes",
"by_field_name": "status",
"partition_field_name": "app"
}
],
"influencers": [
"source_ip",
"dest_ip"
]
},
overall_cardinality={
"status": 10,
"app": 50
},
max_bucket_cardinality={
"source_ip": 300,
"dest_ip": 30
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d1ce66957f8bd84bf01c4bfaee3ba0c3.asciidoc 0000664 0000000 0000000 00000000473 15176617013 0027072 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:974
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
filter_path="hits.events._source.@timestamp,hits.events._source.process.pid",
query="\n process where process.name == \"regsvr32.exe\"\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d1d8b6e642db1a7c70dbbf0fe6d8e92d.asciidoc 0000664 0000000 0000000 00000003433 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/sparse-vector-query.asciidoc:195
[source, python]
----
resp = client.search(
index="my-index",
retriever={
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"multi_match": {
"query": "How is the weather in Jamaica?",
"fields": [
"title",
"description"
]
}
}
}
},
{
"standard": {
"query": {
"sparse_vector": {
"field": "ml.inference.title_expanded.predicted_value",
"inference_id": "my-elser-model",
"query": "How is the weather in Jamaica?",
"boost": 1
}
}
}
},
{
"standard": {
"query": {
"sparse_vector": {
"field": "ml.inference.description_expanded.predicted_value",
"inference_id": "my-elser-model",
"query": "How is the weather in Jamaica?",
"boost": 1
}
}
}
}
],
"window_size": 10,
"rank_constant": 20
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d1e0fee64389e7c8d4c092030626b61f.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:215
[source, python]
----
resp = client.security.get_api_key(
name="my-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d1ea13e1e8372cbf1480a414723ff55a.asciidoc 0000664 0000000 0000000 00000001457 15176617013 0026503 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/d1ecce3632ae338b5e329b0e5ff3bed7.asciidoc 0000664 0000000 0000000 00000000711 15176617013 0027006 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:382
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_join_field": {
"type": "join",
"relations": {
"question": "answer"
},
"eager_global_ordinals": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d1fde25de1980b7e84fa878289fd0bcb.asciidoc 0000664 0000000 0000000 00000000355 15176617013 0026756 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:660
[source, python]
----
resp = client.search(
index="my-index-000001",
size="0",
q="extra:test",
filter_path="hits.total",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d23452f333b77bf5b463310e2a665560.asciidoc 0000664 0000000 0000000 00000001047 15176617013 0026202 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/run-as-privilege.asciidoc:51
[source, python]
----
resp = client.security.put_role(
name="my_director",
refresh=True,
cluster=[
"manage"
],
indices=[
{
"names": [
"index1",
"index2"
],
"privileges": [
"manage"
]
}
],
run_as=[
"jacknich",
"rdeniro"
],
metadata={
"version": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d260225cf97e068ead2a8a6bb5aefd90.asciidoc 0000664 0000000 0000000 00000002130 15176617013 0026724 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1551
[source, python]
----
resp = client.indices.create(
index="russian_example",
settings={
"analysis": {
"filter": {
"russian_stop": {
"type": "stop",
"stopwords": "_russian_"
},
"russian_keywords": {
"type": "keyword_marker",
"keywords": [
"пример"
]
},
"russian_stemmer": {
"type": "stemmer",
"language": "russian"
}
},
"analyzer": {
"rebuilt_russian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"russian_stop",
"russian_keywords",
"russian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d268aec16bb1eb909b634e856175094c.asciidoc 0000664 0000000 0000000 00000001245 15176617013 0026441 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/stop-analyzer.asciidoc:133
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_stop_analyzer": {
"type": "stop",
"stopwords": [
"the",
"over"
]
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_stop_analyzer",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/d27591881da6f5767523b1beb233adc7.asciidoc 0000664 0000000 0000000 00000000366 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-azure.asciidoc:87
[source, python]
----
resp = client.snapshot.create_repository(
name="my_backup",
repository={
"type": "azure"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d2e7dead222cfbebbd2c21a7cc1893b4.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0027131 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/d2f52c106685bd8eab47e11d644d7a70.asciidoc 0000664 0000000 0000000 00000001452 15176617013 0026510 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/date.asciidoc:41
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"date": {
"type": "date"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"date": "2015-01-01"
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"date": "2015-01-01T12:10:30Z"
},
)
print(resp2)
resp3 = client.index(
index="my-index-000001",
id="3",
document={
"date": 1420070400001
},
)
print(resp3)
resp4 = client.search(
index="my-index-000001",
sort={
"date": "asc"
},
)
print(resp4)
----
python-elasticsearch-9.4.0/docs/examples/d2f6040c058a9555dfa62bb42d896a8f.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:513
[source, python]
----
resp = client.search(
index="my_queries1",
query={
"percolate": {
"field": "query",
"document": {
"my_field": "abcd"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d2f6fb271e97fde8685d7744e6718cc7.asciidoc 0000664 0000000 0000000 00000000437 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc:234
[source, python]
----
resp = client.index(
index="text_payloads",
id="1",
document={
"text": "the|0 brown|3 fox|4 is|0 quick|10"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d305110a8cabfbebd1e38d85559d1023.asciidoc 0000664 0000000 0000000 00000003467 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:436
[source, python]
----
resp = client.indices.create(
index="cjk_example",
settings={
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": [
"a",
"and",
"are",
"as",
"at",
"be",
"but",
"by",
"for",
"if",
"in",
"into",
"is",
"it",
"no",
"not",
"of",
"on",
"or",
"s",
"such",
"t",
"that",
"the",
"their",
"then",
"there",
"these",
"they",
"this",
"to",
"was",
"will",
"with",
"www"
]
}
},
"analyzer": {
"rebuilt_cjk": {
"tokenizer": "standard",
"filter": [
"cjk_width",
"lowercase",
"cjk_bigram",
"english_stop"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d3263afc69b6f969b9bbd8738cd07b97.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/post-pause-follow.asciidoc:73
[source, python]
----
resp = client.ccr.pause_follow(
index="follower_index",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d3440ec81dde5f1a01c0206cb35e539c.asciidoc 0000664 0000000 0000000 00000000601 15176617013 0026542 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-reindex.asciidoc:106
[source, python]
----
resp = client.reindex(
wait_for_completion=False,
source={
"index": "test-data",
"size": 50
},
dest={
"index": "azure-openai-embeddings",
"pipeline": "azure_openai_embeddings_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d34946f59b6f938b141a37cb0b729308.asciidoc 0000664 0000000 0000000 00000000572 15176617013 0026310 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/geo-match-enrich-policy-type-ex.asciidoc:58
[source, python]
----
resp = client.enrich.put_policy(
name="postal_policy",
geo_match={
"indices": "postal_codes",
"match_field": "location",
"enrich_fields": [
"location",
"postal_code"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d35a4d78a8b70c9e4d636efb0a92be9d.asciidoc 0000664 0000000 0000000 00000000776 15176617013 0026756 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/multi-terms-aggregation.asciidoc:61
[source, python]
----
resp = client.search(
index="products",
aggs={
"genres_and_products": {
"multi_terms": {
"terms": [
{
"field": "genre"
},
{
"field": "product"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d35c8cf7a98b3f112e1de8797ec6689d.asciidoc 0000664 0000000 0000000 00000000427 15176617013 0026633 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/oidc-prepare-authentication-api.asciidoc:134
[source, python]
----
resp = client.security.oidc_prepare_authentication(
iss="http://127.0.0.1:8080",
login_hint="this_is_an_opaque_string",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d3672a87a857ddb87519788236e57497.asciidoc 0000664 0000000 0000000 00000001367 15176617013 0026212 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/d37b065a94b3ff65a2a8a204fc3b097c.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1324
[source, python]
----
resp = client.eql.get_status(
id="FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d37b0bda2bd24ab310e6b26708c7c6fb.asciidoc 0000664 0000000 0000000 00000001452 15176617013 0026706 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/movfn-aggregation.asciidoc:144
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_date_histo": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M"
},
"aggs": {
"the_sum": {
"sum": {
"field": "price"
}
},
"the_movavg": {
"moving_fn": {
"buckets_path": "the_sum",
"window": 10,
"script": "return values.length > 0 ? values[0] : Double.NaN"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d3a0f648d0fd50b54a4e9ebe363c5047.asciidoc 0000664 0000000 0000000 00000002651 15176617013 0026571 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/d3a5b70d493e0bd77b3f2b586341c83c.asciidoc 0000664 0000000 0000000 00000001052 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1635
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
runtime={
"http.responses": {
"type": "long",
"script": "\n String response=dissect('%{clientip} %{ident} %{auth} [%{@timestamp}] \"%{verb} %{request} HTTP/%{httpversion}\" %{response} %{size}').extract(doc[\"message\"].value)?.response;\n if (response != null) emit(Integer.parseInt(response));\n "
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d3d117fec34301520ccdb26332e7c98a.asciidoc 0000664 0000000 0000000 00000000774 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/registered-domain.asciidoc:35
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"registered_domain": {
"field": "fqdn",
"target_field": "url"
}
}
]
},
docs=[
{
"_source": {
"fqdn": "www.example.ac.uk"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d3dccdb15822e971ededb9f6f7d8ada1.asciidoc 0000664 0000000 0000000 00000000531 15176617013 0027160 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:354
[source, python]
----
resp = client.search(
query={
"query_string": {
"fields": [
"content",
"name.*^5"
],
"query": "this AND that OR thus"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d3e5edac5b461020017fd9d8ec7a91fa.asciidoc 0000664 0000000 0000000 00000001301 15176617013 0026716 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/managing-roles.asciidoc:262
[source, python]
----
resp = client.security.put_role(
name="clicks_admin",
run_as=[
"clicks_watcher_1"
],
cluster=[
"monitor"
],
indices=[
{
"names": [
"events-*"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"category",
"@timestamp",
"message"
]
},
"query": "{\"match\": {\"category\": \"click\"}}"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d3e9e1169c3514fd46e253cd8b5ae3cb.asciidoc 0000664 0000000 0000000 00000001432 15176617013 0026653 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/predicate-tokenfilter.asciidoc:102
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"my_script_filter"
]
}
},
"filter": {
"my_script_filter": {
"type": "predicate_token_filter",
"script": {
"source": "\n token.type.contains(\"ALPHANUM\")\n "
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d4158d486e7fee2702a14068b69e3b33.asciidoc 0000664 0000000 0000000 00000015720 15176617013 0026366 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/d4323be84152fa91abd76e966d4751dc.asciidoc 0000664 0000000 0000000 00000000454 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-api-key.asciidoc:474
[source, python]
----
resp = client.security.query_api_keys(
query={
"term": {
"name": {
"value": "application-key-1"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d443db2755fde3b49ca3a9d296c4a96f.asciidoc 0000664 0000000 0000000 00000001011 15176617013 0026656 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/delimited-payload-tokenfilter.asciidoc:120
[source, python]
----
resp = client.indices.create(
index="delimited_payload",
settings={
"analysis": {
"analyzer": {
"whitespace_delimited_payload": {
"tokenizer": "whitespace",
"filter": [
"delimited_payload"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d44ecc69090c0b2bc08a6cbc2e3467c5.asciidoc 0000664 0000000 0000000 00000000663 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significanttext-aggregation.asciidoc:153
[source, python]
----
resp = client.search(
index="news",
query={
"simple_query_string": {
"query": "+elasticsearch +pozmantier"
}
},
source=[
"title",
"source"
],
highlight={
"fields": {
"content": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d46e9739bbf25eb2f7225f58ab08b2a7.asciidoc 0000664 0000000 0000000 00000000502 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/saml-complete-logout-api.asciidoc:89
[source, python]
----
resp = client.security.saml_complete_logout(
realm="saml1",
ids=[
"_1c368075e0b3..."
],
content="PHNhbWxwOkxvZ291dFJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46...",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d48b274a4b6098ffef0c016c6c945fb9.asciidoc 0000664 0000000 0000000 00000000356 15176617013 0026612 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-tokens.asciidoc:222
[source, python]
----
resp = client.security.get_token(
grant_type="refresh_token",
refresh_token="vLBPvmAB6KvwvJZr27cS",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d49318764244113ad2ac4cc0f06d77ec.asciidoc 0000664 0000000 0000000 00000001061 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:1034
[source, python]
----
resp = client.indices.create(
index="image-index",
mappings={
"properties": {
"image-vector": {
"type": "dense_vector",
"dims": 3,
"similarity": "l2_norm",
"index_options": {
"type": "hnsw",
"m": 32,
"ef_construction": 100
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d4a41fb74b41b41a0ee114a2311f2815.asciidoc 0000664 0000000 0000000 00000000631 15176617013 0026367 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:245
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_age": "7d"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d4b405ef0302227e050ac8f0e39068e1.asciidoc 0000664 0000000 0000000 00000000603 15176617013 0026327 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/evaluate-dfanalytics.asciidoc:259
[source, python]
----
resp = client.ml.evaluate_data_frame(
index="my_analytics_dest_index",
evaluation={
"outlier_detection": {
"actual_field": "is_outlier",
"predicted_probability_field": "ml.outlier_score"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d4b50ae96e541c0031264a10f6afccbf.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026622 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-a-data-stream.asciidoc:336
[source, python]
----
resp = client.indices.migrate_to_data_stream(
name="my-time-series-data",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d4cdcf01014c75693b080c778071c1b5.asciidoc 0000664 0000000 0000000 00000000535 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/stats-aggregation.asciidoc:102
[source, python]
----
resp = client.search(
index="exams",
size="0",
aggs={
"grades_stats": {
"stats": {
"field": "grade",
"missing": 0
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d4d450f536d747d5ef5050d2d8c66f09.asciidoc 0000664 0000000 0000000 00000001364 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/validate.asciidoc:93
[source, python]
----
resp = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"user": {
"id": "kimchy"
},
"@timestamp": "2099-11-15T14:12:12",
"message": "trying out Elasticsearch"
},
{
"index": {
"_id": 2
}
},
{
"user": {
"id": "kimchi"
},
"@timestamp": "2099-11-15T14:12:13",
"message": "My user ID is similar to kimchy!"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d4df39f72d3a3b80cd4042f6a21c3f19.asciidoc 0000664 0000000 0000000 00000000445 15176617013 0026565 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/d4ef6ac034c4d42cb75d830ec69146e6.asciidoc 0000664 0000000 0000000 00000000345 15176617013 0026575 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/delete-auto-follow-pattern.asciidoc:75
[source, python]
----
resp = client.ccr.delete_auto_follow_pattern(
name="my_auto_follow_pattern",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d4fb482a51d67a1af48e429af6019a46.asciidoc 0000664 0000000 0000000 00000001216 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/index-sorting.asciidoc:40
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index": {
"sort.field": [
"username",
"date"
],
"sort.order": [
"asc",
"desc"
]
}
},
mappings={
"properties": {
"username": {
"type": "keyword",
"doc_values": True
},
"date": {
"type": "date"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d50b030edfe6d1128eb76aa5ba9d4e27.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026724 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/put-trained-models-aliases.asciidoc:99
[source, python]
----
resp = client.ml.put_trained_model_alias(
model_id="flight-delay-prediction-1580004349800",
model_alias="flight_delay_model",
reassign=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d5132d34ae922fa8e898889b627a1405.asciidoc 0000664 0000000 0000000 00000001514 15176617013 0026311 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/children-aggregation.asciidoc:95
[source, python]
----
resp = client.search(
index="child_example",
size="0",
aggs={
"top-tags": {
"terms": {
"field": "tags.keyword",
"size": 10
},
"aggs": {
"to-answers": {
"children": {
"type": "answer"
},
"aggs": {
"top-names": {
"terms": {
"field": "owner.display_name.keyword",
"size": 10
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d5242b1ab0213f25e5e0742032274ce6.asciidoc 0000664 0000000 0000000 00000001260 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/attachment.asciidoc:53
[source, python]
----
resp = client.ingest.put_pipeline(
id="attachment",
description="Extract attachment information",
processors=[
{
"attachment": {
"field": "data",
"remove_binary": True
}
}
],
)
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)
----
python-elasticsearch-9.4.0/docs/examples/d524db57be9f16abac5396895b9a2a59.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/resolve.asciidoc:53
[source, python]
----
resp = client.indices.resolve_index(
name="my-index-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d547d55efbf75374f6de1f224323bc73.asciidoc 0000664 0000000 0000000 00000001651 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/geo-grid.asciidoc:39
[source, python]
----
resp = client.indices.create(
index="geocells",
mappings={
"properties": {
"geocell": {
"type": "geo_shape"
}
}
},
)
print(resp)
resp1 = client.ingest.put_pipeline(
id="geotile2shape",
description="translate rectangular z/x/y geotile to bounding box",
processors=[
{
"geo_grid": {
"field": "geocell",
"tile_type": "geotile"
}
}
],
)
print(resp1)
resp2 = client.ingest.put_pipeline(
id="geohex2shape",
description="translate H3 cell to polygon",
processors=[
{
"geo_grid": {
"field": "geocell",
"tile_type": "geohex",
"target_format": "wkt"
}
}
],
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/d5533f08f5cc0479f07a46c761f0786b.asciidoc 0000664 0000000 0000000 00000000660 15176617013 0026370 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:327
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"counter": {
"type": "integer",
"store": False
},
"tags": {
"type": "keyword",
"store": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d56a9d89282df56adbbc34b91390ac17.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/get-auto-follow-pattern.asciidoc:55
[source, python]
----
resp = client.ccr.get_auto_follow_pattern(
name="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d59e9cc75814575aa5e275dbe262918c.asciidoc 0000664 0000000 0000000 00000000451 15176617013 0026455 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-grid-query.asciidoc:119
[source, python]
----
resp = client.search(
index="my_locations",
query={
"geo_grid": {
"location": {
"geohash": "u0"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d5abaf1fd26f0abf410dd8827d077bbf.asciidoc 0000664 0000000 0000000 00000000377 15176617013 0027067 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:173
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"match_all": {}
},
sort=[
"my_id"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d5bf9bc08f622ece98632a14a3982e27.asciidoc 0000664 0000000 0000000 00000000504 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:770
[source, python]
----
resp = client.search(
query={
"match_all": {}
},
script_fields={
"test1": {
"script": "params['_source']['message']"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d5d0ecf75843ddb5f92cfebd089e53e9.asciidoc 0000664 0000000 0000000 00000000503 15176617013 0027035 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:748
[source, python]
----
resp = client.reindex(
source={
"index": "my-index-000001",
"_source": [
"user.id",
"_doc"
]
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d5dcddc6398b473b6ad9bce5c6adf986.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0027117 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:435
[source, python]
----
resp = client.search(
scroll="1m",
sort=[
"_doc"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d5ead6aacbfbedc8396f87bb34acc880.asciidoc 0000664 0000000 0000000 00000000347 15176617013 0027242 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/get-async-eql-search-api.asciidoc:20
[source, python]
----
resp = client.eql.get(
id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d603e76ab70131f7ec6b08758f95a0e3.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/recovery.asciidoc:148
[source, python]
----
resp = client.cat.recovery(
v=True,
h="i,s,t,ty,st,rep,snap,f,fp,b,bp",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d64679f8a53928fe9958dbe5ee5d9d13.asciidoc 0000664 0000000 0000000 00000001303 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:280
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"parent_id": {
"type": "answer",
"id": "1"
}
},
aggs={
"parents": {
"terms": {
"field": "my_join_field#question",
"size": 10
}
}
},
runtime_mappings={
"parent": {
"type": "long",
"script": "\n emit(Integer.parseInt(doc['my_join_field#question'].value)) \n "
}
},
fields=[
{
"field": "parent"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d64d509440afbed7cefd04b6898962eb.asciidoc 0000664 0000000 0000000 00000001053 15176617013 0026670 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-distance-query.asciidoc:100
[source, python]
----
resp = client.search(
index="my_geoshapes",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "200km",
"pin.location": {
"lat": 40,
"lon": -70
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d66e2b4d1931bf88c72e74670156e43f.asciidoc 0000664 0000000 0000000 00000000445 15176617013 0026372 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-api.asciidoc:332
[source, python]
----
resp = client.search(
index="my-index-000001",
track_total_hits=100,
query={
"match": {
"user.id": "elkbee"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d681508a745b2bc777d47ba606d24224.asciidoc 0000664 0000000 0000000 00000000234 15176617013 0026267 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/fielddata.asciidoc:158
[source, python]
----
resp = client.cat.fielddata(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d681b643da0d7f0a384f627b6d56111b.asciidoc 0000664 0000000 0000000 00000000463 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/dissect-syntax.asciidoc:89
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"message": {
"type": "wildcard"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d690a6af462c70a783625a323e11c72c.asciidoc 0000664 0000000 0000000 00000000471 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:187
[source, python]
----
resp = client.indices.create(
index="test-index",
settings={
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "my_policy"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d69bd36335774c8ae1286cee21310241.asciidoc 0000664 0000000 0000000 00000001052 15176617013 0026263 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-api-key.asciidoc:72
[source, python]
----
resp = client.security.put_role(
name="remote-search",
remote_indices=[
{
"clusters": [
"my_remote_cluster"
],
"names": [
"target-index"
],
"privileges": [
"read",
"read_cross_cluster",
"view_index_metadata"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d69cf7c82602431d9e339583e7dfb988.asciidoc 0000664 0000000 0000000 00000002022 15176617013 0026407 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/configuring.asciidoc:10
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"std_english": {
"type": "standard",
"stopwords": "_english_"
}
}
}
},
mappings={
"properties": {
"my_text": {
"type": "text",
"analyzer": "standard",
"fields": {
"english": {
"type": "text",
"analyzer": "std_english"
}
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
field="my_text",
text="The old brown cow",
)
print(resp1)
resp2 = client.indices.analyze(
index="my-index-000001",
field="my_text.english",
text="The old brown cow",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/d6a21afa4a94b9baa734eac430940bcf.asciidoc 0000664 0000000 0000000 00000000302 15176617013 0026761 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connectors-api.asciidoc:95
[source, python]
----
resp = client.connector.list(
from_="0",
size="2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d6a4548b29e939fb197189c20c7c016f.asciidoc 0000664 0000000 0000000 00000000566 15176617013 0026401 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/d70f55cd29cdb2dcd775ffa9e23ff393.asciidoc 0000664 0000000 0000000 00000001115 15176617013 0027030 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/max-aggregation.asciidoc:52
[source, python]
----
resp = client.search(
index="sales",
size=0,
runtime_mappings={
"price.adjusted": {
"type": "double",
"script": "\n double price = doc['price'].value;\n if (doc['promoted'].value) {\n price *= 0.8;\n }\n emit(price);\n "
}
},
aggs={
"max_price": {
"max": {
"field": "price.adjusted"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7141bd4d0db964f5cc4a872ad79dce9.asciidoc 0000664 0000000 0000000 00000000253 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// features/apis/reset-features-api.asciidoc:20
[source, python]
----
resp = client.features.reset_features()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7348119df9f89a556a7b767d5298c7e.asciidoc 0000664 0000000 0000000 00000001305 15176617013 0026421 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geoline-aggregation.asciidoc:218
[source, python]
----
resp = client.search(
index="tour",
filter_path="aggregations",
aggregations={
"path": {
"terms": {
"field": "city"
},
"aggregations": {
"museum_tour": {
"geo_line": {
"point": {
"field": "location"
},
"sort": {
"field": "@timestamp"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7717318d93d0a1f3ad049f9c6604417.asciidoc 0000664 0000000 0000000 00000001346 15176617013 0026302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/standard-tokenizer.asciidoc:139
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "standard",
"max_token_length": 5
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="The 2 QUICK Brown-Foxes jumped over the lazy dog's bone.",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/d775836a0d7abecc6637aa988f204c30.asciidoc 0000664 0000000 0000000 00000000714 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:224
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"fullname": "John Doe",
"text": "test test test "
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
refresh="wait_for",
document={
"fullname": "Jane Doe",
"text": "Another test ..."
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/d7898526d239d2aea83727fb982f8f77.asciidoc 0000664 0000000 0000000 00000000223 15176617013 0026416 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/refresh.asciidoc:119
[source, python]
----
resp = client.indices.refresh()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7919fb6f4d02dde1390775eb8365b79.asciidoc 0000664 0000000 0000000 00000000452 15176617013 0026462 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/text.asciidoc:335
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"my_field": {
"type": "text",
"fielddata": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7a55a7c491e97079e429483085f1d58.asciidoc 0000664 0000000 0000000 00000000703 15176617013 0026245 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-migrate-data-stream-from-ilm-to-dsl.asciidoc:60
[source, python]
----
resp = client.indices.put_index_template(
name="dsl-data-stream-template",
index_patterns=[
"dsl-data-stream*"
],
data_stream={},
priority=500,
template={
"settings": {
"index.lifecycle.name": "pre-dsl-ilm-policy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7a5b0159ffdcdd1ab9078b38829a08b.asciidoc 0000664 0000000 0000000 00000001645 15176617013 0026663 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/semantic-query.asciidoc:87
[source, python]
----
resp = client.search(
index="my-index",
retriever={
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"term": {
"text": "shoes"
}
}
}
},
{
"standard": {
"query": {
"semantic": {
"field": "semantic_field",
"query": "shoes"
}
}
}
}
],
"rank_window_size": 50,
"rank_constant": 20
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7ae456f119246e95f2f4c37e7544b8c.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026464 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/start-datafeed.asciidoc:115
[source, python]
----
resp = client.ml.start_datafeed(
datafeed_id="datafeed-low_request_rate",
start="2019-04-07T18:22:16Z",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7b61bfb6adb22986a43388b823894cc.asciidoc 0000664 0000000 0000000 00000000711 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:4
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="cohere_embeddings",
inference_config={
"service": "cohere",
"service_settings": {
"api_key": "",
"model_id": "embed-english-v3.0",
"embedding_type": "byte"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7d92816cac64b7c70d72b0000eeeeea.asciidoc 0000664 0000000 0000000 00000000756 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/field-level-security.asciidoc:77
[source, python]
----
resp = client.security.put_role(
name="test_role3",
indices=[
{
"names": [
"*"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"customer.handle"
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7f42d1b906dc406be1819d17c625d5f.asciidoc 0000664 0000000 0000000 00000001076 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filter-aggregation.asciidoc:83
[source, python]
----
resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
aggs={
"t_shirts": {
"filter": {
"term": {
"type": "t-shirt"
}
},
"aggs": {
"avg_price": {
"avg": {
"field": "price"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d7fe687201ac87b307cd06ed015dd317.asciidoc 0000664 0000000 0000000 00000000457 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:288
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"user_id": {
"type": "keyword",
"ignore_above": 100
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d803ed00d8f45f81c33e415e1c1ecb8c.asciidoc 0000664 0000000 0000000 00000000755 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:642
[source, python]
----
resp = client.reindex(
source={
"index": "my-data-stream",
"query": {
"range": {
"@timestamp": {
"gte": "now-7d/d",
"lte": "now/d"
}
}
}
},
dest={
"index": "new-data-stream",
"op_type": "create"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d80ac403d8d936ca9dec185c7da13f2f.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026734 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/apis/create-stored-script-api.asciidoc:17
[source, python]
----
resp = client.put_script(
id="my-stored-script",
script={
"lang": "painless",
"source": "Math.log(_score * 2) + params['my_modifier']"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d8310e5606c61e7a6e64a90838b1a830.asciidoc 0000664 0000000 0000000 00000002000 15176617013 0026257 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/parent-aggregation.asciidoc:59
[source, python]
----
resp = client.index(
index="parent_example",
id="2",
routing="1",
document={
"join": {
"name": "answer",
"parent": "1"
},
"owner": {
"location": "Norfolk, United Kingdom",
"display_name": "Sam",
"id": 48
},
"body": "Unfortunately you're pretty much limited to FTP...",
"creation_date": "2009-05-04T13:45:37.030"
},
)
print(resp)
resp1 = client.index(
index="parent_example",
id="3",
routing="1",
refresh=True,
document={
"join": {
"name": "answer",
"parent": "1"
},
"owner": {
"location": "Norfolk, United Kingdom",
"display_name": "Troll",
"id": 49
},
"body": "Use Linux...",
"creation_date": "2009-05-05T13:45:37.030"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/d8496fa0e5a394fd758617ed6a6c956f.asciidoc 0000664 0000000 0000000 00000000704 15176617013 0026552 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:373
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"percolate": {
"field": "query",
"document": {
"message": "The quick brown fox jumps over the lazy dog"
}
}
},
highlight={
"fields": {
"message": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d84a861ce563508aeaaf30a9dd84b5cf.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:271
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"hot": {
"actions": {
"rollover": {
"max_age": "7d",
"max_size": "100gb",
"min_docs": 1000
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d851282dba548251d10db5954a339307.asciidoc 0000664 0000000 0000000 00000000715 15176617013 0026206 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:136
[source, python]
----
resp = client.search(
index="twitter",
query={
"match": {
"title": "elasticsearch"
}
},
search_after=[
1463538857,
"654323"
],
sort=[
{
"date": "asc"
},
{
"tie_breaker_id": "asc"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d870d5bd1f97fc75872a298fcddec513.asciidoc 0000664 0000000 0000000 00000010366 15176617013 0026704 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// text-structure/apis/find-structure.asciidoc:101
[source, python]
----
resp = client.text_structure.find_structure(
text_files=[
{
"name": "Leviathan Wakes",
"author": "James S.A. Corey",
"release_date": "2011-06-02",
"page_count": 561
},
{
"name": "Hyperion",
"author": "Dan Simmons",
"release_date": "1989-05-26",
"page_count": 482
},
{
"name": "Dune",
"author": "Frank Herbert",
"release_date": "1965-06-01",
"page_count": 604
},
{
"name": "Dune Messiah",
"author": "Frank Herbert",
"release_date": "1969-10-15",
"page_count": 331
},
{
"name": "Children of Dune",
"author": "Frank Herbert",
"release_date": "1976-04-21",
"page_count": 408
},
{
"name": "God Emperor of Dune",
"author": "Frank Herbert",
"release_date": "1981-05-28",
"page_count": 454
},
{
"name": "Consider Phlebas",
"author": "Iain M. Banks",
"release_date": "1987-04-23",
"page_count": 471
},
{
"name": "Pandora's Star",
"author": "Peter F. Hamilton",
"release_date": "2004-03-02",
"page_count": 768
},
{
"name": "Revelation Space",
"author": "Alastair Reynolds",
"release_date": "2000-03-15",
"page_count": 585
},
{
"name": "A Fire Upon the Deep",
"author": "Vernor Vinge",
"release_date": "1992-06-01",
"page_count": 613
},
{
"name": "Ender's Game",
"author": "Orson Scott Card",
"release_date": "1985-06-01",
"page_count": 324
},
{
"name": "1984",
"author": "George Orwell",
"release_date": "1985-06-01",
"page_count": 328
},
{
"name": "Fahrenheit 451",
"author": "Ray Bradbury",
"release_date": "1953-10-15",
"page_count": 227
},
{
"name": "Brave New World",
"author": "Aldous Huxley",
"release_date": "1932-06-01",
"page_count": 268
},
{
"name": "Foundation",
"author": "Isaac Asimov",
"release_date": "1951-06-01",
"page_count": 224
},
{
"name": "The Giver",
"author": "Lois Lowry",
"release_date": "1993-04-26",
"page_count": 208
},
{
"name": "Slaughterhouse-Five",
"author": "Kurt Vonnegut",
"release_date": "1969-06-01",
"page_count": 275
},
{
"name": "The Hitchhiker's Guide to the Galaxy",
"author": "Douglas Adams",
"release_date": "1979-10-12",
"page_count": 180
},
{
"name": "Snow Crash",
"author": "Neal Stephenson",
"release_date": "1992-06-01",
"page_count": 470
},
{
"name": "Neuromancer",
"author": "William Gibson",
"release_date": "1984-07-01",
"page_count": 271
},
{
"name": "The Handmaid's Tale",
"author": "Margaret Atwood",
"release_date": "1985-06-01",
"page_count": 311
},
{
"name": "Starship Troopers",
"author": "Robert A. Heinlein",
"release_date": "1959-12-01",
"page_count": 335
},
{
"name": "The Left Hand of Darkness",
"author": "Ursula K. Le Guin",
"release_date": "1969-06-01",
"page_count": 304
},
{
"name": "The Moon is a Harsh Mistress",
"author": "Robert A. Heinlein",
"release_date": "1966-04-01",
"page_count": 288
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d87175daed2327565d4325528c6d8b38.asciidoc 0000664 0000000 0000000 00000000252 15176617013 0026307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:235
[source, python]
----
resp = client.get(
index="my-index-000001",
id="0",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d87cfcc0a297f75ffe646b2e61940d14.asciidoc 0000664 0000000 0000000 00000000760 15176617013 0026612 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/uppercase-tokenfilter.asciidoc:92
[source, python]
----
resp = client.indices.create(
index="uppercase_example",
settings={
"analysis": {
"analyzer": {
"whitespace_uppercase": {
"tokenizer": "whitespace",
"filter": [
"uppercase"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d880630b6f7dc634c4078293f9cd3d80.asciidoc 0000664 0000000 0000000 00000002105 15176617013 0026366 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:716
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"size": 2,
"sources": [
{
"date": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "1d",
"order": "desc"
}
}
},
{
"product": {
"terms": {
"field": "product",
"order": "asc"
}
}
}
],
"after": {
"date": 1494288000000,
"product": "mad max"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d88f883ed2fb8be35cd3e72ddffcf4ef.asciidoc 0000664 0000000 0000000 00000001312 15176617013 0027261 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/length-tokenfilter.asciidoc:149
[source, python]
----
resp = client.indices.create(
index="length_custom_example",
settings={
"analysis": {
"analyzer": {
"whitespace_length_2_to_10_char": {
"tokenizer": "whitespace",
"filter": [
"length_2_to_10_char"
]
}
},
"filter": {
"length_2_to_10_char": {
"type": "length",
"min": 2,
"max": 10
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d89d36741d906a71eca6c144e8d83889.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026405 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/tasks.asciidoc:243
[source, python]
----
resp = client.tasks.cancel(
task_id="oTUltX4IQMOUUVeiohTt8A:12345",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d8a82511cb94f49b4fe4828fee3ba074.asciidoc 0000664 0000000 0000000 00000000330 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:63
[source, python]
----
resp = client.cat.nodes(
v=True,
h="name,node*,heap*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d8c053ee26c1533ce936ec81101d8e1b.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026476 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/d8c401a5b7359ec65947b9f35ecf6927.asciidoc 0000664 0000000 0000000 00000001517 15176617013 0026467 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/ngram-tokenizer.asciidoc:220
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "ngram",
"min_gram": 3,
"max_gram": 3,
"token_chars": [
"letter",
"digit"
]
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="2 Quick Foxes.",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/d8ea6a1a1c546bf29f65f8c65439b156.asciidoc 0000664 0000000 0000000 00000000734 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:190
[source, python]
----
resp = client.indices.create(
index="byte-image-index",
mappings={
"properties": {
"byte-image-vector": {
"type": "dense_vector",
"element_type": "byte",
"dims": 2
},
"title": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d8fa7ca2ec8dbfa034603ea566e33f5b.asciidoc 0000664 0000000 0000000 00000002133 15176617013 0027004 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/filters-aggregation.asciidoc:208
[source, python]
----
resp = client.search(
index="sales",
size="0",
filter_path="aggregations",
aggs={
"the_filter": {
"filters": {
"keyed": False,
"filters": {
"t-shirt": {
"term": {
"type": "t-shirt"
}
},
"hat": {
"term": {
"type": "hat"
}
}
}
},
"aggs": {
"avg_price": {
"avg": {
"field": "price"
}
},
"sort_by_avg_price": {
"bucket_sort": {
"sort": {
"avg_price": "asc"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d93d52b6057a7aff3d0766ca44c505e0.asciidoc 0000664 0000000 0000000 00000001077 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:206
[source, python]
----
resp = client.cluster.put_component_template(
name="my-aliases",
template={
"aliases": {
"my-alias": {}
}
},
)
print(resp)
resp1 = client.indices.put_index_template(
name="my-index-template",
index_patterns=[
"my-index-*"
],
composed_of=[
"my-aliases",
"my-mappings",
"my-settings"
],
template={
"aliases": {
"yet-another-alias": {}
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/d94f666616dea141dcb7aaf08a35bc10.asciidoc 0000664 0000000 0000000 00000000624 15176617013 0026640 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/keep-types-tokenfilter.asciidoc:94
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "keep_types",
"types": [
""
],
"mode": "exclude"
}
],
text="1 quick fox 2 lazy dogs",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d952ac7c73219d8cabc080679e035514.asciidoc 0000664 0000000 0000000 00000000776 15176617013 0026365 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/semantic-search/search.asciidoc:34
[source, python]
----
resp = client.search(
index="my-index",
knn={
"field": "my_embeddings.predicted_value",
"k": 10,
"num_candidates": 100,
"query_vector_builder": {
"text_embedding": {
"model_id": "sentence-transformers__msmarco-minilm-l-12-v3",
"model_text": "the query string"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d979f934af0992fb8c8596beff80b638.asciidoc 0000664 0000000 0000000 00000000463 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:530
[source, python]
----
resp = client.search(
source=[
"obj1.*",
"obj2.*"
],
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d983c1ea730eeabac9e914656d7c9be2.asciidoc 0000664 0000000 0000000 00000002124 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1263
[source, python]
----
resp = client.indices.create(
index="latvian_example",
settings={
"analysis": {
"filter": {
"latvian_stop": {
"type": "stop",
"stopwords": "_latvian_"
},
"latvian_keywords": {
"type": "keyword_marker",
"keywords": [
"piemērs"
]
},
"latvian_stemmer": {
"type": "stemmer",
"language": "latvian"
}
},
"analyzer": {
"rebuilt_latvian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"latvian_stop",
"latvian_keywords",
"latvian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d98fb2ff2cdd154dff4a576430755d98.asciidoc 0000664 0000000 0000000 00000001576 15176617013 0026630 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1122
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"timestamp": {
"type": "date"
},
"temperature": {
"type": "long"
},
"voltage": {
"type": "double"
},
"node": {
"type": "keyword"
},
"voltage_corrected": {
"type": "double",
"on_script_error": "fail",
"script": {
"source": "\n emit(doc['voltage'].value * params['multiplier'])\n ",
"params": {
"multiplier": 4
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d9a1ad1c5746b75972c74dd4d3a3d623.asciidoc 0000664 0000000 0000000 00000001022 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/parent-join.asciidoc:442
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_join_field": {
"type": "join",
"relations": {
"question": [
"answer",
"comment"
],
"answer": "vote"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d9de409a4a197ce7cbe3714e07155d34.asciidoc 0000664 0000000 0000000 00000001414 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/engine.asciidoc:28
[source, python]
----
resp = client.search(
query={
"function_score": {
"query": {
"match": {
"body": "foo"
}
},
"functions": [
{
"script_score": {
"script": {
"source": "pure_df",
"lang": "expert_scripts",
"params": {
"field": "body",
"term": "foo"
}
}
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/d9e0cba8e150681d861f5fd1545514e2.asciidoc 0000664 0000000 0000000 00000000551 15176617013 0026434 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:513
[source, python]
----
resp = client.sql.query(
format="txt",
query="SELECT YEAR(release_date) AS year FROM library WHERE page_count > ? AND author = ? GROUP BY year HAVING COUNT(*) > ?",
params=[
300,
"Frank Herbert",
0
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/da0fe1316e5b8fd68e2a8525bcd8b0f6.asciidoc 0000664 0000000 0000000 00000001040 15176617013 0026726 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/recipes/scoring.asciidoc:169
[source, python]
----
resp = client.search(
query={
"bool": {
"must": {
"match": {
"body": "elasticsearch"
}
},
"should": {
"rank_feature": {
"field": "pagerank",
"saturation": {
"pivot": 10
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/da18bae37cda566c0254b30c15221b01.asciidoc 0000664 0000000 0000000 00000000415 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-service-token-caches.asciidoc:61
[source, python]
----
resp = client.security.clear_cached_service_tokens(
namespace="elastic",
service="fleet-server",
name="token1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/da24c13eee8c9aeae9a23faf80489e31.asciidoc 0000664 0000000 0000000 00000001147 15176617013 0027017 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:177
[source, python]
----
resp = client.indices.delete(
index="my-index",
)
print(resp)
resp1 = client.reindex(
source={
"index": "restored-my-index"
},
dest={
"index": "my-index"
},
)
print(resp1)
resp2 = client.indices.delete_data_stream(
name="logs-my_app-default",
)
print(resp2)
resp3 = client.reindex(
source={
"index": "restored-logs-my_app-default"
},
dest={
"index": "logs-my_app-default",
"op_type": "create"
},
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/da3f280bc65b581fb3097be768061bee.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/saml-prepare-authentication-api.asciidoc:96
[source, python]
----
resp = client.security.saml_prepare_authentication(
acs="https://kibana.org/api/security/saml/callback",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/da8db0769dff7305f178c12b1111bc99.asciidoc 0000664 0000000 0000000 00000000541 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/simple-query-string-query.asciidoc:262
[source, python]
----
resp = client.search(
query={
"simple_query_string": {
"query": "this is a test",
"fields": [
"subject^3",
"message"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/da90e457e2a34fe47dd82a0a2f336095.asciidoc 0000664 0000000 0000000 00000000510 15176617013 0026503 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/range-enrich-policy-type-ex.asciidoc:33
[source, python]
----
resp = client.index(
index="networks",
id="1",
refresh="wait_for",
document={
"range": "10.100.0.0/16",
"name": "production",
"department": "OPS"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/daae2e6acebc84e537764f4ba07f2e6e.asciidoc 0000664 0000000 0000000 00000000360 15176617013 0027073 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// path-settings-overview.asciidoc:75
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.exclude._name": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dabb159e0b3456024889fb9754a10655.asciidoc 0000664 0000000 0000000 00000000453 15176617013 0026276 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:76
[source, python]
----
resp = client.indices.create(
index="example",
mappings={
"properties": {
"geometry": {
"type": "shape"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dabcf0bead37cae1d3e5d2813fd3ccfe.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0027347 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/ip.asciidoc:143
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"query_string": {
"query": "ip_addr:\"2001:db8::/48\""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dac8ec8547bc446637fd97d9fa872f4f.asciidoc 0000664 0000000 0000000 00000006054 15176617013 0026720 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/put-dfanalytics.asciidoc:822
[source, python]
----
resp = client.ml.put_data_frame_analytics(
id="flight_prices",
source={
"index": [
"kibana_sample_data_flights"
]
},
dest={
"index": "kibana_sample_flight_prices"
},
analysis={
"regression": {
"dependent_variable": "AvgTicketPrice",
"num_top_feature_importance_values": 2,
"feature_processors": [
{
"frequency_encoding": {
"field": "DestWeather",
"feature_name": "DestWeather_frequency",
"frequency_map": {
"Rain": 0.14604811155570188,
"Heavy Fog": 0.14604811155570188,
"Thunder & Lightning": 0.14604811155570188,
"Cloudy": 0.14604811155570188,
"Damaging Wind": 0.14604811155570188,
"Hail": 0.14604811155570188,
"Sunny": 0.14604811155570188,
"Clear": 0.14604811155570188
}
}
},
{
"target_mean_encoding": {
"field": "DestWeather",
"feature_name": "DestWeather_targetmean",
"target_map": {
"Rain": 626.5588814585794,
"Heavy Fog": 626.5588814585794,
"Thunder & Lightning": 626.5588814585794,
"Hail": 626.5588814585794,
"Damaging Wind": 626.5588814585794,
"Cloudy": 626.5588814585794,
"Clear": 626.5588814585794,
"Sunny": 626.5588814585794
},
"default_value": 624.0249512020454
}
},
{
"one_hot_encoding": {
"field": "DestWeather",
"hot_map": {
"Rain": "DestWeather_Rain",
"Heavy Fog": "DestWeather_Heavy Fog",
"Thunder & Lightning": "DestWeather_Thunder & Lightning",
"Cloudy": "DestWeather_Cloudy",
"Damaging Wind": "DestWeather_Damaging Wind",
"Hail": "DestWeather_Hail",
"Clear": "DestWeather_Clear",
"Sunny": "DestWeather_Sunny"
}
}
}
]
}
},
analyzed_fields={
"includes": [
"AvgTicketPrice",
"Cancelled",
"DestWeather",
"FlightDelayMin",
"DistanceMiles"
]
},
model_memory_limit="30mb",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dad2d4add751fde5c39475ca709cc14b.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0027003 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/allocation/filtering.asciidoc:54
[source, python]
----
resp = client.indices.put_settings(
index="test",
settings={
"index.routing.allocation.include.size": "big,medium"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dadb69a225778ecd6528924c0aa029bb.asciidoc 0000664 0000000 0000000 00000001266 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:85
[source, python]
----
resp = client.indices.create(
index="image-index",
mappings={
"properties": {
"image-vector": {
"type": "dense_vector",
"dims": 3,
"similarity": "l2_norm"
},
"title-vector": {
"type": "dense_vector",
"dims": 5,
"similarity": "l2_norm"
},
"title": {
"type": "text"
},
"file-type": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dae57cf7df18adb4dc64426eb159733a.asciidoc 0000664 0000000 0000000 00000001065 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/percentile-aggregation.asciidoc:370
[source, python]
----
resp = client.search(
index="latency",
size=0,
aggs={
"load_time_outlier": {
"percentiles": {
"field": "load_time",
"percents": [
95,
99,
99.9
],
"hdr": {
"number_of_significant_value_digits": 3
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/daf5631eba5285f1b929d5d8d8dc0d50.asciidoc 0000664 0000000 0000000 00000001330 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/uaxurlemail-tokenizer.asciidoc:95
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "my_tokenizer"
}
},
"tokenizer": {
"my_tokenizer": {
"type": "uax_url_email",
"max_token_length": 5
}
}
}
},
)
print(resp)
resp1 = client.indices.analyze(
index="my-index-000001",
analyzer="my_analyzer",
text="john.smith@global-international.com",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/db19cc7a26ca80106d86d688f4be67a8.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/stop-dfanalytics.asciidoc:75
[source, python]
----
resp = client.ml.stop_data_frame_analytics(
id="loganalytics",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/db773f690edf659ac9b044dc854c77eb.asciidoc 0000664 0000000 0000000 00000003232 15176617013 0026677 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-vector-tile-api.asciidoc:671
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "geo_point"
},
"name": {
"type": "keyword"
},
"price": {
"type": "long"
},
"included": {
"type": "boolean"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": "1"
}
},
{
"location": "POINT (4.912350 52.374081)",
"name": "NEMO Science Museum",
"price": 1750,
"included": True
},
{
"index": {
"_id": "2"
}
},
{
"location": "POINT (4.901618 52.369219)",
"name": "Museum Het Rembrandthuis",
"price": 1500,
"included": False
},
{
"index": {
"_id": "3"
}
},
{
"location": "POINT (4.914722 52.371667)",
"name": "Nederlands Scheepvaartmuseum",
"price": 1650,
"included": True
},
{
"index": {
"_id": "4"
}
},
{
"location": "POINT (4.914722 52.371667)",
"name": "Amsterdam Centre for Architecture",
"price": 0,
"included": True
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/db8710a9793ae0817a45892d33468160.asciidoc 0000664 0000000 0000000 00000000323 15176617013 0026140 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/diskusage.asciidoc:75
[source, python]
----
resp = client.indices.disk_usage(
index="my-index-000001",
run_expensive_tasks=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/db879dcf70abc4a9a14063a9a2d8d6f5.asciidoc 0000664 0000000 0000000 00000003517 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geohashgrid-aggregation.asciidoc:27
[source, python]
----
resp = client.indices.create(
index="museums",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="museums",
refresh=True,
operations=[
{
"index": {
"_id": 1
}
},
{
"location": "POINT (4.912350 52.374081)",
"name": "NEMO Science Museum"
},
{
"index": {
"_id": 2
}
},
{
"location": "POINT (4.901618 52.369219)",
"name": "Museum Het Rembrandthuis"
},
{
"index": {
"_id": 3
}
},
{
"location": "POINT (4.914722 52.371667)",
"name": "Nederlands Scheepvaartmuseum"
},
{
"index": {
"_id": 4
}
},
{
"location": "POINT (4.405200 51.222900)",
"name": "Letterenhuis"
},
{
"index": {
"_id": 5
}
},
{
"location": "POINT (2.336389 48.861111)",
"name": "Musée du Louvre"
},
{
"index": {
"_id": 6
}
},
{
"location": "POINT (2.327000 48.860000)",
"name": "Musée d'Orsay"
}
],
)
print(resp1)
resp2 = client.search(
index="museums",
size="0",
aggregations={
"large-grid": {
"geohash_grid": {
"field": "location",
"precision": 3
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/db9a8e3edee7c9a96ea0875fd4bbaa69.asciidoc 0000664 0000000 0000000 00000000255 15176617013 0027176 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// monitoring/collecting-monitoring-data.asciidoc:45
[source, python]
----
resp = client.cluster.get_settings()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dbc50b8c934171e94604575a8b36f349.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/update-settings.asciidoc:151
[source, python]
----
resp = client.indices.forcemerge(
index="my-index-000001",
max_num_segments="5",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dbcd8892dd01c43d5a60c94173574faf.asciidoc 0000664 0000000 0000000 00000001472 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-field-note.asciidoc:12
[source, python]
----
resp = client.indices.create(
index="range_index",
settings={
"number_of_shards": 2
},
mappings={
"properties": {
"expected_attendees": {
"type": "integer_range"
},
"time_frame": {
"type": "date_range",
"format": "yyyy-MM-dd||epoch_millis"
}
}
},
)
print(resp)
resp1 = client.index(
index="range_index",
id="1",
refresh=True,
document={
"expected_attendees": {
"gte": 10,
"lte": 20
},
"time_frame": {
"gte": "2019-10-28",
"lte": "2019-11-04"
}
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/dbd1b930782d34d7396fdb2db1216c0d.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/ids-query.asciidoc:13
[source, python]
----
resp = client.search(
query={
"ids": {
"values": [
"1",
"4",
"100"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dbdd58cdeac9ef20b42ff73e4864e697.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0027035 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-field-mapping.asciidoc:251
[source, python]
----
resp = client.indices.get_field_mapping(
index="_all",
fields="*.id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dbf93d02ab86a09929a21232b19709cc.asciidoc 0000664 0000000 0000000 00000000355 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/stop-trained-model-deployment.asciidoc:73
[source, python]
----
resp = client.ml.stop_trained_model_deployment(
model_id="my_model_for_search",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dbf9abc37899352751dab0ede62af2fd.asciidoc 0000664 0000000 0000000 00000000450 15176617013 0027016 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-tokens.asciidoc:121
[source, python]
----
resp = client.security.invalidate_token(
token="dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dc33160f4087443f867080a8f5b2cfbd.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0026441 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:176
[source, python]
----
resp = client.esql.query(
format="json",
query="\n FROM library\n | KEEP author, name, page_count, release_date\n | SORT page_count DESC\n | LIMIT 5\n ",
columnar=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dc3b7603e7d688106acb804059af7834.asciidoc 0000664 0000000 0000000 00000000416 15176617013 0026360 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:496
[source, python]
----
resp = client.search(
source=False,
query={
"match": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dc468865da947b4a9136a5b92878d918.asciidoc 0000664 0000000 0000000 00000000674 15176617013 0026337 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-update-api-keys.asciidoc:131
[source, python]
----
resp = client.security.create_api_key(
name="my-other-api-key",
metadata={
"application": "my-application",
"environment": {
"level": 2,
"trusted": True,
"tags": [
"dev",
"staging"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dc4dcfeae8a5f248639335c2c9809549.asciidoc 0000664 0000000 0000000 00000000352 15176617013 0026537 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pathhierarchy-tokenizer.asciidoc:17
[source, python]
----
resp = client.indices.analyze(
tokenizer="path_hierarchy",
text="/one/two/three",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dc8c94c9bef1f879282caea5c406f36e.asciidoc 0000664 0000000 0000000 00000000442 15176617013 0026754 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:189
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
filter=[
"lowercase"
],
char_filter=[
"html_strip"
],
text="this is a test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dcc02ad69da0a5aa10c4e53b34be8ec0.asciidoc 0000664 0000000 0000000 00000000502 15176617013 0027030 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-get.asciidoc:16
[source, python]
----
resp = client.mget(
docs=[
{
"_index": "my-index-000001",
"_id": "1"
},
{
"_index": "my-index-000001",
"_id": "2"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dcee24dba43050e4b01b6e3a3211ce09.asciidoc 0000664 0000000 0000000 00000000702 15176617013 0026607 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1281
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"@timestamp": {
"format": "strict_date_optional_time||epoch_second",
"type": "date"
},
"message": {
"type": "wildcard"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dcf82f3aacae49c0bb4ccbc673f13e9f.asciidoc 0000664 0000000 0000000 00000001722 15176617013 0027227 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/dcfa7f479a33f459a2d222a92e651451.asciidoc 0000664 0000000 0000000 00000002005 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-roles.asciidoc:126
[source, python]
----
resp = client.security.put_role(
name="my_admin_role",
description="Grants full access to all management features within the cluster.",
cluster=[
"all"
],
indices=[
{
"names": [
"index1",
"index2"
],
"privileges": [
"all"
],
"field_security": {
"grant": [
"title",
"body"
]
},
"query": "{\"match\": {\"title\": \"foo\"}}"
}
],
applications=[
{
"application": "myapp",
"privileges": [
"admin",
"read"
],
"resources": [
"*"
]
}
],
run_as=[
"other_user"
],
metadata={
"version": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dd0b196a099e1cca08c5ce4dd74e935a.asciidoc 0000664 0000000 0000000 00000000453 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:27
[source, python]
----
resp = client.watcher.put_watch(
id="cluster_health_watch",
trigger={
"schedule": {
"interval": "10s"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dd16c9c981551c9da47ebb5ef5105fa0.asciidoc 0000664 0000000 0000000 00000002760 15176617013 0026660 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/dd1a25d821d0c8deaeaa9c8083152a54.asciidoc 0000664 0000000 0000000 00000000255 15176617013 0026634 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/grok.asciidoc:293
[source, python]
----
resp = client.ingest.processor_grok(
s=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dd3b263e9fa4226e59bedfc957d399d2.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/getting-started.asciidoc:22
[source, python]
----
resp = client.sql.query(
format="txt",
query="SELECT * FROM library WHERE release_date < '2000-01-01'",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dd3ee00ab2af607b32532180d60a41d4.asciidoc 0000664 0000000 0000000 00000001255 15176617013 0026454 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/snowball-tokenfilter.asciidoc:19
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"filter": [
"lowercase",
"my_snow"
]
}
},
"filter": {
"my_snow": {
"type": "snowball",
"language": "English"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dd4f051ab62f0507e3b6e3d6f333e85f.asciidoc 0000664 0000000 0000000 00000000261 15176617013 0026566 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-component-template.asciidoc:101
[source, python]
----
resp = client.cluster.get_component_template()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dd71b0c9f9197684ff29c61062c55660.asciidoc 0000664 0000000 0000000 00000000247 15176617013 0026316 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-settings.asciidoc:38
[source, python]
----
resp = client.security.get_settings()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dd7814258121d3c2e576a7f00469d7e3.asciidoc 0000664 0000000 0000000 00000001003 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:197
[source, python]
----
resp = client.ingest.put_pipeline(
id="mistral_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "mistral_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dd792bb53703a57f9207e36d16e26255.asciidoc 0000664 0000000 0000000 00000002502 15176617013 0026277 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:1162
[source, python]
----
resp = client.bulk(
index="my-index-000001",
refresh=True,
operations=[
{
"index": {}
},
{
"timestamp": 1516729294000,
"temperature": 200,
"voltage": 5.2,
"node": "a"
},
{
"index": {}
},
{
"timestamp": 1516642894000,
"temperature": 201,
"voltage": 5.8,
"node": "b"
},
{
"index": {}
},
{
"timestamp": 1516556494000,
"temperature": 202,
"voltage": 5.1,
"node": "a"
},
{
"index": {}
},
{
"timestamp": 1516470094000,
"temperature": 198,
"voltage": 5.6,
"node": "b"
},
{
"index": {}
},
{
"timestamp": 1516383694000,
"temperature": 200,
"voltage": 4.2,
"node": "c"
},
{
"index": {}
},
{
"timestamp": 1516297294000,
"temperature": 202,
"voltage": 4,
"node": "c"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dda949d20d07a9edbe64cefc623df945.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0027022 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:472
[source, python]
----
resp = client.indices.put_mapping(
index="my_test_scores",
properties={
"total_score": {
"type": "long"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ddcfa47381d47078dbec651e31b69949.asciidoc 0000664 0000000 0000000 00000000434 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/detect-threats-with-eql.asciidoc:209
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n library where process.name == \"regsvr32.exe\" and dll.name == \"scrobj.dll\"\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dddb6a6ebd145f8411c5b4910d332f87.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/multivalued-fields.asciidoc:233
[source, python]
----
resp = client.esql.query(
query="FROM mv | EVAL b + 2, a + b | LIMIT 4",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dde283eab92608e7bfbfa09c6482a12e.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026725 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-api-keys.asciidoc:140
[source, python]
----
resp = client.security.invalidate_api_key(
realm_name="native1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dde92fdf3469349ffe2c81764333543a.asciidoc 0000664 0000000 0000000 00000000436 15176617013 0026460 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ddf375e4b6175d830fa4097ea0b41536.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/delete-desired-nodes.asciidoc:61
[source, python]
----
resp = client.perform_request(
"DELETE",
"/_internal/desired_nodes",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ddf56782ecc7eaeb3115e150c4830013.asciidoc 0000664 0000000 0000000 00000000771 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:591
[source, python]
----
resp = client.update_by_query(
index="my-index-000001",
slice={
"id": 0,
"max": 2
},
script={
"source": "ctx._source['extra'] = 'test'"
},
)
print(resp)
resp1 = client.update_by_query(
index="my-index-000001",
slice={
"id": 1,
"max": 2
},
script={
"source": "ctx._source['extra'] = 'test'"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/de139866a220124360e5e27d1a736ea4.asciidoc 0000664 0000000 0000000 00000001200 15176617013 0026251 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:288
[source, python]
----
resp = client.search(
query={
"term": {
"product": "chocolate"
}
},
sort=[
{
"offer.price": {
"mode": "avg",
"order": "asc",
"nested": {
"path": "offer",
"filter": {
"term": {
"offer.color": "blue"
}
}
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/de2f59887737de3a27716177b60393a2.asciidoc 0000664 0000000 0000000 00000000344 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:245
[source, python]
----
resp = client.indices.analyze(
index="analyze_sample",
field="obj1.field1",
text="this is a test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/de876505acc75d371d1f6f484c449197.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-index.asciidoc:257
[source, python]
----
resp = client.indices.create(
index="test",
settings={
"index.write.wait_for_active_shards": "2"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/de90249caeac6f1601a7e7e9f98f1bec.asciidoc 0000664 0000000 0000000 00000000501 15176617013 0027021 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-api-key.asciidoc:400
[source, python]
----
resp = client.security.query_api_keys(
with_limited_by=True,
query={
"ids": {
"values": [
"VuaCfGcBCdbkQm-e5aOx"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dea22bb4997e368950f0fc80f2a5f304.asciidoc 0000664 0000000 0000000 00000000336 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/explicit-mapping.asciidoc:123
[source, python]
----
resp = client.indices.get_field_mapping(
index="my-index-000001",
fields="employee-id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dea4ac54c63a10c62eccd7b7f6543b86.asciidoc 0000664 0000000 0000000 00000000777 15176617013 0026737 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/context-suggest.asciidoc:100
[source, python]
----
resp = client.index(
index="place",
id="1",
document={
"suggest": {
"input": [
"timmy's",
"starbucks",
"dunkin donuts"
],
"contexts": {
"place_type": [
"cafe",
"food"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dead0682932ea6ec33c1197017bcb209.asciidoc 0000664 0000000 0000000 00000001057 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:295
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_bounding_box": {
"pin.location": {
"top_left": "dr5r9ydj2y73",
"bottom_right": "drj7teegpus6"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dec2af498a7e5892e8fcd09ae779c8f0.asciidoc 0000664 0000000 0000000 00000001047 15176617013 0026773 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/iprange-aggregation.asciidoc:61
[source, python]
----
resp = client.search(
index="ip_addresses",
size=0,
aggs={
"ip_ranges": {
"ip_range": {
"field": "ip",
"ranges": [
{
"mask": "10.0.0.0/25"
},
{
"mask": "10.0.0.127/25"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dee3023098d9e63aa9e113beea5686da.asciidoc 0000664 0000000 0000000 00000002066 15176617013 0026657 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:789
[source, python]
----
resp = client.search_application.put(
name="my_search_application",
search_application={
"indices": [
"index1"
],
"template": {
"script": {
"lang": "mustache",
"source": "\n {\n \"knn\": {\n \"field\": \"{{knn_field}}\",\n \"query_vector\": {{#toJson}}query_vector{{/toJson}},\n \"k\": \"{{k}}\",\n \"num_candidates\": {{num_candidates}}\n },\n \"fields\": {{#toJson}}fields{{/toJson}}\n }\n ",
"params": {
"knn_field": "image-vector",
"query_vector": [],
"k": 10,
"num_candidates": 100,
"fields": [
"title",
"file-type"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/df04e2e9af66d5e30b1bfdbd458cab13.asciidoc 0000664 0000000 0000000 00000000264 15176617013 0027062 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:239
[source, python]
----
resp = client.cat.nodes(
v=True,
h="heap.max",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/df0d27d3abd286b75aef7ddcf0e6c66c.asciidoc 0000664 0000000 0000000 00000001763 15176617013 0027164 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/apis/reload-analyzers.asciidoc:116
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index": {
"analysis": {
"analyzer": {
"my_synonyms": {
"tokenizer": "whitespace",
"filter": [
"synonym"
]
}
},
"filter": {
"synonym": {
"type": "synonym_graph",
"synonyms_path": "analysis/synonym.txt",
"updateable": True
}
}
}
}
},
mappings={
"properties": {
"text": {
"type": "text",
"analyzer": "standard",
"search_analyzer": "my_synonyms"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/df103a3df9b353357e72f9180ef421a1.asciidoc 0000664 0000000 0000000 00000000553 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/rare-terms-aggregation.asciidoc:280
[source, python]
----
resp = client.search(
aggs={
"genres": {
"rare_terms": {
"field": "genre",
"include": "swi*",
"exclude": "electro*"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/df1336e768fb6fc1826a5afa30a57285.asciidoc 0000664 0000000 0000000 00000000534 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:61
[source, python]
----
resp = client.index(
index="my-data-stream",
document={
"@timestamp": "2099-03-08T11:06:07.000Z",
"user": {
"id": "8a4f500d"
},
"message": "Login successful"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/df34c8ebaaa59a3ee0e3f28e2443bc30.asciidoc 0000664 0000000 0000000 00000002654 15176617013 0027004 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/nested-query.asciidoc:298
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"properties": {
"comments": {
"type": "nested"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index",
id="1",
refresh=True,
document={
"comments": [
{
"author": "kimchy"
}
]
},
)
print(resp1)
resp2 = client.index(
index="my-index",
id="2",
refresh=True,
document={
"comments": [
{
"author": "kimchy"
},
{
"author": "nik9000"
}
]
},
)
print(resp2)
resp3 = client.index(
index="my-index",
id="3",
refresh=True,
document={
"comments": [
{
"author": "nik9000"
}
]
},
)
print(resp3)
resp4 = client.search(
index="my-index",
query={
"nested": {
"path": "comments",
"query": {
"bool": {
"must_not": [
{
"term": {
"comments.author": "nik9000"
}
}
]
}
}
}
},
)
print(resp4)
----
python-elasticsearch-9.4.0/docs/examples/df7dbac966b67404b8bfa9cdda5ef480.asciidoc 0000664 0000000 0000000 00000000272 15176617013 0027105 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/ack-watch.asciidoc:259
[source, python]
----
resp = client.watcher.ack_watch(
watch_id="my_watch",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/df7ed126d8c92ddd3655c59ce4f305c9.asciidoc 0000664 0000000 0000000 00000000357 15176617013 0026701 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/thread_pool.asciidoc:178
[source, python]
----
resp = client.cat.thread_pool(
thread_pool_patterns="generic",
v=True,
h="id,name,active,rejected,completed",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/df81b88a2192dd6f9912e0c948a44487.asciidoc 0000664 0000000 0000000 00000000632 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-task.asciidoc:36
[source, python]
----
resp = client.inference.put(
task_type="sparse_embedding",
inference_id="elser_embeddings",
inference_config={
"service": "elasticsearch",
"service_settings": {
"num_allocations": 1,
"num_threads": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/df82a9cb21a7557f3ddba2509f76f608.asciidoc 0000664 0000000 0000000 00000000450 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/fingerprint-tokenfilter.asciidoc:35
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"fingerprint"
],
text="zebra jumps over resting resting dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dfa16b7300d225e013f23625f44c087b.asciidoc 0000664 0000000 0000000 00000002401 15176617013 0026324 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/similarity.asciidoc:194
[source, python]
----
resp = client.indices.create(
index="index",
settings={
"number_of_shards": 1,
"similarity": {
"scripted_tfidf": {
"type": "scripted",
"script": {
"source": "double tf = Math.sqrt(doc.freq); double idf = Math.log((field.docCount+1.0)/(term.docFreq+1.0)) + 1.0; double norm = 1/Math.sqrt(doc.length); return query.boost * tf * idf * norm;"
}
}
}
},
mappings={
"properties": {
"field": {
"type": "text",
"similarity": "scripted_tfidf"
}
}
},
)
print(resp)
resp1 = client.index(
index="index",
id="1",
document={
"field": "foo bar foo"
},
)
print(resp1)
resp2 = client.index(
index="index",
id="2",
document={
"field": "bar baz"
},
)
print(resp2)
resp3 = client.indices.refresh(
index="index",
)
print(resp3)
resp4 = client.search(
index="index",
explain=True,
query={
"query_string": {
"query": "foo^1.7",
"default_field": "field"
}
},
)
print(resp4)
----
python-elasticsearch-9.4.0/docs/examples/dfa75000edf4b960ed9002595a051871.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026334 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/migrate-to-data-tiers-routing-guide.asciidoc:139
[source, python]
----
resp = client.ilm.stop()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dfb20907cfc5ac520ea3b1dba5f00811.asciidoc 0000664 0000000 0000000 00000000440 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/example-watches/example-watch-clusterstatus.asciidoc:115
[source, python]
----
resp = client.search(
index=".watcher-history*",
sort=[
{
"result.execution_time": "desc"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dfb641d2d3155669ad6fb5a424dabf4f.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/migrate-to-data-tiers-routing-guide.asciidoc:158
[source, python]
----
resp = client.ilm.get_status()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dfbf53781adc6640493d49931a352167.asciidoc 0000664 0000000 0000000 00000001515 15176617013 0026304 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/enabled.asciidoc:64
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"enabled": False
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="session_1",
document={
"user_id": "kimchy",
"session_data": {
"arbitrary_object": {
"some_array": [
"foo",
"bar",
{
"baz": 2
}
]
}
},
"last_updated": "2015-12-06T18:20:22"
},
)
print(resp1)
resp2 = client.get(
index="my-index-000001",
id="session_1",
)
print(resp2)
resp3 = client.indices.get_mapping(
index="my-index-000001",
)
print(resp3)
----
python-elasticsearch-9.4.0/docs/examples/dfcc83efefaddccfe5dce0695c2266ef.asciidoc 0000664 0000000 0000000 00000000463 15176617013 0027412 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/nested-query.asciidoc:23
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"obj1": {
"type": "nested"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dfcdcd3ea6753dcc391a4a52cf640527.asciidoc 0000664 0000000 0000000 00000001655 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/update-desired-nodes.asciidoc:118
[source, python]
----
resp = client.perform_request(
"PUT",
"/_internal/desired_nodes/Ywkh3INLQcuPT49f6kcppA/101",
headers={"Content-Type": "application/json"},
body={
"nodes": [
{
"settings": {
"node.name": "instance-000187",
"node.external_id": "instance-000187",
"node.roles": [
"data_hot",
"master"
],
"node.attr.data": "hot",
"node.attr.logical_availability_zone": "zone-0"
},
"processors_range": {
"min": 8,
"max": 10
},
"memory": "58gb",
"storage": "2tb"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dfce1be1d035aff0b8fdf4a8839f7795.asciidoc 0000664 0000000 0000000 00000000644 15176617013 0027036 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/update-trained-model-deployment.asciidoc:121
[source, python]
----
resp = client.ml.update_trained_model_deployment(
model_id="elastic__distilbert-base-uncased-finetuned-conll03-english",
adaptive_allocations={
"enabled": True,
"min_number_of_allocations": 3,
"max_number_of_allocations": 10
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dfdf82b8d99436582f150117695190b3.asciidoc 0000664 0000000 0000000 00000001115 15176617013 0026231 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/children-aggregation.asciidoc:39
[source, python]
----
resp = client.index(
index="child_example",
id="1",
document={
"join": {
"name": "question"
},
"body": "I have Windows 2003 server and i bought a new Windows 2008 server...",
"title": "Whats the best way to file transfer my site from server to a newer one?",
"tags": [
"windows-server-2003",
"windows-server-2008",
"file-transfer"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dff61a76d5ef9ca8cbe59a416269a84b.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026761 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/apis/delete-pipeline.asciidoc:34
[source, python]
----
resp = client.ingest.delete_pipeline(
id="my-pipeline-id",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/dffbbdc4025e5777c647d8818847b960.asciidoc 0000664 0000000 0000000 00000000327 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-api-keys.asciidoc:275
[source, python]
----
resp = client.security.get_api_key(
id="VuaCfGcBCdbkQm-e5aOx",
owner=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e017c2de6f93a8dd97f5c6e002dd5c4f.asciidoc 0000664 0000000 0000000 00000001347 15176617013 0026747 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/e04267ffc50d916800b919c6cdc9622a.asciidoc 0000664 0000000 0000000 00000000373 15176617013 0026440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/ignore-above.asciidoc:74
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index.mapping.ignore_above": 256
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e0734215054e1ff5df712ce3a826cdba.asciidoc 0000664 0000000 0000000 00000000426 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:604
[source, python]
----
resp = client.indices.delete(
index="my-index",
)
print(resp)
resp1 = client.indices.delete_data_stream(
name="logs-my_app-default",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/e08fb1435dc659c24badf25b676efb68.asciidoc 0000664 0000000 0000000 00000000543 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/index-prefixes.asciidoc:21
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"body_text": {
"type": "text",
"index_prefixes": {}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e095fc96504efecc588f97673912e3d3.asciidoc 0000664 0000000 0000000 00000002443 15176617013 0026474 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/put-job.asciidoc:420
[source, python]
----
resp = client.ml.put_job(
job_id="test-job1",
pretty=True,
analysis_config={
"bucket_span": "15m",
"detectors": [
{
"detector_description": "Sum of bytes",
"function": "sum",
"field_name": "bytes"
}
]
},
data_description={
"time_field": "timestamp",
"time_format": "epoch_ms"
},
analysis_limits={
"model_memory_limit": "11MB"
},
model_plot_config={
"enabled": True,
"annotations_enabled": True
},
results_index_name="test-job1",
datafeed_config={
"indices": [
"kibana_sample_data_logs"
],
"query": {
"bool": {
"must": [
{
"match_all": {}
}
]
}
},
"runtime_mappings": {
"hour_of_day": {
"type": "long",
"script": {
"source": "emit(doc['timestamp'].value.getHour());"
}
}
},
"datafeed_id": "datafeed-test-job1"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e09d30195108bd6a1f6857394a6123ea.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026263 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/reverse-tokenfilter.asciidoc:24
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"reverse"
],
text="quick fox jumps",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e09ee13ce253c7892dd5ef076fbfbba5.asciidoc 0000664 0000000 0000000 00000001110 15176617013 0027012 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/remove-duplicates-tokenfilter.asciidoc:136
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"tokenizer": "standard",
"filter": [
"keyword_repeat",
"stemmer",
"remove_duplicates"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e0a7c730ef0f22e3edffe9a254bc56e7.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0027007 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:240
[source, python]
----
resp = client.reindex(
source={
"index": "my-index-000001",
"slice": {
"id": 0,
"max": 2
}
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
resp1 = client.reindex(
source={
"index": "my-index-000001",
"slice": {
"id": 1,
"max": 2
}
},
dest={
"index": "my-new-index-000001"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/e0b2f56c34e33ff52f8f9658be2f7ca1.asciidoc 0000664 0000000 0000000 00000000253 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/stats.asciidoc:111
[source, python]
----
resp = client.indices.stats(
index="index1,index2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e0bbfb368eae307e9508ab8d6e9cf23c.asciidoc 0000664 0000000 0000000 00000000257 15176617013 0027023 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/fielddata.asciidoc:108
[source, python]
----
resp = client.cat.fielddata(
v=True,
fields="body",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e0d4a800de2d8f4062e69433586c38db.asciidoc 0000664 0000000 0000000 00000000622 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/saml-complete-logout-api.asciidoc:75
[source, python]
----
resp = client.security.saml_complete_logout(
realm="saml1",
ids=[
"_1c368075e0b3..."
],
query_string="SAMLResponse=fZHLasMwEEVbfb1bf...&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=CuCmFn%2BLqnaZGZJqK...",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e0fcef99656799de6b88117d56f131e2.asciidoc 0000664 0000000 0000000 00000000445 15176617013 0026474 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:276
[source, python]
----
resp = client.explain(
index="my-index-000001",
id="0",
query={
"match": {
"message": "elasticsearch"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e1220f2c28db6ef0233e26e6bd3866fa.asciidoc 0000664 0000000 0000000 00000002421 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/tophits-aggregation.asciidoc:427
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"top_tags": {
"terms": {
"field": "type",
"size": 3
},
"aggs": {
"top_sales_hits": {
"top_hits": {
"sort": [
{
"date": {
"order": "desc"
}
}
],
"_source": {
"includes": [
"date",
"price"
]
},
"size": 1
}
},
"having.top_salary": {
"bucket_selector": {
"buckets_path": {
"tp": "top_sales_hits[_source.price]"
},
"script": "params.tp < 180"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e12f2d2ddca387630e7855a6db952da2.asciidoc 0000664 0000000 0000000 00000001703 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-aggregation.asciidoc:180
[source, python]
----
resp = client.search(
index="sales",
runtime_mappings={
"price.euros": {
"type": "double",
"script": {
"source": "\n emit(doc['price'].value * params.conversion_rate)\n ",
"params": {
"conversion_rate": 0.835526591
}
}
}
},
aggs={
"price_ranges": {
"range": {
"field": "price.euros",
"ranges": [
{
"to": 100
},
{
"from": 100,
"to": 200
},
{
"from": 200
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e1337c6b76defd5a46d05220f9d9c9fc.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-tokens.asciidoc:134
[source, python]
----
resp = client.security.get_token(
grant_type="password",
username="test_admin",
password="x-pack-test-password",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e14a5a5a1c880031486bfff43031fa3a.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026460 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/circuit-breaker-errors.asciidoc:71
[source, python]
----
resp = client.nodes.stats(
metric="breaker",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e16a353e619b935c5c70769b1b9fa100.asciidoc 0000664 0000000 0000000 00000001125 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/composite-aggregation.asciidoc:458
[source, python]
----
resp = client.search(
size=0,
aggs={
"my_buckets": {
"composite": {
"sources": [
{
"tile": {
"geotile_grid": {
"field": "location",
"precision": 8
}
}
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e1874cc7cd22b6860ca8b11bde3c70c1.asciidoc 0000664 0000000 0000000 00000001021 15176617013 0026626 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:227
[source, python]
----
resp = client.search(
index="index2",
query={
"query_string": {
"query": "running with scissors",
"fields": [
"comment",
"comment.english"
]
}
},
highlight={
"order": "score",
"fields": {
"comment": {
"type": "fvh"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e194e9cbe3eb2305f4f7cdda0cf529bd.asciidoc 0000664 0000000 0000000 00000000705 15176617013 0027074 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/misc.asciidoc:10
[source, python]
----
resp = client.search(
typed_keys=True,
suggest={
"text": "some test mssage",
"my-first-suggester": {
"term": {
"field": "message"
}
},
"my-second-suggester": {
"phrase": {
"field": "message"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e19f5e3724d9f3f36a817b9a811ca42e.asciidoc 0000664 0000000 0000000 00000001227 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline.asciidoc:62
[source, python]
----
resp = client.search(
aggs={
"my_date_histo": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "day"
},
"aggs": {
"the_sum": {
"sum": {
"field": "lemmings"
}
},
"the_deriv": {
"derivative": {
"buckets_path": "the_sum"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e1c08f5774e81da31cd75aa1bdc2c548.asciidoc 0000664 0000000 0000000 00000001525 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/percolate-query.asciidoc:688
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"bool": {
"should": [
{
"percolate": {
"field": "query",
"document": {
"message": "bonsai tree"
},
"name": "query1"
}
},
{
"percolate": {
"field": "query",
"document": {
"message": "tulip flower"
},
"name": "query2"
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e1d6ecab4148b09f4c605474157e7dbd.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026573 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:305
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e1f20ee96ce80edcc35b647cef731e15.asciidoc 0000664 0000000 0000000 00000000455 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/match-enrich-policy-type-ex.asciidoc:101
[source, python]
----
resp = client.index(
index="my-index-000001",
id="my_id",
pipeline="user_lookup",
document={
"email": "mardy.brown@asciidocsmith.com"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e1f6ea7c0937cf7e6ea7e8209e52e8bb.asciidoc 0000664 0000000 0000000 00000000432 15176617013 0026752 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/index-sorting.asciidoc:158
[source, python]
----
resp = client.search(
index="events",
size=10,
sort=[
{
"timestamp": "desc"
}
],
track_total_hits=False,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e22a1da3c622611be6855e534c0709ae.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0026410 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/e26c96978096ccc592849cca9db67ffc.asciidoc 0000664 0000000 0000000 00000000373 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// shard-request-cache.asciidoc:74
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index.requests.cache.enable": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e26e8bfa68aa4ab265b22304c38c3aef.asciidoc 0000664 0000000 0000000 00000004213 15176617013 0026715 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/esql/esql-getting-started-sample-data.asciidoc:7
[source, python]
----
resp = client.indices.create(
index="sample_data",
mappings={
"properties": {
"client_ip": {
"type": "ip"
},
"message": {
"type": "keyword"
}
}
},
)
print(resp)
resp1 = client.bulk(
index="sample_data",
operations=[
{
"index": {}
},
{
"@timestamp": "2023-10-23T12:15:03.360Z",
"client_ip": "172.21.2.162",
"message": "Connected to 10.1.0.3",
"event_duration": 3450233
},
{
"index": {}
},
{
"@timestamp": "2023-10-23T12:27:28.948Z",
"client_ip": "172.21.2.113",
"message": "Connected to 10.1.0.2",
"event_duration": 2764889
},
{
"index": {}
},
{
"@timestamp": "2023-10-23T13:33:34.937Z",
"client_ip": "172.21.0.5",
"message": "Disconnected",
"event_duration": 1232382
},
{
"index": {}
},
{
"@timestamp": "2023-10-23T13:51:54.732Z",
"client_ip": "172.21.3.15",
"message": "Connection error",
"event_duration": 725448
},
{
"index": {}
},
{
"@timestamp": "2023-10-23T13:52:55.015Z",
"client_ip": "172.21.3.15",
"message": "Connection error",
"event_duration": 8268153
},
{
"index": {}
},
{
"@timestamp": "2023-10-23T13:53:55.832Z",
"client_ip": "172.21.3.15",
"message": "Connection error",
"event_duration": 5033755
},
{
"index": {}
},
{
"@timestamp": "2023-10-23T13:55:01.543Z",
"client_ip": "172.21.3.15",
"message": "Connected to 10.1.0.1",
"event_duration": 1756467
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/e270f3f721a5712cd11a5ca03554f5b0.asciidoc 0000664 0000000 0000000 00000000622 15176617013 0026401 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:171
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "Will Smith",
"type": "best_fields",
"fields": [
"first_name",
"last_name"
],
"operator": "and"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e273060a675c959fd5f3cde27c8aff07.asciidoc 0000664 0000000 0000000 00000000504 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/disk-usage.asciidoc:14
[source, python]
----
resp = client.indices.create(
index="index",
mappings={
"properties": {
"foo": {
"type": "integer",
"index": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2750d69bcb6d4c7e16e704cd0fb3530.asciidoc 0000664 0000000 0000000 00000001011 15176617013 0026555 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rank-feature-query.asciidoc:67
[source, python]
----
resp = client.indices.create(
index="test",
mappings={
"properties": {
"pagerank": {
"type": "rank_feature"
},
"url_length": {
"type": "rank_feature",
"positive_score_impact": False
},
"topics": {
"type": "rank_features"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2883c88b5ceca9fce1e70e716d80025.asciidoc 0000664 0000000 0000000 00000000471 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/version.asciidoc:19
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_version": {
"type": "version"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2a22c6fd58cc0becf4c383134a08f8b.asciidoc 0000664 0000000 0000000 00000001072 15176617013 0026721 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/intervals-query.asciidoc:455
[source, python]
----
resp = client.search(
query={
"intervals": {
"my_text": {
"match": {
"query": "salty",
"filter": {
"contained_by": {
"match": {
"query": "hot porridge"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2a753029b450942a3228e3003a55a7d.asciidoc 0000664 0000000 0000000 00000000643 15176617013 0026172 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/apis/put-lifecycle.asciidoc:111
[source, python]
----
resp = client.indices.put_data_lifecycle(
name="my-weather-sensor-data-stream",
downsampling=[
{
"after": "1d",
"fixed_interval": "10m"
},
{
"after": "7d",
"fixed_interval": "1d"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2a7d127b82ddebb690a959dcd0cbc09.asciidoc 0000664 0000000 0000000 00000000750 15176617013 0027010 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/elision-tokenfilter.asciidoc:96
[source, python]
----
resp = client.indices.create(
index="elision_example",
settings={
"analysis": {
"analyzer": {
"whitespace_elision": {
"tokenizer": "whitespace",
"filter": [
"elision"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2b4867a9f72bda87ebaa3608d3fba4c.asciidoc 0000664 0000000 0000000 00000001277 15176617013 0027022 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:354
[source, python]
----
resp = client.render_search_template(
source={
"query": {
"range": {
"user.effective.date": {
"gte": "{{date.min}}",
"lte": "{{date.max}}",
"format": "{{#join delimiter='||'}}date.formats{{/join delimiter='||'}}"
}
}
}
},
params={
"date": {
"min": "2098",
"max": "06/05/2099",
"formats": [
"dd/MM/yyyy",
"yyyy"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2bcc8f4ed2b4de82729e7a5a7c8f634.asciidoc 0000664 0000000 0000000 00000000256 15176617013 0026753 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// synonyms/apis/list-synonyms-sets.asciidoc:86
[source, python]
----
resp = client.synonyms.get_synonyms_sets()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2d8cf24a12053eb09fec7087cdab43a.asciidoc 0000664 0000000 0000000 00000001460 15176617013 0026716 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/normalize-aggregation.asciidoc:95
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
},
"percent_of_total_sales": {
"normalize": {
"buckets_path": "sales",
"method": "percent_of_sum",
"format": "00.00%"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e2ec9e867f7141b304b53ebc59098f2a.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/update-api-key.asciidoc:258
[source, python]
----
resp = client.security.update_api_key(
id="VuaCfGcBCdbkQm-e5aOx",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e3019fd5f23458ae49ad9854c97d321c.asciidoc 0000664 0000000 0000000 00000000335 15176617013 0026451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/oidc-prepare-authentication-api.asciidoc:78
[source, python]
----
resp = client.security.oidc_prepare_authentication(
realm="oidc1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e308899a306e61d1a590868308689955.asciidoc 0000664 0000000 0000000 00000001261 15176617013 0026030 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/e30ea6e3823a139d7693d8cce1920a06.asciidoc 0000664 0000000 0000000 00000000520 15176617013 0026424 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/multi-match-query.asciidoc:50
[source, python]
----
resp = client.search(
query={
"multi_match": {
"query": "this is a test",
"fields": [
"subject^3",
"message"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e316271f668c9889bf548311fb421f1e.asciidoc 0000664 0000000 0000000 00000000560 15176617013 0026313 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:846
[source, python]
----
resp = client.search(
aggs={
"ip_addresses": {
"terms": {
"field": "destination_ip",
"missing": "0.0.0.0",
"value_type": "ip"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e317a8380dfbc76c4e7f23d0997b3518.asciidoc 0000664 0000000 0000000 00000000364 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:524
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"action.destructive_requires_name": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e324ea1547635180c31c1adf77870ba2.asciidoc 0000664 0000000 0000000 00000002120 15176617013 0026330 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/tsds-reindex.asciidoc:249
[source, python]
----
resp = client.cluster.put_component_template(
name="destination_template",
template={
"settings": {
"index": {
"number_of_replicas": 2,
"number_of_shards": 2,
"mode": "time_series",
"routing_path": [
"metricset"
]
}
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
},
"metricset": {
"type": "keyword",
"time_series_dimension": True
},
"k8s": {
"properties": {
"tx": {
"type": "long"
},
"rx": {
"type": "long"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e35abc9403e4aef7d538ab29ccc363b3.asciidoc 0000664 0000000 0000000 00000000417 15176617013 0026726 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/prevalidate-node-removal.asciidoc:111
[source, python]
----
resp = client.perform_request(
"POST",
"/_internal/prevalidate_node_removal",
params={
"names": "node1,node2"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e3678142aec988e2ff0ae5d934dc39e9.asciidoc 0000664 0000000 0000000 00000003761 15176617013 0026631 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-point.asciidoc:28
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"location": {
"type": "geo_point"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"text": "Geopoint as an object using GeoJSON format",
"location": {
"type": "Point",
"coordinates": [
-71.34,
41.12
]
}
},
)
print(resp1)
resp2 = client.index(
index="my-index-000001",
id="2",
document={
"text": "Geopoint as a WKT POINT primitive",
"location": "POINT (-71.34 41.12)"
},
)
print(resp2)
resp3 = client.index(
index="my-index-000001",
id="3",
document={
"text": "Geopoint as an object with 'lat' and 'lon' keys",
"location": {
"lat": 41.12,
"lon": -71.34
}
},
)
print(resp3)
resp4 = client.index(
index="my-index-000001",
id="4",
document={
"text": "Geopoint as an array",
"location": [
-71.34,
41.12
]
},
)
print(resp4)
resp5 = client.index(
index="my-index-000001",
id="5",
document={
"text": "Geopoint as a string",
"location": "41.12,-71.34"
},
)
print(resp5)
resp6 = client.index(
index="my-index-000001",
id="6",
document={
"text": "Geopoint as a geohash",
"location": "drm3btev3e86"
},
)
print(resp6)
resp7 = client.search(
index="my-index-000001",
query={
"geo_bounding_box": {
"location": {
"top_left": {
"lat": 42,
"lon": -72
},
"bottom_right": {
"lat": 40,
"lon": -74
}
}
}
},
)
print(resp7)
----
python-elasticsearch-9.4.0/docs/examples/e375c7da666276c4df6664c6821cd5f4.asciidoc 0000664 0000000 0000000 00000001205 15176617013 0026454 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/e3a6462ca79c101314da0680c97678cd.asciidoc 0000664 0000000 0000000 00000001202 15176617013 0026342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/retrieve-selected-fields.asciidoc:734
[source, python]
----
resp = client.search(
query={
"match_all": {}
},
script_fields={
"test1": {
"script": {
"lang": "painless",
"source": "doc['price'].value * 2"
}
},
"test2": {
"script": {
"lang": "painless",
"source": "doc['price'].value * params.factor",
"params": {
"factor": 2
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e3b3a8ae12ab947ad3ba96eb228402ca.asciidoc 0000664 0000000 0000000 00000000432 15176617013 0026705 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/store.asciidoc:122
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index.store.preload": [
"nvd",
"dvd"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e3f2f6ee3e312b8a90634827ae954d70.asciidoc 0000664 0000000 0000000 00000001535 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:421
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "GeometryCollection",
"geometries": [
{
"type": "Point",
"coordinates": [
100,
0
]
},
{
"type": "LineString",
"coordinates": [
[
101,
0
],
[
102,
1
]
]
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e3fe842951dc873d7d00c8f6a010c53f.asciidoc 0000664 0000000 0000000 00000000373 15176617013 0026516 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/e4193867485595c9c92f909a052d2a90.asciidoc 0000664 0000000 0000000 00000000734 15176617013 0026166 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/has-parent-query.asciidoc:27
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my-join-field": {
"type": "join",
"relations": {
"parent": "child"
}
},
"tag": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e41a9bac42d0c1cb103674ae9039b7af.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0026624 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/field-mapping.asciidoc:234
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"numeric_detection": True
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"my_float": "1.0",
"my_integer": "1"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/e441cb3be3c2f007621ee1f8c9a2e0ef.asciidoc 0000664 0000000 0000000 00000000562 15176617013 0026717 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/matrix-stats-aggregation.asciidoc:45
[source, python]
----
resp = client.search(
aggs={
"statistics": {
"matrix_stats": {
"fields": [
"poverty",
"income"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e451900efbd8be50c2b8347a83816aa6.asciidoc 0000664 0000000 0000000 00000001315 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/extended-stats-bucket-aggregation.asciidoc:44
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"stats_monthly_sales": {
"extended_stats_bucket": {
"buckets_path": "sales_per_month>sales"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e46c83db1580e14be844079cd008f518.asciidoc 0000664 0000000 0000000 00000000501 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/enable-index-allocation.asciidoc:130
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"routing.allocation.enable": "all"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e47a71a2e314dbbee5db8142a23957ce.asciidoc 0000664 0000000 0000000 00000000643 15176617013 0026644 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:621
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"set": {
"description": "Index the ingest timestamp as 'event.ingested'",
"field": "event.ingested",
"value": "{{{_ingest.timestamp}}}"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e48e7da65c2b32d724fd7e3bfa175c6f.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026747 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-overall-buckets.asciidoc:136
[source, python]
----
resp = client.ml.get_overall_buckets(
job_id="job-*",
overall_score=80,
start="1403532000000",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e494162e83ce041c56b2e2bc29d33474.asciidoc 0000664 0000000 0000000 00000000627 15176617013 0026354 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:394
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n sequence by process.pid with maxspan=1h\n [ process where process.name == \"regsvr32.exe\" ]\n [ file where stringContains(file.name, \"scrobj.dll\") ]\n until [ process where event.type == \"termination\" ]\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e4b2b5e0aaedf3cbbcde3d61eb1f13fc.asciidoc 0000664 0000000 0000000 00000000352 15176617013 0027342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/refresh.asciidoc:108
[source, python]
----
resp = client.index(
index="test",
id="4",
refresh="wait_for",
document={
"test": "test"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e4b38973c74037335378d8480f1ce894.asciidoc 0000664 0000000 0000000 00000001703 15176617013 0026164 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/e4b64b8277af259a52c8d3940157b5fa.asciidoc 0000664 0000000 0000000 00000002346 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/painless-examples.asciidoc:402
[source, python]
----
resp = client.transform.put_transform(
transform_id="data_log",
source={
"index": "kibana_sample_data_logs"
},
dest={
"index": "data-logs-by-client"
},
pivot={
"group_by": {
"machine.os": {
"terms": {
"field": "machine.os.keyword"
}
},
"machine.ip": {
"terms": {
"field": "clientip"
}
}
},
"aggregations": {
"time_frame.lte": {
"max": {
"field": "timestamp"
}
},
"time_frame.gte": {
"min": {
"field": "timestamp"
}
},
"time_length": {
"bucket_script": {
"buckets_path": {
"min": "time_frame.gte.value",
"max": "time_frame.lte.value"
},
"script": "params.max - params.min"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e4b6a6a921c97b4c0bbe97bd89f4cf33.asciidoc 0000664 0000000 0000000 00000000317 15176617013 0026744 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/promote-data-stream-api.asciidoc:32
[source, python]
----
resp = client.indices.promote_data_stream(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e4be53736bcc02b03068fd72fdbfe271.asciidoc 0000664 0000000 0000000 00000000406 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:114
[source, python]
----
resp = client.indices.put_mapping(
index="publications",
properties={
"title": {
"type": "text"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e4d1f01c025fb797a1d87f372760eabf.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/hotspotting.asciidoc:271
[source, python]
----
resp = client.tasks.list(
human=True,
detailed=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e4de6035653e8202c43631f02d244661.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026121 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-across-clusters.asciidoc:127
[source, python]
----
resp = client.search(
index="cluster_one:my-index-000001",
size=1,
query={
"match": {
"user.id": "kimchy"
}
},
source=[
"user.id",
"message",
"http.response.status_code"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e4ea514eb9a01716d9bbc5aa04ee0252.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026630 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/query-user.asciidoc:192
[source, python]
----
resp = client.perform_request(
"POST",
"/_security/_query/user",
headers={"Content-Type": "application/json"},
body={
"query": {
"prefix": {
"roles": "other"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e51a86b666f447cda5f634547a8e1a4a.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026516 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-data-stream.asciidoc:28
[source, python]
----
resp = client.indices.create_data_stream(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e551ea38a2d8f8deac110b33304200cc.asciidoc 0000664 0000000 0000000 00000001113 15176617013 0026531 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// reranking/learning-to-rank-search-usage.asciidoc:17
[source, python]
----
resp = client.search(
index="my-index",
query={
"multi_match": {
"fields": [
"title",
"content"
],
"query": "the quick brown fox"
}
},
rescore={
"learning_to_rank": {
"model_id": "ltr-model",
"params": {
"query_text": "the quick brown fox"
}
},
"window_size": 100
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e586d1d2a997133e039fd352a42a72b3.asciidoc 0000664 0000000 0000000 00000000732 15176617013 0026352 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/terms-set-query.asciidoc:136
[source, python]
----
resp = client.search(
index="job-candidates",
query={
"terms_set": {
"programming_languages": {
"terms": [
"c++",
"java",
"php"
],
"minimum_should_match_field": "required_matches"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e58833449d01379df20ad06dc28144d8.asciidoc 0000664 0000000 0000000 00000000436 15176617013 0026302 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update-by-query.asciidoc:331
[source, python]
----
resp = client.update_by_query(
index="my-index-000001",
conflicts="proceed",
query={
"term": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e58b7965c3a314c34bc444c6db3b1b79.asciidoc 0000664 0000000 0000000 00000000443 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/enable-index-allocation.asciidoc:104
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
name="index.routing.allocation.enable",
flat_settings=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e5901f48eb8a419b878fc2cb815d8691.asciidoc 0000664 0000000 0000000 00000000355 15176617013 0026463 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/update-settings.asciidoc:50
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"indices.recovery.max_bytes_per_sec": "50mb"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e5c710b08a545522d50b4ce35503bc46.asciidoc 0000664 0000000 0000000 00000001325 15176617013 0026327 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:230
[source, python]
----
resp = client.index(
index="my-data-stream",
pipeline="my-pipeline",
document={
"@timestamp": "2099-03-07T11:04:05.000Z",
"my-keyword-field": "foo"
},
)
print(resp)
resp1 = client.bulk(
index="my-data-stream",
pipeline="my-pipeline",
operations=[
{
"create": {}
},
{
"@timestamp": "2099-03-07T11:04:06.000Z",
"my-keyword-field": "foo"
},
{
"create": {}
},
{
"@timestamp": "2099-03-07T11:04:07.000Z",
"my-keyword-field": "bar"
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/e5f50b31f165462d883ecbff45f74985.asciidoc 0000664 0000000 0000000 00000001155 15176617013 0026461 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-index-template-v1.asciidoc:20
[source, python]
----
resp = client.indices.put_template(
name="template_1",
index_patterns=[
"te*",
"bar*"
],
settings={
"number_of_shards": 1
},
mappings={
"_source": {
"enabled": False
},
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e5f89a04f50df707a0a53ec0f2eecbbd.asciidoc 0000664 0000000 0000000 00000000345 15176617013 0027063 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:77
[source, python]
----
resp = client.get(
index="my-index-000001",
id="0",
source_includes="*.id",
source_excludes="entities",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e5f8f83df37ab2296dc4bfed95d7aba7.asciidoc 0000664 0000000 0000000 00000000417 15176617013 0027116 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/enable-cluster-allocation.asciidoc:112
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.enable": "all"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e608cd0c034f6c245ea87f425e09ce2f.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026571 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-term-query.asciidoc:10
[source, python]
----
resp = client.search(
query={
"span_term": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e60b7f75ca806f2c74927c3d9409a986.asciidoc 0000664 0000000 0000000 00000000525 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/create-role-mappings.asciidoc:166
[source, python]
----
resp = client.security.put_role_mapping(
name="mapping3",
roles=[
"ldap-user"
],
enabled=True,
rules={
"field": {
"realm.name": "ldap1"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e60c2bf89fdf38187709d04dd1c55330.asciidoc 0000664 0000000 0000000 00000000617 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/mlt-query.asciidoc:19
[source, python]
----
resp = client.search(
query={
"more_like_this": {
"fields": [
"title",
"description"
],
"like": "Once upon a time",
"min_term_freq": 1,
"max_query_terms": 12
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e60ded7becfd5b2ccaef5bad2aaa93f5.asciidoc 0000664 0000000 0000000 00000000551 15176617013 0027440 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:185
[source, python]
----
resp = client.search(
aggs={
"products": {
"terms": {
"field": "product",
"size": 5,
"show_term_doc_count_error": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e61b5abe85000cc954a42e2cd74f3a26.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026552 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/put-calendar.asciidoc:50
[source, python]
----
resp = client.ml.put_calendar(
calendar_id="planned-outages",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e6369e7cef82d881af593d5526bf79bd.asciidoc 0000664 0000000 0000000 00000000455 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-term-query.asciidoc:22
[source, python]
----
resp = client.search(
query={
"span_term": {
"user.id": {
"value": "kimchy",
"boost": 2
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e63775a2ff22b945ab9d5f630b80c506.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/health.asciidoc:202
[source, python]
----
resp = client.cluster.health(
index="my-index-000001",
level="shards",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e63cf08350e9381f519c2835843be7cd.asciidoc 0000664 0000000 0000000 00000000653 15176617013 0026374 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/field-mapping.asciidoc:175
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_date_formats": [
"yyyy/MM||MM/dd/yyyy"
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"create_date": "09/25/2015"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/e642be44a62a89cf4afb2db28220c9a9.asciidoc 0000664 0000000 0000000 00000000454 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:459
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"ingest.geoip.downloader.enabled": True,
"indices.lifecycle.history_index_enabled": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e650d73c57ab313e686fec01e3b0c90f.asciidoc 0000664 0000000 0000000 00000000653 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:915
[source, python]
----
resp = client.reindex(
source={
"index": "my-index-000001"
},
dest={
"index": "my-new-index-000001",
"version_type": "external"
},
script={
"source": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}",
"lang": "painless"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e697ef947f3fb7835f7fadb9125b1043.asciidoc 0000664 0000000 0000000 00000000603 15176617013 0026537 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:375
[source, python]
----
resp = client.sql.query(
format="txt",
query="SELECT * FROM library ORDER BY page_count DESC",
filter={
"range": {
"page_count": {
"gte": 100,
"lte": 200
}
}
},
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e6b972611c0ec8ab4c240f33f323d85b.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0026505 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:418
[source, python]
----
resp = client.search(
index="my-index-000001",
size="0",
aggs={
"by_day": {
"date_histogram": {
"field": "date",
"calendar_interval": "day",
"time_zone": "-01:00"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e6ccd979c34ba03007e625c6ec3e71a9.asciidoc 0000664 0000000 0000000 00000000213 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:260
[source, python]
----
resp = client.indices.get_alias()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e6dcc2911d2416a65eaec9846b956e15.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026520 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/refresh.asciidoc:19
[source, python]
----
resp = client.indices.refresh(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e6e47da87079a8b67f767a2a01878cf2.asciidoc 0000664 0000000 0000000 00000000716 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:578
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"set": {
"description": "Use geo_point dynamic template for address field",
"field": "_dynamic_templates",
"value": {
"address": "geo_point"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e6f6d3aeea7ecea47cfd5c3d727f7004.asciidoc 0000664 0000000 0000000 00000002456 15176617013 0027107 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/e6faae2e272ee57727f38e55a3de5bb2.asciidoc 0000664 0000000 0000000 00000000505 15176617013 0026741 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:557
[source, python]
----
resp = client.search(
highlight={
"fields": [
{
"title": {}
},
{
"text": {}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e715fb8c792bf09ac98f0ceca99beb84.asciidoc 0000664 0000000 0000000 00000000276 15176617013 0027044 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// migration/migrate_9_0.asciidoc:345
[source, python]
----
resp = client.migration.deprecations(
index=".ml-anomalies-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e71d300cd87f09a9527cf45395dd7eb1.asciidoc 0000664 0000000 0000000 00000000247 15176617013 0026527 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// slm/apis/slm-execute-retention.asciidoc:40
[source, python]
----
resp = client.slm.execute_retention()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e77c2f41a7eca765b0c5f734a66d919f.asciidoc 0000664 0000000 0000000 00000000767 15176617013 0026621 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/attachment.asciidoc:133
[source, python]
----
resp = client.ingest.put_pipeline(
id="attachment",
description="Extract attachment information",
processors=[
{
"attachment": {
"field": "data",
"properties": [
"content",
"title"
],
"remove_binary": True
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e784fc00894635470adfd78a0c46b427.asciidoc 0000664 0000000 0000000 00000001235 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-component-template.asciidoc:19
[source, python]
----
resp = client.cluster.put_component_template(
name="template_1",
template={
"settings": {
"number_of_shards": 1
},
"mappings": {
"_source": {
"enabled": False
},
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e7cfe670b4177d1011076f845ec2916c.asciidoc 0000664 0000000 0000000 00000000516 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-manage-data-stream-retention.asciidoc:144
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"data_streams.lifecycle.retention.default": "7d",
"data_streams.lifecycle.retention.max": "90d"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e7d819634d765cde269e2669e2dc677f.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026476 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-api-keys.asciidoc:151
[source, python]
----
resp = client.security.invalidate_api_key(
username="myuser",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e7e95022867c72a6563137f066dd2973.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0026150 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significantterms-aggregation.asciidoc:207
[source, python]
----
resp = client.search(
aggs={
"hotspots": {
"geohash_grid": {
"field": "location",
"precision": 5
},
"aggs": {
"significant_crime_types": {
"significant_terms": {
"field": "crime_type"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e7eca57a5bf5a53cbbe2463bce11495b.asciidoc 0000664 0000000 0000000 00000000507 15176617013 0027003 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/valuecount-aggregation.asciidoc:15
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"types_count": {
"value_count": {
"field": "type"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e8211247c280a3fbbbdd32850b743b7b.asciidoc 0000664 0000000 0000000 00000000675 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/put-dfanalytics.asciidoc:723
[source, python]
----
resp = client.ml.put_data_frame_analytics(
id="house_price_regression_analysis",
source={
"index": "houses_sold_last_10_yrs"
},
dest={
"index": "house_price_predictions"
},
analysis={
"regression": {
"dependent_variable": "price"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e821d27a8b810821707ba860e31f8b78.asciidoc 0000664 0000000 0000000 00000000600 15176617013 0026270 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/put-mapping.asciidoc:238
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
properties={
"city": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e827a9040e137410d62d10bb3b3cbb71.asciidoc 0000664 0000000 0000000 00000000263 15176617013 0026377 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/get-watch.asciidoc:55
[source, python]
----
resp = client.watcher.get_watch(
id="my_watch",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e82c33def91faddcfeed7b02cd258605.asciidoc 0000664 0000000 0000000 00000001057 15176617013 0027077 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/multi-terms-aggregation.asciidoc:248
[source, python]
----
resp = client.search(
index="products",
aggs={
"genres_and_products": {
"multi_terms": {
"terms": [
{
"field": "genre"
},
{
"field": "product",
"missing": "Product Z"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e84e23232c7ecc8d6377ec2c16a60269.asciidoc 0000664 0000000 0000000 00000000621 15176617013 0026436 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-index.asciidoc:198
[source, python]
----
resp = client.indices.create(
index="test",
aliases={
"alias_1": {},
"alias_2": {
"filter": {
"term": {
"user.id": "kimchy"
}
},
"routing": "shard-1"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e88a057a13e191e4d5faa22edf2ae8ed.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0027014 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:368
[source, python]
----
resp = client.cluster.get_settings(
filter_path="**.xpack.profiling.templates.enabled",
include_defaults=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e891e1d4805172da45a81f62b6b44aca.asciidoc 0000664 0000000 0000000 00000001171 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:464
[source, python]
----
resp = client.search(
size=0,
runtime_mappings={
"normalized_genre": {
"type": "keyword",
"script": "\n String genre = doc['genre'].value;\n if (doc['product'].value.startsWith('Anthology')) {\n emit(genre + ' anthology');\n } else {\n emit(genre);\n }\n "
}
},
aggs={
"genres": {
"terms": {
"field": "normalized_genre"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e89bf0d893b7bf43c2d9b44db6cfe21b.asciidoc 0000664 0000000 0000000 00000000511 15176617013 0027017 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rank-feature-query.asciidoc:295
[source, python]
----
resp = client.search(
index="test",
query={
"rank_feature": {
"field": "pagerank",
"log": {
"scaling_factor": 4
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e8a2726eea5545355d1d0835d4599f55.asciidoc 0000664 0000000 0000000 00000000377 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/ip.asciidoc:126
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"term": {
"ip_addr": "2001:db8::/48"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e8bb5c57bdeff22be8e5f39a99dfe70e.asciidoc 0000664 0000000 0000000 00000001376 15176617013 0027211 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/sampler-aggregation.asciidoc:22
[source, python]
----
resp = client.search(
index="stackoverflow",
size="0",
query={
"query_string": {
"query": "tags:kibana OR tags:javascript"
}
},
aggs={
"sample": {
"sampler": {
"shard_size": 200
},
"aggs": {
"keywords": {
"significant_terms": {
"field": "tags",
"exclude": [
"kibana",
"javascript"
]
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e8c348cabe15dfe58ab4c3cc13a963fe.asciidoc 0000664 0000000 0000000 00000000263 15176617013 0027073 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-shards.asciidoc:78
[source, python]
----
resp = client.search_shards(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e8cbe2269f3dff6b231e73119e81511d.asciidoc 0000664 0000000 0000000 00000000336 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/exists-query.asciidoc:20
[source, python]
----
resp = client.search(
query={
"exists": {
"field": "user"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e8ea65153d7775f25b08dfdfe6954498.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026471 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/simple-query-string-query.asciidoc:245
[source, python]
----
resp = client.search(
query={
"simple_query_string": {
"query": "Will Smith",
"fields": [
"title",
"*_name"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e8f1c9ee003d115ec8f55e57990df6e4.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026613 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-category.asciidoc:154
[source, python]
----
resp = client.ml.get_categories(
job_id="esxi_log",
page={
"size": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e905543b281e9c41395304da76ed2ea3.asciidoc 0000664 0000000 0000000 00000000260 15176617013 0026347 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/troubleshooting.asciidoc:29
[source, python]
----
resp = client.indices.delete(
index=".watches",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e930a572e8ddfdecc13498c04007b9e3.asciidoc 0000664 0000000 0000000 00000001030 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:97
[source, python]
----
resp = client.indices.create(
index="openai-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 1536,
"element_type": "float",
"similarity": "dot_product"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e93ff228ab3e63738e1c83fdfb7424b9.asciidoc 0000664 0000000 0000000 00000000652 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:446
[source, python]
----
resp = client.search(
query={
"match": {
"user.id": "kimchy"
}
},
highlight={
"pre_tags": [
""
],
"post_tags": [
" "
],
"fields": {
"body": {}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e95ba581b298cd7bb598374afbfed315.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/frequent-item-sets-aggregation.asciidoc:173
[source, python]
----
resp = client.async_search.get(
id="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e95e61988dc3073a007f7b7445dd233b.asciidoc 0000664 0000000 0000000 00000001072 15176617013 0026362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/lifecycle/tutorial-migrate-data-stream-from-ilm-to-dsl.asciidoc:192
[source, python]
----
resp = client.indices.put_index_template(
name="dsl-data-stream-template",
index_patterns=[
"dsl-data-stream*"
],
data_stream={},
priority=500,
template={
"settings": {
"index.lifecycle.name": "pre-dsl-ilm-policy",
"index.lifecycle.prefer_ilm": False
},
"lifecycle": {
"data_retention": "7d"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e9625da419bff6470ffd9927c59ca159.asciidoc 0000664 0000000 0000000 00000000360 15176617013 0026544 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/rejected-requests.asciidoc:29
[source, python]
----
resp = client.cat.thread_pool(
v=True,
h="id,name,queue,active,rejected,completed",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e9738fe09a99080506a07945795e8eda.asciidoc 0000664 0000000 0000000 00000000427 15176617013 0026334 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/stop-tokenfilter.asciidoc:31
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"stop"
],
text="a quick fox jumps over the lazy dog",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e99c45a47dc0ba7440aea8a9a99c84fa.asciidoc 0000664 0000000 0000000 00000001132 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significanttext-aggregation.asciidoc:39
[source, python]
----
resp = client.search(
index="news",
query={
"match": {
"content": "Bird flu"
}
},
aggregations={
"my_sample": {
"sampler": {
"shard_size": 100
},
"aggregations": {
"keywords": {
"significant_text": {
"field": "content"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e9a0b450af6219772631703d602c7092.asciidoc 0000664 0000000 0000000 00000002273 15176617013 0026125 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/text-expansion-query.asciidoc:229
[source, python]
----
resp = client.search(
index="my-index",
query={
"text_expansion": {
"ml.tokens": {
"model_id": ".elser_model_2",
"model_text": "How is the weather in Jamaica?",
"pruning_config": {
"tokens_freq_ratio_threshold": 5,
"tokens_weight_threshold": 0.4,
"only_score_pruned_tokens": False
}
}
}
},
rescore={
"window_size": 100,
"query": {
"rescore_query": {
"text_expansion": {
"ml.tokens": {
"model_id": ".elser_model_2",
"model_text": "How is the weather in Jamaica?",
"pruning_config": {
"tokens_freq_ratio_threshold": 5,
"tokens_weight_threshold": 0.4,
"only_score_pruned_tokens": True
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e9f9e184499a793828233e536fac0487.asciidoc 0000664 0000000 0000000 00000000435 15176617013 0026256 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/delete-by-query.asciidoc:412
[source, python]
----
resp = client.delete_by_query(
index="my-index-000001",
scroll_size="5000",
query={
"term": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e9fc47015922d51c2b05e502ce9c622e.asciidoc 0000664 0000000 0000000 00000000645 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-google-ai-studio.asciidoc:103
[source, python]
----
resp = client.inference.put(
task_type="completion",
inference_id="google_ai_studio_completion",
inference_config={
"service": "googleaistudio",
"service_settings": {
"api_key": "",
"model_id": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/e9fe3b53b5b6e1ff9566b5237c0fa513.asciidoc 0000664 0000000 0000000 00000002000 15176617013 0026570 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/children-aggregation.asciidoc:59
[source, python]
----
resp = client.index(
index="child_example",
id="2",
routing="1",
document={
"join": {
"name": "answer",
"parent": "1"
},
"owner": {
"location": "Norfolk, United Kingdom",
"display_name": "Sam",
"id": 48
},
"body": "Unfortunately you're pretty much limited to FTP...",
"creation_date": "2009-05-04T13:45:37.030"
},
)
print(resp)
resp1 = client.index(
index="child_example",
id="3",
routing="1",
refresh=True,
document={
"join": {
"name": "answer",
"parent": "1"
},
"owner": {
"location": "Norfolk, United Kingdom",
"display_name": "Troll",
"id": 49
},
"body": "Use Linux...",
"creation_date": "2009-05-05T13:45:37.030"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/ea020ea32d5cd35e577c61a120f92451.asciidoc 0000664 0000000 0000000 00000001621 15176617013 0026405 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-a-data-stream.asciidoc:240
[source, python]
----
resp = client.bulk(
index="my-data-stream",
operations=[
{
"create": {}
},
{
"@timestamp": "2099-05-06T16:21:15.000Z",
"message": "192.0.2.42 - - [06/May/2099:16:21:15 +0000] \"GET /images/bg.jpg HTTP/1.0\" 200 24736"
},
{
"create": {}
},
{
"@timestamp": "2099-05-06T16:25:42.000Z",
"message": "192.0.2.255 - - [06/May/2099:16:25:42 +0000] \"GET /favicon.ico HTTP/1.0\" 200 3638"
}
],
)
print(resp)
resp1 = client.index(
index="my-data-stream",
document={
"@timestamp": "2099-05-06T16:21:15.000Z",
"message": "192.0.2.42 - - [06/May/2099:16:21:15 +0000] \"GET /images/bg.jpg HTTP/1.0\" 200 24736"
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/ea29029884a5fd9a8d8830d25884bf07.asciidoc 0000664 0000000 0000000 00000000433 15176617013 0026400 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/parent-id-query.asciidoc:79
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"parent_id": {
"type": "my-child",
"id": "1"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ea313059c18d6edbd28c3f743a5e7c1c.asciidoc 0000664 0000000 0000000 00000001015 15176617013 0026643 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/significantterms-aggregation.asciidoc:602
[source, python]
----
resp = client.search(
query={
"match": {
"city": "madrid"
}
},
aggs={
"tags": {
"significant_terms": {
"field": "tag",
"background_filter": {
"term": {
"text": "spain"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ea5391267ced860c00214c096e08c8d4.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/update-settings.asciidoc:19
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"number_of_replicas": 2
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ea5b4d2d87fd4e040afad18903c44869.asciidoc 0000664 0000000 0000000 00000001360 15176617013 0026575 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:185
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_bounding_box": {
"pin.location": {
"top_left": {
"lat": 40.73,
"lon": -74.1
},
"bottom_right": {
"lat": 40.01,
"lon": -71.12
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ea61aa2531ea73ccc0acd2d41f0518eb.asciidoc 0000664 0000000 0000000 00000001363 15176617013 0026755 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/rank-feature.asciidoc:11
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"pagerank": {
"type": "rank_feature"
},
"url_length": {
"type": "rank_feature",
"positive_score_impact": False
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"pagerank": 8,
"url_length": 22
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"rank_feature": {
"field": "pagerank"
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ea66a620c23337545e409c120c4ed5d9.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/ilm-tutorial.asciidoc:207
[source, python]
----
resp = client.ilm.explain_lifecycle(
index=".ds-timeseries-*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ea68e3428cc2ca3455bf312d09451489.asciidoc 0000664 0000000 0000000 00000000717 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:1244
[source, python]
----
resp = client.indices.create(
index="product-index",
mappings={
"properties": {
"product-vector": {
"type": "dense_vector",
"dims": 5,
"index": False
},
"price": {
"type": "long"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ea690283f301c6ce957efad93d7d5c5d.asciidoc 0000664 0000000 0000000 00000000741 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/length-tokenfilter.asciidoc:109
[source, python]
----
resp = client.indices.create(
index="length_example",
settings={
"analysis": {
"analyzer": {
"standard_length": {
"tokenizer": "standard",
"filter": [
"length"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ea8c4229afa6dd4f1321355542be9912.asciidoc 0000664 0000000 0000000 00000001411 15176617013 0026423 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/attachment.asciidoc:268
[source, python]
----
resp = client.ingest.put_pipeline(
id="attachment",
description="Extract attachment information",
processors=[
{
"attachment": {
"field": "data",
"indexed_chars": 11,
"indexed_chars_field": "max_size",
"remove_binary": True
}
}
],
)
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)
----
python-elasticsearch-9.4.0/docs/examples/ea92390651e8ecad0c890658985343c5.asciidoc 0000664 0000000 0000000 00000000737 15176617013 0026322 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:557
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="hourly-snapshots",
name="",
schedule="0 0 * * * ?",
repository="my_repository",
config={
"indices": "*",
"include_global_state": True
},
retention={
"expire_after": "1d",
"min_count": 1,
"max_count": 24
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eab3cad0257c539c5efd2689aa52f242.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0026642 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:111
[source, python]
----
resp = client.indices.data_streams_stats(
name="my-data-stream",
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eac3bc428d03eb4926fa51f74b9bc4d5.asciidoc 0000664 0000000 0000000 00000003143 15176617013 0026727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/highlighting.asciidoc:354
[source, python]
----
resp = client.search(
query={
"match": {
"comment": {
"query": "foo bar"
}
}
},
rescore={
"window_size": 50,
"query": {
"rescore_query": {
"match_phrase": {
"comment": {
"query": "foo bar",
"slop": 1
}
}
},
"rescore_query_weight": 10
}
},
source=False,
highlight={
"order": "score",
"fields": {
"comment": {
"fragment_size": 150,
"number_of_fragments": 3,
"highlight_query": {
"bool": {
"must": {
"match": {
"comment": {
"query": "foo bar"
}
}
},
"should": {
"match_phrase": {
"comment": {
"query": "foo bar",
"slop": 1,
"boost": 10
}
}
},
"minimum_should_match": 0
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ead4d875877d618594d0cdbdd9b7998b.asciidoc 0000664 0000000 0000000 00000000417 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/add-nodes.asciidoc:170
[source, python]
----
resp = client.cluster.delete_voting_config_exclusions()
print(resp)
resp1 = client.cluster.delete_voting_config_exclusions(
wait_for_removal=False,
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/eada8af6588584ac88f1e5b15f4a5c2a.asciidoc 0000664 0000000 0000000 00000002326 15176617013 0026745 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/valuecount-aggregation.asciidoc:97
[source, python]
----
resp = client.index(
index="metrics_index",
id="1",
document={
"network.name": "net-1",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
3,
7,
23,
12,
6
]
}
},
)
print(resp)
resp1 = client.index(
index="metrics_index",
id="2",
document={
"network.name": "net-2",
"latency_histo": {
"values": [
0.1,
0.2,
0.3,
0.4,
0.5
],
"counts": [
8,
17,
8,
7,
6
]
}
},
)
print(resp1)
resp2 = client.search(
index="metrics_index",
size="0",
aggs={
"total_requests": {
"value_count": {
"field": "latency_histo"
}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/eae8931d01b3b878dd0c45214121e662.asciidoc 0000664 0000000 0000000 00000000544 15176617013 0026341 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:329
[source, python]
----
resp = client.search(
index="my_locations",
query={
"geo_bounding_box": {
"pin.location": {
"top_left": "dr",
"bottom_right": "dr"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eaf53b05959cc6b7fb09579baf34de68.asciidoc 0000664 0000000 0000000 00000002123 15176617013 0026673 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline.asciidoc:127
[source, python]
----
resp = client.search(
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sale_type": {
"terms": {
"field": "type"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
},
"hat_vs_bag_ratio": {
"bucket_script": {
"buckets_path": {
"hats": "sale_type['hat']>sales",
"bags": "sale_type['bag']>sales"
},
"script": "params.hats / params.bags"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eaf6a846ded090fd6ac48269ad2b328b.asciidoc 0000664 0000000 0000000 00000000606 15176617013 0026737 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-rollover.asciidoc:38
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index.lifecycle.name": "my_policy",
"index.lifecycle.rollover_alias": "my_data"
},
aliases={
"my_data": {
"is_write_index": True
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eafdabe80b21b90495555fa6d9089412.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026514 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-service-token-caches.asciidoc:68
[source, python]
----
resp = client.security.clear_cached_service_tokens(
namespace="elastic",
service="fleet-server",
name="token1,token2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb09235533a1c65a0627ba05f7d4ad4d.asciidoc 0000664 0000000 0000000 00000001155 15176617013 0026472 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/context-suggest.asciidoc:253
[source, python]
----
resp = client.index(
index="place",
id="1",
document={
"suggest": {
"input": "timmy's",
"contexts": {
"location": [
{
"lat": 43.6624803,
"lon": -79.3863353
},
{
"lat": 43.6624718,
"lon": -79.3873227
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb141f8df8ead40ff7440b623ea92267.asciidoc 0000664 0000000 0000000 00000001062 15176617013 0026573 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/copy-to.asciidoc:94
[source, python]
----
resp = client.indices.create(
index="good_example_index",
mappings={
"properties": {
"field_1": {
"type": "text",
"copy_to": [
"field_2",
"field_3"
]
},
"field_2": {
"type": "text"
},
"field_3": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb14cedd3bdda9ffef3c118f3d528dcd.asciidoc 0000664 0000000 0000000 00000000340 15176617013 0027307 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/update.asciidoc:178
[source, python]
----
resp = client.update(
index="test",
id="1",
script="ctx._source.new_field = 'value_of_new_field'",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb33a7e5a0fe83fdaa0f79354f659428.asciidoc 0000664 0000000 0000000 00000000641 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:740
[source, python]
----
resp = client.indices.put_mapping(
index="my-index-000001",
runtime={
"client_ip": {
"type": "ip",
"script": {
"source": "String m = doc[\"message\"].value; int end = m.indexOf(\" \"); emit(m.substring(0, end));"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb4e43b47867b54214a8630172dd0e21.asciidoc 0000664 0000000 0000000 00000000345 15176617013 0026262 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-forecast.asciidoc:75
[source, python]
----
resp = client.ml.delete_forecast(
job_id="total-requests",
forecast_id="_all",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb54506fbc71a7d250e86b22d0600114.asciidoc 0000664 0000000 0000000 00000000331 15176617013 0026320 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/list-connectors-api.asciidoc:117
[source, python]
----
resp = client.connector.list(
service_type="sharepoint_online,google_drive",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb5486d2fe4283475bf9e0e09280be16.asciidoc 0000664 0000000 0000000 00000000643 15176617013 0026450 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-forcemerge.asciidoc:64
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"forcemerge": {
"max_num_segments": 1
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb5987b58dae90c3a8a1609410be0570.asciidoc 0000664 0000000 0000000 00000002160 15176617013 0026426 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1092
[source, python]
----
resp = client.indices.create(
index="indonesian_example",
settings={
"analysis": {
"filter": {
"indonesian_stop": {
"type": "stop",
"stopwords": "_indonesian_"
},
"indonesian_keywords": {
"type": "keyword_marker",
"keywords": [
"contoh"
]
},
"indonesian_stemmer": {
"type": "stemmer",
"language": "indonesian"
}
},
"analyzer": {
"rebuilt_indonesian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"indonesian_stop",
"indonesian_keywords",
"indonesian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb6d62f1d855a8e8fe9eab2656d47504.asciidoc 0000664 0000000 0000000 00000001453 15176617013 0026617 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/phrase-suggest.asciidoc:410
[source, python]
----
resp = client.search(
index="test",
suggest={
"text": "obel prize",
"simple_phrase": {
"phrase": {
"field": "title.trigram",
"size": 1,
"direct_generator": [
{
"field": "title.trigram",
"suggest_mode": "always"
},
{
"field": "title.reverse",
"suggest_mode": "always",
"pre_filter": "reverse",
"post_filter": "reverse"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb964d8d7f27c057a4542448ba5b74e4.asciidoc 0000664 0000000 0000000 00000000477 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/get-snapshot-api.asciidoc:488
[source, python]
----
resp = client.snapshot.get(
repository="my_repository",
snapshot="snapshot*",
size="2",
sort="name",
after="c25hcHNob3RfMixteV9yZXBvc2l0b3J5LHNuYXBzaG90XzI=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb96d7dd5f3116a50f7a86b729f1a934.asciidoc 0000664 0000000 0000000 00000000530 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-scheduling-api.asciidoc:126
[source, python]
----
resp = client.connector.update_scheduling(
connector_id="my-connector",
scheduling={
"full": {
"enabled": True,
"interval": "0 10 0 * * ?"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eb9a41f7fc8bdf5559bb9db822ae3a65.asciidoc 0000664 0000000 0000000 00000004553 15176617013 0027034 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/bulk-create-roles.asciidoc:236
[source, python]
----
resp = client.security.bulk_put_role(
roles={
"my_admin_role": {
"cluster": [
"bad_cluster_privilege"
],
"indices": [
{
"names": [
"index1",
"index2"
],
"privileges": [
"all"
],
"field_security": {
"grant": [
"title",
"body"
]
},
"query": "{\"match\": {\"title\": \"foo\"}}"
}
],
"applications": [
{
"application": "myapp",
"privileges": [
"admin",
"read"
],
"resources": [
"*"
]
}
],
"run_as": [
"other_user"
],
"metadata": {
"version": 1
}
},
"my_user_role": {
"cluster": [
"all"
],
"indices": [
{
"names": [
"index1"
],
"privileges": [
"read"
],
"field_security": {
"grant": [
"title",
"body"
]
},
"query": "{\"match\": {\"title\": \"foo\"}}"
}
],
"applications": [
{
"application": "myapp",
"privileges": [
"admin",
"read"
],
"resources": [
"*"
]
}
],
"run_as": [
"other_user"
],
"metadata": {
"version": 1
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ebb1c7554e91adb4552599f3e5de1865.asciidoc 0000664 0000000 0000000 00000000421 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/split-index.asciidoc:90
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"index": {
"number_of_routing_shards": 30
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ebd76a45e153c4656c5871e23b7b5508.asciidoc 0000664 0000000 0000000 00000000340 15176617013 0026355 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/delete-app-privileges.asciidoc:47
[source, python]
----
resp = client.security.delete_privileges(
application="myapp",
name="read",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ebef3dc8ed1766d433a5cffc40fde7ae.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0027234 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:289
[source, python]
----
resp = client.ilm.remove_policy(
index="logs-my_app-default",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ec0e50f78390b8622cef4e0b0cd45967.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026513 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql-search-api.asciidoc:586
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
query="\n process where (process.name == \"cmd.exe\" and process.pid != 2013)\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ec135f0cc0d3f526df68000b2a95c65b.asciidoc 0000664 0000000 0000000 00000000425 15176617013 0026554 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ec195297eb804cba1cb19c9926773059.asciidoc 0000664 0000000 0000000 00000000517 15176617013 0026372 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/set-up-lifecycle-policy.asciidoc:265
[source, python]
----
resp = client.indices.put_settings(
index="mylogs-pre-ilm*",
settings={
"index": {
"lifecycle": {
"name": "mylogs_policy_existing"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ec420b28e327f332c9e99d6040c4eb3f.asciidoc 0000664 0000000 0000000 00000000535 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/geo-match-enrich-policy-type-ex.asciidoc:117
[source, python]
----
resp = client.index(
index="users",
id="0",
pipeline="postal_lookup",
document={
"first_name": "Mardy",
"last_name": "Brown",
"geo_location": "POINT (13.5 52.5)"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ec44999b6618ac6bbacb23eb08c0fa88.asciidoc 0000664 0000000 0000000 00000001460 15176617013 0026736 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/common-script-uses.asciidoc:324
[source, python]
----
resp = client.search(
index="my-index",
runtime_mappings={
"gc_size": {
"type": "keyword",
"script": "\n Map gc=dissect('[%{@timestamp}][%{code}][%{desc}] %{ident} used %{usize}, capacity %{csize}, committed %{comsize}, reserved %{rsize}').extract(doc[\"gc.keyword\"].value);\n if (gc != null) emit(\"used\" + ' ' + gc.usize + ', ' + \"capacity\" + ' ' + gc.csize + ', ' + \"committed\" + ' ' + gc.comsize);\n "
}
},
size=1,
aggs={
"sizes": {
"terms": {
"field": "gc_size",
"size": 10
}
}
},
fields=[
"gc_size"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ec4b43c3ebd8816799fa004596b2f0cb.asciidoc 0000664 0000000 0000000 00000000466 15176617013 0026603 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ec5a2ce156c36aaa267fa31dd9367307.asciidoc 0000664 0000000 0000000 00000000615 15176617013 0026563 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/checkpoints.asciidoc:80
[source, python]
----
resp = client.ingest.put_pipeline(
id="set_ingest_time",
description="Set ingest timestamp.",
processors=[
{
"set": {
"field": "event.ingested",
"value": "{{{_ingest.timestamp}}}"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ec69543e39c1f6afb5aff6fb9adc400d.asciidoc 0000664 0000000 0000000 00000001017 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/highlighting-multi-fields.asciidoc:29
[source, python]
----
resp = client.bulk(
index="index1",
refresh=True,
operations=[
{
"index": {
"_id": "doc1"
}
},
{
"comment": "run with scissors"
},
{
"index": {
"_id": "doc2"
}
},
{
"comment": "running with scissors"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ec736c31f49c54e5424efa2e53b22906.asciidoc 0000664 0000000 0000000 00000001300 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/user-agent.asciidoc:31
[source, python]
----
resp = client.ingest.put_pipeline(
id="user_agent",
description="Add user agent information",
processors=[
{
"user_agent": {
"field": "agent"
}
}
],
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="my_id",
pipeline="user_agent",
document={
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
},
)
print(resp1)
resp2 = client.get(
index="my-index-000001",
id="my_id",
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ec8f176ebf436d5719bdeca4a9ea8220.asciidoc 0000664 0000000 0000000 00000001236 15176617013 0026742 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/multi-terms-aggregation.asciidoc:172
[source, python]
----
resp = client.search(
index="products",
runtime_mappings={
"genre.length": {
"type": "long",
"script": "emit(doc['genre'].value.length())"
}
},
aggs={
"genres_and_products": {
"multi_terms": {
"terms": [
{
"field": "genre.length"
},
{
"field": "product"
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ecc57597f6b791d1151ad79d9f4ce67b.asciidoc 0000664 0000000 0000000 00000000703 15176617013 0026623 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:643
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sales_over_time": {
"date_histogram": {
"field": "date",
"calendar_interval": "1M",
"format": "yyyy-MM-dd",
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ece01f9382e450f669c0e0925e5b30e5.asciidoc 0000664 0000000 0000000 00000001140 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/daterange-aggregation.asciidoc:305
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"range": {
"date_range": {
"field": "date",
"format": "MM-yyy",
"ranges": [
{
"to": "now-10M/M"
},
{
"from": "now-10M/M"
}
],
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ecfd0d94dd14ef05dfa861f22544b388.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026665 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-error-api.asciidoc:87
[source, python]
----
resp = client.connector.update_error(
connector_id="my-connector",
error="Houston, we have a problem!",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed01b542bb56b1521ea8d5a3c67aa891.asciidoc 0000664 0000000 0000000 00000000553 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/repository-gcs.asciidoc:142
[source, python]
----
resp = client.snapshot.create_repository(
name="my_gcs_repository",
repository={
"type": "gcs",
"settings": {
"bucket": "my_bucket",
"client": "my_alternate_client"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed01d27b8f80bb4ea54bf4e32b8d6258.asciidoc 0000664 0000000 0000000 00000001602 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/geodistance-aggregation.asciidoc:203
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggs={
"rings_around_amsterdam": {
"geo_distance": {
"field": "location",
"origin": "POINT (4.894 52.3760)",
"ranges": [
{
"to": 100000,
"key": "first_ring"
},
{
"from": 100000,
"to": 300000,
"key": "second_ring"
},
{
"from": 300000,
"key": "third_ring"
}
],
"keyed": True
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed09432c6069e41409f0a5e0d1d3842a.asciidoc 0000664 0000000 0000000 00000000461 15176617013 0026340 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/apis/reload-analyzers.asciidoc:16
[source, python]
----
resp = client.indices.reload_search_analyzers(
index="my-index-000001",
)
print(resp)
resp1 = client.indices.clear_cache(
index="my-index-000001",
request=True,
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/ed12eeadb4e530b53c4975dadaa06054.asciidoc 0000664 0000000 0000000 00000000275 15176617013 0026713 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/grok.asciidoc:281
[source, python]
----
resp = client.ingest.processor_grok(
ecs_compatibility="v1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed250b74bc77c15bb794f55a12d762c3.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026507 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// setup/sysconfig/swap.asciidoc:77
[source, python]
----
resp = client.nodes.info(
filter_path="**.mlockall",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed27843eff311f3011b679e97e6fda50.asciidoc 0000664 0000000 0000000 00000000534 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:647
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="my_snapshot_2099.05.06",
indices="my-index,logs-my_app-default",
index_settings={
"index.number_of_replicas": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed3bdf4d6799b43526851e92b6a60c55.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-field-mapping.asciidoc:135
[source, python]
----
resp = client.indices.get_field_mapping(
index="publications",
fields="author.id,abstract,name",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed5bfa68d01e079aac94de78dc5caddf.asciidoc 0000664 0000000 0000000 00000000225 15176617013 0027237 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/master.asciidoc:57
[source, python]
----
resp = client.cat.master(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed5c3b45e8de912faba44507d827eb93.asciidoc 0000664 0000000 0000000 00000000665 15176617013 0026667 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:501
[source, python]
----
resp = client.search(
sort=[
{
"_geo_distance": {
"pin.location": "POINT (-70 40)",
"order": "asc",
"unit": "km"
}
}
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed60daeaec351fc8b3f39a3dfad6fc4e.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0027303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-mapping.asciidoc:275
[source, python]
----
resp = client.indices.create(
index="amazon-bedrock-embeddings",
mappings={
"properties": {
"content_embedding": {
"type": "dense_vector",
"dims": 1024,
"element_type": "float",
"similarity": "dot_product"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed688d86eeaa4d7969acb0f574eb917f.asciidoc 0000664 0000000 0000000 00000000512 15176617013 0026765 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:495
[source, python]
----
resp = client.index(
index="my_queries1",
id="1",
refresh=True,
document={
"query": {
"term": {
"my_field.prefix": "abc"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed6b996ea389e0955a01c2e67f4c8339.asciidoc 0000664 0000000 0000000 00000000334 15176617013 0026461 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:101
[source, python]
----
resp = client.field_caps(
index="my-index-000001",
fields="my-field",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed7fa1971ac322aeccd6391ab32d0490.asciidoc 0000664 0000000 0000000 00000000431 15176617013 0026627 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/disk/increase-master-node-capacity.asciidoc:83
[source, python]
----
resp = client.cat.nodes(
v=True,
h="name,master,node.role,disk.used_percent,disk.used,disk.avail,disk.total",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ed85ed833bec7286a0dfbe64077c5715.asciidoc 0000664 0000000 0000000 00000002111 15176617013 0026601 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:530
[source, python]
----
resp = client.indices.create(
index="danish_example",
settings={
"analysis": {
"filter": {
"danish_stop": {
"type": "stop",
"stopwords": "_danish_"
},
"danish_keywords": {
"type": "keyword_marker",
"keywords": [
"eksempel"
]
},
"danish_stemmer": {
"type": "stemmer",
"language": "danish"
}
},
"analyzer": {
"rebuilt_danish": {
"tokenizer": "standard",
"filter": [
"lowercase",
"danish_stop",
"danish_keywords",
"danish_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/edae616e1244babf6032aecc6aaaf836.asciidoc 0000664 0000000 0000000 00000000766 15176617013 0027060 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:474
[source, python]
----
resp = client.search(
sort=[
{
"_geo_distance": {
"pin.location": {
"lat": 40,
"lon": -70
},
"order": "asc",
"unit": "km"
}
}
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/edb25dc0162b039d477cb06aed2d6275.asciidoc 0000664 0000000 0000000 00000002401 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/sparse-vector-query.asciidoc:152
[source, python]
----
resp = client.search(
index="my-index",
query={
"bool": {
"should": [
{
"sparse_vector": {
"field": "ml.inference.title_expanded.predicted_value",
"inference_id": "my-elser-model",
"query": "How is the weather in Jamaica?",
"boost": 1
}
},
{
"sparse_vector": {
"field": "ml.inference.description_expanded.predicted_value",
"inference_id": "my-elser-model",
"query": "How is the weather in Jamaica?",
"boost": 1
}
},
{
"multi_match": {
"query": "How is the weather in Jamaica?",
"fields": [
"title",
"description"
],
"boost": 4
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/edb5cad890208014ecd91f3f739ce193.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026576 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/set-up-tsds.asciidoc:276
[source, python]
----
resp = client.indices.rollover(
alias="metrics-weather_sensors-dev",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/edcfadbfb14d97a2f5e6e21ef7039818.asciidoc 0000664 0000000 0000000 00000001713 15176617013 0027025 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/function-score-query.asciidoc:41
[source, python]
----
resp = client.search(
query={
"function_score": {
"query": {
"match_all": {}
},
"boost": "5",
"functions": [
{
"filter": {
"match": {
"test": "bar"
}
},
"random_score": {},
"weight": 23
},
{
"filter": {
"match": {
"test": "cat"
}
},
"weight": 42
}
],
"max_boost": 42,
"score_mode": "max",
"boost_mode": "multiply",
"min_score": 42
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ee08328cd157d547de19b4abe867b23e.asciidoc 0000664 0000000 0000000 00000000235 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// alias.asciidoc:277
[source, python]
----
resp = client.indices.get_alias(
name="logs",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ee0fd67acc807f1bddf5e9807c06e7eb.asciidoc 0000664 0000000 0000000 00000006315 15176617013 0027112 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/weighted-tokens-query.asciidoc:86
[source, python]
----
resp = client.search(
index="my-index",
query={
"weighted_tokens": {
"query_expansion_field": {
"tokens": {
"2161": 0.4679,
"2621": 0.307,
"2782": 0.1299,
"2851": 0.1056,
"3088": 0.3041,
"3376": 0.1038,
"3467": 0.4873,
"3684": 0.8958,
"4380": 0.334,
"4542": 0.4636,
"4633": 2.2805,
"4785": 1.2628,
"4860": 1.0655,
"5133": 1.0709,
"7139": 1.0016,
"7224": 0.2486,
"7387": 0.0985,
"7394": 0.0542,
"8915": 0.369,
"9156": 2.8947,
"10505": 0.2771,
"11464": 0.3996,
"13525": 0.0088,
"14178": 0.8161,
"16893": 0.1376,
"17851": 1.5348,
"19939": 0.6012
},
"pruning_config": {
"tokens_freq_ratio_threshold": 5,
"tokens_weight_threshold": 0.4,
"only_score_pruned_tokens": False
}
}
}
},
rescore={
"window_size": 100,
"query": {
"rescore_query": {
"weighted_tokens": {
"query_expansion_field": {
"tokens": {
"2161": 0.4679,
"2621": 0.307,
"2782": 0.1299,
"2851": 0.1056,
"3088": 0.3041,
"3376": 0.1038,
"3467": 0.4873,
"3684": 0.8958,
"4380": 0.334,
"4542": 0.4636,
"4633": 2.2805,
"4785": 1.2628,
"4860": 1.0655,
"5133": 1.0709,
"7139": 1.0016,
"7224": 0.2486,
"7387": 0.0985,
"7394": 0.0542,
"8915": 0.369,
"9156": 2.8947,
"10505": 0.2771,
"11464": 0.3996,
"13525": 0.0088,
"14178": 0.8161,
"16893": 0.1376,
"17851": 1.5348,
"19939": 0.6012
},
"pruning_config": {
"tokens_freq_ratio_threshold": 5,
"tokens_weight_threshold": 0.4,
"only_score_pruned_tokens": True
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ee223e604bb695cad2517d28ae63ac34.asciidoc 0000664 0000000 0000000 00000001706 15176617013 0026564 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rrf.asciidoc:53
[source, python]
----
resp = client.search(
index="example-index",
retriever={
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"term": {
"text": "shoes"
}
}
}
},
{
"knn": {
"field": "vector",
"query_vector": [
1.25,
2,
3.5
],
"k": 50,
"num_candidates": 100
}
}
],
"rank_window_size": 50,
"rank_constant": 20
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ee2d97090d617ed8aa2a87ea33556dd7.asciidoc 0000664 0000000 0000000 00000000446 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/truncate-tokenfilter.asciidoc:24
[source, python]
----
resp = client.indices.analyze(
tokenizer="whitespace",
filter=[
"truncate"
],
text="the quinquennial extravaganza carried on",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ee577c4c7cc723e99569ea2d1137adba.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026663 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-roles-cache.asciidoc:48
[source, python]
----
resp = client.security.clear_cached_roles(
name="my_admin_role",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ee634d59def6302134d24fa90e18b609.asciidoc 0000664 0000000 0000000 00000000767 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/deciders/machine-learning-decider.asciidoc:48
[source, python]
----
resp = client.autoscaling.put_autoscaling_policy(
name="my_autoscaling_policy",
policy={
"roles": [
"ml"
],
"deciders": {
"ml": {
"num_anomaly_jobs_in_queue": 5,
"num_analytics_jobs_in_queue": 3,
"down_scale_delay": "30m"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ee90d1fb22b59d30da339d825303b912.asciidoc 0000664 0000000 0000000 00000001243 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/put-app-privileges.asciidoc:136
[source, python]
----
resp = client.security.put_privileges(
privileges={
"app01": {
"read": {
"actions": [
"action:login",
"data:read/*"
]
},
"write": {
"actions": [
"action:login",
"data:write/*"
]
}
},
"app02": {
"all": {
"actions": [
"*"
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eeb35b759bd239bb773c8ebd5fe63d05.asciidoc 0000664 0000000 0000000 00000001004 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geocentroid-aggregation.asciidoc:79
[source, python]
----
resp = client.search(
index="museums",
size="0",
aggs={
"cities": {
"terms": {
"field": "city.keyword"
},
"aggs": {
"centroid": {
"geo_centroid": {
"field": "location"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eec051555c8050d017d3fe38ea59e3a0.asciidoc 0000664 0000000 0000000 00000000424 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search.asciidoc:915
[source, python]
----
resp = client.search(
index="my-index-000001",
from_="40",
size="20",
query={
"term": {
"user.id": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eed37703cfe8fec093ed5a42210a6ffd.asciidoc 0000664 0000000 0000000 00000001445 15176617013 0027016 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/rollup-getting-started.asciidoc:38
[source, python]
----
resp = client.rollup.put_job(
id="sensor",
index_pattern="sensor-*",
rollup_index="sensor_rollup",
cron="*/30 * * * * ?",
page_size=1000,
groups={
"date_histogram": {
"field": "timestamp",
"fixed_interval": "60m"
},
"terms": {
"fields": [
"node"
]
}
},
metrics=[
{
"field": "temperature",
"metrics": [
"min",
"max",
"sum"
]
},
{
"field": "voltage",
"metrics": [
"avg"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc 0000664 0000000 0000000 00000000643 15176617013 0026435 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-hugging-face.asciidoc:107
[source, python]
----
resp = client.inference.put(
task_type="text_embedding",
inference_id="hugging-face-embeddings",
inference_config={
"service": "hugging_face",
"service_settings": {
"api_key": "",
"url": ""
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eef9deff7f9799d1f7657bb7e2afb7f1.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0027136 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/restore-snapshot.asciidoc:429
[source, python]
----
resp = client.indices.delete(
index="*",
expand_wildcards="all",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef10e8d07d9fae945e035d5dee1e9754.asciidoc 0000664 0000000 0000000 00000000660 15176617013 0026675 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/flatten-graph-tokenfilter.asciidoc:118
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "synonym_graph",
"synonyms": [
"dns, domain name system"
]
},
"flatten_graph"
],
text="domain name system is fragile",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef22234b97cc06d7dd620b4ce7c97b31.asciidoc 0000664 0000000 0000000 00000000411 15176617013 0026564 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:700
[source, python]
----
resp = client.reindex(
max_docs=1,
source={
"index": "my-index-000001"
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef33b3b373f7040b874146599db5d557.asciidoc 0000664 0000000 0000000 00000000360 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:179
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
filter=[
"lowercase"
],
text="this is a test",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef3666b5d288faefbcbc4a25e8f506da.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0027107 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:84
[source, python]
----
resp = client.count(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef46c42d473b2acc151a6a41272e0f14.asciidoc 0000664 0000000 0000000 00000001146 15176617013 0026465 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:661
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic": "runtime",
"runtime": {
"day_of_week": {
"type": "keyword",
"script": {
"source": "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))"
}
}
},
"properties": {
"@timestamp": {
"type": "date"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef643bab44e7de6ddddde23a2eece5c7.asciidoc 0000664 0000000 0000000 00000000545 15176617013 0027317 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ef779b87b3b0fb6e6bae9c8875e3a1cf.asciidoc 0000664 0000000 0000000 00000001300 15176617013 0027031 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:699
[source, python]
----
resp = client.search(
index="sales",
size="0",
runtime_mappings={
"date.promoted_is_tomorrow": {
"type": "date",
"script": "\n long date = doc['date'].value.toInstant().toEpochMilli();\n if (doc['promoted'].value) {\n date += 86400;\n }\n emit(date);\n "
}
},
aggs={
"sales_over_time": {
"date_histogram": {
"field": "date.promoted_is_tomorrow",
"calendar_interval": "1M"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef867e563cbffe7866769a096b5d7a92.asciidoc 0000664 0000000 0000000 00000001324 15176617013 0026561 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/cumulative-sum-aggregation.asciidoc:40
[source, python]
----
resp = client.search(
index="sales",
size=0,
aggs={
"sales_per_month": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
},
"cumulative_sales": {
"cumulative_sum": {
"buckets_path": "sales"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef8f30e85e12e9a5a8817d28977598e4.asciidoc 0000664 0000000 0000000 00000001161 15176617013 0026417 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/range-aggregation.asciidoc:13
[source, python]
----
resp = client.search(
index="sales",
aggs={
"price_ranges": {
"range": {
"field": "price",
"ranges": [
{
"to": 100
},
{
"from": 100,
"to": 200
},
{
"from": 200
}
]
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ef9c29759459904fef162acd223462c4.asciidoc 0000664 0000000 0000000 00000000314 15176617013 0026371 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-stats.asciidoc:2595
[source, python]
----
resp = client.nodes.stats(
metric="ingest",
filter_path="nodes.*.ingest",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/efa146bf81a9351ba42b92a6decbcfee.asciidoc 0000664 0000000 0000000 00000001056 15176617013 0027144 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/common-script-uses.asciidoc:173
[source, python]
----
resp = client.indices.put_mapping(
index="my-index",
runtime={
"http.response": {
"type": "long",
"script": "\n String response=dissect('%{clientip} %{ident} %{auth} [%{@timestamp}] \"%{verb} %{request} HTTP/%{httpversion}\" %{response} %{size}').extract(doc[\"message\"].value)?.response;\n if (response != null) emit(Integer.parseInt(response));\n "
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/efa924638043f3a6b23ccb824d757eba.asciidoc 0000664 0000000 0000000 00000001030 15176617013 0026562 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/multivalued-fields.asciidoc:11
[source, python]
----
resp = client.bulk(
index="mv",
refresh=True,
operations=[
{
"index": {}
},
{
"a": 1,
"b": [
2,
1
]
},
{
"index": {}
},
{
"a": 2,
"b": 3
}
],
)
print(resp)
resp1 = client.esql.query(
query="FROM mv | LIMIT 2",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/efbd4936cca1a752493d8fa2ba6ad1a3.asciidoc 0000664 0000000 0000000 00000001110 15176617013 0026770 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:130
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"runtime": {
"day_of_week": {
"type": "keyword",
"script": {
"source": "emit(doc['@timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ENGLISH))"
}
}
},
"properties": {
"@timestamp": {
"type": "date"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eff2fc92d46eb3c8f4d424eed18f54a2.asciidoc 0000664 0000000 0000000 00000000567 15176617013 0027034 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/function-score-query.asciidoc:19
[source, python]
----
resp = client.search(
query={
"function_score": {
"query": {
"match_all": {}
},
"boost": "5",
"random_score": {},
"boost_mode": "multiply"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/eff8ecaed1ed084909c64450fc363a20.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026653 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/update-settings.asciidoc:101
[source, python]
----
resp = client.cluster.put_settings(
transient={
"indices.recovery.max_bytes_per_sec": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f03352bb1129938a89f97e4b650038dd.asciidoc 0000664 0000000 0000000 00000001021 15176617013 0026274 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:223
[source, python]
----
resp = client.ingest.put_pipeline(
id="amazon_bedrock_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "amazon_bedrock_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f04e1284d09ceb4443d67b2ef9c7f476.asciidoc 0000664 0000000 0000000 00000000351 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/delete-snapshot-api.asciidoc:36
[source, python]
----
resp = client.snapshot.delete(
repository="my_repository",
snapshot="my_snapshot",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f0816beb8ac21cb0940858b72f6b1946.asciidoc 0000664 0000000 0000000 00000000264 15176617013 0026434 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/fielddata.asciidoc:132
[source, python]
----
resp = client.cat.fielddata(
fields="body,soul",
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f097c02541056f3c0fc855e7bbeef8a8.asciidoc 0000664 0000000 0000000 00000002123 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:1746
[source, python]
----
resp = client.indices.create(
index="swedish_example",
settings={
"analysis": {
"filter": {
"swedish_stop": {
"type": "stop",
"stopwords": "_swedish_"
},
"swedish_keywords": {
"type": "keyword_marker",
"keywords": [
"exempel"
]
},
"swedish_stemmer": {
"type": "stemmer",
"language": "swedish"
}
},
"analyzer": {
"rebuilt_swedish": {
"tokenizer": "standard",
"filter": [
"lowercase",
"swedish_stop",
"swedish_keywords",
"swedish_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f09817fd13ff3dce52eb79d0722409c3.asciidoc 0000664 0000000 0000000 00000001533 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/percolator.asciidoc:115
[source, python]
----
resp = client.indices.create(
index="new_index",
mappings={
"properties": {
"query": {
"type": "percolator"
},
"body": {
"type": "text"
}
}
},
)
print(resp)
resp1 = client.reindex(
refresh=True,
source={
"index": "index"
},
dest={
"index": "new_index"
},
)
print(resp1)
resp2 = client.indices.update_aliases(
actions=[
{
"remove": {
"index": "index",
"alias": "queries"
}
},
{
"add": {
"index": "new_index",
"alias": "queries"
}
}
],
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/f0bfc8d7ab4eb94ea5fdf2e087d8cf5b.asciidoc 0000664 0000000 0000000 00000001173 15176617013 0027247 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/boxplot-aggregation.asciidoc:83
[source, python]
----
resp = client.search(
index="latency",
size=0,
runtime_mappings={
"load_time.seconds": {
"type": "long",
"script": {
"source": "emit(doc['load_time'].value / params.timeUnit)",
"params": {
"timeUnit": 1000
}
}
}
},
aggs={
"load_time_boxplot": {
"boxplot": {
"field": "load_time.seconds"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f0c3235d8fce641d6ff8ce90ab7b7b8b.asciidoc 0000664 0000000 0000000 00000000514 15176617013 0027022 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-termvectors.asciidoc:120
[source, python]
----
resp = client.mtermvectors(
index="my-index-000001",
ids=[
"1",
"2"
],
parameters={
"fields": [
"message"
],
"term_statistics": True
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f10ab582387b2c157917a60205c993f7.asciidoc 0000664 0000000 0000000 00000000576 15176617013 0026224 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/meta.asciidoc:9
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"latency": {
"type": "long",
"meta": {
"unit": "ms"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f128a9dff5051b47efe2c53c4454a68f.asciidoc 0000664 0000000 0000000 00000000526 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/rollover-index.asciidoc:261
[source, python]
----
resp = client.indices.rollover(
alias="my-data-stream",
conditions={
"max_age": "7d",
"max_docs": 1000,
"max_primary_shard_size": "50gb",
"max_primary_shard_docs": "2000"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f14d0e4a280fee540e8e5f0fc4d0e9f1.asciidoc 0000664 0000000 0000000 00000000533 15176617013 0026731 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-grid-query.asciidoc:174
[source, python]
----
resp = client.search(
index="my_locations",
size=0,
aggs={
"grouped": {
"geotile_grid": {
"field": "location",
"precision": 6
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f1508a2221152842894819e762e63491.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0025727 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:696
[source, python]
----
resp = client.sql.query(
format="json",
keep_on_completion=True,
wait_for_completion_timeout="2s",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f160561efab38e40c2feebf5a2542ab5.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026715 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/nodes-stats.asciidoc:2603
[source, python]
----
resp = client.nodes.stats(
metric="ingest",
filter_path="nodes.*.ingest.pipelines",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f18248c181690b81d090275b072f0070.asciidoc 0000664 0000000 0000000 00000000440 15176617013 0026036 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1351
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
keep_alive="2d",
wait_for_completion_timeout="2s",
query="\n process where process.name == \"cmd.exe\"\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f187ac2dc35425cb0ef48f328cc7e435.asciidoc 0000664 0000000 0000000 00000000460 15176617013 0026574 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-cert.asciidoc:195
[source, python]
----
resp = client.security.put_user(
username="cross-search-user",
password="l0ng-r4nd0m-p@ssw0rd",
roles=[
"remote-search"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f1b24217b1d9ba6ea5e4fa6e6f412022.asciidoc 0000664 0000000 0000000 00000000604 15176617013 0026550 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/post-inference.asciidoc:138
[source, python]
----
resp = client.inference.inference(
task_type="rerank",
inference_id="cohere_rerank",
input=[
"luke",
"like",
"leia",
"chewy",
"r2d2",
"star",
"wars"
],
query="star wars main character",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f1bf0c03581b79c3324cfa3246a60e4d.asciidoc 0000664 0000000 0000000 00000000743 15176617013 0026476 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/f1bf3edbd9e6c7e01b00c74c99a58b61.asciidoc 0000664 0000000 0000000 00000001022 15176617013 0026725 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1454
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"cluster_one": {
"seeds": [
"127.0.0.1:9300"
]
},
"cluster_two": {
"seeds": [
"127.0.0.1:9301"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f1d2b8169160adfd27f32988113f0f9f.asciidoc 0000664 0000000 0000000 00000000755 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/word-delimiter-tokenfilter.asciidoc:148
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "keyword",
"filter": [
"word_delimiter"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f1dc6f69453867ffafe86e998dd464d9.asciidoc 0000664 0000000 0000000 00000000522 15176617013 0026652 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/pathhierarchy-tokenizer.asciidoc:309
[source, python]
----
resp = client.search(
index="file-path-test",
query={
"term": {
"file_path.tree_reversed": {
"value": "my_photo1.jpg"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f1e2af6dbb30fc5335e7d0b5507a2a93.asciidoc 0000664 0000000 0000000 00000000301 15176617013 0026625 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/reset-job.asciidoc:62
[source, python]
----
resp = client.ml.reset_job(
job_id="total-requests",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f2175feadc2abe545899889e6d4ffcad.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0027043 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// slm/apis/slm-get.asciidoc:77
[source, python]
----
resp = client.slm.get_lifecycle(
policy_id="daily-snapshots",
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f235544a883fd04bed2dc369b0c450f3.asciidoc 0000664 0000000 0000000 00000000465 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:409
[source, python]
----
resp = client.sql.query(
format="txt",
query="SELECT * FROM library",
filter={
"terms": {
"_routing": [
"abc"
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f2359acfb6eaa919125463cc1d3a7cd1.asciidoc 0000664 0000000 0000000 00000000564 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authorization/mapping-roles.asciidoc:138
[source, python]
----
resp = client.security.put_role_mapping(
name="admins",
roles=[
"monitoring",
"user"
],
rules={
"field": {
"groups": "cn=admins,dc=example,dc=com"
}
},
enabled=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f268416813befd13c604642c6fe6eda9.asciidoc 0000664 0000000 0000000 00000001324 15176617013 0026521 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/lowercase-tokenfilter.asciidoc:131
[source, python]
----
resp = client.indices.create(
index="custom_lowercase_example",
settings={
"analysis": {
"analyzer": {
"greek_lowercase_example": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"greek_lowercase"
]
}
},
"filter": {
"greek_lowercase": {
"type": "lowercase",
"language": "greek"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f27c28ddbf4c266b5f42d14da837b8de.asciidoc 0000664 0000000 0000000 00000000217 15176617013 0026740 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/flush.asciidoc:147
[source, python]
----
resp = client.indices.flush()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f281ff50b2cdb67ac0ece93f1594fa95.asciidoc 0000664 0000000 0000000 00000001705 15176617013 0026743 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-shape-query.asciidoc:111
[source, python]
----
resp = client.search(
index="example_points",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_shape": {
"location": {
"shape": {
"type": "envelope",
"coordinates": [
[
13,
53
],
[
14,
52
]
]
},
"relation": "intersects"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f298c4eb50ea97b34c57f8756eb350d3.asciidoc 0000664 0000000 0000000 00000000243 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/pending_tasks.asciidoc:57
[source, python]
----
resp = client.cat.pending_tasks(
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f29a28fffa7ec604a33a838f48f7ea79.asciidoc 0000664 0000000 0000000 00000001567 15176617013 0026712 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query_filter_context.asciidoc:81
[source, python]
----
resp = client.search(
query={
"bool": {
"must": [
{
"match": {
"title": "Search"
}
},
{
"match": {
"content": "Elasticsearch"
}
}
],
"filter": [
{
"term": {
"status": "published"
}
},
{
"range": {
"publish_date": {
"gte": "2015-01-01"
}
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f29b2674299ddf51a25ed87619025ede.asciidoc 0000664 0000000 0000000 00000000525 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-search.asciidoc:122
[source, python]
----
resp = client.rollup.rollup_search(
index="sensor_rollup",
size=0,
aggregations={
"max_temperature": {
"max": {
"field": "temperature"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f2a5f77f929cc7b893b80f4bd5b1a192.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/get-connector-api.asciidoc:74
[source, python]
----
resp = client.connector.get(
connector_id="my-connector",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f2b2d62bc0a44940ad14fca57d6d008a.asciidoc 0000664 0000000 0000000 00000005217 15176617013 0026630 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/examples.asciidoc:215
[source, python]
----
resp = client.transform.put_transform(
transform_id="suspicious_client_ips",
source={
"index": "kibana_sample_data_logs"
},
dest={
"index": "sample_weblogs_by_clientip"
},
sync={
"time": {
"field": "timestamp",
"delay": "60s"
}
},
pivot={
"group_by": {
"clientip": {
"terms": {
"field": "clientip"
}
}
},
"aggregations": {
"url_dc": {
"cardinality": {
"field": "url.keyword"
}
},
"bytes_sum": {
"sum": {
"field": "bytes"
}
},
"geo.src_dc": {
"cardinality": {
"field": "geo.src"
}
},
"agent_dc": {
"cardinality": {
"field": "agent.keyword"
}
},
"geo.dest_dc": {
"cardinality": {
"field": "geo.dest"
}
},
"responses.total": {
"value_count": {
"field": "timestamp"
}
},
"success": {
"filter": {
"term": {
"response": "200"
}
}
},
"error404": {
"filter": {
"term": {
"response": "404"
}
}
},
"error5xx": {
"filter": {
"range": {
"response": {
"gte": 500,
"lt": 600
}
}
}
},
"timestamp.min": {
"min": {
"field": "timestamp"
}
},
"timestamp.max": {
"max": {
"field": "timestamp"
}
},
"timestamp.duration_ms": {
"bucket_script": {
"buckets_path": {
"min_time": "timestamp.min.value",
"max_time": "timestamp.max.value"
},
"script": "(params.max_time - params.min_time)"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f2c9afd052878b2ec00908739b0d0f74.asciidoc 0000664 0000000 0000000 00000002527 15176617013 0026443 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:697
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"rename": {
"description": "Rename 'provider' to 'cloud.provider'",
"field": "provider",
"target_field": "cloud.provider",
"on_failure": [
{
"set": {
"description": "Set 'error.message'",
"field": "error.message",
"value": "Field 'provider' does not exist. Cannot rename to 'cloud.provider'",
"override": False,
"on_failure": [
{
"set": {
"description": "Set 'error.message.multi'",
"field": "error.message.multi",
"value": "Document encountered multiple ingest errors",
"override": True
}
}
]
}
}
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f2e854b6c99659ccc1824e86c096e433.asciidoc 0000664 0000000 0000000 00000000345 15176617013 0026406 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/auto-follow/resume-auto-follow-pattern.asciidoc:86
[source, python]
----
resp = client.ccr.resume_auto_follow_pattern(
name="my_auto_follow_pattern",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f2ec53c0ef5025de8890d0ff8ec287a0.asciidoc 0000664 0000000 0000000 00000001010 15176617013 0026647 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rank-eval.asciidoc:359
[source, python]
----
resp = client.rank_eval(
index="my-index-000001",
requests=[
{
"id": "JFK query",
"request": {
"query": {
"match_all": {}
}
},
"ratings": []
}
],
metric={
"mean_reciprocal_rank": {
"k": 20,
"relevant_rating_threshold": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f2f1cae094855a45fd8f73478bec8e70.asciidoc 0000664 0000000 0000000 00000000500 15176617013 0026610 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/split-index.asciidoc:209
[source, python]
----
resp = client.indices.split(
index="my_source_index",
target="my_target_index",
settings={
"index.number_of_shards": 5
},
aliases={
"my_search_indices": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f321d4e92aa83d573ecf52bf56b0b774.asciidoc 0000664 0000000 0000000 00000000524 15176617013 0026574 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/f329242d7c8406297eff9bf609870c37.asciidoc 0000664 0000000 0000000 00000000670 15176617013 0026327 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/suggesters/completion-suggest.asciidoc:304
[source, python]
----
resp = client.search(
index="music",
pretty=True,
suggest={
"song-suggest": {
"prefix": "nor",
"completion": {
"field": "suggest",
"fuzzy": {
"fuzziness": 2
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f32f0c19b42de3b87dd764fe4ca17e7c.asciidoc 0000664 0000000 0000000 00000000516 15176617013 0026741 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/query-string-query.asciidoc:420
[source, python]
----
resp = client.search(
query={
"query_string": {
"default_field": "title",
"query": "ny city",
"auto_generate_synonyms_phrase_query": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f342465c65ba76383dedbb334b57b616.asciidoc 0000664 0000000 0000000 00000001312 15176617013 0026430 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/index-options.asciidoc:32
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"text": {
"type": "text",
"index_options": "offsets"
}
}
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"text": "Quick brown fox"
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"match": {
"text": "brown fox"
}
},
highlight={
"fields": {
"text": {}
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/f34c02351662481dd61a5c2a3e206c60.asciidoc 0000664 0000000 0000000 00000001013 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/hyphenation-decompounder-tokenfilter.asciidoc:25
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
{
"type": "hyphenation_decompounder",
"hyphenation_patterns_path": "analysis/hyphenation_patterns.xml",
"word_list": [
"Kaffee",
"zucker",
"tasse"
]
}
],
text="Kaffeetasse",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3594de7ef39ab09b0bb12c1e76bfe6b.asciidoc 0000664 0000000 0000000 00000000504 15176617013 0027012 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/shrink-index.asciidoc:125
[source, python]
----
resp = client.indices.shrink(
index="my_source_index",
target="my_target_index",
settings={
"index.routing.allocation.require._name": None,
"index.blocks.write": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3697682a886ab129530f3e5c1b30632.asciidoc 0000664 0000000 0000000 00000000271 15176617013 0026215 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/termvectors.asciidoc:16
[source, python]
----
resp = client.termvectors(
index="my-index-000001",
id="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f37173a75cd1b0d683c6f67819dd1de3.asciidoc 0000664 0000000 0000000 00000000262 15176617013 0026523 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:800
[source, python]
----
resp = client.get(
index="my-new-index-000001",
id="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f388e571224dd6850f8c9f9f08fca3da.asciidoc 0000664 0000000 0000000 00000000315 15176617013 0026617 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/invalidate-api-keys.asciidoc:129
[source, python]
----
resp = client.security.invalidate_api_key(
name="my-api-key",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3942d9b34138dfca79dff707af270b7.asciidoc 0000664 0000000 0000000 00000000473 15176617013 0026614 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:1169
[source, python]
----
resp = client.eql.search(
index="my-data-stream",
timestamp_field="file.accessed",
event_category_field="file.type",
query="\n file where (file.size > 1 and file.type == \"file\")\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f39512478cae2db8f4566a1e4af9e8f5.asciidoc 0000664 0000000 0000000 00000001742 15176617013 0026621 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/rollup-getting-started.asciidoc:217
[source, python]
----
resp = client.rollup.rollup_search(
index="sensor_rollup",
size=0,
aggregations={
"timeline": {
"date_histogram": {
"field": "timestamp",
"fixed_interval": "7d"
},
"aggs": {
"nodes": {
"terms": {
"field": "node"
},
"aggs": {
"max_temperature": {
"max": {
"field": "temperature"
}
},
"avg_voltage": {
"avg": {
"field": "voltage"
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3ab820e1f2f54ea718017aeae865742.asciidoc 0000664 0000000 0000000 00000001036 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/oidc-guide.asciidoc:470
[source, python]
----
resp = client.security.put_role_mapping(
name="oidc-finance",
roles=[
"finance_data"
],
enabled=True,
rules={
"all": [
{
"field": {
"realm.name": "oidc1"
}
},
{
"field": {
"groups": "finance-team"
}
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3b185131f40687c25d2f85e1231d8bd.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026342 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/validate.asciidoc:105
[source, python]
----
resp = client.indices.validate_query(
index="my-index-000001",
q="user.id:kimchy",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3b4ddce8ff21fc1a76a7c0d9c36650e.asciidoc 0000664 0000000 0000000 00000000633 15176617013 0027015 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-shrink.asciidoc:65
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"shrink": {
"number_of_shards": 1
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3c696cd63a3f042e62cbb94b75c2427.asciidoc 0000664 0000000 0000000 00000000342 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// upgrade/archived-settings.asciidoc:24
[source, python]
----
resp = client.cluster.get_settings(
flat_settings=True,
filter_path="persistent.archived*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3e1dfe1c440e3590be26f265e19425d.asciidoc 0000664 0000000 0000000 00000001427 15176617013 0026515 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// vectors/vector-functions.asciidoc:235
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"script_score": {
"query": {
"bool": {
"filter": {
"term": {
"status": "published"
}
}
}
},
"script": {
"source": "1 / (1 + l2norm(params.queryVector, 'my_dense_vector'))",
"params": {
"queryVector": [
4,
3.4,
-0.2
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3fb3cba44988b6e9fee93316138b2cf.asciidoc 0000664 0000000 0000000 00000000343 15176617013 0026671 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-privileges-cache.asciidoc:56
[source, python]
----
resp = client.security.clear_cached_privileges(
application="myapp,my-other-app",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3fb52680482925c202c2e2f8af6f044.asciidoc 0000664 0000000 0000000 00000000277 15176617013 0026357 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:459
[source, python]
----
resp = client.cat.count(
index="my-index-000001",
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f3fe2012557ebbce1ebad4fc997c092d.asciidoc 0000664 0000000 0000000 00000000502 15176617013 0027006 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/register-fs-repo.asciidoc:32
[source, python]
----
resp = client.snapshot.create_repository(
name="my_fs_backup",
repository={
"type": "fs",
"settings": {
"location": "my_fs_backup_location"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f43d551aaaad73d979adf1b86533e6a3.asciidoc 0000664 0000000 0000000 00000000571 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:216
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sales_over_time": {
"date_histogram": {
"field": "date",
"fixed_interval": "2w"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f43ec4041e3b72bbde063452990bfc4b.asciidoc 0000664 0000000 0000000 00000000310 15176617013 0026550 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/clearcache.asciidoc:148
[source, python]
----
resp = client.indices.clear_cache(
index="my-index-000001,my-index-000002",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f44d287c6937785eb09b91353c1deb1e.asciidoc 0000664 0000000 0000000 00000000350 15176617013 0026446 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-datafeed-stats.asciidoc:183
[source, python]
----
resp = client.ml.get_datafeed_stats(
datafeed_id="datafeed-high_sum_total_sales",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f453e14bcf30853e57618bf12f83e148.asciidoc 0000664 0000000 0000000 00000001231 15176617013 0026356 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/pattern-analyzer.asciidoc:385
[source, python]
----
resp = client.indices.create(
index="pattern_example",
settings={
"analysis": {
"tokenizer": {
"split_on_non_word": {
"type": "pattern",
"pattern": "\\W+"
}
},
"analyzer": {
"rebuilt_pattern": {
"tokenizer": "split_on_non_word",
"filter": [
"lowercase"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f454e3f8ad5f5bd82a4a25af7dee9ca1.asciidoc 0000664 0000000 0000000 00000002017 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/array.asciidoc:39
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"message": "some arrays in this document...",
"tags": [
"elasticsearch",
"wow"
],
"lists": [
{
"name": "prog_list",
"description": "programming list"
},
{
"name": "cool_list",
"description": "cool stuff list"
}
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="2",
document={
"message": "no arrays in this document...",
"tags": "elasticsearch",
"lists": {
"name": "prog_list",
"description": "programming list"
}
},
)
print(resp1)
resp2 = client.search(
index="my-index-000001",
query={
"match": {
"tags": "elasticsearch"
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/f45990264f8755b96b11c69c12c90ff4.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026316 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/troubleshooting-searches.asciidoc:21
[source, python]
----
resp = client.indices.exists(
index="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f495f9c99916a05e3b28166d31955fad.asciidoc 0000664 0000000 0000000 00000001064 15176617013 0026403 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/terms-aggregation.asciidoc:292
[source, python]
----
resp = client.search(
aggs={
"genres": {
"terms": {
"field": "genre",
"order": {
"playback_stats.max": "desc"
}
},
"aggs": {
"playback_stats": {
"stats": {
"field": "play_count"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f49ac80f0130cae8d0ea6f4472a149dd.asciidoc 0000664 0000000 0000000 00000001061 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/knn-query.asciidoc:18
[source, python]
----
resp = client.indices.create(
index="my-image-index",
mappings={
"properties": {
"image-vector": {
"type": "dense_vector",
"dims": 3,
"index": True,
"similarity": "l2_norm"
},
"file-type": {
"type": "keyword"
},
"title": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f4ae3f3fbf07a7d39122ac5ac20b9c03.asciidoc 0000664 0000000 0000000 00000001132 15176617013 0026704 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/knn-search.asciidoc:280
[source, python]
----
resp = client.indices.create(
index="quantized-image-index",
mappings={
"properties": {
"image-vector": {
"type": "dense_vector",
"element_type": "float",
"dims": 2,
"index": True,
"index_options": {
"type": "int8_hnsw"
}
},
"title": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f4b9baed3c6a82be3672cbc8999c2368.asciidoc 0000664 0000000 0000000 00000000320 15176617013 0026666 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/terms-enum.asciidoc:19
[source, python]
----
resp = client.terms_enum(
index="stackoverflow",
field="tags",
string="kiba",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f4c194628761a4cf2a01453a96bbcc3c.asciidoc 0000664 0000000 0000000 00000004400 15176617013 0026476 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:344
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "multipolygon",
"coordinates": [
[
[
[
1002,
200
],
[
1003,
200
],
[
1003,
300
],
[
1002,
300
],
[
1002,
200
]
]
],
[
[
[
1000,
200
],
[
1001,
100
],
[
1001,
100
],
[
1000,
100
],
[
1000,
100
]
],
[
[
1000.2,
200.2
],
[
1000.8,
100.2
],
[
1000.8,
100.8
],
[
1000.2,
100.8
],
[
1000.2,
100.2
]
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f4dc1286d0a2f8d1fde64fbf12fd9f8d.asciidoc 0000664 0000000 0000000 00000001455 15176617013 0027111 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// troubleshooting/common-issues/disk-usage-exceeded.asciidoc:90
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster.routing.allocation.disk.watermark.low": None,
"cluster.routing.allocation.disk.watermark.low.max_headroom": None,
"cluster.routing.allocation.disk.watermark.high": None,
"cluster.routing.allocation.disk.watermark.high.max_headroom": None,
"cluster.routing.allocation.disk.watermark.flood_stage": None,
"cluster.routing.allocation.disk.watermark.flood_stage.max_headroom": None,
"cluster.routing.allocation.disk.watermark.flood_stage.frozen": None,
"cluster.routing.allocation.disk.watermark.flood_stage.frozen.max_headroom": None
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f4f557716049b23f8840d58d71e748f0.asciidoc 0000664 0000000 0000000 00000000426 15176617013 0026243 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/update-settings.asciidoc:121
[source, python]
----
resp = client.indices.put_settings(
index="my-index-000001",
settings={
"index": {
"refresh_interval": "-1"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f4fdfe52ecba65eec6beb30d8deb8bbf.asciidoc 0000664 0000000 0000000 00000000600 15176617013 0027451 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/post-forget-follower.asciidoc:41
[source, python]
----
resp = client.ccr.forget_follower(
index="",
follower_cluster="",
follower_index="",
follower_index_uuid="",
leader_remote_cluster="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5013174f77868da4dc40cdd745d4ea4.asciidoc 0000664 0000000 0000000 00000000505 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/rare-terms-aggregation.asciidoc:130
[source, python]
----
resp = client.search(
aggs={
"genres": {
"rare_terms": {
"field": "genre",
"max_doc_count": 2
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5140f08f56c64b5789357539f8b9ba8.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026330 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/delete-alias.asciidoc:16
[source, python]
----
resp = client.indices.delete_alias(
index="my-data-stream",
name="my-alias",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f545bb95214769aca993c1632a71ad2c.asciidoc 0000664 0000000 0000000 00000003305 15176617013 0026431 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:785
[source, python]
----
resp = client.indices.create(
index="french_example",
settings={
"analysis": {
"filter": {
"french_elision": {
"type": "elision",
"articles_case": True,
"articles": [
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d",
"c",
"jusqu",
"quoiqu",
"lorsqu",
"puisqu"
]
},
"french_stop": {
"type": "stop",
"stopwords": "_french_"
},
"french_keywords": {
"type": "keyword_marker",
"keywords": [
"Example"
]
},
"french_stemmer": {
"type": "stemmer",
"language": "light_french"
}
},
"analyzer": {
"rebuilt_french": {
"tokenizer": "standard",
"filter": [
"french_elision",
"lowercase",
"french_stop",
"french_keywords",
"french_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f54f6d06163221f2c7aff6e8db942be3.asciidoc 0000664 0000000 0000000 00000000740 15176617013 0026577 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/take-snapshot.asciidoc:579
[source, python]
----
resp = client.slm.put_lifecycle(
policy_id="daily-snapshots",
name="",
schedule="0 45 23 * * ?",
repository="my_repository",
config={
"indices": "*",
"include_global_state": True
},
retention={
"expire_after": "30d",
"min_count": 1,
"max_count": 31
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc 0000664 0000000 0000000 00000000775 15176617013 0026553 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// inference/service-azure-openai.asciidoc:165
[source, python]
----
resp = client.inference.put(
task_type="completion",
inference_id="azure_openai_completion",
inference_config={
"service": "azureopenai",
"service_settings": {
"api_key": "",
"resource_name": "",
"deployment_id": "",
"api_version": "2024-02-01"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5815d573cee0447910c9668003887b8.asciidoc 0000664 0000000 0000000 00000000574 15176617013 0026165 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/datehistogram-aggregation.asciidoc:122
[source, python]
----
resp = client.search(
index="sales",
size="0",
aggs={
"sales_over_time": {
"date_histogram": {
"field": "date",
"calendar_interval": "2d"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f58969ac405db85f439c5940d014964b.asciidoc 0000664 0000000 0000000 00000001010 15176617013 0026305 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-bounding-box-query.asciidoc:271
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_bounding_box": {
"pin.location": {
"wkt": "BBOX (-74.1, -71.12, 40.73, 40.01)"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f58fd031597e2c3df78bf0efd07206e3.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026602 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/start-basic.asciidoc:68
[source, python]
----
resp = client.license.post_start_basic(
acknowledge=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5bf2526af19d964f8c4c59d4795cffc.asciidoc 0000664 0000000 0000000 00000001300 15176617013 0026702 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/mlt-query.asciidoc:121
[source, python]
----
resp = client.indices.create(
index="imdb",
mappings={
"properties": {
"title": {
"type": "text",
"term_vector": "yes"
},
"description": {
"type": "text"
},
"tags": {
"type": "text",
"fields": {
"raw": {
"type": "text",
"analyzer": "keyword",
"term_vector": "yes"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5cbbb60ca26867a5d2da625a68a6e65.asciidoc 0000664 0000000 0000000 00000001613 15176617013 0026651 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// transform/ecommerce-tutorial.asciidoc:337
[source, python]
----
resp = client.indices.create(
index="ecommerce-customers",
mappings={
"properties": {
"total_quantity.sum": {
"type": "double"
},
"total_quantity": {
"type": "object"
},
"taxless_total_price": {
"type": "object"
},
"taxless_total_price.sum": {
"type": "double"
},
"order_id.cardinality": {
"type": "long"
},
"customer_id": {
"type": "keyword"
},
"total_quantity.max": {
"type": "integer"
},
"order_id": {
"type": "object"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5e50fe8a60467adb2c5ee9e0f2d88da.asciidoc 0000664 0000000 0000000 00000000435 15176617013 0027025 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:348
[source, python]
----
resp = client.sql.clear_cursor(
cursor="sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5e6378cc41ddf5326fe4084396c59b2.asciidoc 0000664 0000000 0000000 00000000714 15176617013 0026456 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/specify-analyzer.asciidoc:186
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"default": {
"type": "simple"
},
"default_search": {
"type": "whitespace"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5eed3f2e3558a238487bc85305b7a71.asciidoc 0000664 0000000 0000000 00000000425 15176617013 0026445 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:241
[source, python]
----
resp = client.index(
index="example",
document={
"location": "POLYGON ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f5ef80dd92c67059ca353a833e6b7b5e.asciidoc 0000664 0000000 0000000 00000000746 15176617013 0026615 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/sum-aggregation.asciidoc:14
[source, python]
----
resp = client.search(
index="sales",
size="0",
query={
"constant_score": {
"filter": {
"match": {
"type": "hat"
}
}
}
},
aggs={
"hat_prices": {
"sum": {
"field": "price"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f625fdbbe78c4198d9e40b35f3f008b3.asciidoc 0000664 0000000 0000000 00000000412 15176617013 0026600 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/f63f6343e74bd5c844854272e746de14.asciidoc 0000664 0000000 0000000 00000000307 15176617013 0026314 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/deactivate-watch.asciidoc:88
[source, python]
----
resp = client.watcher.deactivate_watch(
watch_id="my_watch",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f642b64e592131f37209a5100fe161cc.asciidoc 0000664 0000000 0000000 00000001744 15176617013 0026262 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/dynamic/templates.asciidoc:425
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"dynamic_templates": [
{
"named_analyzers": {
"match_mapping_type": "string",
"match": "*",
"mapping": {
"type": "text",
"analyzer": "{name}"
}
}
},
{
"no_doc_values": {
"match_mapping_type": "*",
"mapping": {
"type": "{dynamic_type}",
"doc_values": False
}
}
}
]
},
)
print(resp)
resp1 = client.index(
index="my-index-000001",
id="1",
document={
"english": "Some English text",
"count": 5
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/f6566395f85d3afe917228643d7318d6.asciidoc 0000664 0000000 0000000 00000000270 15176617013 0026247 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:469
[source, python]
----
resp = client.indices.delete(
index="my-index-000001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f656c1e64268293ecc8ebd8065628faa.asciidoc 0000664 0000000 0000000 00000000410 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-service-token-caches.asciidoc:76
[source, python]
----
resp = client.security.clear_cached_service_tokens(
namespace="elastic",
service="fleet-server",
name="*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f65abb38dd0cfedeb06e0cef206fbdab.asciidoc 0000664 0000000 0000000 00000000377 15176617013 0027362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/ngram-tokenfilter.asciidoc:30
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"ngram"
],
text="Quick fox",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f66643c54999426c5afa6d5a87435d4e.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-api-key-cache.asciidoc:49
[source, python]
----
resp = client.security.clear_api_key_cache(
ids="yVGMr3QByxdh1MSaicYx",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f679e414de48b8fe25e458844be05618.asciidoc 0000664 0000000 0000000 00000000436 15176617013 0026410 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/f67d8aab9106ad24b1d2c771d3840ed1.asciidoc 0000664 0000000 0000000 00000003407 15176617013 0026563 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// watcher/actions.asciidoc:276
[source, python]
----
resp = client.watcher.put_watch(
id="log_event_watch",
trigger={
"schedule": {
"interval": "5m"
}
},
input={
"search": {
"request": {
"indices": "log-events",
"body": {
"size": 0,
"query": {
"match": {
"status": "error"
}
}
}
}
}
},
condition={
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
actions={
"email_administrator": {
"email": {
"to": "sys.admino@host.domain",
"subject": "Encountered {{ctx.payload.hits.total}} errors",
"body": "Too many error in the system, see attached data",
"attachments": {
"attached_data": {
"data": {
"format": "json"
}
}
},
"priority": "high"
}
},
"notify_pager": {
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 5
}
}
},
"webhook": {
"method": "POST",
"host": "pager.service.domain",
"port": 1234,
"path": "/{{watch_id}}",
"body": "Encountered {{ctx.payload.hits.total}} errors"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6911b0f2f56523ccbd8027f276981b3.asciidoc 0000664 0000000 0000000 00000000616 15176617013 0026361 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/combined-fields-query.asciidoc:15
[source, python]
----
resp = client.search(
query={
"combined_fields": {
"query": "database systems",
"fields": [
"title",
"abstract",
"body"
],
"operator": "and"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6982ff80b9a64cd5fcac5b20908c906.asciidoc 0000664 0000000 0000000 00000000404 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/delete-calendar-event.asciidoc:49
[source, python]
----
resp = client.ml.delete_calendar_event(
calendar_id="planned-outages",
event_id="LS8LJGEBMTCMA-qz49st",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6c9d72fa26cbedd0c3f9fa64a88c38a.asciidoc 0000664 0000000 0000000 00000000332 15176617013 0027103 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/alias.asciidoc:86
[source, python]
----
resp = client.search(
query={
"match_all": {}
},
source="route_length_miles",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6d493650b4344f17297b568016fb445.asciidoc 0000664 0000000 0000000 00000000274 15176617013 0026151 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/apis/follow/post-unfollow.asciidoc:39
[source, python]
----
resp = client.ccr.unfollow(
index="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6de702c3d097af0b0bd391c4f947233.asciidoc 0000664 0000000 0000000 00000000451 15176617013 0026506 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/disk/decrease-data-node-disk-usage.asciidoc:103
[source, python]
----
resp = client.cat.indices(
v=True,
s="rep:desc,pri.store.size:desc",
h="health,index,pri,rep,store.size,pri.store.size",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6df4acf3c7a4f85706ff314b21ebcb2.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0027007 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/clear-privileges-cache.asciidoc:49
[source, python]
----
resp = client.security.clear_cached_privileges(
application="myapp",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6ead39c5505045543b9225deca7367d.asciidoc 0000664 0000000 0000000 00000000332 15176617013 0026434 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cluster/voting-exclusions.asciidoc:115
[source, python]
----
resp = client.cluster.post_voting_config_exclusions(
node_names="nodeName1,nodeName2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6edbed2b5b2709bbc13866a4780e27a.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026653 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/params/dynamic.asciidoc:9
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
document={
"username": "johnsmith",
"name": {
"first": "John",
"last": "Smith"
}
},
)
print(resp)
resp1 = client.indices.get_mapping(
index="my-index-000001",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/f6eff830fb0fad200ebfb1e3e46f6f0e.asciidoc 0000664 0000000 0000000 00000000701 15176617013 0027142 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/execute-watch.asciidoc:161
[source, python]
----
resp = client.watcher.execute_watch(
id="my_watch",
trigger_data={
"triggered_time": "now",
"scheduled_time": "now"
},
alternative_input={
"foo": "bar"
},
ignore_condition=True,
action_modes={
"my-action": "force_simulate"
},
record_execution=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f6f647eb644a2d236637ff05f833cb73.asciidoc 0000664 0000000 0000000 00000000502 15176617013 0026444 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/f70a54cd9a9f4811bf962e469f2ca2ea.asciidoc 0000664 0000000 0000000 00000000467 15176617013 0026672 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/bool-query.asciidoc:91
[source, python]
----
resp = client.search(
query={
"bool": {
"filter": {
"term": {
"status": "active"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f70ff57c80cdbce3f1e7c63ee307c92d.asciidoc 0000664 0000000 0000000 00000000447 15176617013 0027027 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:508
[source, python]
----
resp = client.reindex(
source={
"index": "my_test_scores"
},
dest={
"index": "my_test_scores_2",
"pipeline": "my_test_scores_pipeline"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f7139b3c0e066be832b9100ae17157cc.asciidoc 0000664 0000000 0000000 00000000441 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// esql/esql-rest.asciidoc:50
[source, python]
----
resp = client.esql.query(
format="txt",
query="\n FROM library\n | KEEP author, name, page_count, release_date\n | SORT page_count DESC\n | LIMIT 5\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f733b25cd4c448b226bb76862974eef2.asciidoc 0000664 0000000 0000000 00000001477 15176617013 0026457 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/pattern-capture-tokenfilter.asciidoc:51
[source, python]
----
resp = client.indices.create(
index="test",
settings={
"analysis": {
"filter": {
"code": {
"type": "pattern_capture",
"preserve_original": True,
"patterns": [
"(\\p{Ll}+|\\p{Lu}\\p{Ll}+|\\p{Lu}+)",
"(\\d+)"
]
}
},
"analyzer": {
"code": {
"tokenizer": "pattern",
"filter": [
"code",
"lowercase"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f749efe8f11ebd43ef83db91922c736e.asciidoc 0000664 0000000 0000000 00000001157 15176617013 0026704 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ccr/uni-directional-disaster-recovery.asciidoc:133
[source, python]
----
resp = client.cluster.put_settings(
persistent={
"cluster": {
"remote": {
"clusterB": {
"mode": "proxy",
"skip_unavailable": "true",
"server_name": "clusterb.es.region-b.gcp.elastic-cloud.com",
"proxy_socket_connections": "18",
"proxy_address": "clusterb.es.region-b.gcp.elastic-cloud.com:9400"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f7726cc2c60dea26b88bf0df99fb0813.asciidoc 0000664 0000000 0000000 00000000462 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:197
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"runtime": {
"day_of_week": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f785b5d17eb59f8d2a353c2dee66eb5b.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026751 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/get-connector-sync-job-api.asciidoc:51
[source, python]
----
resp = client.perform_request(
"GET",
"/_connector/_sync_job/my-connector-sync-job",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f7b20e4bb8366f6d2e4486f3bf4211bc.asciidoc 0000664 0000000 0000000 00000001271 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/histogram-aggregation.asciidoc:201
[source, python]
----
resp = client.search(
index="sales",
size="0",
query={
"constant_score": {
"filter": {
"range": {
"price": {
"lte": "500"
}
}
}
}
},
aggs={
"prices": {
"histogram": {
"field": "price",
"interval": 50,
"hard_bounds": {
"min": 100,
"max": 200
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f7d3d367a3d8e8ff0eca426b6ea85252.asciidoc 0000664 0000000 0000000 00000000407 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/tsds-reindex.asciidoc:222
[source, python]
----
resp = client.reindex(
source={
"index": "k8s"
},
dest={
"index": "k9s",
"op_type": "create"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f7dc2fed08e57abda2c3e8a14f8eb098.asciidoc 0000664 0000000 0000000 00000002141 15176617013 0027076 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/lang-analyzer.asciidoc:136
[source, python]
----
resp = client.indices.create(
index="armenian_example",
settings={
"analysis": {
"filter": {
"armenian_stop": {
"type": "stop",
"stopwords": "_armenian_"
},
"armenian_keywords": {
"type": "keyword_marker",
"keywords": [
"օրինակ"
]
},
"armenian_stemmer": {
"type": "stemmer",
"language": "armenian"
}
},
"analyzer": {
"rebuilt_armenian": {
"tokenizer": "standard",
"filter": [
"lowercase",
"armenian_stop",
"armenian_keywords",
"armenian_stemmer"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f7ec9062b3a7578fed55f119d7c22b74.asciidoc 0000664 0000000 0000000 00000000414 15176617013 0026530 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/testing.asciidoc:62
[source, python]
----
resp = client.indices.analyze(
tokenizer="standard",
filter=[
"lowercase",
"asciifolding"
],
text="Is this déja vu?",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f823e4b87ed181b27f73ebc51351f0ee.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/delete-data-stream.asciidoc:32
[source, python]
----
resp = client.indices.delete_data_stream(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f83eb6605c7c56e297a494b318400ef0.asciidoc 0000664 0000000 0000000 00000001022 15176617013 0026353 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/filter-search-results.asciidoc:58
[source, python]
----
resp = client.search(
index="shirts",
query={
"bool": {
"filter": [
{
"term": {
"color": "red"
}
},
{
"term": {
"brand": "gucci"
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f86337e13526c968848cfe29a52d658f.asciidoc 0000664 0000000 0000000 00000000776 15176617013 0026346 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/inference-api/infer-api-ingest-pipeline.asciidoc:41
[source, python]
----
resp = client.ingest.put_pipeline(
id="elser_embeddings_pipeline",
processors=[
{
"inference": {
"model_id": "elser_embeddings",
"input_output": {
"input_field": "content",
"output_field": "content_embedding"
}
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f8651356ce2e7e93fa306c30f57ed588.asciidoc 0000664 0000000 0000000 00000000757 15176617013 0026467 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/truncate-tokenfilter.asciidoc:93
[source, python]
----
resp = client.indices.create(
index="custom_truncate_example",
settings={
"analysis": {
"analyzer": {
"standard_truncate": {
"tokenizer": "standard",
"filter": [
"truncate"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f8833488041f3d318435b60917fa877c.asciidoc 0000664 0000000 0000000 00000001507 15176617013 0026157 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-overview.asciidoc:98
[source, python]
----
resp = client.search_application.put(
name="my_search_application",
search_application={
"indices": [
"my_search_index1",
"my_search_index2"
],
"template": {
"script": {
"source": {
"query": {
"query_string": {
"query": "{{query_string}}",
"default_field": "{{default_field}}"
}
}
},
"params": {
"query_string": "*",
"default_field": "*"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f8a0010753b1ff563dc42d703902d2fa.asciidoc 0000664 0000000 0000000 00000001751 15176617013 0026414 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/bool-query.asciidoc:39
[source, python]
----
resp = client.search(
query={
"bool": {
"must": {
"term": {
"user.id": "kimchy"
}
},
"filter": {
"term": {
"tags": "production"
}
},
"must_not": {
"range": {
"age": {
"gte": 10,
"lte": 20
}
}
},
"should": [
{
"term": {
"tags": "env1"
}
},
{
"term": {
"tags": "deployed"
}
}
],
"minimum_should_match": 1,
"boost": 1
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f8cafb1a08bc9b2dd5239f99d4e93f4c.asciidoc 0000664 0000000 0000000 00000000545 15176617013 0027034 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenizers/chargroup-tokenizer.asciidoc:33
[source, python]
----
resp = client.indices.analyze(
tokenizer={
"type": "char_group",
"tokenize_on_chars": [
"whitespace",
"-",
"\n"
]
},
text="The QUICK brown-fox",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f8cb1a04c2e487ff006b5ae0e1a7afbd.asciidoc 0000664 0000000 0000000 00000000266 15176617013 0027055 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/apis/rollup-caps.asciidoc:181
[source, python]
----
resp = client.rollup.get_rollup_caps(
id="sensor-1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f8f960550104c33e00dc78bc8723ccef.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026506 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/f92d2f5018a8843ffbb56ade15f84406.asciidoc 0000664 0000000 0000000 00000000246 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// licensing/get-basic-status.asciidoc:41
[source, python]
----
resp = client.license.get_basic_status()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f95a4d7ab02bf400246c8822f0245f02.asciidoc 0000664 0000000 0000000 00000000273 15176617013 0026334 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// cat/trainedmodel.asciidoc:124
[source, python]
----
resp = client.cat.ml_trained_models(
h="c,o,l,ct,v",
v=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f96d4614f2fc294339fef325b794355f.asciidoc 0000664 0000000 0000000 00000000370 15176617013 0026404 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/get-bucket.asciidoc:208
[source, python]
----
resp = client.ml.get_buckets(
job_id="low_request_rate",
anomaly_score=80,
start="1454530200001",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f96d8131e8a592fbf6dfd686173940a9.asciidoc 0000664 0000000 0000000 00000001023 15176617013 0026461 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/watcher/update-settings.asciidoc:22
[source, python]
----
resp = client.watcher.put_watch(
id="test_watch",
trigger={
"schedule": {
"hourly": {
"minute": [
0,
5
]
}
}
},
input={
"simple": {
"payload": {
"send": "yes"
}
}
},
condition={
"always": {}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f9732ce07960134ea7156e118c2da8a6.asciidoc 0000664 0000000 0000000 00000000661 15176617013 0026356 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/analyzers/simple-analyzer.asciidoc:134
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
settings={
"analysis": {
"analyzer": {
"my_custom_simple_analyzer": {
"tokenizer": "lowercase",
"filter": []
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f978088f5117d4addd55c11ee3777312.asciidoc 0000664 0000000 0000000 00000000403 15176617013 0026364 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/get-service-credentials.asciidoc:56
[source, python]
----
resp = client.security.create_service_token(
namespace="elastic",
service="fleet-server",
name="token1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f97aa2efabbf11a534073041eb2658c9.asciidoc 0000664 0000000 0000000 00000000304 15176617013 0026554 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/apis/delete-stored-script-api.asciidoc:30
[source, python]
----
resp = client.delete_script(
id="my-stored-script",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f98687271e1bec031cc34d05d8f4b60b.asciidoc 0000664 0000000 0000000 00000000577 15176617013 0026522 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/span-multi-term-query.asciidoc:12
[source, python]
----
resp = client.search(
query={
"span_multi": {
"match": {
"prefix": {
"user.id": {
"value": "ki"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f994498dd6576be657dedce2822d2b9e.asciidoc 0000664 0000000 0000000 00000002130 15176617013 0026630 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/f9a315ea99bed0cf2f36be1d74eb3e4a.asciidoc 0000664 0000000 0000000 00000000620 15176617013 0027070 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:407
[source, python]
----
resp = client.index(
index="example",
document={
"location": "MULTIPOLYGON (((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0, 102.0 2.0)), ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2)))"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f9bad6fd369764185e1cb09b89ee39cc.asciidoc 0000664 0000000 0000000 00000001323 15176617013 0026702 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/text.asciidoc:237
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"text": {
"type": "text",
"store": True
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"text": [
"the quick brown fox",
"the quick brown fox",
"jumped over the lazy dog"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/f9c8245cc13770dff052b6759a749efa.asciidoc 0000664 0000000 0000000 00000000261 15176617013 0026532 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/get.asciidoc:294
[source, python]
----
resp = client.get_source(
index="my-index-000001",
id="1",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/f9f541ae23a184301913f07e62d1afd3.asciidoc 0000664 0000000 0000000 00000000455 15176617013 0026423 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// sql/endpoints/rest.asciidoc:657
[source, python]
----
resp = client.sql.query(
format="json",
keep_alive="2d",
wait_for_completion_timeout="2s",
query="SELECT * FROM library ORDER BY page_count DESC",
fetch_size=5,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fa42ae3bf6a300420cd0f77ba006458a.asciidoc 0000664 0000000 0000000 00000000313 15176617013 0026532 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:17
[source, python]
----
resp = client.indices.analyze(
analyzer="standard",
text="Quick Brown Foxes!",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fa5dcd1c7fadc473a791daf0d7ceec36.asciidoc 0000664 0000000 0000000 00000001057 15176617013 0027233 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/metrics/geoline-aggregation.asciidoc:318
[source, python]
----
resp = client.search(
index="tour",
filter_path="aggregations",
aggregations={
"path": {
"time_series": {},
"aggregations": {
"museum_tour": {
"geo_line": {
"point": {
"field": "location"
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fa61e3481b1f889b3bd4253866bb1c6b.asciidoc 0000664 0000000 0000000 00000006266 15176617013 0026525 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/bucket-correlation-aggregation.asciidoc:103
[source, python]
----
resp = client.search(
index="correlate_latency",
size="0",
filter_path="aggregations",
aggs={
"buckets": {
"terms": {
"field": "version",
"size": 2
},
"aggs": {
"latency_ranges": {
"range": {
"field": "latency",
"ranges": [
{
"to": 0
},
{
"from": 0,
"to": 105
},
{
"from": 105,
"to": 225
},
{
"from": 225,
"to": 445
},
{
"from": 445,
"to": 665
},
{
"from": 665,
"to": 885
},
{
"from": 885,
"to": 1115
},
{
"from": 1115,
"to": 1335
},
{
"from": 1335,
"to": 1555
},
{
"from": 1555,
"to": 1775
},
{
"from": 1775
}
]
}
},
"bucket_correlation": {
"bucket_correlation": {
"buckets_path": "latency_ranges>_count",
"function": {
"count_correlation": {
"indicator": {
"expectations": [
0,
52.5,
165,
335,
555,
775,
1000,
1225,
1445,
1665,
1775
],
"doc_count": 200
}
}
}
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fa82d86a046d67366cfe9ce65535e433.asciidoc 0000664 0000000 0000000 00000001071 15176617013 0026454 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// graph/explore.asciidoc:402
[source, python]
----
resp = client.graph.explore(
index="clicklogs",
vertices=[
{
"field": "product",
"include": [
"1854873"
]
}
],
connections={
"vertices": [
{
"field": "query.raw",
"exclude": [
"midi keyboard",
"midi",
"synth"
]
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fa88f6f5a7d728ec4f1d05244228cb09.asciidoc 0000664 0000000 0000000 00000000575 15176617013 0026533 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/bool-query.asciidoc:110
[source, python]
----
resp = client.search(
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"term": {
"status": "active"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fa946228e946da256d40264c8b070a1a.asciidoc 0000664 0000000 0000000 00000000563 15176617013 0026350 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations.asciidoc:241
[source, python]
----
resp = client.search(
index="my-index-000001",
aggs={
"my-agg-name": {
"terms": {
"field": "my-field"
},
"meta": {
"my-metadata-field": "foo"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fa9a3ef94470f3d9bd6500b65bf993d1.asciidoc 0000664 0000000 0000000 00000000405 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/multiplexer-tokenfilter.asciidoc:61
[source, python]
----
resp = client.indices.analyze(
index="multiplexer_example",
analyzer="my_analyzer",
text="Going HOME",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fab4b811ba968aa4df92fb1ac059ea31.asciidoc 0000664 0000000 0000000 00000000464 15176617013 0027000 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/geo-shape.asciidoc:106
[source, python]
----
resp = client.indices.create(
index="example",
mappings={
"properties": {
"location": {
"type": "geo_shape"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fab702851e90e945c1b62dec0bb6a205.asciidoc 0000664 0000000 0000000 00000000374 15176617013 0026556 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// behavioral-analytics/apis/delete-analytics-collection.asciidoc:59
[source, python]
----
resp = client.search_application.delete_behavioral_analytics(
name="my_analytics_collection",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fabe14480624a99e8ee42c7338672058.asciidoc 0000664 0000000 0000000 00000000312 15176617013 0026304 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/create-index.asciidoc:270
[source, python]
----
resp = client.indices.create(
index="test",
wait_for_active_shards="2",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fad26f4fb5a1bc9c38db33394e877d94.asciidoc 0000664 0000000 0000000 00000000333 15176617013 0026670 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/df-analytics/apis/get-dfanalytics-stats.asciidoc:539
[source, python]
----
resp = client.ml.get_data_frame_analytics_stats(
id="weblog-outliers",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fad524db23eb5718ff310956e590b00d.asciidoc 0000664 0000000 0000000 00000000476 15176617013 0026512 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/function-score-query.asciidoc:241
[source, python]
----
resp = client.search(
query={
"function_score": {
"random_score": {
"seed": 10,
"field": "_seq_no"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/faf7d8b9827cf5c0db5c177f01dc31c4.asciidoc 0000664 0000000 0000000 00000001044 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/rank-eval.asciidoc:263
[source, python]
----
resp = client.rank_eval(
index="my-index-000001",
requests=[
{
"id": "JFK query",
"request": {
"query": {
"match_all": {}
}
},
"ratings": []
}
],
metric={
"precision": {
"k": 20,
"relevant_rating_threshold": 1,
"ignore_unlabeled": False
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fb0152f6c70f647a8b6709969113486d.asciidoc 0000664 0000000 0000000 00000001265 15176617013 0026236 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/keyword.asciidoc:222
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"kwd": {
"type": "keyword",
"store": True
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"kwd": [
"foo",
"foo",
"bar",
"baz"
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/fb1180992b2087dfb36576b44c4261e4.asciidoc 0000664 0000000 0000000 00000000700 15176617013 0026271 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/change-mappings-and-settings.asciidoc:249
[source, python]
----
resp = client.indices.put_mapping(
index="my-data-stream",
write_index_only=True,
properties={
"host": {
"properties": {
"ip": {
"type": "ip",
"ignore_malformed": True
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fb1263cfdcbb6a89b20b57004d7e0dfc.asciidoc 0000664 0000000 0000000 00000001207 15176617013 0026774 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/set.asciidoc:96
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"set": {
"field": "my_field",
"value": "{{{input_field.1}}}"
}
}
]
},
docs=[
{
"_index": "index",
"_id": "id",
"_source": {
"input_field": [
"Ubuntu",
"Windows",
"Ventura"
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fb2b91206cfa8b86b4c7117ac1b5193b.asciidoc 0000664 0000000 0000000 00000001667 15176617013 0026567 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/pipeline/cumulative-cardinality-aggregation.asciidoc:145
[source, python]
----
resp = client.search(
index="user_hits",
size=0,
aggs={
"users_per_day": {
"date_histogram": {
"field": "timestamp",
"calendar_interval": "day"
},
"aggs": {
"distinct_users": {
"cardinality": {
"field": "user_id"
}
},
"total_new_users": {
"cumulative_cardinality": {
"buckets_path": "distinct_users"
}
},
"incremental_new_users": {
"derivative": {
"buckets_path": "total_new_users"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fb3505d976283fb7c7b9705a761e0dc2.asciidoc 0000664 0000000 0000000 00000001566 15176617013 0026452 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:264
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "polygon",
"orientation": "clockwise",
"coordinates": [
[
[
1000,
1000
],
[
1000,
1001
],
[
1001,
1001
],
[
1001,
1000
],
[
1000,
1000
]
]
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fb4799d2fe4011bf6084f89d97d9a4a5.asciidoc 0000664 0000000 0000000 00000000321 15176617013 0026536 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// autoscaling/apis/get-autoscaling-policy.asciidoc:47
[source, python]
----
resp = client.autoscaling.get_autoscaling_policy(
name="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fb56c2ac77d4c308d7702b6b33698382.asciidoc 0000664 0000000 0000000 00000000445 15176617013 0026364 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/fb955375a202f66133af009c04cb77ad.asciidoc 0000664 0000000 0000000 00000000717 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/range-enrich-policy-type-ex.asciidoc:17
[source, python]
----
resp = client.indices.create(
index="networks",
mappings={
"properties": {
"range": {
"type": "ip_range"
},
"name": {
"type": "keyword"
},
"department": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fbb38243221c8fb311660616e3add9ce.asciidoc 0000664 0000000 0000000 00000001130 15176617013 0026472 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:420
[source, python]
----
resp = client.search(
sort=[
{
"_geo_distance": {
"pin.location": [
-70,
40
],
"order": "asc",
"unit": "km",
"mode": "min",
"distance_type": "arc",
"ignore_unmapped": True
}
}
],
query={
"term": {
"user": "kimchy"
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fbc5ab85b908480bf944b55da0a43488.asciidoc 0000664 0000000 0000000 00000000407 15176617013 0026517 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/prefix-query.asciidoc:16
[source, python]
----
resp = client.search(
query={
"prefix": {
"user.id": {
"value": "ki"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fbdad6620eb645f5f1f02e3673604d01.asciidoc 0000664 0000000 0000000 00000000733 15176617013 0026502 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/geo-distance-query.asciidoc:236
[source, python]
----
resp = client.search(
index="my_locations",
query={
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_distance": {
"distance": "12km",
"pin.location": "drm3btev3e86"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc1907515f6a913884a9f86451e90ee8.asciidoc 0000664 0000000 0000000 00000001013 15176617013 0026317 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/semantic-search-elser.asciidoc:316
[source, python]
----
resp = client.indices.create(
index="my-index",
mappings={
"_source": {
"excludes": [
"content_embedding"
]
},
"properties": {
"content_embedding": {
"type": "sparse_vector"
},
"content": {
"type": "text"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc190fbbf71949331266dcb3f46a1198.asciidoc 0000664 0000000 0000000 00000000303 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/data-stream-stats.asciidoc:57
[source, python]
----
resp = client.indices.data_streams_stats(
name="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc26f51bb22c0b5270a66b4722f18aa7.asciidoc 0000664 0000000 0000000 00000000727 15176617013 0026475 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-allocate.asciidoc:60
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"allocate": {
"number_of_replicas": 2,
"total_shards_per_node": 200
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc3f5f40fa283559ca615cd0eb0a1755.asciidoc 0000664 0000000 0000000 00000000611 15176617013 0026560 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/doc-count-field.asciidoc:34
[source, python]
----
resp = client.indices.create(
index="my_index",
mappings={
"properties": {
"my_histogram": {
"type": "histogram"
},
"my_text": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc49437ce2e7916facf58128308c2aa3.asciidoc 0000664 0000000 0000000 00000000707 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// searchable-snapshots/apis/mount-snapshot.asciidoc:134
[source, python]
----
resp = client.searchable_snapshots.mount(
repository="my_repository",
snapshot="my_snapshot",
wait_for_completion=True,
index="my_docs",
renamed_index="docs",
index_settings={
"index.number_of_replicas": 0
},
ignore_index_settings=[
"index.refresh_interval"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc51fbc60b0e20aac83300a43ad90252.asciidoc 0000664 0000000 0000000 00000001542 15176617013 0026526 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/shape.asciidoc:375
[source, python]
----
resp = client.index(
index="example",
document={
"location": {
"type": "geometrycollection",
"geometries": [
{
"type": "point",
"coordinates": [
1000,
100
]
},
{
"type": "linestring",
"coordinates": [
[
1001,
100
],
[
1002,
100
]
]
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc5a81f34d416e4b45ca8a859dd3b8f1.asciidoc 0000664 0000000 0000000 00000000640 15176617013 0026660 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/autodatehistogram-aggregation.asciidoc:190
[source, python]
----
resp = client.search(
index="my-index-000001",
size="0",
aggs={
"by_day": {
"auto_date_histogram": {
"field": "date",
"buckets": 3,
"time_zone": "-01:00"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc75ea748e5f49b8ab292e453ab641a6.asciidoc 0000664 0000000 0000000 00000001113 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// aggregations/bucket/nested-aggregation.asciidoc:62
[source, python]
----
resp = client.search(
index="products",
size="0",
query={
"match": {
"name": "led tv"
}
},
aggs={
"resellers": {
"nested": {
"path": "resellers"
},
"aggs": {
"min_price": {
"min": {
"field": "resellers.price"
}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc8a426f8a5112e61e2acb913982a8d9.asciidoc 0000664 0000000 0000000 00000000376 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// index-modules/index-sorting.asciidoc:137
[source, python]
----
resp = client.search(
index="events",
size=10,
sort=[
{
"timestamp": "desc"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fc9a1b1173690a911725cff3912e9755.asciidoc 0000664 0000000 0000000 00000000534 15176617013 0026303 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ilm/actions/ilm-readonly.asciidoc:22
[source, python]
----
resp = client.ilm.put_lifecycle(
name="my_policy",
policy={
"phases": {
"warm": {
"actions": {
"readonly": {}
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fccbddfba9f975de7e321732874dfb78.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0027041 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/data-stream-stats.asciidoc:182
[source, python]
----
resp = client.indices.data_streams_stats(
name="my-data-stream*",
human=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fce5c03a388c893cb11a6696e068543f.asciidoc 0000664 0000000 0000000 00000002406 15176617013 0026447 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/has-privileges-user-profile.asciidoc:104
[source, python]
----
resp = client.security.has_privileges_user_profile(
uids=[
"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0",
"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1",
"u_does-not-exist_0"
],
privileges={
"cluster": [
"monitor",
"create_snapshot",
"manage_ml"
],
"index": [
{
"names": [
"suppliers",
"products"
],
"privileges": [
"create_doc"
]
},
{
"names": [
"inventory"
],
"privileges": [
"read",
"write"
]
}
],
"application": [
{
"application": "inventory_manager",
"privileges": [
"read",
"data:write/inventory"
],
"resources": [
"product/1852563"
]
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fce7a35a737fc9e54ac1225e310dd561.asciidoc 0000664 0000000 0000000 00000001550 15176617013 0026565 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// vectors/vector-functions.asciidoc:121
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"script_score": {
"query": {
"bool": {
"filter": {
"term": {
"status": "published"
}
}
}
},
"script": {
"source": "\n double value = dotProduct(params.query_vector, 'my_dense_vector');\n return sigmoid(1, Math.E, -value); \n ",
"params": {
"query_vector": [
4,
3.4,
-0.2
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd04289c54493e19c1d3ac70d0b489c4.asciidoc 0000664 0000000 0000000 00000001201 15176617013 0026427 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest.asciidoc:840
[source, python]
----
resp = client.ingest.put_pipeline(
id="my-pipeline",
processors=[
{
"drop": {
"description": "Drop documents that don't contain 'prod' tag",
"if": "\n Collection tags = ctx.tags;\n if(tags != null){\n for (String tag : tags) {\n if (tag.toLowerCase().contains('prod')) {\n return false;\n }\n }\n }\n return true;\n "
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd0cd8ecd03468726b59a605eea06d75.asciidoc 0000664 0000000 0000000 00000001640 15176617013 0026600 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// query-dsl/rank-feature-query.asciidoc:138
[source, python]
----
resp = client.search(
index="test",
query={
"bool": {
"must": [
{
"match": {
"content": "2016"
}
}
],
"should": [
{
"rank_feature": {
"field": "pagerank"
}
},
{
"rank_feature": {
"field": "url_length",
"boost": 0.1
}
},
{
"rank_feature": {
"field": "topics.sports",
"boost": 0.4
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd26bfdbe95b2d2db374385d12849f77.asciidoc 0000664 0000000 0000000 00000000726 15176617013 0026617 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/trim-tokenfilter.asciidoc:99
[source, python]
----
resp = client.indices.create(
index="trim_example",
settings={
"analysis": {
"analyzer": {
"keyword_trim": {
"tokenizer": "keyword",
"filter": [
"trim"
]
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd2d289e6b725fcc3cbe8fe7ffe02ea0.asciidoc 0000664 0000000 0000000 00000000246 15176617013 0027165 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/get-index-template-v1.asciidoc:103
[source, python]
----
resp = client.indices.get_template()
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd352b472d44d197022a46fce90b6ecb.asciidoc 0000664 0000000 0000000 00000001266 15176617013 0026572 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/multi-get.asciidoc:184
[source, python]
----
resp = client.mget(
docs=[
{
"_index": "test",
"_id": "1",
"_source": False
},
{
"_index": "test",
"_id": "2",
"_source": [
"field3",
"field4"
]
},
{
"_index": "test",
"_id": "3",
"_source": {
"include": [
"user"
],
"exclude": [
"user.location"
]
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd60b4092c6552164862cec287359676.asciidoc 0000664 0000000 0000000 00000000354 15176617013 0026154 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/anomaly-detection/apis/stop-datafeed.asciidoc:80
[source, python]
----
resp = client.ml.stop_datafeed(
datafeed_id="datafeed-low_request_rate",
timeout="30s",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd620f09dbce62c6f0f603a366623607.asciidoc 0000664 0000000 0000000 00000001044 15176617013 0026425 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// connector/apis/update-connector-filtering-api.asciidoc:156
[source, python]
----
resp = client.connector.update_filtering(
connector_id="my-sql-connector",
advanced_snippet={
"value": [
{
"tables": [
"users",
"orders"
],
"query": "SELECT users.id AS id, orders.order_id AS order_id FROM users JOIN orders ON users.id = orders.user_id"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd6fdc8fa994dd02cf1177077325304f.asciidoc 0000664 0000000 0000000 00000000623 15176617013 0026524 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/troubleshooting/data/restore-from-snapshot.asciidoc:454
[source, python]
----
resp = client.snapshot.restore(
repository="my_repository",
snapshot="snapshot-20200617",
feature_states=[
"geoip"
],
indices="kibana_sample_data_flights,.ds-my-data-stream-2022.06.17-000001",
include_aliases=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd738a9af7b5d21da31a7722f03aade8.asciidoc 0000664 0000000 0000000 00000000353 15176617013 0026724 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/size-your-shards.asciidoc:171
[source, python]
----
resp = client.cat.shards(
v=True,
h="index,prirep,shard,store",
s="prirep,store",
bytes="gb",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd7eeadab6251d9113c4380a7fbe2572.asciidoc 0000664 0000000 0000000 00000001041 15176617013 0026637 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/remote-clusters-privileges-api-key.asciidoc:27
[source, python]
----
resp = client.security.put_role(
name="remote-replication",
cluster=[
"manage_ccr"
],
remote_indices=[
{
"clusters": [
"my_remote_cluster"
],
"names": [
"leader-index"
],
"privileges": [
"cross_cluster_replication"
]
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fd9b668eeb1f117950bd4991c7c03fb1.asciidoc 0000664 0000000 0000000 00000000363 15176617013 0026604 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// indices/analyze.asciidoc:163
[source, python]
----
resp = client.indices.analyze(
analyzer="standard",
text=[
"this is a test",
"the second text"
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fdada036a875d7995d5d7aba9c06361e.asciidoc 0000664 0000000 0000000 00000000570 15176617013 0026664 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/dense-vector.asciidoc:94
[source, python]
----
resp = client.indices.create(
index="my-index-2",
mappings={
"properties": {
"my_vector": {
"type": "dense_vector",
"dims": 3,
"index": False
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fdc8e090293e78e9a6b283650b682517.asciidoc 0000664 0000000 0000000 00000000274 15176617013 0026317 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:161
[source, python]
----
resp = client.indices.open(
index="my-data-stream",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fde3463ddf136fdfff1306a60986515e.asciidoc 0000664 0000000 0000000 00000000362 15176617013 0026605 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// upgrade/archived-settings.asciidoc:64
[source, python]
----
resp = client.indices.get_settings(
index="*",
flat_settings=True,
filter_path="**.settings.archived*",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fdf7cfdf1c92d21ee710675596eac6fd.asciidoc 0000664 0000000 0000000 00000002133 15176617013 0027031 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// tab-widgets/semantic-search/hybrid-search.asciidoc:55
[source, python]
----
resp = client.search(
index="my-index",
retriever={
"rrf": {
"retrievers": [
{
"standard": {
"query": {
"match": {
"my_text_field": "the query string"
}
}
}
},
{
"knn": {
"field": "text_embedding.predicted_value",
"k": 10,
"num_candidates": 100,
"query_vector_builder": {
"text_embedding": {
"model_id": "sentence-transformers__msmarco-minilm-l-12-v3",
"model_text": "the query string"
}
}
}
}
]
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fe208d94ec93eabf3bd06139fa70701e.asciidoc 0000664 0000000 0000000 00000002156 15176617013 0026654 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rollup/migrating-to-downsampling.asciidoc:59
[source, python]
----
resp = client.indices.put_index_template(
name="sensor-template",
index_patterns=[
"sensor-*"
],
data_stream={},
template={
"lifecycle": {
"downsampling": [
{
"after": "1d",
"fixed_interval": "1h"
}
]
},
"settings": {
"index.mode": "time_series"
},
"mappings": {
"properties": {
"node": {
"type": "keyword",
"time_series_dimension": True
},
"temperature": {
"type": "half_float",
"time_series_metric": "gauge"
},
"voltage": {
"type": "half_float",
"time_series_metric": "gauge"
},
"@timestamp": {
"type": "date"
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fe3a927d868cbc530e08e05964d5174a.asciidoc 0000664 0000000 0000000 00000001124 15176617013 0026442 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/sort-search-results.asciidoc:117
[source, python]
----
resp = client.index(
index="my-index-000001",
id="1",
refresh=True,
document={
"product": "chocolate",
"price": [
20,
4
]
},
)
print(resp)
resp1 = client.search(
query={
"term": {
"product": "chocolate"
}
},
sort=[
{
"price": {
"order": "asc",
"mode": "avg"
}
}
],
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/fe54f3e53dbe7dee40ec3108a461d19a.asciidoc 0000664 0000000 0000000 00000001116 15176617013 0026725 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// security/authentication/jwt-realm.asciidoc:522
[source, python]
----
resp = client.security.put_role_mapping(
name="jwt_user1",
refresh=True,
roles=[
"jwt_role1"
],
rules={
"all": [
{
"field": {
"realm.name": "jwt2"
}
},
{
"field": {
"username": "user2"
}
}
]
},
enabled=True,
metadata={
"version": 1
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fe6429d0d82174aa5acf95e96e237380.asciidoc 0000664 0000000 0000000 00000001322 15176617013 0026444 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/range.asciidoc:324
[source, python]
----
resp = client.indices.create(
index="idx",
settings={
"index": {
"mapping": {
"source": {
"mode": "synthetic"
}
}
}
},
mappings={
"properties": {
"my_range": {
"type": "ip_range"
}
}
},
)
print(resp)
resp1 = client.index(
index="idx",
id="1",
document={
"my_range": [
"10.0.0.0/24",
{
"gte": "10.0.0.0",
"lte": "10.0.0.255"
}
]
},
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/fe6e35839f7d7381f8ec535c8f21959b.asciidoc 0000664 0000000 0000000 00000000714 15176617013 0026501 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// how-to/recipes/scoring.asciidoc:124
[source, python]
----
resp = client.search(
index="index",
query={
"script_score": {
"query": {
"match": {
"body": "elasticsearch"
}
},
"script": {
"source": "_score * saturation(doc['pagerank'].value, 10)"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fe7169bab8e626f582c9ea87585d0f35.asciidoc 0000664 0000000 0000000 00000000611 15176617013 0026543 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/types/histogram.asciidoc:98
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"my_histogram": {
"type": "histogram"
},
"my_text": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fe806011466e7cdc1590da186297edb6.asciidoc 0000664 0000000 0000000 00000000263 15176617013 0026441 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// api-conventions.asciidoc:119
[source, python]
----
resp = client.indices.create(
index="",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fe825c05e13e8163073166572c7ac97d.asciidoc 0000664 0000000 0000000 00000000525 15176617013 0026304 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/geo-grid.asciidoc:199
[source, python]
----
resp = client.index(
index="geocells",
id="1",
pipeline="geohex2shape",
document={
"geocell": "811fbffffffffff"
},
)
print(resp)
resp1 = client.get(
index="geocells",
id="1",
)
print(resp1)
----
python-elasticsearch-9.4.0/docs/examples/fe8c3e2632f5057bfbd1898a8fe4d0d2.asciidoc 0000664 0000000 0000000 00000002456 15176617013 0026674 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:325
[source, python]
----
resp = client.search_application.put(
name="my_search_application",
search_application={
"indices": [
"index1",
"index2"
],
"template": {
"script": {
"lang": "mustache",
"source": "\n {\n \"query\": {\n \"multi_match\": {\n \"query\": \"{{query_string}}\",\n \"fields\": [{{#text_fields}}\"{{name}}^{{boost}}\",{{/text_fields}}]\n }\n },\n \"explain\": \"{{explain}}\",\n \"from\": \"{{from}}\",\n \"size\": \"{{size}}\"\n }\n ",
"params": {
"query_string": "*",
"text_fields": [
{
"name": "title",
"boost": 10
},
{
"name": "description",
"boost": 5
}
],
"explain": False,
"from": 0,
"size": 10
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fe96ca3b2a559d8411aca7ed5f3854bd.asciidoc 0000664 0000000 0000000 00000000326 15176617013 0026737 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/common-options.asciidoc:229
[source, python]
----
resp = client.indices.get_settings(
index="my-index-000001",
flat_settings=True,
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/febb71d774e0a1fc67454213d7448c53.asciidoc 0000664 0000000 0000000 00000000342 15176617013 0026433 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// scripting/using.asciidoc:367
[source, python]
----
resp = client.update(
index="my-index-000001",
id="1",
script="ctx._source.remove('new_field')",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fece7c0fe1f7d113aa05ff5346a18aff.asciidoc 0000664 0000000 0000000 00000001634 15176617013 0027070 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// data-streams/use-a-data-stream.asciidoc:81
[source, python]
----
resp = client.bulk(
index="my-data-stream",
refresh=True,
operations=[
{
"create": {}
},
{
"@timestamp": "2099-03-08T11:04:05.000Z",
"user": {
"id": "vlb44hny"
},
"message": "Login attempt failed"
},
{
"create": {}
},
{
"@timestamp": "2099-03-08T11:06:07.000Z",
"user": {
"id": "8a4f500d"
},
"message": "Login successful"
},
{
"create": {}
},
{
"@timestamp": "2099-03-09T11:07:08.000Z",
"user": {
"id": "l7gk7f82"
},
"message": "Logout successful"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/feda4b996ea7004f8b2c5f5007fb717b.asciidoc 0000664 0000000 0000000 00000000771 15176617013 0026662 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/range-enrich-policy-type-ex.asciidoc:91
[source, python]
----
resp = client.ingest.put_pipeline(
id="networks_lookup",
processors=[
{
"enrich": {
"description": "Add 'network' data based on 'ip'",
"policy_name": "networks-policy",
"field": "ip",
"target_field": "network",
"max_matches": "10"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fef520cbc9b0656e6aac7b3dd3da9984.asciidoc 0000664 0000000 0000000 00000000472 15176617013 0027022 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// eql/eql.asciidoc:789
[source, python]
----
resp = client.eql.search(
index="my-index*",
query="\n sample by host\n [any where uptime > 0] by os\n [any where port > 100] by op_sys\n [any where bool == true] by os\n ",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff05842419968a2141bde0371ac2f6f4.asciidoc 0000664 0000000 0000000 00000000677 15176617013 0026362 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-template.asciidoc:320
[source, python]
----
resp = client.render_search_template(
source={
"query": {
"match": {
"user.group.emails": "{{#join}}emails{{/join}}"
}
}
},
params={
"emails": [
"user1@example.com",
"user_one@example.com"
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff09e13391cecb2e8b9dd440b37e065f.asciidoc 0000664 0000000 0000000 00000000325 15176617013 0026655 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:316
[source, python]
----
resp = client.search(
index="my-new-index-000001",
size="0",
filter_path="hits.total",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff1b96d2fdcf628bd938bff9e939943c.asciidoc 0000664 0000000 0000000 00000001013 15176617013 0026771 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/runtime.asciidoc:965
[source, python]
----
resp = client.indices.create(
index="my-index-000001",
mappings={
"properties": {
"timestamp": {
"type": "date"
},
"temperature": {
"type": "long"
},
"voltage": {
"type": "double"
},
"node": {
"type": "keyword"
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff27e5cddd1f58d8a8f84f807fd27eec.asciidoc 0000664 0000000 0000000 00000001314 15176617013 0027126 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ingest/processors/redact.asciidoc:179
[source, python]
----
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"redact": {
"field": "message",
"patterns": [
"%{GITHUB_NAME:GITHUB_NAME}"
],
"pattern_definitions": {
"GITHUB_NAME": "@%{USERNAME}"
}
}
}
]
},
docs=[
{
"_source": {
"message": "@elastic-data-management the PR is ready for review"
}
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff56ded50c65998c70f3c5691ddc6f86.asciidoc 0000664 0000000 0000000 00000000316 15176617013 0026632 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// snapshot-restore/apis/delete-repo-api.asciidoc:33
[source, python]
----
resp = client.snapshot.delete_repository(
name="my_repository",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff63ae39c34925dbfa54282ec9989124.asciidoc 0000664 0000000 0000000 00000001007 15176617013 0026454 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// docs/reindex.asciidoc:1009
[source, python]
----
resp = client.reindex(
source={
"remote": {
"host": "http://otherhost:9200",
"headers": {
"Authorization": "ApiKey API_KEY_VALUE"
}
},
"index": "my-index-000001",
"query": {
"match": {
"test": "data"
}
}
},
dest={
"index": "my-new-index-000001"
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff776c0fccf93e1c7050f7cb7efbae0b.asciidoc 0000664 0000000 0000000 00000000470 15176617013 0027156 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// ml/trained-models/apis/infer-trained-model.asciidoc:1012
[source, python]
----
resp = client.ml.infer_trained_model(
model_id="model2",
docs=[
{
"text_field": "Hi my name is Josh and I live in Berlin"
}
],
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff7b81fa96c3b994efa3dee230512291.asciidoc 0000664 0000000 0000000 00000000672 15176617013 0026606 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// graph/explore.asciidoc:210
[source, python]
----
resp = client.graph.explore(
index="clicklogs",
query={
"match": {
"query.raw": "midi"
}
},
vertices=[
{
"field": "product"
}
],
connections={
"vertices": [
{
"field": "query.raw"
}
]
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ff945f5db7d8a9b0d9f6a2f2fcf849e3.asciidoc 0000664 0000000 0000000 00000001126 15176617013 0027047 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// mapping/fields/tier-field.asciidoc:10
[source, python]
----
resp = client.index(
index="index_1",
id="1",
document={
"text": "Document in index 1"
},
)
print(resp)
resp1 = client.index(
index="index_2",
id="2",
refresh=True,
document={
"text": "Document in index 2"
},
)
print(resp1)
resp2 = client.search(
index="index_1,index_2",
query={
"terms": {
"_tier": [
"data_hot",
"data_warm"
]
}
},
)
print(resp2)
----
python-elasticsearch-9.4.0/docs/examples/ffcf80e1094aa2d774f56f6b0bc54827.asciidoc 0000664 0000000 0000000 00000000471 15176617013 0026603 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// analysis/tokenfilters/word-delimiter-graph-tokenfilter.asciidoc:47
[source, python]
----
resp = client.indices.analyze(
tokenizer="keyword",
filter=[
"word_delimiter_graph"
],
text="Neil's-Super-Duper-XL500--42+AutoCoder",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ffd63dd186ab81b893faec3b3358fa09.asciidoc 0000664 0000000 0000000 00000000300 15176617013 0026733 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// rest-api/security/delete-users.asciidoc:45
[source, python]
----
resp = client.security.delete_user(
username="jacknich",
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/ffda10edaa7ce087703193c3cb95a426.asciidoc 0000664 0000000 0000000 00000007032 15176617013 0026643 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/examples/ffe45a7c70071730c2078cabb8cbdf95.asciidoc 0000664 0000000 0000000 00000002150 15176617013 0026646 0 ustar 00root root 0000000 0000000 // This file is autogenerated, DO NOT EDIT
// vectors/vector-functions.asciidoc:294
[source, python]
----
resp = client.search(
index="my-index-000001",
query={
"script_score": {
"query": {
"bool": {
"filter": {
"term": {
"status": "published"
}
}
}
},
"script": {
"source": "\n float[] v = doc['my_dense_vector'].vectorValue;\n float vm = doc['my_dense_vector'].magnitude;\n float dotProduct = 0;\n for (int i = 0; i < v.length; i++) {\n dotProduct += v[i] * params.queryVector[i];\n }\n return dotProduct / (vm * (float) params.queryVectorMag);\n ",
"params": {
"queryVector": [
4,
3.4,
-0.2
],
"queryVectorMag": 5.25357
}
}
}
},
)
print(resp)
----
python-elasticsearch-9.4.0/docs/examples/fff86117c47f974074284644e8a97a99.asciidoc 0000664 0000000 0000000 00000000625 15176617013 0026265 0 ustar 00root root 0000000 0000000 // 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)
----
python-elasticsearch-9.4.0/docs/guide/ 0000775 0000000 0000000 00000000000 15176617013 0017711 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/docs/guide/index-custom-title-page.html 0000664 0000000 0000000 00000015111 15176617013 0025246 0 ustar 00root root 0000000 0000000
Documentation
The official Python client provides one-to-one mapping with Elasticsearch REST APIs.
Get started
Get to know the Python client
ℹ️ The
elasticsearch-labs repo contains many interactive Python notebooks for testing out Elasticsearch using the Python client. These examples are mainly focused on vector search, hybrid search and generative AI use cases.
Explore by use case
View all Elastic docs
python-elasticsearch-9.4.0/docs/images/ 0000775 0000000 0000000 00000000000 15176617013 0020061 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/docs/images/logo-elastic-glyph-color.svg 0000664 0000000 0000000 00000006362 15176617013 0025430 0 ustar 00root root 0000000 0000000
python-elasticsearch-9.4.0/docs/reference/ 0000775 0000000 0000000 00000000000 15176617013 0020552 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/docs/reference/async.md 0000664 0000000 0000000 00000012212 15176617013 0022207 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/async.html
---
# Using with asyncio [async]
The `elasticsearch` package supports async/await with [asyncio](https://docs.python.org/3/library/asyncio.html) and [aiohttp](https://docs.aiohttp.org). You can either install `aiohttp` directly or use the `[async]` extra:
```bash
$ python -m pip install elasticsearch aiohttp
# - OR -
$ python -m pip install elasticsearch[async]
```
## Getting Started with Async [_getting_started_with_async]
After installation all async API endpoints are available via `~elasticsearch.AsyncElasticsearch` and are used in the same way as other APIs, with an extra `await`:
```python
import asyncio
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch()
async def main():
resp = await client.search(
index="documents",
body={"query": {"match_all": {}}},
size=20,
)
print(resp)
asyncio.run(main())
```
All APIs that are available under the sync client are also available under the async client.
[Reference documentation](https://elasticsearch-py.readthedocs.io/en/latest/async.html#api-reference)
## ASGI Applications and Elastic APM [_asgi_applications_and_elastic_apm]
[ASGI](https://asgi.readthedocs.io) (Asynchronous Server Gateway Interface) is a way to serve Python web applications making use of async I/O to achieve better performance. Some examples of ASGI frameworks include FastAPI, Django 3.0+, and Starlette. If you’re using one of these frameworks along with Elasticsearch then you should be using `~elasticsearch.AsyncElasticsearch` to avoid blocking the event loop with synchronous network calls for optimal performance.
[Elastic APM](apm-agent-python://reference/index.md) also supports tracing of async Elasticsearch queries like synchronous queries. For an example on how to configure `AsyncElasticsearch` with a popular ASGI framework [FastAPI](https://fastapi.tiangolo.com/) and APM tracing there is a [pre-built example](https://github.com/elastic/elasticsearch-py/tree/master/examples/fastapi-apm) in the `examples/fastapi-apm` directory.
See also the [Using OpenTelemetry](/reference/opentelemetry.md) page.
## Trio support
If you prefer using Trio instead of asyncio to take advantage of its better structured concurrency support, you can use the HTTPX async node which supports Trio out of the box.
```python
import trio
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch(
"https://...",
api_key="...",
node_class="httpxasync")
async def main():
resp = await client.info()
print(resp.body)
trio.run(main)
```
The one limitation of Trio support is that it does not currently support node sniffing, which was not implemented with structured concurrency in mind.
## Frequently Asked Questions [_frequently_asked_questions]
### ValueError when initializing `AsyncElasticsearch`? [_valueerror_when_initializing_asyncelasticsearch]
If when trying to use `AsyncElasticsearch` you receive `ValueError: You must have 'aiohttp' installed to use AiohttpHttpNode` you should ensure that you have `aiohttp` installed in your environment (check with `$ python -m pip freeze | grep aiohttp`). Otherwise, async support won’t be available.
### What about the `elasticsearch-async` package? [_what_about_the_elasticsearch_async_package]
Previously asyncio was supported separately with the [elasticsearch-async](https://github.com/elastic/elasticsearch-py-async) package. The `elasticsearch-async` package has been deprecated in favor of `AsyncElasticsearch` provided by the `elasticsearch` package in v7.8 and onwards.
### Receiving *Unclosed client session / connector* warning? [_receiving_unclosed_client_session_connector_warning]
This warning is created by `aiohttp` when an open HTTP connection is garbage collected. You’ll typically run into this when closing your application. To resolve the issue ensure that `~elasticsearch.AsyncElasticsearch.close` is called before the `~elasticsearch.AsyncElasticsearch` instance is garbage collected.
For example if using FastAPI that might look like this:
```python
import os
from contextlib import asynccontextmanager
from fastapi import FastAPI
from elasticsearch import AsyncElasticsearch
ELASTICSEARCH_URL = os.environ["ELASTICSEARCH_URL"]
client = None
@asynccontextmanager
async def lifespan(app: FastAPI):
global client
client = AsyncElasticsearch(ELASTICSEARCH_URL)
yield
await client.close()
app = FastAPI(lifespan=lifespan)
@app.get("/")
async def main():
return await client.info()
```
You can run this example by saving it to `main.py` and executing `ELASTICSEARCH_URL=http://localhost:9200 uvicorn main:app`.
## Async Helpers [_async_helpers]
Async variants of all helpers are available in `elasticsearch.helpers` and are all prefixed with `async_*`. You’ll notice that these APIs are identical to the ones in the sync [*Client helpers*](/reference/client-helpers.md) documentation.
All async helpers that accept an iterator or generator also accept async iterators and async generators.
[Reference documentation](https://elasticsearch-py.readthedocs.io/en/latest/async.html#api-reference)
python-elasticsearch-9.4.0/docs/reference/client-helpers.md 0000664 0000000 0000000 00000005361 15176617013 0024017 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/client-helpers.html
---
# Client helpers [client-helpers]
You can find here a collection of simple helper functions that abstract some specifics of the raw API.
## Bulk helpers [bulk-helpers]
There are several helpers for the bulk API since its requirement for specific formatting and other considerations can make it cumbersome if used directly.
All bulk helpers accept an instance of `Elasticsearch` class and an iterable `action` (any iterable, can also be a generator, which is ideal in most cases since it allows you to index large datasets without the need of loading them into memory). For asynchronous Python, use the bulk helpers with the `async_` prefix and pass an `AsyncElasticsearch` instance as first argument.
The items in the iterable `action` should be the documents we wish to index in several formats. The most common one is the same as returned by `search()`, for example:
```yaml
{
'_index': 'index-name',
'_id': 42,
'_routing': 5,
'pipeline': 'my-ingest-pipeline',
'_source': {
"title": "Hello World!",
"body": "..."
}
}
```
Alternatively, if `_source` is not present, it pops all metadata fields from the doc and use the rest as the document data:
```yaml
{
"_id": 42,
"_routing": 5,
"title": "Hello World!",
"body": "..."
}
```
The `bulk()` api accepts `index`, `create`, `delete`, and `update` actions. Use the `_op_type` field to specify an action (`_op_type` defaults to `index`):
```yaml
{
'_op_type': 'delete',
'_index': 'index-name',
'_id': 42,
}
{
'_op_type': 'update',
'_index': 'index-name',
'_id': 42,
'doc': {'question': 'The life, universe and everything.'}
}
```
## Scan [scan]
Simple abstraction on top of the `scroll()` API - a simple iterator that yields all hits as returned by underlining scroll requests.
By default scan does not return results in any pre-determined order. To have a standard order in the returned documents (either by score or explicit sort definition) when scrolling, use `preserve_order=True`. This may be an expensive operation and will negate the performance benefits of using `scan`.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
from elasticsearch.helpers import scan
es = Elasticsearch(hosts=['https://localhost:9200'])
scan(
es,
query={"query": {"match": {"title": "python"}}},
index="orders-*"
)
```
:::
:::{tab-item} Async Python
:sync: async
```py
from elasticsearch.helpers import async_scan
es = AsyncElasticsearch(hosts=['https://localhost:9200'])
async def main():
await async_scan(
es,
query={"query": {"match": {"title": "python"}}},
index="orders-*"
asyncio.run(main())
```
:::
::::
python-elasticsearch-9.4.0/docs/reference/configuration.md 0000664 0000000 0000000 00000052450 15176617013 0023751 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/config.html
navigation_title: Configuration
---
# Python client configuration for {{es}} [config]
This page contains information about the most important configuration options of the Python {{es}} client.
## TLS/SSL [tls-and-ssl]
The options in this section can only be used when the node is configured for HTTPS. An error will be raised if using these options with an HTTP node.
### Verifying server certificates [_verifying_server_certificates]
The typical route to verify a cluster certificate is via a "CA bundle" which can be specified via the `ca_certs` parameter. If no options are given and the [certifi package](https://github.com/certifi/python-certifi) is installed then certifi’s CA bundle is used by default.
If you have your own CA bundle to use you can configure via the `ca_certs` parameter:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
"https://...",
ca_certs="/path/to/certs.pem"
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
"https://...",
ca_certs="/path/to/certs.pem"
)
```
:::
::::
If using a generated certificate or certificate with a known fingerprint you can use the `ssl_assert_fingerprint` to specify the fingerprint which tries to match the server’s leaf certificate during the TLS handshake. If there is any matching certificate the connection is verified, otherwise a `TlsError` is raised.
In Python 3.9 and earlier only the leaf certificate will be verified but in Python 3.10+ private APIs are used to verify any certificate in the certificate chain. This helps when using certificates that are generated on a multi-node cluster.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
"https://...",
ssl_assert_fingerprint=(
"315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3"
)
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
"https://...",
ssl_assert_fingerprint=(
"315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3"
)
)
```
:::
::::
To disable certificate verification use the `verify_certs=False` parameter. This option should be avoided in production, instead use the other options to verify the clusters' certificate.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
"https://...",
verify_certs=False
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
"https://...",
verify_certs=False
)
```
:::
::::
### TLS versions [_tls_versions]
Configuring the minimum TLS version to connect to is done via the `ssl_version` parameter. By default this is set to a minimum value of TLSv1.2. Use the `ssl.TLSVersion` enumeration to specify versions.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import ssl
client = Elasticsearch(
...,
ssl_version=ssl.TLSVersion.TLSv1_2
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
import ssl
client = AsyncElasticsearch(
...,
ssl_version=ssl.TLSVersion.TLSv1_2
)
```
:::
::::
### Client TLS certificate authentication [_client_tls_certificate_authentication]
Elasticsearch can be configured to authenticate clients via TLS client certificates. Client certificate and keys can be configured via the `client_cert` and `client_key` parameters:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
...,
client_cert="/path/to/cert.pem",
client_key="/path/to/key.pem",
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
...,
client_cert="/path/to/cert.pem",
client_key="/path/to/key.pem",
)
```
:::
::::
### Using an SSLContext [_using_an_sslcontext]
For advanced users an `ssl.SSLContext` object can be used for configuring TLS via the `ssl_context` parameter. The `ssl_context` parameter can’t be combined with any other TLS options except for the `ssl_assert_fingerprint` parameter.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import ssl
# Create and configure an SSLContext
ctx = ssl.create_default_context()
ctx.load_verify_locations(...)
client = Elasticsearch(
...,
ssl_context=ctx
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
import ssl
# Create and configure an SSLContext
ctx = ssl.create_default_context()
ctx.load_verify_locations(...)
client = AsyncElasticsearch(
...,
ssl_context=ctx
)
```
:::
::::
## HTTP compression [compression]
Compression of HTTP request and response bodies can be enabled with the `http_compress` parameter. If enabled then HTTP request bodies will be compressed with `gzip` and HTTP responses will include the `Accept-Encoding: gzip` HTTP header. By default compression is disabled.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
...,
http_compress=True # Enable compression!
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
...,
http_compress=True # Enable compression!
)
```
:::
::::
HTTP compression is recommended to be enabled when requests are traversing the network. Compression is automatically enabled when connecting to Elastic Cloud.
## Request timeouts [timeouts]
Requests can be configured to timeout if taking too long to be serviced. The `request_timeout` parameter can be passed via the client constructor or the client `.options()` method. When the request times out the node will raise a `ConnectionTimeout` exception which can trigger retries.
Setting `request_timeout` to `None` will disable timeouts.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
...,
request_timeout=10 # 10 second timeout
)
# Search request will timeout in 5 seconds
client.options(request_timeout=5).search(...)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
...,
request_timeout=10 # 10 second timeout
)
async def example():
# Search request will timeout in 5 seconds
await client.options(request_timeout=5).search(...)
```
:::
::::
### API and server timeouts [_api_and_server_timeouts]
There are API-level timeouts to take into consideration when making requests which can cause the request to timeout on server-side rather than client-side. You may need to configure both a transport and API level timeout for long running operations.
In the example below there are three different configurable timeouts for the `cluster.health` API all with different meanings for the request:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client.options(
# Amount of time to wait for an HTTP response to start.
request_timeout=30
).cluster.health(
# Amount of time to wait to collect info on all nodes.
timeout=30,
# Amount of time to wait for info from the master node.
master_timeout=10,
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
await client.options(
# Amount of time to wait for an HTTP response to start.
request_timeout=30
).cluster.health(
# Amount of time to wait to collect info on all nodes.
timeout=30,
# Amount of time to wait for info from the master node.
master_timeout=10,
)
```
:::
::::
## Retries [retries]
Requests can be retried if they don’t return with a successful response. This provides a way for requests to be resilient against transient failures or overloaded nodes.
The maximum number of retries per request can be configured via the `max_retries` parameter. Setting this parameter to 0 disables retries. This parameter can be set in the client constructor or per-request via the client `.options()` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
...,
max_retries=5
)
# For this API request we disable retries with 'max_retries=0'
client.options(max_retries=0).index(
index="blogs",
document={
"title": "..."
}
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
...,
max_retries=5
)
async def example():
# For this API request we disable retries with 'max_retries=0'
await client.options(max_retries=0).index(
index="blogs",
document={
"title": "..."
}
)
```
:::
::::
### Retrying on connection errors and timeouts [_retrying_on_connection_errors_and_timeouts]
Connection errors are automatically retried if retries are enabled. Retrying requests on connection timeouts can be enabled or disabled via the `retry_on_timeout` parameter. This parameter can be set on the client constructor or via the client `.options()` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
...,
retry_on_timeout=True
)
client.options(retry_on_timeout=False).info()
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
...,
retry_on_timeout=True
)
async def example():
await client.options(retry_on_timeout=False).info()
```
:::
::::
### Retrying status codes [_retrying_status_codes]
By default if retries are enabled `retry_on_status` is set to `(429, 502, 503, 504)`. This parameter can be set on the client constructor or via the client `.options()` method. Setting this value to `()` will disable the default behavior.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
...,
retry_on_status=()
)
# Retry this API on '500 Internal Error' statuses
client.options(retry_on_status=[500]).index(
index="blogs",
document={
"title": "..."
}
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
...,
retry_on_status=()
)
async def example():
# Retry this API on '500 Internal Error' statuses
await client.options(retry_on_status=[500]).index(
index="blogs",
document={
"title": "..."
}
)
```
:::
::::
### Ignoring status codes [_ignoring_status_codes]
By default an `ApiError` exception will be raised for any non-2XX HTTP requests that exhaust retries, if any. If you’re expecting an HTTP error from the API but aren’t interested in raising an exception you can use the `ignore_status` parameter via the client `.options()` method.
A good example where this is useful is setting up or cleaning up resources in a cluster in a robust way:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(...)
# API request is robust against the index not existing:
resp = client.options(ignore_status=404).indices.delete(index="delete-this")
resp.meta.status # Can be either '2XX' or '404'
# API request is robust against the index already existing:
resp = client.options(ignore_status=[400]).indices.create(
index="create-this",
mapping={
"properties": {"field": {"type": "integer"}}
}
)
resp.meta.status # Can be either '2XX' or '400'
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(...)
async def example():
# API request is robust against the index not existing:
resp = await client.options(ignore_status=404).indices.delete(index="delete-this")
resp.meta.status # Can be either '2XX' or '404'
# API request is robust against the index already existing:
resp = await client.options(ignore_status=[400]).indices.create(
index="create-this",
mapping={
"properties": {"field": {"type": "integer"}}
}
)
resp.meta.status # Can be either '2XX' or '400'
```
:::
::::
When using the `ignore_status` parameter the error response will be returned serialized like a non-error response. In these cases it can be useful to inspect the HTTP status of the response. To do this you can inspect the `resp.meta.status`.
## Sniffing for new nodes [sniffing]
Additional nodes can be discovered by a process called "sniffing" where the client will query the cluster for more nodes that can handle requests.
Sniffing can happen at three different times: on client instantiation, before requests, and on a node failure. These three behaviors can be enabled and disabled with the `sniff_on_start`, `sniff_before_requests`, and `sniff_on_node_failure` parameters.
::::{important}
When using an HTTP load balancer or proxy you cannot use sniffing functionality as the cluster would supply the client with IP addresses to directly connect to the cluster, circumventing the load balancer. Depending on your configuration this might be something you don’t want or break completely.
::::
### Waiting between sniffing attempts [_waiting_between_sniffing_attempts]
To avoid needlessly sniffing too often there is a delay between attempts to discover new nodes. This value can be controlled via the `min_delay_between_sniffing` parameter.
### Filtering nodes which are sniffed [_filtering_nodes_which_are_sniffed]
By default nodes which are marked with only a `master` role will not be used. To change the behavior the parameter `sniffed_node_callback` can be used. To mark a sniffed node not to be added to the node pool return `None` from the `sniffed_node_callback`, otherwise return a `NodeConfig` instance.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from typing import Optional, Dict, Any
from elastic_transport import NodeConfig
from elasticsearch import Elasticsearch
def filter_master_eligible_nodes(
node_info: Dict[str, Any],
node_config: NodeConfig
) -> Optional[NodeConfig]:
# This callback ignores all nodes that are master eligible
# instead of master-only nodes (default behavior)
if "master" in node_info.get("roles", ()):
return None
return node_config
client = Elasticsearch(
"https://localhost:9200",
sniffed_node_callback=filter_master_eligible_nodes
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from typing import Optional, Dict, Any
from elastic_transport import NodeConfig
from elasticsearch import AsyncElasticsearch
def filter_master_eligible_nodes(
node_info: Dict[str, Any],
node_config: NodeConfig
) -> Optional[NodeConfig]:
# This callback ignores all nodes that are master eligible
# instead of master-only nodes (default behavior)
if "master" in node_info.get("roles", ()):
return None
return node_config
client = AsyncElasticsearch(
"https://localhost:9200",
sniffed_node_callback=filter_master_eligible_nodes
)
```
:::
::::
The `node_info` parameter is part of the response from the `nodes.info()` API, below is an example of what that object looks like:
```json
{
"name": "SRZpKFZ",
"transport_address": "127.0.0.1:9300",
"host": "127.0.0.1",
"ip": "127.0.0.1",
"version": "5.0.0",
"build_hash": "253032b",
"roles": ["master", "data", "ingest"],
"http": {
"bound_address": ["[fe80::1]:9200", "[::1]:9200", "127.0.0.1:9200"],
"publish_address": "1.1.1.1:123",
"max_content_length_in_bytes": 104857600
}
}
```
## Node Pool [node-pool]
### Selecting a node from the pool [_selecting_a_node_from_the_pool]
You can specify a node selector pattern via the `node_selector_class` parameter. The supported values are `round_robin` and `random`. Default is `round_robin`.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
...,
node_selector_class="round_robin"
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
...,
node_selector_class="round_robin"
)
```
:::
::::
Custom selectors are also supported:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elastic_transport import NodeSelector
class CustomSelector(NodeSelector):
def select(nodes): ...
client = Elasticsearch(
...,
node_selector_class=CustomSelector
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elastic_transport import NodeSelector
class CustomSelector(NodeSelector):
def select(nodes): ...
client = AsyncElasticsearch(
...,
node_selector_class=CustomSelector
)
```
:::
::::
### Marking nodes dead and alive [_marking_nodes_dead_and_alive]
Individual nodes of Elasticsearch can have transient connectivity or load issues which may make them unable to service requests. To combat this the pool of nodes will detect when a node isn’t able to service requests due to transport or API errors.
After a node has been timed out it will be moved back to the set of "alive" nodes but only after the node returns a successful response will the node be marked as "alive" in terms of consecutive errors.
The `dead_node_backoff_factor` and `max_dead_node_backoff` parameters can be used to configure how long the node pool will put the node into timeout with each consecutive failure. Both parameters use a unit of seconds.
The calculation is equal to `min(dead_node_backoff_factor * (2 ** (consecutive_failures - 1)), max_dead_node_backoff)`.
## Serializers [serializer]
Serializers transform bytes on the wire into native Python objects and vice-versa. By default the client ships with serializers for `application/json`, `application/x-ndjson`, `text/*`, `application/vnd.apache.arrow.stream` and `application/mapbox-vector-tile`.
You can define custom serializers via the `serializers` parameter:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch, JsonSerializer
class JsonSetSerializer(JsonSerializer):
"""Custom JSON serializer that handles Python sets"""
def default(self, data: Any) -> Any:
if isinstance(data, set):
return list(data)
return super().default(data)
client = Elasticsearch(
...,
# Serializers are a mapping of 'mimetype' to Serializer class.
serializers={"application/json": JsonSetSerializer()}
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch, JsonSerializer
class JsonSetSerializer(JsonSerializer):
"""Custom JSON serializer that handles Python sets"""
def default(self, data: Any) -> Any:
if isinstance(data, set):
return list(data)
return super().default(data)
client = AsyncElasticsearch(
...,
# Serializers are a mapping of 'mimetype' to Serializer class.
serializers={"application/json": JsonSetSerializer()}
)
```
:::
::::
If the `orjson` package is installed, you can use the faster ``OrjsonSerializer`` for the default mimetype (``application/json``):
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch, OrjsonSerializer
es = Elasticsearch(
...,
serializer=OrjsonSerializer()
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch, OrjsonSerializer
es = AsyncElasticsearch(
...,
serializer=OrjsonSerializer()
)
```
:::
::::
orjson is particularly fast when serializing vectors as it has native numpy support. This will be the default in a future release. You can install orjson with the `orjson` extra:
```sh
$ python -m pip install elasticsearch[orjson]
```
## Nodes [nodes]
### Node implementations [_node_implementations]
The default node class for synchronous I/O is `urllib3` and the default node class for asynchronous I/O is `aiohttp`.
For all of the built-in HTTP node implementations like `urllib3`, `requests`, and `aiohttp` you can specify with a simple string to the `node_class` parameter:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
client = Elasticsearch(
...,
node_class="requests"
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch(
...,
node_class="httpxasync"
)
```
:::
::::
You can also specify a custom node implementation via the `node_class` parameter:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
from elastic_transport import Urllib3HttpNode
class CustomHttpNode(Urllib3HttpNode):
...
client = Elasticsearch(
...
node_class=CustomHttpNode
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch
from elastic_transport import AophttpHttpNode
class CustomHttpNode(AiohttpHttpNode):
...
client = AsyncElasticsearch(
...
node_class=CustomHttpNode
)
```
:::
::::
### HTTP connections per node [_http_connections_per_node]
Each node contains its own pool of HTTP connections to allow for concurrent requests. This value is configurable via the `connections_per_node` parameter:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
client = Elasticsearch(
...,
connections_per_node=5
)
```
:::
::::{tab-item} Async Python
:sync: async
```python
client = AsyncElasticsearch(
...,
connections_per_node=5
)
```
:::
:::
python-elasticsearch-9.4.0/docs/reference/connecting.md 0000664 0000000 0000000 00000044727 15176617013 0023241 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/connecting.html
---
# Connecting [connecting]
This page contains the information you need to connect the Client with {{es}}.
## Connecting to Elastic Cloud [connect-ec]
[Elastic Cloud](docs-content://deploy-manage/deploy/elastic-cloud/cloud-hosted.md) is the easiest way to get started with {{es}}. When connecting to Elastic Cloud with the Python {{es}} client you should always use the `cloud_id` parameter to connect. You can find this value within the "Manage Deployment" page after you’ve created a cluster (look in the top-left if you’re in Kibana).
We recommend using a Cloud ID whenever possible because your client will be automatically configured for optimal use with Elastic Cloud including HTTPS and HTTP compression.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import os
from elasticsearch import Elasticsearch
# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = os.environ['ELASTIC_PASSWORD']
# Found in the 'Manage Deployment' page
CLOUD_ID = "deployment-name:dXMtZWFzdDQuZ2Nw..."
# Create the client instance
client = Elasticsearch(
cloud_id=CLOUD_ID,
basic_auth=("elastic", ELASTIC_PASSWORD)
)
# Successful response!
client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}
```
:::
:::{tab-item} Async Python
:sync: async
```python
import asyncio
import os
from elasticsearch import AsyncElasticsearch
# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = os.environ['ELASTIC_PASSWORD']
# Found in the 'Manage Deployment' page
CLOUD_ID = "deployment-name:dXMtZWFzdDQuZ2Nw..."
async def main():
# Create the client instance
client = AsyncElasticsearch(
cloud_id=CLOUD_ID,
basic_auth=("elastic", ELASTIC_PASSWORD)
)
# Successful response!
await client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}
asyncio.run(main())
```
:::
::::
## Connecting to a self-managed cluster [connect-self-managed-new]
By default {{es}} will start with security features like authentication and TLS enabled. To connect to the {{es}} cluster you’ll need to configure the Python {{es}} client to use HTTPS with the generated CA certificate in order to make requests successfully.
If you’re getting started with {{es}} we recommend reading the documentation on [configuring](docs-content://deploy-manage/deploy/self-managed/configure-elasticsearch.md) and [starting {{es}}](docs-content://deploy-manage/maintenance/start-stop-services/start-stop-elasticsearch.md) to ensure your cluster is running as expected.
When you start {{es}} for the first time you’ll see a distinct block like the one below in the output from {{es}} (you may have to scroll up if it’s been a while):
```sh
----------------------------------------------------------------
-> Elasticsearch security features have been automatically configured!
-> Authentication is enabled and cluster connections are encrypted.
-> Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
lhQpLELkjkrawaBoaz0Q
-> HTTP CA certificate SHA-256 fingerprint:
a52dd93511e8c6045e21f16654b77c9ee0f34aea26d9f40320b531c474676228
...
----------------------------------------------------------------
```
Note down the `elastic` user password and HTTP CA fingerprint for the next sections. In the examples below they will be stored in the variables `ELASTIC_PASSWORD` and `CERT_FINGERPRINT` respectively.
Depending on the circumstances there are two options for verifying the HTTPS connection, either verifying with the CA certificate itself or via the HTTP CA certificate fingerprint.
### Verifying HTTPS with CA certificates [_verifying_https_with_ca_certificates]
Using the `ca_certs` option is the default way the Python {{es}} client verifies an HTTPS connection.
The generated root CA certificate can be found in the `certs` directory in your {{es}} config location (`$ES_CONF_PATH/certs/http_ca.crt`). If you’re running {{es}} in Docker there is [additional documentation for retrieving the CA certificate](docs-content://deploy-manage/deploy/self-managed/install-elasticsearch-with-docker.md).
Once you have the `http_ca.crt` file somewhere accessible pass the path to the client via `ca_certs`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import os
from elasticsearch import Elasticsearch
# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = os.environ['ELASTIC_PASSWORD']
# Create the client instance
client = Elasticsearch(
"https://localhost:9200",
ca_certs="/path/to/http_ca.crt",
basic_auth=("elastic", ELASTIC_PASSWORD)
)
# Successful response!
client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}
```
:::
:::{tab-item} Async Python
:sync: async
```python
import asyncio
import os
from elasticsearch import AsyncElasticsearch
# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = os.environ['ELASTIC_PASSWORD']
async def main():
# Create the client instance
client = AsyncElasticsearch(
"https://localhost:9200",
ca_certs="/path/to/http_ca.crt",
basic_auth=("elastic", ELASTIC_PASSWORD)
)
# Successful response!
await client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}
asyncio.run(main())
```
:::
::::
::::{note}
If you don’t specify `ca_certs` or `ssl_assert_fingerprint` then the [certifi package](https://certifiio.readthedocs.io) will be used for `ca_certs` by default if available.
::::
### Verifying HTTPS with certificate fingerprints (Python 3.10 or later) [_verifying_https_with_certificate_fingerprints_python_3_10_or_later]
::::{note}
Using this method **requires using Python 3.10 or later** and isn’t available when using the `aiohttp` HTTP client library so can’t be used with `AsyncElasticsearch`.
::::
This method of verifying the HTTPS connection takes advantage of the certificate fingerprint value noted down earlier. Take this SHA256 fingerprint value and pass it to the Python {{es}} client via `ssl_assert_fingerprint`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import os
from elasticsearch import Elasticsearch
# Fingerprint either from Elasticsearch startup or above script.
# Colons and uppercase/lowercase don't matter when using
# the 'ssl_assert_fingerprint' parameter
CERT_FINGERPRINT = "A5:2D:D9:35:11:E8:C6:04:5E:21:F1:66:54:B7:7C:9E:E0:F3:4A:EA:26:D9:F4:03:20:B5:31:C4:74:67:62:28"
# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = os.environ['ELASTIC_PASSWORD']
client = Elasticsearch(
"https://localhost:9200",
ssl_assert_fingerprint=CERT_FINGERPRINT,
basic_auth=("elastic", ELASTIC_PASSWORD)
)
# Successful response!
client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}
```
:::
:::{tab-item} Async Python
:sync: async
```python
import asyncio
import os
from elasticsearch import AsyncElasticsearch
# Fingerprint either from Elasticsearch startup or above script.
# Colons and uppercase/lowercase don't matter when using
# the 'ssl_assert_fingerprint' parameter
CERT_FINGERPRINT = "A5:2D:D9:35:11:E8:C6:04:5E:21:F1:66:54:B7:7C:9E:E0:F3:4A:EA:26:D9:F4:03:20:B5:31:C4:74:67:62:28"
# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = os.environ['ELASTIC_PASSWORD']
async def main():
client = AsyncElasticsearch(
"https://localhost:9200",
ssl_assert_fingerprint=CERT_FINGERPRINT,
basic_auth=("elastic", ELASTIC_PASSWORD)
)
# Successful response!
await client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}
asyncio.run(main())
```
:::
::::
The certificate fingerprint can be calculated using `openssl x509` with the certificate file:
```sh
openssl x509 -fingerprint -sha256 -noout -in /path/to/http_ca.crt
```
If you don’t have access to the generated CA file from {{es}} you can use the following script to output the root CA fingerprint of the {{es}} instance with `openssl s_client`:
```sh
# Replace the values of 'localhost' and '9200' to the
# corresponding host and port values for the cluster.
openssl s_client -connect localhost:9200 -servername localhost -showcerts /dev/null \
| openssl x509 -fingerprint -sha256 -noout -in /dev/stdin
```
The output of `openssl x509` will look something like this:
```sh
SHA256 Fingerprint=A5:2D:D9:35:11:E8:C6:04:5E:21:F1:66:54:B7:7C:9E:E0:F3:4A:EA:26:D9:F4:03:20:B5:31:C4:74:67:62:28
```
## Connecting without security enabled [connect-no-security]
::::{warning}
Running {{es}} without security enabled is not recommended.
::::
If your cluster is configured with [security explicitly disabled](elasticsearch://reference/elasticsearch/configuration-reference/security-settings.md) then you can connect via HTTP:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
# Create the client instance
client = Elasticsearch("http://localhost:9200")
# Successful response!
client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}
```
:::
:::{tab-item} Async Python
:sync: async
```python
import asyncio
from elasticsearch import AsyncElasticsearch
async def main():
# Create the client instance
client = AsyncElasticsearch("http://localhost:9200")
# Successful response!
await client.info()
# {'name': 'instance-0000000000', 'cluster_name': ...}
asyncio.run(main())
```
:::
::::
## Connecting to multiple nodes [connect-url]
The Python {{es}} client supports sending API requests to multiple nodes in the cluster. This means that work will be more evenly spread across the cluster instead of hammering the same node over and over with requests. To configure the client with multiple nodes you can pass a list of URLs, each URL will be used as a separate node in the pool.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import os
from elasticsearch import Elasticsearch
# List of nodes to connect use with different hosts and ports.
NODES = [
"https://localhost:9200",
"https://localhost:9201",
"https://localhost:9202",
]
# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = os.environ['ELASTIC_PASSWORD']
client = Elasticsearch(
NODES,
ca_certs="/path/to/http_ca.crt",
basic_auth=("elastic", ELASTIC_PASSWORD)
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
import os
from elasticsearch import AsyncElasticsearch
# List of nodes to connect use with different hosts and ports.
NODES = [
"https://localhost:9200",
"https://localhost:9201",
"https://localhost:9202",
]
# Password for the 'elastic' user generated by Elasticsearch
ELASTIC_PASSWORD = os.environ['ELASTIC_PASSWORD']
client = AsyncElasticsearch(
NODES,
ca_certs="/path/to/http_ca.crt",
basic_auth=("elastic", ELASTIC_PASSWORD)
)
```
:::
::::
By default nodes are selected using round-robin, but alternate node selection strategies can be configured with `node_selector_class` parameter.
::::{note}
If your {{es}} cluster is behind a load balancer like when using Elastic Cloud you won’t need to configure multiple nodes. Instead use the load balancer host and port.
::::
## Authentication [authentication]
This section contains code snippets to show you how to connect to various {{es}} providers. All authentication methods are supported on the client constructor or via the per-request `.options()` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import os
from elasticsearch import Elasticsearch
# Authenticate from the constructor
client = Elasticsearch(
"https://localhost:9200",
ca_certs="/path/to/http_ca.crt",
basic_auth=("username", os.environ["ELASTIC_PASSWORD"])
)
# Authenticate via the .options() method:
client.options(
basic_auth=("username", os.environ["ELASTIC_PASSWORD"])
).indices.get(index="*")
# You can persist the authenticated client to use
# later or use for multiple API calls:
auth_client = client.options(api_key=os.environ["ELASTIC_API_KEY"])
for i in range(10):
auth_client.index(
index="example-index",
document={"field": i}
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
import asyncio
import os
from elasticsearch import AsyncElasticsearch
async def main():
# Authenticate from the constructor
client = AsyncElasticsearch(
"https://localhost:9200",
ca_certs="/path/to/http_ca.crt",
basic_auth=("username", os.environ["ELASTIC_PASSWORD"])
)
# Authenticate via the .options() method:
await client.options(
basic_auth=("username", os.environ["ELASTIC_PASSWORD"])
).indices.get(index="*")
# You can persist the authenticated client to use
# later or use for multiple API calls:
auth_client = client.options(api_key=os.environ["ELASTIC_API_KEY"])
for i in range(10):
await auth_client.index(
index="example-index",
document={"field": i}
)
asyncio.run(main())
```
:::
::::
### HTTP Basic authentication (Username and Password) [auth-basic]
HTTP Basic authentication uses the `basic_auth` parameter by passing in a username and password within a tuple:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import os
from elasticsearch import Elasticsearch
# Adds the HTTP header 'Authorization: Basic '
client = Elasticsearch(
"https://localhost:9200",
ca_certs="/path/to/http_ca.crt",
basic_auth=("username", os.environ["ELASTIC_PASSWORD"])
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
import os
from elasticsearch import AsyncElasticsearch
# Adds the HTTP header 'Authorization: Basic '
client = AsyncElasticsearch(
"https://localhost:9200",
ca_certs="/path/to/http_ca.crt",
basic_auth=("username", os.environ["ELASTIC_PASSWORD"])
)
```
:::
::::
### HTTP Bearer authentication [auth-bearer]
HTTP Bearer authentication uses the `bearer_auth` parameter by passing the token as a string. This authentication method is used by [Service Account Tokens](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-create-service-token) and [Bearer Tokens](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-get-token).
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
import os
from elasticsearch import Elasticsearch
# Adds the HTTP header 'Authorization: Bearer token-value'
client = Elasticsearch(
"https://localhost:9200",
bearer_auth=os.environ["ELASTIC_TOKEN"]
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
import os
from elasticsearch import AsyncElasticsearch
# Adds the HTTP header 'Authorization: Bearer token-value'
client = AsyncElasticsearch(
"https://localhost:9200",
bearer_auth=os.environ["ELASTIC_TOKEN"]
)
```
:::
::::
### API Key authentication [auth-apikey]
You can configure the client to use {{es}}'s API Key for connecting to your cluster. These can be generated through the [Elasticsearch Create API key API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-create-api-key) or [Kibana Stack Management](docs-content://deploy-manage/api-keys/elasticsearch-api-keys.md#create-api-key).
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
# Adds the HTTP header 'Authorization: ApiKey '
client = Elasticsearch(
"https://localhost:9200",
ca_certs="/path/to/http_ca.crt",
api_key=os.environ["ELASTIC_API_KEY"],
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch
# Adds the HTTP header 'Authorization: ApiKey '
client = AsyncElasticsearch(
"https://localhost:9200",
ca_certs="/path/to/http_ca.crt",
api_key=os.environ["ELASTIC_API_KEY"],
)
```
:::
::::
## Using the Client in a Function-as-a-Service Environment [connecting-faas]
This section illustrates the best practices for leveraging the {{es}} client in a Function-as-a-Service (FaaS) environment.
The most influential optimization is to initialize the client outside of the function, the global scope.
This practice does not only improve performance but also enables background functionality as – for example – [sniffing](https://www.elastic.co/blog/elasticsearch-sniffing-best-practices-what-when-why-how). The following examples provide a skeleton for the best practices.
::::{important}
The async client shouldn’t be used within Function-as-a-Service as a new event loop must be started for each invocation. Instead the synchronous `Elasticsearch` client is recommended.
::::
### GCP Cloud Functions [connecting-faas-gcp]
```python
import os
from elasticsearch import Elasticsearch
# Client initialization
client = Elasticsearch(
cloud_id="deployment-name:ABCD...",
api_key=os.environ["ELASTIC_API_KEY"]
)
def main(request):
# Use the client
client.search(index=..., query={"match_all": {}})
```
### AWS Lambda [connecting-faas-aws]
```python
import os
from elasticsearch import Elasticsearch
# Client initialization
client = Elasticsearch(
cloud_id="deployment-name:ABCD...",
api_key=os.environ["ELASTIC_API_KEY"]
)
def main(event, context):
# Use the client
client.search(index=..., query={"match_all": {}})
```
### Azure Functions [connecting-faas-azure]
```python
import azure.functions as func
import os
from elasticsearch import Elasticsearch
# Client initialization
client = Elasticsearch(
cloud_id="deployment-name:ABCD...",
api_key=os.environ["ELASTIC_API_KEY"]
)
def main(request: func.HttpRequest) -> func.HttpResponse:
# Use the client
client.search(index=..., query={"match_all": {}})
```
Resources used to assess these recommendations:
* [GCP Cloud Functions: Tips & Tricks](https://cloud.google.com/functions/docs/bestpractices/tips#use_global_variables_to_reuse_objects_in_future_invocations)
* [Best practices for working with AWS Lambda functions](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html)
* [Azure Functions Python developer guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=azurecli-linux%2Capplication-level#global-variables)
* [AWS Lambda: Comparing the effect of global scope](https://docs.aws.amazon.com/lambda/latest/operatorguide/global-scope.html)
python-elasticsearch-9.4.0/docs/reference/dsl_configuration.md 0000664 0000000 0000000 00000013664 15176617013 0024617 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/_configuration.html
navigation_title: Configuration
---
# Python DSL configuration for {{es}} [_configuration]
There are several ways to configure connections for the library. The easiest and most useful approach is to define one default connection that can be used every time an API call is made without explicitly passing in other connections.
::::{note}
Unless you want to access multiple clusters from your application, it is highly recommended that you use the `create_connection` method and all operations will use that connection automatically.
::::
## Default connection [_default_connection]
To define a default connection that can be used globally, use the `connections` module and the `create_connection` method like this:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import connections
connections.create_connection(hosts=['https://localhost:9200'], request_timeout=20)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import async_connections
async_connections.create_connection(hosts=['https://localhost:9200'], request_timeout=20)
```
:::
::::
### Single connection with an alias [_single_connection_with_an_alias]
You can define the `alias` or name of a connection so you can efficiently refer to it later. The default value for `alias` is `default`.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import connections
connections.create_connection(alias='my_new_connection', hosts=['https://localhost:9200'], request_timeout=60)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import async_connections
async_connections.create_connection(alias='my_new_connection', hosts=['https://localhost:9200'], request_timeout=60)
```
:::
::::
Additional keyword arguments (`hosts` and `timeout` in our example) will be passed to the `Elasticsearch` class from `elasticsearch-py`.
To see all possible configuration options refer to the [documentation](https://elasticsearch-py.readthedocs.io/en/latest/api/elasticsearch.html).
## Multiple clusters [_multiple_clusters]
You can define multiple connections to multiple clusters at the same time using the `configure` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import connections
connections.configure(
default={'hosts': 'https://localhost:9200'},
dev={
'hosts': ['https://esdev1.example.com:9200'],
'sniff_on_start': True
}
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import async_connections
async_connections.configure(
default={'hosts': 'https://localhost:9200'},
dev={
'hosts': ['https://esdev1.example.com:9200'],
'sniff_on_start': True
}
)
```
:::
::::
Such connections will be constructed lazily when requested for the first time.
You can alternatively define multiple connections by adding them one by one as shown in the following example:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
# if you have configuration options to be passed to Elasticsearch.__init__
# this also shows creating a connection with the alias 'qa'
connections.create_connection('qa', hosts=['esqa1.example.com'], sniff_on_start=True)
# if you already have an Elasticsearch instance ready
connections.add_connection('another_qa', my_client)
```
:::
:::{tab-item} Async Python
:sync: async
```python
# if you have configuration options to be passed to Elasticsearch.__init__
# this also shows creating a connection with the alias 'qa'
async_connections.create_connection('qa', hosts=['esqa1.example.com'], sniff_on_start=True)
# if you already have an Elasticsearch instance ready
async_connections.add_connection('another_qa', my_client)
```
:::
::::
### Using aliases [_using_aliases]
When using multiple connections, you can refer to them using the string alias specified when you created the connection.
This example shows how to use an alias to a connection:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search(using='qa')
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch(using='qa')
```
:::
::::
A `KeyError` will be raised if there is no connection registered with that alias.
## Manual [_manual]
If you don’t want to supply a global configuration, you can always pass in your own connection as an instance of `elasticsearch.Elasticsearch` with the parameter `using` wherever it is accepted like this:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search(using=Elasticsearch('https://localhost:9200'))
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch(using=AsyncElasticsearch('https://localhost:9200'))
```
:::
::::
You can even use this approach to override any connection the object might be already associated with:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = s.using(Elasticsearch('https://otherhost:9200'))
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = s.using(AsyncElasticsearch('https://otherhost:9200'))
```
:::
::::
::::{note}
When using the `dsl` module, it is highly recommended that you use the built-in serializer (`elasticsearch.dsl.serializer.serializer`) to ensure your objects are correctly serialized into `JSON` every time. The `create_connection` method that is described here (and that the `configure` method uses under the hood) will do that automatically for you, unless you explicitly specify your own serializer. The built-in serializer also allows you to serialize your own objects - define a `to_dict()` method on your objects and that method will be automatically called when serializing your custom objects to `JSON`.
::::
python-elasticsearch-9.4.0/docs/reference/dsl_examples.md 0000664 0000000 0000000 00000000527 15176617013 0023560 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/_examples.html
navigation_title: Examples
---
# {{es}} Python DSL examples [_examples]
Refer to the [DSL examples](https://github.com/elastic/elasticsearch-py/tree/master/examples/dsl) directory to see some complex examples using the DSL module.
python-elasticsearch-9.4.0/docs/reference/dsl_how_to_guides.md 0000664 0000000 0000000 00000264644 15176617013 0024615 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/_how_to_guides.html
---
# How-To Guides [_how_to_guides]
## Search DSL [search_dsl]
### The `Search` object [_the_search_object]
The `Search` object represents the entire search request:
* queries
* filters
* aggregations
* k-nearest neighbor searches
* sort
* pagination
* highlighting
* suggestions
* collapsing
* additional parameters
* associated client
The API is designed to be chainable. With the exception of the aggregations functionality this means that the `Search` object is immutable -all changes to the object will result in a shallow copy being created which contains the changes. You can safely pass the `Search` object to foreign code without fear of it modifying your objects as long as it sticks to the `Search` object APIs.
You can pass an instance of the [elasticsearch client](https://elasticsearch-py.readthedocs.io/) when instantiating the `Search` object:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
from elasticsearch.dsl import Search
client = Elasticsearch()
s = Search(using=client)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch
from elasticsearch.dsl import AsyncSearch
client = AsyncElasticsearch()
s = AsyncSearch(using=client)
```
:::
::::
You can also define the client at a later time (for more options see the `configuration` chapter):
```python
s = s.using(client)
```
::::{note}
All methods return a *copy* of the object, making it safe to pass to outside code.
::::
The API is chainable, allowing you to combine multiple method calls in one statement:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search().using(client).query(Match("title", "python"))
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch().using(client).query(Match("title", "python"))
```
:::
::::
To send the request to Elasticsearch:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = s.execute()
```
:::
:::{tab-item} Async Python
:sync: async
```python
response = await s.execute()
```
:::
::::
If you want to iterate over the hits returned by your search you can iterate over the `Search` or `AsyncSearch` objects:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
for hit in s:
print(hit.title)
```
:::
:::{tab-item} Async Python
:sync: async
```python
async for hit in s:
print(hit.title)
```
:::
::::
Search results will be cached. Subsequent calls to `execute` or trying to iterate over an already executed `Search` object will not trigger additional requests being sent to Elasticsearch. To force a new request to be issued specify `ignore_cache=True` when calling `execute`.
For debugging purposes you can serialize the `Search` object to a `dict` with the raw Elasticsearch request:
```python
print(s.to_dict())
```
#### Delete By Query [_delete_by_query]
You can delete the documents matching a search by calling `delete` on the `Search` object instead of `execute` like this:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search(index='i').query(Match("title", "python"))
response = s.delete()
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch(index='i').query(Match("title", "python"))
response = await s.delete()
```
:::
::::
To pass [deletion parameters](https://elasticsearch-py.readthedocs.io/en/latest/api/elasticsearch.html#elasticsearch.Elasticsearch.delete_by_query)
in your query, you can add them by calling ``params`` on the ``Search`` object before ``delete`` like this:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search(index='i').query("match", title="python")
s = s.params(ignore_unavailable=False, wait_for_completion=True)
response = s.delete()
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch(index='i').query("match", title="python")
s = s.params(ignore_unavailable=False, wait_for_completion=True)
response = await s.delete()
```
:::
::::
#### Queries [_queries]
The `elasticsearch.dsl.query` module provides classes for all Elasticsearch query types. These classes accept keyword arguments in their constructors, which are serialized to the appropriate format to be sent to Elasticsearch. There is a clear one-to-one mapping between the raw query and its equivalent class-based version:
```python
>>> from elasticsearch.dsl.query import MultiMatch, Match
>>> q = MultiMatch(query='python django', fields=['title', 'body'])
>>> q.to_dict()
{'multi_match': {'query': 'python django', 'fields': ['title', 'body']}}
>>> q = Match("title", {"query": "web framework", "type": "phrase"})
>>> q.to_dict()
{'match': {'title': {'query': 'web framework', 'type': 'phrase'}}}
```
An alternative to the class-based queries is to use the `Q` shortcut, passing a query name followed by its parameters, or the raw query as a `dict`:
```python
from elasticsearch.dsl import Q
Q("multi_match", query='python django', fields=['title', 'body'])
Q({"multi_match": {"query": "python django", "fields": ["title", "body"]}})
```
To add a query to the `Search` object, use the `.query()` method. This works with class-based or `Q` queries:
```python
q = Q("multi_match", query='python django', fields=['title', 'body'])
s = s.query(q)
```
As a shortcut the `query()` method also accepts all the parameters of the `Q` shortcut directly:
```python
s = s.query("multi_match", query='python django', fields=['title', 'body'])
```
If you already have a query object, or a `dict` representing one, you can assign it to the `query` attribute of a `Search` object to add it to it, replacing any previously configured queries:
```python
s.query = Q('bool', must=[Q('match', title='python'), Q('match', body='best')])
```
#### Dotted fields [_dotted_fields]
Sometimes you want to refer to a field within another field, either as a multi-field (`title.keyword`) or in a structured `json` document like `address.city`. This is not a problem when using class-based queries, but when working without classes it is often required to pass field names as keyword arguments. To make this easier, you can use `__` (double underscore) in place of a dot in a keyword argument:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search()
s = s.filter('term', category__keyword='Python')
s = s.query('match', address__city='prague')
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch()
s = s.filter('term', category__keyword='Python')
s = s.query('match', address__city='prague')
```
:::
::::
Alternatively you can use Python’s keyword argument unpacking:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search()
s = s.filter('term', **{'category.keyword': 'Python'})
s = s.query('match', **{'address.city': 'prague'})
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch()
s = s.filter('term', **{'category.keyword': 'Python'})
s = s.query('match', **{'address.city': 'prague'})
```
:::
::::
#### Query combination [_query_combination]
Query objects can be combined using logical operators `|`, `&` and `~`:
```python
>>> q = Match("title", "python") | Match("title", "django")
>>> q.to_dict()
{'bool': {'should': [{'match': {'title': 'python'}}, {'match': {'title': 'django'}}]}}
>>> q = Match("title", "python") & Match("title", "django")
>>> q.to_dict()
{'bool': {'must': [{'match': {'title': 'python'}}, {'match': {'title': 'django'}}]}}
>>> q = ~Match("title", "python")
>>> q.to_dict()
{'bool': {'must_not': [{'match': {'title': 'python'}}]}}
```
When you call the `.query()` method multiple times, the `&` operator will be used internally to combine all the queries:
```python
s = s.query().query()
print(s.to_dict())
# {"query": {"bool": {...}}}
```
If you want to have precise control over the query form, use the `Q` shortcut to directly construct the combined query:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
q = Q('bool',
must=[Q('match', title='python')],
should=[Q(...), Q(...)],
minimum_should_match=1
)
s = Search().query(q)
```
:::
:::{tab-item} Async Python
:sync: async
```python
q = Q('bool',
must=[Q('match', title='python')],
should=[Q(...), Q(...)],
minimum_should_match=1
)
s = AsyncSearch().query(q)
```
:::
::::
#### Filters [_filters]
If you want to add a query in a [filter context](docs-content://explore-analyze/query-filter/languages/querydsl.md) you can use the `filter()` method to make things easier:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl.query import Terms
s = Search()
s = s.filter(Terms("tags", ['search', 'python']))
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl.query import Terms
s = AsyncSearch()
s = s.filter(Terms("tags", ['search', 'python']))
```
:::
::::
Behind the scenes this will produce a `Bool` query and place the specified `terms` query into its `filter` branch, making it equivalent to:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl.query import Terms, Bool
s = Search()
s = s.query(Bool(filter=[Terms("tags", ["search", "python"])]))
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl.query import Terms, Bool
s = AsyncSearch()
s = s.query(Bool(filter=[Terms("tags", ["search", "python"])]))
```
:::
::::
If you want to use the `post_filter` element for faceted navigation, use the `.post_filter()` method.
The `exclude()` method works like `filter()`, but it applies the query as negated:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search()
s = s.exclude(Terms("tags", ['search', 'python']))
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch()
s = s.exclude(Terms("tags", ['search', 'python']))
```
:::
::::
which is shorthand for:
```python
s = s.query(Bool(filter=[~Terms("tags", ["search", "python"])]))
```
#### Aggregations [_aggregations]
As with queries, there are classes that represent each aggregation type, all accessible through the `elasticsearch.dsl.aggs` module:
```python
from elasticsearch.dsl import aggs
a = aggs.Terms(field="tags")
# {"terms": {"field": "tags"}}
```
It is also possible to define an aggregation using the `A` shortcut:
```python
from elasticsearch.dsl import A
A('terms', field='tags')
```
To nest aggregations, you can use the `.bucket()`, `.metric()` and `.pipeline()` methods:
```python
a = aggs.Terms(field="category")
# {'terms': {'field': 'category'}}
a.metric("clicks_per_category", aggs.Sum(field="clicks")) \
.bucket("tags_per_category", aggs.Terms(field="tags"))
# {
# 'terms': {'field': 'category'},
# 'aggs': {
# 'clicks_per_category': {'sum': {'field': 'clicks'}},
# 'tags_per_category': {'terms': {'field': 'tags'}}
# }
# }
```
To add aggregations to the `Search` object, use the `.aggs` property, which acts as a top-level aggregation:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search()
a = aggs.Terms(field="category")
s.aggs.bucket("category_terms", a)
# {
# 'aggs': {
# 'category_terms': {
# 'terms': {
# 'field': 'category'
# }
# }
# }
# }
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch()
a = aggs.Terms(field="category")
s.aggs.bucket("category_terms", a)
# {
# 'aggs': {
# 'category_terms': {
# 'terms': {
# 'field': 'category'
# }
# }
# }
# }
```
:::
::::
or
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search()
s.aggs.bucket("articles_per_day", aggs.DateHistogram(field="publish_date", interval="day")) \
.metric("clicks_per_day", aggs.Sum(field="clicks")) \
.pipeline("moving_click_average", aggs.MovingAvg(buckets_path="clicks_per_day")) \
.bucket("tags_per_day", aggs.Terms(field="tags"))
s.to_dict()
# {
# "aggs": {
# "articles_per_day": {
# "date_histogram": { "interval": "day", "field": "publish_date" },
# "aggs": {
# "clicks_per_day": { "sum": { "field": "clicks" } },
# "moving_click_average": { "moving_avg": { "buckets_path": "clicks_per_day" } },
# "tags_per_day": { "terms": { "field": "tags" } }
# }
# }
# }
# }
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch()
s.aggs.bucket("articles_per_day", aggs.DateHistogram(field="publish_date", interval="day")) \
.metric("clicks_per_day", aggs.Sum(field="clicks")) \
.pipeline("moving_click_average", aggs.MovingAvg(buckets_path="clicks_per_day")) \
.bucket("tags_per_day", aggs.Terms(field="tags"))
s.to_dict()
# {
# "aggs": {
# "articles_per_day": {
# "date_histogram": { "interval": "day", "field": "publish_date" },
# "aggs": {
# "clicks_per_day": { "sum": { "field": "clicks" } },
# "moving_click_average": { "moving_avg": { "buckets_path": "clicks_per_day" } },
# "tags_per_day": { "terms": { "field": "tags" } }
# }
# }
# }
# }
```
:::
::::
You can access an existing bucket by its name:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search()
s.aggs.bucket("per_category", aggs.Terms(field="category"))
s.aggs["per_category"].metric("clicks_per_category", aggs.Sum(field="clicks"))
s.aggs["per_category"].bucket("tags_per_category", aggs.Terms(field="tags"))
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch()
s.aggs.bucket("per_category", aggs.Terms(field="category"))
s.aggs["per_category"].metric("clicks_per_category", aggs.Sum(field="clicks"))
s.aggs["per_category"].bucket("tags_per_category", aggs.Terms(field="tags"))
```
:::
::::
::::{note}
When chaining multiple aggregations, there is a difference between what `.bucket()` and `.metric()` methods return - `.bucket()` returns the newly defined bucket while `.metric()` returns its parent bucket to allow further chaining.
::::
As opposed to other methods on the `Search` objects, aggregations are defined in-place, without returning a new copy.
#### K-Nearest Neighbor Searches [_k_nearest_neighbor_searches]
To issue a kNN search, use the `.knn()` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search()
vector = get_embedding("search text")
s = s.knn(
field="embedding",
k=5,
num_candidates=10,
query_vector=vector
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch()
vector = get_embedding("search text")
s = s.knn(
field="embedding",
k=5,
num_candidates=10,
query_vector=vector
)
```
:::
::::
The `field`, `k` and `num_candidates` arguments can be given as positional or keyword arguments and are required. In addition to these, `query_vector` or `query_vector_builder` must be given as well.
The `.knn()` method can be invoked multiple times to include multiple kNN searches in the request.
#### Sorting [_sorting]
To specify sorting order, use the `.sort()` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search().sort(
'category',
'-title',
{"lines" : {"order" : "asc", "mode" : "avg"}}
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch().sort(
'category',
'-title',
{"lines" : {"order" : "asc", "mode" : "avg"}}
)
```
:::
::::
It accepts positional arguments which can be either strings or dictionaries. String value is a field name, optionally prefixed by the `-` sign to specify a descending order.
To reset the sorting, call the method with no arguments:
```python
s = s.sort()
```
#### Pagination [_pagination]
To specify the from/size parameters, apply the standard Python slicing operator on the `Search` instance:
```python
s = s[10:20]
# {"from": 10, "size": 10}
s = s[:20]
# {"size": 20}
s = s[10:]
# {"from": 10}
s = s[10:20][2:]
# {"from": 12, "size": 8}
```
If you want to access all the documents matched by your query you can use the `scan` method which uses the scan/scroll elasticsearch API:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
for hit in s.scan():
print(hit.title)
```
:::
:::{tab-item} Async Python
:sync: async
```python
async for hit in s.scan():
print(hit.title)
```
:::
::::
In this case, the results won’t be sorted.
#### Highlighting [_highlighting]
To set common attributes for highlighting use the `highlight_options` method:
```python
s = s.highlight_options(order='score')
```
Enabling highlighting for individual fields is done using the `highlight` method:
```python
s = s.highlight('title')
# or, including parameters:
s = s.highlight('title', fragment_size=50)
```
The fragments in the response will then be available on each `Result` object as `.meta.highlight.FIELD` which will contain the list of fragments:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = s.execute()
for hit in response:
for fragment in hit.meta.highlight.title:
print(fragment)
```
:::
:::{tab-item} Async Python
:sync: async
```python
response = await s.execute()
for hit in response:
for fragment in hit.meta.highlight.title:
print(fragment)
```
:::
::::
#### Suggestions [_suggestions]
To specify a suggest request on your `Search` object use the `suggest` method:
```python
# check for correct spelling
s = s.suggest('my_suggestion', 'pyhton', term={'field': 'title'})
```
The first argument is the name of the suggestions (name under which it will be returned), second is the actual text you wish the suggester to work on and the keyword arguments will be added to the suggest’s json as-is which means that it should be one of `term`, `phrase` or `completion` to indicate which type of suggester should be used.
#### Collapsing [_collapsing]
To collapse search results use the `collapse` method on your `Search` object:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search().query(Match("message", "GET /search"))
# collapse results by user_id
s = s.collapse("user_id")
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch().query(Match("message", "GET /search"))
# collapse results by user_id
s = s.collapse("user_id")
```
:::
::::
The top hits will only include one result per `user_id`. You can also expand each collapsed top hit with the `inner_hits` parameter, `max_concurrent_group_searches` being the number of concurrent requests allowed to retrieve the inner hits per group:
```python
inner_hits = {"name": "recent_search", "size": 5, "sort": [{"@timestamp": "desc"}]}
s = s.collapse("user_id", inner_hits=inner_hits, max_concurrent_group_searches=4)
```
#### More Like This Query [_more_like_this_query]
To use Elasticsearch’s `more_like_this` functionality, you can use the MoreLikeThis query type.
A simple example is below
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl.query import MoreLikeThis
from elasticsearch.dsl import Search
my_text = 'I want to find something similar'
s = Search()
# We're going to match based only on two fields, in this case text and title
s = s.query(MoreLikeThis(like=my_text, fields=['text', 'title']))
# You can also exclude fields from the result to make the response quicker in the normal way
s = s.source(exclude=["text"])
response = s.execute()
for hit in response:
print(hit.title)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl.query import MoreLikeThis
from elasticsearch.dsl import AsyncSearch
async def example():
my_text = 'I want to find something similar'
s = AsyncSearch()
# We're going to match based only on two fields, in this case text and title
s = s.query(MoreLikeThis(like=my_text, fields=['text', 'title']))
# You can also exclude fields from the result to make the response quicker in the normal way
s = s.source(exclude=["text"])
response = await s.execute()
for hit in response:
print(hit.title)
```
:::
::::
#### Extra properties and parameters [_extra_properties_and_parameters]
To set extra properties of the search request, use the `.extra()` method. This can be used to define keys in the body that cannot be defined using a specific API method like `explain` or `search_after`:
```python
s = s.extra(explain=True)
```
To set query parameters, use the `.params()` method:
```python
s = s.params(routing="42")
```
If you need to limit the fields being returned by elasticsearch, use the `source()` method:
```python
# only return the selected fields
s = s.source(['title', 'body'])
# don't return any fields, just the metadata
s = s.source(False)
# explicitly include/exclude fields
s = s.source(includes=["title"], excludes=["user.*"])
# reset the field selection
s = s.source(None)
```
#### Serialization and Deserialization [_serialization_and_deserialization]
The search object can be serialized into a dictionary by using the `.to_dict()` method.
You can also create a `Search` object from a `dict` using the `from_dict` class method. This will create a new `Search` object and populate it using the data from the dict:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search.from_dict({"query": {"match": {"title": "python"}}})
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch.from_dict({"query": {"match": {"title": "python"}}})
```
:::
::::
If you wish to modify an existing `Search` object, overriding it’s properties, instead use the `update_from_dict` method that alters an instance **in-place**:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search(index='i')
s.update_from_dict({"query": {"match": {"title": "python"}}, "size": 42})
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch(index='i')
s.update_from_dict({"query": {"match": {"title": "python"}}, "size": 42})
```
:::
::::
### Response [_response]
You can execute your search by calling the `.execute()` method that will return a `Response` object. The `Response` object allows you access to any key from the response dictionary using attribute access. It also provides some convenient helpers:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = s.execute()
print(response.success())
# True
print(response.took)
# 12
print(response.hits.total.relation)
# eq
print(response.hits.total.value)
# 142
print(response.suggest.my_suggestions)
```
:::
:::{tab-item} Async Python
:sync: async
```python
await response = s.execute()
print(response.success())
# True
print(response.took)
# 12
print(response.hits.total.relation)
# eq
print(response.hits.total.value)
# 142
print(response.suggest.my_suggestions)
```
:::
::::
If you want to inspect the contents of the `response` objects, use its `to_dict` method to get access to the raw data for pretty printing.
#### Hits [_hits]
To access the hits returned by the search, use the `hits` property or iterate over the `Response` object:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = s.execute()
print(f"Total {response.hits.total} hits found.")
for h in response:
print(h.title, h.body)
```
:::
:::{tab-item} Async Python
:sync: async
```python
response = await s.execute()
print(f"Total {response.hits.total} hits found.")
for h in response:
print(h.title, h.body)
```
:::
::::
::::{note}
If you are only seeing partial results (for example 10000 or even 10 results), consider using the option `s.extra(track_total_hits=True)` to get a full hit count.
::::
#### Result [_result]
The individual hits is wrapped in a convenience class that allows attribute access to the keys in the returned dictionary. All the metadata for the results are accessible using `meta` (without the leading `_`):
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = s.execute()
h = response.hits[0]
print(f"/{h.meta.index}/{h.meta.doc_type}/{h.meta.id} returned with score {h.meta.score}")
```
:::
:::{tab-item} Async Python
:sync: async
```python
response = await s.execute()
h = response.hits[0]
print(f"/{h.meta.index}/{h.meta.doc_type}/{h.meta.id} returned with score {h.meta.score}")
```
:::
::::
::::{note}
If your document has a field called `meta` you have to access it using the get item syntax: `hit['meta']`.
::::
#### Aggregations [_aggregations_2]
Aggregations are available through the `aggregations` property:
```python
for tag in response.aggregations.per_tag.buckets:
print(tag.key, tag.max_lines.value)
```
### `MultiSearch` [_multisearch]
If you need to execute multiple searches at the same time you can use the `MultiSearch` class which will use the `_msearch` API:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import MultiSearch, Search
from elasticsearch.dsl.query import Term
ms = MultiSearch(index='blogs')
ms = ms.add(Search().filter(Term("tags", "python")))
ms = ms.add(Search().filter(Term("tags", 'elasticsearch')))
responses = ms.execute()
for response in responses:
print("Results for query %r." % response._search.query)
for hit in response:
print(hit.title)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import AsyncMultiSearch, AsyncSearch
from elasticsearch.dsl.query import Term
async def example():
ms = AsyncMultiSearch(index='blogs')
ms = ms.add(AsyncSearch().filter(Term("tags", "python")))
ms = ms.add(AsyncSearch().filter(Term("tags", 'elasticsearch')))
responses = await ms.execute()
for response in responses:
print("Results for query %r." % response._search.query)
for hit in response:
print(hit.title)
```
:::
::::
### `EmptySearch` [_emptysearch]
The `EmptySearch` class can be used as a fully compatible version of `Search` that will return no results, regardless of any queries configured.
## Persistence [_persistence_2]
You can use the DSL module to define your mappings and a basic persistent layer for your application.
For more comprehensive examples have a look at the [DSL examples](https://github.com/elastic/elasticsearch-py/tree/main/examples/dsl) directory in the repository.
### Document [doc_type]
If you want to create a model-like wrapper around your documents, use the `Document` class (or the equivalent `AsyncDocument` for asynchronous applications). It can also be used to create all the necessary mappings and settings in Elasticsearch (see [Document life cycle](#life-cycle) below for details).
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from datetime import datetime
from elasticsearch.dsl import AsyncDocument, Boolean, InnerDoc, Completion, Keyword, Text, analyzer
html_strip = analyzer('html_strip',
tokenizer="standard",
filter=["standard", "lowercase", "stop", "snowball"],
char_filter=["html_strip"]
)
class Comment(InnerDoc):
author: str = Text(fields={'raw': Keyword()})
content: str = Text(analyzer='snowball')
created_at: datetime
def age(self):
return datetime.now() - self.created_at
class Post(Document):
title: str
title_suggest: str = Completion()
created_at: datetime
published: bool
category: str = Text(
analyzer=html_strip,
fields={'raw': Keyword()}
)
comments: Comment
class Index:
name = 'blog'
def add_comment(self, author, content):
self.comments.append(
Comment(author=author, content=content, created_at=datetime.now()))
def save(self, ** kwargs):
self.created_at = datetime.now()
return super().save(** kwargs)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from datetime import datetime
from elasticsearch.dsl import AsyncDocument, Boolean, InnerDoc, Completion, Keyword, Text, analyzer
html_strip = analyzer('html_strip',
tokenizer="standard",
filter=["standard", "lowercase", "stop", "snowball"],
char_filter=["html_strip"]
)
class Comment(InnerDoc):
author: str = Text(fields={'raw': Keyword()})
content: str = Text(analyzer='snowball')
created_at: datetime
def age(self):
return datetime.now() - self.created_at
class Post(AsyncDocument):
title: str
title_suggest: str = Completion()
created_at: datetime
published: bool
category: str = Text(
analyzer=html_strip,
fields={'raw': Keyword()}
)
comments: Comment
class Index:
name = 'blog'
def add_comment(self, author, content):
self.comments.append(
Comment(author=author, content=content, created_at=datetime.now()))
async def save(self, ** kwargs):
self.created_at = datetime.now()
return await super().save(** kwargs)
```
:::
::::
#### Data types [_data_types]
The `Document` instances can use native Python types such as `str` and `datetime` for its attributes. In case of `Object` or `Nested` fields an instance of the `InnerDoc` subclass is used, as in the `add_comment` method in the above example, where we are creating an instance of the `Comment` class.
There are also specific type classes that were created to make working with some field types easier, for example the `Range` object used in any of the [range fields](elasticsearch://reference/elasticsearch/mapping-reference/range.md):
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import Document, DateRange, Keyword, Range
class RoomBooking(Document):
room = Keyword()
dates = DateRange()
rb = RoomBooking(
room='Conference Room II',
dates=Range(
gte=datetime(2018, 11, 17, 9, 0, 0),
lt=datetime(2018, 11, 17, 10, 0, 0)
)
)
# Range supports the in operator correctly:
datetime(2018, 11, 17, 9, 30, 0) in rb.dates # True
# you can also get the limits and whether they are inclusive or exclusive:
rb.dates.lower # datetime(2018, 11, 17, 9, 0, 0), True
rb.dates.upper # datetime(2018, 11, 17, 10, 0, 0), False
# empty range is unbounded
Range().lower # None, False
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import AsyncDocument, DateRange, Keyword, Range
class RoomBooking(AsyncDocument):
room = Keyword()
dates = DateRange()
rb = RoomBooking(
room='Conference Room II',
dates=Range(
gte=datetime(2018, 11, 17, 9, 0, 0),
lt=datetime(2018, 11, 17, 10, 0, 0)
)
)
# Range supports the in operator correctly:
datetime(2018, 11, 17, 9, 30, 0) in rb.dates # True
# you can also get the limits and whether they are inclusive or exclusive:
rb.dates.lower # datetime(2018, 11, 17, 9, 0, 0), True
rb.dates.upper # datetime(2018, 11, 17, 10, 0, 0), False
# empty range is unbounded
Range().lower # None, False
```
:::
::::
#### Python Type Hints [_python_type_hints]
Document fields can be defined using standard Python type hints if desired. Here are some examples:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from typing import Optional
class Post(Document):
title: str # same as title = Text(required=True)
created_at: Optional[datetime] # same as created_at = Date(required=False)
published: bool # same as published = Boolean(required=True)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from typing import Optional
class Post(AsyncDocument):
title: str # same as title = Text(required=True)
created_at: Optional[datetime] # same as created_at = Date(required=False)
published: bool # same as published = Boolean(required=True)
```
:::
::::
:::::{note}
When using `Field` subclasses such as `Text`, `Date` and `Boolean` to define attributes, these classes must be given in the right-hand side.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
class Post(Document):
title = Text() # correct
subtitle: Text # incorrect
```
:::
:::{tab-item} Async Python
:sync: async
```python
class Post(AsyncDocument):
title = Text() # correct
subtitle: Text # incorrect
```
:::
::::
Using a `Field` subclass as a Python type hint will result in errors.
:::::
Python types are mapped to their corresponding `Field` types according to the following table:
| Python type | DSL field |
| --- | --- |
| `str` | `Text(required=True)` |
| `bool` | `Boolean(required=True)` |
| `int` | `Integer(required=True)` |
| `float` | `Float(required=True)` |
| `bytes` | `Binary(required=True)` |
| `datetime` | `Date(required=True)` |
| `date` | `Date(format="yyyy-MM-dd", required=True)` |
To type a field as optional, the standard `Optional` modifier from the Python `typing` package can be used. When using Python 3.10 or newer, "pipe" syntax can also be used, by adding `| None` to a type. The `List` modifier can be added to a field to convert it to an array, similar to using the `multi=True` argument on the `Field` object.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from typing import Optional, List
class MyDoc(Document):
pub_date: Optional[datetime] # same as pub_date = Date()
middle_name: str | None # same as middle_name = Text()
authors: List[str] # same as authors = Text(multi=True, required=True)
comments: Optional[List[str]] # same as comments = Text(multi=True)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from typing import Optional, List
class MyDoc(AsyncDocument):
pub_date: Optional[datetime] # same as pub_date = Date()
middle_name: str | None # same as middle_name = Text()
authors: List[str] # same as authors = Text(multi=True, required=True)
comments: Optional[List[str]] # same as comments = Text(multi=True)
```
:::
::::
A field can also be given a type hint of an `InnerDoc` subclass, in which case it becomes an `Object` field of that class. When the `InnerDoc` subclass is wrapped with `List`, a `Nested` field is created instead.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from typing import List
class Address(InnerDoc):
...
class Comment(InnerDoc):
...
class Post(Document):
address: Address # same as address = Object(Address, required=True)
comments: List[Comment] # same as comments = Nested(Comment, required=True)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from typing import List
class Address(InnerDoc):
...
class Comment(InnerDoc):
...
class Post(AsyncDocument):
address: Address # same as address = Object(Address, required=True)
comments: List[Comment] # same as comments = Nested(Comment, required=True)
```
:::
::::
Unfortunately it is impossible to have Python type hints that uniquely identify every possible Elasticsearch `Field` type. To choose a type that is different than the one that is assigned according to the table above, the desired `Field` instance can be added explicitly as a right-side assignment in the field declaration. The next example creates a field that is typed as `Optional[str]`, but is mapped to `Keyword` instead of `Text`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
class MyDocument(Document):
category: Optional[str] = Keyword()
```
:::
:::{tab-item} Async Python
:sync: async
```python
class MyDocument(AsyncDocument):
category: Optional[str] = Keyword()
```
:::
::::
This form can also be used when additional options need to be given to initialize the field, such as when using custom analyzer settings:
```python
class Comment(InnerDoc):
content: str = Text(analyzer='snowball')
```
When using type hints as above, subclasses of `Document` and `InnerDoc` inherit some of the behaviors associated with Python dataclasses, as defined by [PEP 681](https://peps.python.org/pep-0681/) and the [dataclass_transform decorator](https://typing.readthedocs.io/en/latest/spec/dataclasses.html#dataclass-transform). To add per-field dataclass options such as `default` or `default_factory`, the `mapped_field()` wrapper can be used on the right side of a typed field declaration:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
class MyDocument(Document):
title: str = mapped_field(default="no title")
created_at: datetime = mapped_field(default_factory=datetime.now)
published: bool = mapped_field(default=False)
category: str = mapped_field(Keyword(), default="general")
```
:::
:::{tab-item} Async Python
:sync: async
```python
class MyDocument(AsyncDocument):
title: str = mapped_field(default="no title")
created_at: datetime = mapped_field(default_factory=datetime.now)
published: bool = mapped_field(default=False)
category: str = mapped_field(Keyword(), default="general")
```
:::
::::
The `mapped_field()` wrapper function can optionally be given an explicit field type instance as a first positional argument, as the `category` field does in the example above to be defined as `Keyword` instead of the `Text` default.
Static type checkers such as [mypy](https://mypy-lang.org/) and [pyright](https://github.com/microsoft/pyright) can use the type hints and the dataclass-specific options added to the `mapped_field()` function to improve type inference and provide better real-time code completion and suggestions in IDEs.
One situation in which type checkers can’t infer the correct type is when using fields as class attributes. Consider the following example:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
class MyDocument(Document):
title: str
doc = MyDocument()
# doc.title is typed as "str" (correct)
# MyDocument.title is also typed as "str" (incorrect)
```
:::
:::{tab-item} Async Python
:sync: async
```python
class MyDocument(AsyncDocument):
title: str
doc = MyDocument()
# doc.title is typed as "str" (correct)
# MyDocument.title is also typed as "str" (incorrect)
```
:::
::::
To help type checkers correctly identify class attributes as such, the `M` generic must be used as a wrapper to the type hint, as shown in the next examples:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import M
class MyDocument(Document):
title: M[str]
created_at: M[datetime] = mapped_field(default_factory=datetime.now)
doc = MyDocument()
# doc.title is typed as "str"
# doc.created_at is typed as "datetime"
# MyDocument.title is typed as "InstrumentedField"
# MyDocument.created_at is typed as "InstrumentedField"
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import M
class MyDocument(AsyncDocument):
title: M[str]
created_at: M[datetime] = mapped_field(default_factory=datetime.now)
doc = MyDocument()
# doc.title is typed as "str"
# doc.created_at is typed as "datetime"
# MyDocument.title is typed as "InstrumentedField"
# MyDocument.created_at is typed as "InstrumentedField"
```
:::
::::
The `M` type hint does not provide any runtime behavior and its use is not required, but it can be useful to remove spurious type errors in IDEs or type checking builds.
The `InstrumentedField` objects returned when fields are accessed as class attributes are proxies for the field instances that can be used anywhere a field needs to be referenced, such as when specifying sort options in a `Search` object:
```python
# sort by creation date descending, and title ascending
s = MyDocument.search().sort(-MyDocument.created_at, MyDocument.title)
```
When specifying sorting order, the `+` and `-` unary operators can be used on the class field attributes to indicate ascending and descending order.
Finally, it is also possible to define class attributes and request that they are ignored when building the Elasticsearch mapping. One way is to type attributes with the `ClassVar` annotation. Alternatively, the `mapped_field()` wrapper function accepts an `exclude` argument that can be set to `True`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from typing import ClassVar
class MyDoc(Document):
title: M[str] created_at: M[datetime] = mapped_field(default_factory=datetime.now)
my_var: ClassVar[str] # regular class variable, ignored by Elasticsearch
anoter_custom_var: int = mapped_field(exclude=True) # also ignored by Elasticsearch
```
:::
:::{tab-item} Async Python
:sync: async
```python
from typing import ClassVar
class MyDoc(AsyncDocument):
title: M[str] created_at: M[datetime] = mapped_field(default_factory=datetime.now)
my_var: ClassVar[str] # regular class variable, ignored by Elasticsearch
anoter_custom_var: int = mapped_field(exclude=True) # also ignored by Elasticsearch
```
:::
::::
#### Note on dates [_note_on_dates]
The DSL module will always respect the timezone information (or lack thereof) on the `datetime` objects passed in or stored in Elasticsearch. Elasticsearch itself interprets all datetimes with no timezone information as `UTC`. If you wish to reflect this in your python code, you can specify `default_timezone` when instantiating a `Date` field:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
class Post(Document):
created_at = Date(default_timezone='UTC')
```
:::
:::{tab-item} Async Python
:sync: async
```python
class Post(AsyncDocument):
created_at = Date(default_timezone='UTC')
```
:::
::::
In that case any `datetime` object passed in (or parsed from Elasticsearch) will be treated as if it were in `UTC` timezone.
#### Custom field names
By default, the `Document` and `AsyncDocument` classes use the names given to the field attributes as the field names in the Elasticsearch index. But sometimes it is necessary for the names of a field in Python and Elasticsearch to be different, such as when the Elasticsearch name is not a valid Python identifier.
The following example shows how to define the Elasticsearch field `@timestamp`, used with data streams:
:::{tab-item} Standard Python
:sync: sync
```python
class MyDoc(Document):
timestamp: datetime = mapped_field(es_name='@timestamp')
```
:::
:::{tab-item} Async Python
:sync: async
```python
class MyDoc(AsyncDocument):
timestamp: datetime = mapped_field(es_name='@timestamp')
```
:::
::::
If using `Field` subclasses to define attribute types, the `_es_name` argument can be passed with the desired Elasticsearch name:
:::{tab-item} Standard Python
:sync: sync
```python
class MyDoc(Document):
timestamp = Date(_es_name='@timestamp')
```
:::
:::{tab-item} Async Python
:sync: async
```python
class MyDoc(AsyncDocument):
timestamp = Date(_es_name='@timestamp')
```
:::
::::
The conversion between the Python and Elasticsearch names happens automatically during serialization and deserialization of `Document` and `AsyncDocument` instances. The Elasticsearch field names must be used when sending requests outside of the document classes. Likewise, responses from Elasticsearch that are not deserialized to a document class will reference the Elasticsearch field names.
#### Document life cycle [life-cycle]
Before you first use the `Post` document type, you need to create the mappings in Elasticsearch. For that you can either use the `index` object or create the mappings directly by calling the `init` class method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
# create the mappings in Elasticsearch
Post.init()
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
# create the mappings in Elasticsearch
await Post.init()
```
:::
::::
This code will typically be run in the setup for your application during a code deploy, similar to running database migrations.
To create a new `Post` document, instantiate the class and pass in any fields you wish to set, you can then use standard attribute setting to change/add more fields. You are not limited to the fields defined explicitly:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
# instantiate the document
first = Post(title='My First Blog Post, yay!', published=True)
# assign some field values, can be values or lists of values
first.category = ['everything', 'nothing']
# every document has an id in meta
first.meta.id = 47
# save the document into the cluster
first.save()
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
# instantiate the document
first = Post(title='My First Blog Post, yay!', published=True)
# assign some field values, can be values or lists of values
first.category = ['everything', 'nothing']
# every document has an id in meta
first.meta.id = 47
# save the document into the cluster
await first.save()
```
:::
::::
All the metadata fields (`id`, `routing`, `index` and so on) can be accessed (and set) using a `meta` attribute or directly using the underscored variant:
```python
post = Post(meta={'id': 42})
# prints 42
print(post.meta.id)
# override default index
post.meta.index = 'my-blog'
```
::::{note}
Having all metadata accessible through `meta` means that this name is reserved and you shouldn’t have a field called `meta` on your document. If you, however, need it you can still access the data using the get item (as opposed to attribute) syntax: `post['meta']`.
::::
To retrieve an existing document use the `get` class method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
# retrieve the document
first = Post.get(id=42)
# now we can call methods, change fields, ...
first.add_comment('me', 'This is nice!')
# and save the changes into the cluster again
first.save()
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
# retrieve the document
first = Post.get(id=42)
# now we can call methods, change fields, ...
first.add_comment('me', 'This is nice!')
# and save the changes into the cluster again
await first.save()
```
:::
::::
The [Update API](https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-document) can also be used via the `update` method. By default any keyword arguments, beyond the parameters of the API, will be considered fields with new values. Those fields will be updated on the local copy of the document and then sent over as partial document to be updated:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
# retrieve the document
first = Post.get(id=42)
# you can update just individual fields which will call the update API
# and also update the document in place
first.update(published=True, published_by='me')
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
# retrieve the document
first = await Post.get(id=42)
# you can update just individual fields which will call the update API
# and also update the document in place
await first.update(published=True, published_by='me')
```
:::
::::
In case you wish to use a `painless` script to perform the update you can pass in the script string as `script` or the `id` of a [stored script](docs-content://explore-analyze/scripting/modules-scripting-store-and-retrieve.md) via `script_id`. All additional keyword arguments to the `update` method will then be passed in as parameters of the script. The document will not be updated in place.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
# retrieve the document
first = Post.get(id=42)
# we execute a script in elasticsearch with additional kwargs being passed
# as params into the script
first.update(script='ctx._source.category.add(params.new_category)',
new_category='testing')
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
# retrieve the document
first = await Post.get(id=42)
# we execute a script in elasticsearch with additional kwargs being passed
# as params into the script
await first.update(script='ctx._source.category.add(params.new_category)',
new_category='testing')
```
:::
::::
If the document is not found in elasticsearch, an exception (`elasticsearch.NotFoundError`) will be raised. If you wish to return `None` instead just pass in `ignore=404` to suppress the exception:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
p = Post.get(id='not-in-es', ignore=404)
if p is None:
...
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
p = await Post.get(id='not-in-es', ignore=404)
if p is None:
...
```
:::
::::
When you wish to retrieve multiple documents at the same time by their `id` you can use the `mget` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
posts = Post.mget([42, 47, 256])
```
:::
:::{tab-item} Async Python
:sync: async
```python
posts = await Post.mget([42, 47, 256])
```
:::
::::
`mget` will, by default, raise a `NotFoundError` if any of the documents wasn’t found and `RequestError` if any of the document had resulted in error. You can control this behavior by setting parameters:
* `raise_on_error`: If `True` (default) then any error will cause an exception to be raised. Otherwise all documents containing errors will be treated as missing.
* `missing`: Can have three possible values: `'none'` (default), `'raise'` and `'skip'`. If a document is missing or errored it will either be replaced with `None`, an exception will be raised or the document will be skipped in the output list entirely.
The index associated with the `Document` is accessible via the `_index` class property which gives you access to the `index` class.
The `_index` attribute is also home to the `load_mappings` method which will update the mapping on the `Index` from elasticsearch. This is useful if you use dynamic mappings and want the class to be aware of those fields (for example if you wish the `Date` fields to be properly (de)serialized):
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
Post._index.load_mappings()
```
:::
:::{tab-item} Async Python
:sync: async
```python
await Post._index.load_mappings()
```
:::
::::
To delete a document, call its `delete` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
first = Post.get(id=42)
first.delete()
```
:::
:::{tab-item} Async Python
:sync: async
```python
first = await Post.get(id=42)
await first.delete()
```
:::
::::
#### Integration with Pydantic models
::::{warning}
This functionality 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.
::::
::::{note}
This feature is available in the Python Elasticsearch client starting with release 9.2.0.
::::
Applications that define their data models using [Pydantic](https://docs.pydantic.dev/latest/) can combine these
models with Elasticsearch DSL annotations. To take advantage of this option, Pydantic's `BaseModel` base class
needs to be replaced with `BaseESModel` (or `AsyncBaseESModel` for asynchronous applications), and then the model
can include type annotations for Pydantic and Elasticsearch both, as demonstrated in the following example:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from typing import Annotated
from pydantic import Field
from elasticsearch import dsl
from elasticsearch.dsl.pydantic import BaseESModel
class Quote(BaseESModel):
quote: str
author: Annotated[str, dsl.Keyword()]
tags: Annotated[list[str], dsl.Keyword(normalizer="lowercase")]
embedding: Annotated[list[float], dsl.DenseVector()] = Field(init=False, default=[])
class Index:
name = "quotes"
```
:::
:::{tab-item} Async Python
:sync: async
```python
from typing import Annotated
from pydantic import Field
from elasticsearch import dsl
from elasticsearch.dsl.pydantic import AsyncBaseESModel
class Quote(AsyncBaseESModel):
quote: str
author: Annotated[str, dsl.Keyword()]
tags: Annotated[list[str], dsl.Keyword(normalizer="lowercase")]
embedding: Annotated[list[float], dsl.DenseVector()] = Field(init=False, default=[])
class Index:
name = "quotes"
```
:::
::::
In this example, the `quote` attribute is annotated with a `str` type hint. Both Pydantic and Elasticsearch use this
annotation.
The `author` and `tags` attributes have a Python type hint and an Elasticsearch annotation, both wrapped with
Python's `typing.Annotated`. When using the `BaseESModel` or `AsyncBaseESModel` classes, the typing information intended for Elasticsearch needs
to be defined inside `Annotated`.
The `embedding` attribute includes a base Python type and an Elasticsearch annotation in the same format as the
other fields, but it adds Pydantic's `Field` definition as a right-hand side assignment.
Finally, any other items that need to be defined for the Elasticsearch document class, such as `class Index` and
`class Meta` entries (discussed later), can be added as well.
The next example demonstrates how to define `Object` and `Nested` fields:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from typing import Annotated
from pydantic import BaseModel, Field
from elasticsearch import dsl
from elasticsearch.dsl.pydantic import BaseESModel
class Phone(BaseModel):
type: Annotated[str, dsl.Keyword()] = Field(default="Home")
number: str
class Person(BaseESModel):
name: str
main_phone: Phone # same as Object(Phone)
other_phones: list[Phone] # same as Nested(Phone)
class Index:
name = "people"
```
:::
:::{tab-item} Async Python
:sync: async
```python
from typing import Annotated
from pydantic import BaseModel, Field
from elasticsearch import dsl
from elasticsearch.dsl.pydantic import AsyncBaseESModel
class Phone(BaseModel):
type: Annotated[str, dsl.Keyword()] = Field(default="Home")
number: str
class Person(AsyncBaseESModel):
name: str
main_phone: Phone # same as Object(Phone)
other_phones: list[Phone] # same as Nested(Phone)
class Index:
name = "people"
```
:::
::::
Inner classes do not need to be defined with a custom base class; these should be standard Pydantic model
classes. The attributes defined in these classes can include Elasticsearch annotations, as long as they are given
in an `Annotated` type hint.
All model classes that are created as described in this section function like normal Pydantic models and can be used
anywhere standard Pydantic models are used, but they have some added attributes:
- `_doc`: a class attribute that is a dynamically generated `Document` class to use with the Elasticsearch index.
- `meta`: an attribute added to all models that includes Elasticsearch document metadata items such as `id`, `score`, etc.
- `to_doc()`: a method that converts the Pydantic model to an Elasticsearch document.
- `from_doc()`: a class method that accepts an Elasticsearch document as an argument and returns an equivalent Pydantic model.
These are demonstrated in the examples below:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
# create a Pydantic model
quote = Quote(
quote="An unexamined life is not worth living.",
author="Socrates",
tags=["phillosophy"]
)
# save the model to the Elasticsearch index
quote.to_doc().save()
# get a document from the Elasticsearch index as a Pydantic model
quote = Quote.from_doc(Quote._doc.get(id=42))
# run a search and print the Pydantic models
s = Quote._doc.search().query(Match(Quote._doc.quote, "life"))
for doc in s:
quote = Quote.from_doc(doc)
print(quote.meta.id, quote.meta.score, quote.quote)
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
# create a Pydantic model
quote = Quote(
quote="An unexamined life is not worth living.",
author="Socrates",
tags=["phillosophy"]
)
# save the model to the Elasticsearch index
await quote.to_doc().save()
# get a document from the Elasticsearch index as a Pydantic model
quote = Quote.from_doc(await Quote._doc.get(id=42))
# run a search and print the Pydantic models
s = Quote._doc.search().query(Match(Quote._doc.quote, "life"))
async for doc in s:
quote = Quote.from_doc(doc)
print(quote.meta.id, quote.meta.score, quote.quote)
```
:::
::::
#### Analysis [_analysis]
To specify `analyzer` values for `Text` fields you can use the name of the analyzer (as a string) and either rely on the analyzer being defined (like built-in analyzers) or define the analyzer yourself manually.
Alternatively, you can create your own analyzer and have the persistence layer handle its creation, from our example earlier:
```python
from elasticsearch.dsl import analyzer, tokenizer
my_analyzer = analyzer('my_analyzer',
tokenizer=tokenizer('trigram', 'nGram', min_gram=3, max_gram=3),
filter=['lowercase']
)
```
Each analysis object needs to have a name (`my_analyzer` and `trigram` in our example) and tokenizers, token filters and char filters also need to specify type (`nGram` in our example).
Once you have an instance of a custom `analyzer` you can also call the [analyze API](https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-indices) on it by using the `simulate` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = my_analyzer.simulate('Hello World!')
# ['hel', 'ell', 'llo', 'lo ', 'o w', ' wo', 'wor', 'orl', 'rld', 'ld!']
tokens = [t.token for t in response.tokens]
```
:::
:::{tab-item} Async Python
:sync: async
```python
response = my_analyzer.async_simulate('Hello World!')
# ['hel', 'ell', 'llo', 'lo ', 'o w', ' wo', 'wor', 'orl', 'rld', 'ld!']
tokens = [t.token for t in response.tokens]
```
:::
::::
::::{note}
When creating a mapping which relies on a custom analyzer the index must either not exist or be closed. To create multiple `Document`-defined mappings you can use the `index` object.
::::
#### Search [_search_2]
To search for this document type, use the `search` class method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
# by calling .search we get back a standard Search object
s = Post.search()
# the search is already limited to the index and doc_type of our document
s = s.filter('term', published=True).query('match', title='first')
results = s.execute()
# when you execute the search the results are wrapped in your document class (Post)
for post in results:
print(post.meta.score, post.title)
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
# by calling .search we get back a standard Search object
s = Post.search()
# the search is already limited to the index and doc_type of our document
s = s.filter('term', published=True).query('match', title='first')
results = await s.execute()
# when you execute the search the results are wrapped in your document class (Post)
for post in results:
print(post.meta.score, post.title)
```
:::
::::
Alternatively you can take a `Search` or `AsyncSearch` object and restrict it to return our document type, wrapped in correct class:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Search()
s = s.doc_type(Post)
```
:::
:::{tab-item} Async Python
:sync: async
```python
s = AsyncSearch()
s = s.doc_type(Post)
```
:::
::::
You can also combine document classes with standard doc types (strings), which will be treated as before. You can also pass in multiple `Document` subclasses and each document in the response will be wrapped in it’s class.
If you want to run suggestions, use the `suggest` method on the `Search` object:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
s = Post.search()
s = s.suggest('title_suggestions', 'pyth', completion={'field': 'title_suggest'})
response = s.execute()
for result in response.suggest.title_suggestions:
print('Suggestions for %s:' % result.text)
for option in result.options:
print(' %s (%r)' % (option.text, option.payload))
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
s = Post.search()
s = s.suggest('title_suggestions', 'pyth', completion={'field': 'title_suggest'})
response = await s.execute()
for result in response.suggest.title_suggestions:
print('Suggestions for %s:' % result.text)
for option in result.options:
print(' %s (%r)' % (option.text, option.payload))
```
:::
::::
#### `class Meta` options [_class_meta_options]
In the `Meta` class inside your document definition you can define various metadata for your document:
* `mapping`: optional instance of `Mapping` or `AsyncMapping` classes to use as base for the mappings created from the fields on the document class itself.
Any attributes on the `Meta` class that are instance of `MetaField` will be used to control the mapping of the meta fields (`_all`, `dynamic` and so on). Name the parameter (without the leading underscore) as the field you wish to map and pass any parameters to the `MetaField` class:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
class Post(Document):
title = Text()
class Meta:
all = MetaField(enabled=False)
dynamic = MetaField('strict')
```
:::
:::{tab-item} Async Python
:sync: async
```python
class Post(AsyncDocument):
title = Text()
class Meta:
all = MetaField(enabled=False)
dynamic = MetaField('strict')
```
:::
::::
#### `class Index` options [_class_index_options]
This section of the `Document` definition can contain any information about the index, its name, settings and other attributes:
* `name`: name of the index to use, if it contains a wildcard (`*`) then it cannot be used for any write operations and an `index` kwarg will have to be passed explicitly when calling methods like `.save()`.
* `using`: default connection alias to use, defaults to `'default'`
* `settings`: dictionary containing any settings for the `Index` object like `number_of_shards`.
* `analyzers`: additional list of analyzers that should be defined on an index (see `analysis` for details).
* `aliases`: dictionary with any aliases definitions
* `data_stream`: set to `True` to configure a data stream instead of an index.
#### Document Inheritance [_document_inheritance]
You can use standard Python inheritance to extend models, this can be useful in a few scenarios. For example if you want to have a `BaseDocument` defining some common fields that several different `Document` classes should share:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
class User(InnerDoc):
username: str = mapped_field(Text(fields={'keyword': Keyword()}))
email: str
class BaseDocument(Document):
created_by: User
created_date: datetime
last_updated: datetime
def save(**kwargs):
if not self.created_date:
self.created_date = datetime.now()
self.last_updated = datetime.now()
return super(BaseDocument, self).save(**kwargs)
class BlogPost(BaseDocument):
class Index:
name = 'blog'
```
:::
:::{tab-item} Async Python
:sync: async
```python
class User(InnerDoc):
username: str = mapped_field(Text(fields={'keyword': Keyword()}))
email: str
class BaseDocument(AsyncDocument):
created_by: User
created_date: datetime
last_updated: datetime
async def save(**kwargs):
if not self.created_date:
self.created_date = datetime.now()
self.last_updated = datetime.now()
return await super(BaseDocument, self).save(**kwargs)
class BlogPost(BaseDocument):
class Index:
name = 'blog'
```
:::
::::
Another use case would be using the [join type](elasticsearch://reference/elasticsearch/mapping-reference/parent-join.md) to have multiple different entities in a single index. You can see an [example](https://github.com/elastic/elasticsearch-py/blob/master/examples/dsl/parent_child.py) of this approach. In this case, if the subclasses don’t define their own Index classes, the mappings are merged and shared between all the subclasses.
### Index [_index]
In typical scenario using `class Index` on a `Document` class is sufficient to perform any action. In a few cases though it can be useful to manipulate an `Index` object directly.
`Index` is a class responsible for holding all the metadata related to an index in elasticsearch - mappings and settings. It is most useful when defining your mappings since it allows for easy creation of multiple mappings at the same time. This is especially useful when setting up your elasticsearch objects in a migration:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import Index, Document, Text, analyzer
blogs = Index('blogs')
# define custom settings
blogs.settings(
number_of_shards=1,
number_of_replicas=0
)
# define aliases
blogs.aliases(
old_blogs={}
)
# register a document with the index
blogs.document(Post)
# can also be used as class decorator when defining the Document
@blogs.document
class Post(Document):
title: str
# You can attach custom analyzers to the index
html_strip = analyzer('html_strip',
tokenizer="standard",
filter=["standard", "lowercase", "stop", "snowball"],
char_filter=["html_strip"]
)
blogs.analyzer(html_strip)
# delete the index, ignore if it doesn't exist
blogs.delete(ignore=404)
# create the index in elasticsearch
blogs.create()
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import AsyncIndex, AsyncDocument, Text, analyzer
blogs = AsyncIndex('blogs')
# define custom settings
blogs.settings(
number_of_shards=1,
number_of_replicas=0
)
# define aliases
blogs.aliases(
old_blogs={}
)
# register a document with the index
blogs.document(Post)
# can also be used as class decorator when defining the Document
@blogs.document
class Post(AsyncDocument):
title: str
# You can attach custom analyzers to the index
html_strip = analyzer('html_strip',
tokenizer="standard",
filter=["standard", "lowercase", "stop", "snowball"],
char_filter=["html_strip"]
)
blogs.analyzer(html_strip)
async def example():
# delete the index, ignore if it doesn't exist
await blogs.delete(ignore=404)
# create the index in elasticsearch
await blogs.create()
```
:::
::::
You can also set up a template for your indices and use the `clone` method to create specific copies:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
blogs = Index('blogs', using='production')
blogs.settings(number_of_shards=2)
blogs.document(Post)
# create a copy of the index with different name
company_blogs = blogs.clone('company-blogs')
# create a different copy on different cluster
dev_blogs = blogs.clone('blogs', using='dev')
# and change its settings
dev_blogs.setting(number_of_shards=1)
```
:::
:::{tab-item} Async Python
:sync: async
```python
blogs = AsyncIndex('blogs', using='production')
blogs.settings(number_of_shards=2)
blogs.document(Post)
# create a copy of the index with different name
company_blogs = blogs.clone('company-blogs')
# create a different copy on different cluster
dev_blogs = blogs.clone('blogs', using='dev')
# and change its settings
dev_blogs.setting(number_of_shards=1)
```
:::
::::
#### IndexTemplate [index-template]
The DSL module also exposes an option to manage [index templates](docs-content://manage-data/data-store/templates.md) in elasticsearch using the `ComposableIndexTemplate` and `IndexTemplate` classes, which have a similar API to `Index`.
::::{note}
Composable index templates should always be preferred over the legacy index templates.
::::
Once an index template is saved in Elasticsearch its contents will be automatically applied to new indices (existing indices are completely unaffected by templates) that match the template pattern (any index starting with `blogs-` in our example), even if the index is created automatically upon indexing a document into that index.
Potential workflow for a set of time based indices governed by a single template:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from datetime import datetime
from elasticsearch.dsl import Document, Date, Text
class Log(Document):
content: str
timestamp: datetime
class Index:
name = "logs-*"
def save(self, **kwargs):
# assign now if no timestamp given
if not self.timestamp:
self.timestamp = datetime.now()
# override the index to go to the proper timeslot
kwargs['index'] = self.timestamp.strftime('logs-%Y%m%d')
return super().save(**kwargs)
# once, as part of application setup, during deploy/migrations:
logs = Log._index.as_composable_template('logs', priority=100)
logs.save()
# to perform search across all logs:
search = Log.search()
```
:::
:::{tab-item} Async Python
:sync: async
```python
from datetime import datetime
from elasticsearch.dsl import AsyncDocument, Date, Text
class Log(AsyncDocument):
content: str
timestamp: datetime
class Index:
name = "logs-*"
async def save(self, **kwargs):
# assign now if no timestamp given
if not self.timestamp:
self.timestamp = datetime.now()
# override the index to go to the proper timeslot
kwargs['index'] = self.timestamp.strftime('logs-%Y%m%d')
return await super().save(**kwargs)
async def example():
# once, as part of application setup, during deploy/migrations:
logs = Log._index.as_composable_template('logs', priority=100)
await logs.save()
# to perform search across all logs:
search = Log.search()
```
:::
::::
## Faceted Search [faceted_search]
The library comes with a basic abstraction aimed at helping you develop faceted navigation for your data.
### Configuration [_configuration_2]
You can provide several configuration options (as class attributes) when declaring a `FacetedSearch` subclass:
* `index`: the name of the index (as string) to search through, defaults to `'_all'`.
* `doc_types`: list of `Document` subclasses or strings to be used, defaults to `['_all']`.
* `fields`: list of fields on the document type to search through. The list will be passes to `MultiMatch` query so can contain boost values (`'title^5'`), defaults to `['*']`.
* `facets`: dictionary of facets to display/filter on. The key is the name displayed and values should be instances of any `Facet` subclass, for example: `{'tags': TermsFacet(field='tags')}`
#### Facets [_facets]
There are several different facets available:
* `TermsFacet`: provides an option to split documents into groups based on a value of a field, for example `TermsFacet(field='category')`
* `DateHistogramFacet`: split documents into time intervals, example: `DateHistogramFacet(field="published_date", calendar_interval="day")`
* `HistogramFacet`: similar to `DateHistogramFacet` but for numerical values: `HistogramFacet(field="rating", interval=2)`
* `RangeFacet`: allows you to define your own ranges for a numerical fields: `RangeFacet(field="comment_count", ranges=[("few", (None, 2)), ("lots", (2, None))])`
* `NestedFacet`: is a basic facet that wraps another to provide access to nested documents: `NestedFacet('variants', TermsFacet(field='variants.color'))`
By default facet results will only calculate document count, if you wish for a different metric you can pass in any single value metric aggregation as the `metric` kwarg (`TermsFacet(field='tags', metric=A('max', field=timestamp))`). When specifying `metric` the results will be, by default, sorted in descending order by that metric. To change it to ascending specify `metric_sort="asc"` and to sort by document count use `metric_sort=False`.
#### Advanced [_advanced]
If you require any custom behavior or modifications simply override one or more of the methods responsible for the class' functions:
* `search(self)`: is responsible for constructing the `Search` object used. Override this if you want to customize the search object (for example by adding a global filter for published articles only).
* `query(self, search)`: adds the query position of the search (if search input specified), by default using `MultiField` query. Override this if you want to modify the query type used.
* `highlight(self, search)`: defines the highlighting on the `Search` object and returns a new one. Default behavior is to highlight on all fields specified for search.
### Usage [_usage]
The custom subclass can be instantiated empty to provide an empty search (matching everything) or with `query`, `filters` and `sort`.
* `query`: is used to pass in the text of the query to be performed. If `None` is passed in (default) a `MatchAll` query will be used. For example `'python web'`
* `filters`: is a dictionary containing all the facet filters that you wish to apply. Use the name of the facet (from `.facets` attribute) as the key and one of the possible values as value. For example `{'tags': 'python'}`.
* `sort`: is a tuple or list of fields on which the results should be sorted. The format of the individual fields are to be the same as those passed to `~elasticsearch.dsl.Search.sort`.
#### Response [_response_2]
the response returned from the `FacetedSearch` object (by calling `.execute()`) is a subclass of the standard `Response` class that adds a property called `facets` which contains a dictionary with lists of buckets -each represented by a tuple of key, document count and a flag indicating whether this value has been filtered on.
### Example [_example]
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from datetime import date
from elasticsearch.dsl import FacetedSearch, TermsFacet, DateHistogramFacet
class BlogSearch(FacetedSearch):
doc_types = [Article, ]
# fields that should be searched
fields = ['tags', 'title', 'body']
facets = {
# use bucket aggregations to define facets
'tags': TermsFacet(field='tags'),
'publishing_frequency': DateHistogramFacet(field='published_from', interval='month')
}
def search(self):
# override methods to add custom pieces
s = super().search()
return s.filter('range', publish_from={'lte': 'now/h'})
bs = BlogSearch('python web', {'publishing_frequency': date(2015, 6)})
response = bs.execute()
# access hits and other attributes as usual
total = response.hits.total
print('total hits', total.relation, total.value)
for hit in response:
print(hit.meta.score, hit.title)
for (tag, count, selected) in response.facets.tags:
print(tag, ' (SELECTED):' if selected else ':', count)
for (month, count, selected) in response.facets.publishing_frequency:
print(month.strftime('%B %Y'), ' (SELECTED):' if selected else ':', count)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from datetime import date
from elasticsearch.dsl import AsyncFacetedSearch, TermsFacet, DateHistogramFacet
class BlogSearch(AsyncFacetedSearch):
doc_types = [Article, ]
# fields that should be searched
fields = ['tags', 'title', 'body']
facets = {
# use bucket aggregations to define facets
'tags': TermsFacet(field='tags'),
'publishing_frequency': DateHistogramFacet(field='published_from', interval='month')
}
def search(self):
# override methods to add custom pieces
s = super().search()
return s.filter('range', publish_from={'lte': 'now/h'})
async def example():
bs = BlogSearch('python web', {'publishing_frequency': date(2015, 6)})
response = await bs.execute()
# access hits and other attributes as usual
total = response.hits.total
print('total hits', total.relation, total.value)
for hit in response:
print(hit.meta.score, hit.title)
for (tag, count, selected) in response.facets.tags:
print(tag, ' (SELECTED):' if selected else ':', count)
for (month, count, selected) in response.facets.publishing_frequency:
print(month.strftime('%B %Y'), ' (SELECTED):' if selected else ':', count)
```
:::
::::
## Update By Query [update_by_query]
### The `Update By Query` object [_the_update_by_query_object]
The `Update By Query` object enables the use of the [_update_by_query](https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-update-by-query) endpoint to perform an update on documents that match a search query.
The object is implemented as a modification of the `Search` object, containing a subset of its query methods, as well as a script method, which is used to make updates.
The `Update By Query` object implements the following `Search` query types:
* queries
* filters
* excludes
For more information on queries, see the `search_dsl` chapter.
Like the `Search` object, the API is designed to be chainable. This means that the `Update By Query` object is immutable: all changes to the object will result in a shallow copy being created which contains the changes. This means you can safely pass the `Update By Query` object to foreign code without fear of it modifying your objects as long as it sticks to the `Update By Query` object APIs.
You can define your client in a number of ways, but the preferred method is to use a global configuration. For more information on defining a client, see the `configuration` chapter.
Once your client is defined, you can instantiate a copy of the `Update By Query` object as seen below:
```python
from elasticsearch.dsl import UpdateByQuery
ubq = UpdateByQuery().using(client)
# or
ubq = UpdateByQuery(using=client)
```
::::{note}
All methods return a *copy* of the object, making it safe to pass to outside code.
::::
The API is chainable, allowing you to combine multiple method calls in one statement:
```python
ubq = UpdateByQuery().using(client).query(Match("title", python"))
```
To send the request to Elasticsearch:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = ubq.execute()
```
:::
:::{tab-item} Async Python
:sync: async
```python
response = await ubq.execute()
```
:::
::::
It should be noted, that there are limits to the chaining using the script method: calling script multiple times will overwrite the previous value. That is, only a single script can be sent with a call. An attempt to use two scripts will result in only the second script being stored.
Given the below example:
```python
ubq = UpdateByQuery() \
.using(client) \
.script(source="ctx._source.likes++") \
.script(source="ctx._source.likes+=2")
```
This means that the stored script by this client will be `'source': 'ctx._source.likes{{plus}}=2'` and the previous call will not be stored.
For debugging purposes you can serialize the `Update By Query` object to a `dict` explicitly:
```python
print(ubq.to_dict())
```
Also, to use variables in script see below example:
```python
ubq.script(
source="ctx._source.messages.removeIf(x -> x.somefield == params.some_var)",
params={
'some_var': 'some_string_val'
}
)
```
#### Serialization and Deserialization [_serialization_and_deserialization_2]
The search object can be serialized into a dictionary by using the `.to_dict()` method.
You can also create a `Update By Query` object from a `dict` using the `from_dict` class method. This will create a new `Update By Query` object and populate it using the data from the dict:
```python
ubq = UpdateByQuery.from_dict({"query": {"match": {"title": "python"}}})
```
If you wish to modify an existing `Update By Query` object, overriding it’s properties, instead use the `update_from_dict` method that alters an instance **in-place**:
```python
ubq = UpdateByQuery(index='i')
ubq.update_from_dict({"query": {"match": {"title": "python"}}, "size": 42})
```
#### Extra properties and parameters [_extra_properties_and_parameters_2]
To set extra properties of the search request, use the `.extra()` method. This can be used to define keys in the body that cannot be defined via a specific API method like `explain`:
```python
ubq = ubq.extra(explain=True)
```
To set query parameters, use the `.params()` method:
```python
ubq = ubq.params(routing="42")
```
### Response [_response_3]
You can execute your search by calling the `.execute()` method that will return a `Response` object. The `Response` object allows you access to any key from the response dictionary via attribute access. It also provides some convenient helpers:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = ubq.execute()
print(response.success())
# True
print(response.took)
# 12
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
response = await ubq.execute()
print(response.success())
# True
print(response.took)
# 12
```
:::
::::
If you want to inspect the contents of the `response` objects, use its `to_dict` method to get access to the raw data for pretty printing.
## ES|QL Queries
When working with `Document` classes, you can use the ES|QL query language to retrieve documents. For this you can use the `esql_from()` and `esql_execute()` methods available to all sub-classes of `Document`.
Consider the following `Employee` document definition:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import Document, InnerDoc, M
class Address(InnerDoc):
address: M[str]
city: M[str]
zip_code: M[str]
class Employee(Document):
emp_no: M[int]
first_name: M[str]
last_name: M[str]
height: M[float]
still_hired: M[bool]
address: M[Address]
class Index:
name = 'employees'
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import AsyncDocument, InnerDoc, M
class Address(InnerDoc):
address: M[str]
city: M[str]
zip_code: M[str]
class Employee(AsyncDocument):
emp_no: M[int]
first_name: M[str]
last_name: M[str]
height: M[float]
still_hired: M[bool]
address: M[Address]
class Index:
name = 'employees'
```
:::
::::
The `esql_from()` method creates a base ES|QL query for the index associated with the document class. The following example creates a base query for the `Employee` class:
```python
query = Employee.esql_from()
```
This query includes a `FROM` command with the index name, and a `KEEP` command that retrieves all the document attributes.
To execute this query and receive the results, you can pass the query to the `esql_execute()` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
for emp in Employee.esql_execute(query):
print(f"{emp.name} from {emp.address.city} is {emp.height:.2f}m tall")
```
:::
:::{tab-item} Async Python
:sync: async
```python
async for emp in Employee.esql_execute(query):
print(f"{emp.name} from {emp.address.city} is {emp.height:.2f}m tall")
```
:::
::::
In this example, the `esql_execute()` class method runs the query and returns all the documents in the index, up to the maximum of 1000 results allowed by ES|QL. Here is a possible output from this example:
```
Kevin Macias from North Robert is 1.60m tall
Drew Harris from Boltonshire is 1.68m tall
Julie Williams from Maddoxshire is 1.99m tall
Christopher Jones from Stevenbury is 1.98m tall
Anthony Lopez from Port Sarahtown is 2.42m tall
Tricia Stone from North Sueshire is 2.39m tall
Katherine Ramirez from Kimberlyton is 1.83m tall
...
```
To search for specific documents you can extend the base query with additional ES|QL commands that narrow the search criteria. The next example searches for documents that include only employees that are taller than 2 meters, sorted by their last name. It also limits the results to 4 people:
```python
query = (
Employee.esql_from()
.where(Employee.height > 2)
.sort(Employee.last_name)
.limit(4)
)
```
When running this query with the same for-loop shown above, possible results would be:
```
Michael Adkins from North Stacey is 2.48m tall
Kimberly Allen from Toddside is 2.24m tall
Crystal Austin from East Michaelchester is 2.30m tall
Rebecca Berger from Lake Adrianside is 2.40m tall
```
### Additional fields
ES|QL provides a few ways to add new fields to a query, for example through the `EVAL` command. The following example shows a query that adds an evaluated field:
```python
from elasticsearch.esql import E, functions
query = (
Employee.esql_from()
.eval(height_cm=functions.round(Employee.height * 100))
.where(E("height_cm") >= 200)
.sort(Employee.last_name)
.limit(10)
)
```
In this example we are adding the height in centimeters to the query, calculated from the `height` document field, which is in meters. The `height_cm` calculated field is available to use in other query clauses, and in particular is referenced in `where()` in this example. Note how the new field is given as `E("height_cm")` in this clause. The `E()` wrapper tells the query builder that the argument is an ES|QL field name and not a string literal. This is done automatically for document fields that are given as class attributes, such as `Employee.height` in the `eval()`. The `E()` wrapper is only needed for fields that are not in the document.
By default, the `esql_execute()` method returns only document instances. To receive any additional fields that are not part of the document in the query results, the `return_additional=True` argument can be passed to it, and then the results are returned as tuples with the document as first element, and a dictionary with the additional fields as second element:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
for emp, additional in Employee.esql_execute(query, return_additional=True):
print(emp.name, additional)
```
:::
:::{tab-item} Async Python
:sync: async
```python
async for emp, additional in Employee.esql_execute(query, return_additional=True):
print(emp.name, additional)
```
:::
::::
Example output from the query given above:
```
Michael Adkins {'height_cm': 248.0}
Kimberly Allen {'height_cm': 224.0}
Crystal Austin {'height_cm': 230.0}
Rebecca Berger {'height_cm': 240.0}
Katherine Blake {'height_cm': 214.0}
Edward Butler {'height_cm': 246.0}
Steven Carlson {'height_cm': 242.0}
Mark Carter {'height_cm': 240.0}
Joseph Castillo {'height_cm': 229.0}
Alexander Cohen {'height_cm': 245.0}
```
### Missing fields
The base query returned by the `esql_from()` method includes a `KEEP` command with the complete list of fields that are part of the document. If any subsequent clauses added to the query remove fields that are part of the document, then the `esql_execute()` method will raise an exception, because it will not be able construct complete document instances to return as results.
To prevent errors, it is recommended that the `keep()` and `drop()` clauses are not used when working with `Document` instances.
If a query has missing fields, it can be forced to execute without errors by passing the `ignore_missing_fields=True` argument to `esql_execute()`. When this option is used, returned documents will have any missing fields set to `None`.
## Using asyncio with Elasticsearch Python DSL [asyncio]
The DSL module supports async/await with [asyncio](https://docs.python.org/3/library/asyncio.html). To ensure that you have all the required dependencies, install the `[async]` extra:
```bash
$ python -m pip install "elasticsearch[async]"
```
The DSL module also supports [Trio](https://trio.readthedocs.io/en/stable/) when using the Async HTTPX client. You do need to install Trio and HTTPX separately:
```bash
$ python -m pip install "elasticsearch trio httpx"
```
### Connections [_connections]
Use the `connections` module to manage your synchronous connections.
```python
from elasticsearch.dsl import connections
connections.create_connection(hosts=['https://localhost:9200'], request_timeout=20)
```
For asynchronous connection management, use the `async_connections` module:
```python
from elasticsearch.dsl import async_connections
async_connections.create_connection(hosts=['https://localhost:9200'], request_timeout=20)
```
If you're using Trio, you need to explicitly request the Async HTTP client:
```python
from elasticsearch.dsl import async_connections
async_connections.create_connection(hosts=['https://localhost:9200'], node_class="httpxasync")
```
#### How to avoid *Unclosed client session / connector* warnings on exit [_how_to_avoid_unclosed_client_session_connector_warnings_on_exit]
These warnings come from the `aiohttp` package, which is used internally by the `AsyncElasticsearch` client. They appear often when the application exits and are caused by HTTP connections that are open when they are garbage collected. To avoid these warnings, make sure that you close your connections.
```python
es = async_connections.get_connection()
await es.close()
```
### Search DSL [_search_dsl]
Use the `AsyncSearch` class to perform asynchronous searches.
```python
from elasticsearch.dsl import AsyncSearch
from elasticsearch.dsl.query import Match
s = AsyncSearch().query(Match("title", "python"))
async for hit in s:
print(hit.title)
```
Instead of using the `AsyncSearch` object as an asynchronous iterator, you can explicitly call the `execute()` method to get a `Response` object.
```python
s = AsyncSearch().query(Match("title", "python"))
response = await s.execute()
for hit in response:
print(hit.title)
```
An `AsyncMultiSearch` is available as well.
```python
from elasticsearch.dsl import AsyncMultiSearch
from elasticsearch.dsl.query import Term
ms = AsyncMultiSearch(index='blogs')
ms = ms.add(AsyncSearch().filter(Term("tags", "python")))
ms = ms.add(AsyncSearch().filter(Term("tags", "elasticsearch")))
responses = await ms.execute()
for response in responses:
print("Results for query %r." % response.search.query)
for hit in response:
print(hit.title)
```
### Asynchronous Documents, Indexes, and more [_asynchronous_documents_indexes_and_more]
The `Document`, `BaseESModel`, `Index`, `IndexTemplate`, `Mapping`, `UpdateByQuery` and `FacetedSearch` classes all have asynchronous versions that use the same name with an `Async` prefix. These classes expose the same interfaces as the synchronous versions, but any methods that perform I/O are defined as coroutines.
Auxiliary classes that do not perform I/O do not have asynchronous versions. The same classes can be used in synchronous and asynchronous applications.
When using a custom analyzer in an asynchronous application, use the `async_simulate()` method to invoke the Analyze API on it.
Consult the `api` section for details about each specific method.
python-elasticsearch-9.4.0/docs/reference/dsl_migrating.md 0000664 0000000 0000000 00000002377 15176617013 0023730 0 ustar 00root root 0000000 0000000 # Migrating from the `elasticsearch-dsl` package [_migrating_from_elasticsearch_dsl_package]
In the past the Elasticsearch Python DSL module was distributed as a standalone package called `elasticsearch-dsl`. This package is now deprecated as all its functionality has been integrated into the main Python client. We recommend all developers to migrate their applications and remove their dependency on the `elasticsearch-dsl` package.
To migrate your application, all references to `elasticsearch_dsl` as a top-level package must be changed to `elasticsearch.dsl`. In other words, the underscore from the package name should be replaced by a period.
Here are a few examples:
```python
# from:
from elasticsearch_dsl import Date, Document, InnerDoc, Text, connections
# to:
from elasticsearch.dsl import Date, Document, InnerDoc, Text, connections
# from:
from elasticsearch_dsl.query import MultiMatch
# to:
from elasticsearch.dsl.query import MultiMatch
# from:
import elasticsearch_dsl as dsl
# to:
from elasticsearch import dsl
# from:
import elasticsearch_dsl
# to:
from elasticsearch import dsl as elasticsearch_dsl
# from:
import elasticsearch_dsl
# to:
from elasticsearch import dsl
# and replace all references to "elasticsearch_dsl" in the code with "dsl"
```
python-elasticsearch-9.4.0/docs/reference/dsl_tutorials.md 0000664 0000000 0000000 00000033450 15176617013 0023771 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/_tutorials.html
---
# Tutorials [_tutorials]
## Search [_search]
Let’s have a typical search request written directly as a `dict`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
client = Elasticsearch("https://localhost:9200")
response = client.search(
index="my-index",
body={
"query": {
"bool": {
"must": [{"match": {"title": "python"}}],
"must_not": [{"match": {"description": "beta"}}],
"filter": [{"term": {"category": "search"}}]
}
},
"aggs" : {
"per_tag": {
"terms": {"field": "tags"},
"aggs": {
"max_lines": {"max": {"field": "lines"}}
}
}
}
}
)
for hit in response['hits']['hits']:
print(hit['_score'], hit['_source']['title'])
for tag in response['aggregations']['per_tag']['buckets']:
print(tag['key'], tag['max_lines']['value'])
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch("https://localhost:9200")
async def example():
response = await client.search(
index="my-index",
body={
"query": {
"bool": {
"must": [{"match": {"title": "python"}}],
"must_not": [{"match": {"description": "beta"}}],
"filter": [{"term": {"category": "search"}}]
}
},
"aggs" : {
"per_tag": {
"terms": {"field": "tags"},
"aggs": {
"max_lines": {"max": {"field": "lines"}}
}
}
}
}
)
for hit in response['hits']['hits']:
print(hit['_score'], hit['_source']['title'])
for tag in response['aggregations']['per_tag']['buckets']:
print(tag['key'], tag['max_lines']['value'])
```
:::
::::
The problem with this approach is that it is verbose, prone to syntax mistakes like incorrect nesting, hard to modify (for example adding another filter) and definitely not fun to write.
Let’s rewrite the example using the DSL module:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
from elasticsearch.dsl import Search, query, aggs
client = Elasticsearch("https://localhost:9200")
s = Search(using=client, index="my-index") \
.query(query.Match("title", "python")) \
.filter(query.Term("category", "search")) \
.exclude(query.Match("description", "beta"))
s.aggs.bucket('per_tag', aggs.Terms(field="tags")) \
.metric('max_lines', aggs.Max(field='lines'))
response = s.execute()
for hit in response:
print(hit.meta.score, hit.title)
for tag in response.aggregations.per_tag.buckets:
print(tag.key, tag.max_lines.value)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch
from elasticsearch.dsl import AsyncSearch, query, aggs
client = AsyncElasticsearch("https://localhost:9200")
async def example():
s = AsyncSearch(using=client, index="my-index") \
.query(query.Match("title", "python")) \
.filter(query.Term("category", "search")) \
.exclude(query.Match("description", "beta"))
s.aggs.bucket('per_tag', aggs.Terms(field="tags")) \
.metric('max_lines', aggs.Max(field='lines'))
response = await s.execute()
for hit in response:
print(hit.meta.score, hit.title)
for tag in response.aggregations.per_tag.buckets:
print(tag.key, tag.max_lines.value)
```
:::
::::
As you see, the DSL module took care of:
* creating appropriate `Query` objects from classes
* composing queries into a compound `bool` query
* putting the `term` query in a filter context of the `bool` query
* providing a convenient access to response data
* no curly or square brackets everywhere
## Persistence [_persistence]
Let’s have a simple Python class representing an article in a blogging system:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from datetime import datetime
from elasticsearch.dsl import Document, Date, Integer, Keyword, Text, connections, mapped_field
# Define a default Elasticsearch client
connections.create_connection(hosts="https://localhost:9200")
class Article(Document):
title: str = mapped_field(Text(analyzer='snowball', fields={'raw': Keyword()}))
body: str = mapped_field(Text(analyzer='snowball'))
tags: list[str] = mapped_field(Keyword())
published_from: datetime
lines: int
class Index:
name = 'blog'
settings = {
"number_of_shards": 2,
}
def save(self, **kwargs):
self.lines = len(self.body.split())
return super(Article, self).save(** kwargs)
def is_published(self):
return datetime.now() > self.published_from
# create the mappings in elasticsearch
Article.init()
# create and save and article
article = Article(meta={'id': 42}, title='Hello world!', tags=['test'])
article.body = ''' looong text '''
article.published_from = datetime.now()
article.save()
article = Article.get(id=42)
print(article.is_published())
# Display cluster health
print(connections.get_connection().cluster.health())
```
:::
:::{tab-item} Async Python
:sync: async
```python
from datetime import datetime
from elasticsearch.dsl import AsyncDocument, Date, Integer, Keyword, Text, async_connections, mapped_field
# Define a default Elasticsearch client
async_connections.create_connection(hosts="https://localhost:9200")
class Article(AsyncDocument):
title: str = mapped_field(Text(analyzer='snowball', fields={'raw': Keyword()}))
body: str = mapped_field(Text(analyzer='snowball'))
tags: list[str] = mapped_field(Keyword())
published_from: datetime
lines: int
class Index:
name = 'blog'
settings = {
"number_of_shards": 2,
}
async def save(self, **kwargs):
self.lines = len(self.body.split())
return await super(Article, self).save(** kwargs)
def is_published(self):
return datetime.now() > self.published_from
async def example():
# create the mappings in elasticsearch
await Article.init()
# create and save and article
article = Article(meta={'id': 42}, title='Hello world!', tags=['test'])
article.body = ''' looong text '''
article.published_from = datetime.now()
await article.save()
article = await Article.get(id=42)
print(article.is_published())
# Display cluster health
print(await async_connections.get_connection().cluster.health())
```
:::
::::
In this example you can see:
* providing a default connection
* defining fields with Python type hints and additional mapping configuration when necessary
* setting index name
* defining custom methods
* overriding the built-in `.save()` method to hook into the persistence life cycle
* retrieving and saving the object into Elasticsearch
* accessing the underlying client for other APIs
You can see more in the [persistence](dsl_how_to_guides.md#_persistence_2) chapter.
## Pre-built Faceted Search [_pre_built_faceted_search]
If you have your `Document`s defined you can create a faceted search class to simplify searching and filtering.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import FacetedSearch, TermsFacet, DateHistogramFacet
class BlogSearch(FacetedSearch):
doc_types = [Article, ]
# fields that should be searched
fields = ['tags', 'title', 'body']
facets = {
# use bucket aggregations to define facets
'tags': TermsFacet(field='tags'),
'publishing_frequency': DateHistogramFacet(field='published_from', interval='month')
}
# empty search
bs = BlogSearch()
response = bs.execute()
for hit in response:
print(hit.meta.score, hit.title)
for (tag, count, selected) in response.facets.tags:
print(tag, ' (SELECTED):' if selected else ':', count)
for (month, count, selected) in response.facets.publishing_frequency:
print(month.strftime('%B %Y'), ' (SELECTED):' if selected else ':', count)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import AsyncFacetedSearch, TermsFacet, DateHistogramFacet
class BlogSearch(AsyncFacetedSearch):
doc_types = [Article, ]
# fields that should be searched
fields = ['tags', 'title', 'body']
facets = {
# use bucket aggregations to define facets
'tags': TermsFacet(field='tags'),
'publishing_frequency': DateHistogramFacet(field='published_from', interval='month')
}
async def example():
# empty search
bs = BlogSearch()
response = await bs.execute()
for hit in response:
print(hit.meta.score, hit.title)
for (tag, count, selected) in response.facets.tags:
print(tag, ' (SELECTED):' if selected else ':', count)
for (month, count, selected) in response.facets.publishing_frequency:
print(month.strftime('%B %Y'), ' (SELECTED):' if selected else ':', count)
```
:::
::::
You can find more details in the `faceted_search` chapter.
## Update By Query [_update_by_query]
Let’s resume the simple example of articles on a blog, and let’s assume that each article has a number of likes. For this example, imagine we want to increment the number of likes by 1 for all articles that match a certain tag and do not match a certain description. Writing this as a `dict`, we would have the following code:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
client = Elasticsearch()
response = client.update_by_query(
index="my-index",
body={
"query": {
"bool": {
"must": [{"match": {"tag": "python"}}],
"must_not": [{"match": {"description": "beta"}}]
}
},
"script"={
"source": "ctx._source.likes++",
"lang": "painless"
}
},
)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch()
async def example():
response = await client.update_by_query(
index="my-index",
body={
"query": {
"bool": {
"must": [{"match": {"tag": "python"}}],
"must_not": [{"match": {"description": "beta"}}]
}
},
"script"={
"source": "ctx._source.likes++",
"lang": "painless"
}
},
)
```
:::
::::
Using the DSL, we can now express this query as such:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
from elasticsearch.dsl import Search, UpdateByQuery
from elasticsearch.dsl.query import Match
client = Elasticsearch()
ubq = UpdateByQuery(using=client, index="my-index") \
.query(Match("title", "python")) \
.exclude(Match("description", "beta")) \
.script(source="ctx._source.likes++", lang="painless")
response = ubq.execute()
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch import AsyncElasticsearch
from elasticsearch.dsl import AsyncSearch, AsyncUpdateByQuery
from elasticsearch.dsl.query import Match
client = AsyncElasticsearch()
async def example():
ubq = UpdateByQuery(using=client, index="my-index") \
.query(Match("title", "python")) \
.exclude(Match("description", "beta")) \
.script(source="ctx._source.likes++", lang="painless")
response = await ubq.execute()
```
:::
::::
As you can see, the `Update By Query` object provides many of the savings offered by the `Search` object, and additionally allows one to update the results of the search based on a script assigned in the same manner.
## ES|QL Queries
The DSL module features an integration with the ES|QL query builder, consisting of two methods available in all `Document` sub-classes: `esql_from()` and `esql_execute()`. Using the `Article` document from above, we can search for up to ten articles that include `"world"` in their titles with the following ES|QL query:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.esql import functions
query = Article.esql_from().where(functions.match(Article.title, 'world')).limit(10)
for a in Article.esql_execute(query):
print(a.title)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.esql import functions
async def example():
query = Article.esql_from().where(functions.match(Article.title, 'world')).limit(10)
async for a in Article.esql_execute(query):
print(a.title)
```
:::
::::
Review the [ES|QL query builder section](esql-query-builder.md) to learn more about building ES|QL queries in Python.
## Migration from the standard client [_migration_from_the_standard_client]
You don’t have to port your entire application to get the benefits of the DSL module, you can start gradually by creating a `Search` object from your existing `dict`, modifying it using the API and serializing it back to a `dict`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
body = {...} # insert complicated query here
# Convert to Search object
s = Search.from_dict(body)
# Add some filters, aggregations, queries, ...
s.filter(query.Term("tags", "python"))
# Convert back to dict to plug back into existing code
body = s.to_dict()
```
:::
:::{tab-item} Async Python
:sync: async
```python
body = {...} # insert complicated query here
# Convert to Search object
s = AsyncSearch.from_dict(body)
# Add some filters, aggregations, queries, ...
s.filter(query.Term("tags", "python"))
# Convert back to dict to plug back into existing code
body = s.to_dict()
```
:::
::::
python-elasticsearch-9.4.0/docs/reference/elasticsearch-dsl.md 0000664 0000000 0000000 00000003123 15176617013 0024465 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/elasticsearch-dsl.html
---
# Elasticsearch Python DSL [elasticsearch-dsl]
Elasticsearch DSL is a module of the official Python client that aims to help with writing and running queries against Elasticsearch in a more convenient and idiomatic way. It stays close to the Elasticsearch JSON DSL, mirroring its terminology and structure. It exposes the whole range of the DSL from Python either directly using defined classes or a queryset-like expressions. Here is an example:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch.dsl import Search
from elasticsearch.dsl.query import Match, Term
s = Search(index="my-index") \
.query(Match("title", "python")) \
.filter(Term("category", "search")) \
.exclude(Match("description", "beta"))
for hit in s:
print(hit.title)
```
:::
:::{tab-item} Async Python
:sync: async
```python
from elasticsearch.dsl import AsyncSearch
from elasticsearch.dsl.query import Match, Term
async def run_query():
s = AsyncSearch(index="my-index") \
.query(Match("title", "python")) \
.filter(Term("category", "search")) \
.exclude(Match("description", "beta"))
async for hit in s:
print(hit.title)
```
:::
::::
It also provides an optional wrapper for working with documents as Python objects: defining mappings, retrieving and saving documents, wrapping the document data in user-defined classes.
For other Elasticsearch APIs such as cluster health, use the regular client.
python-elasticsearch-9.4.0/docs/reference/esql-pandas.md 0000664 0000000 0000000 00000127743 15176617013 0023322 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/esql-pandas.html
---
# ES|QL and Pandas [esql-pandas]
The [Elasticsearch Query Language (ES|QL)](docs-content://explore-analyze/query-filter/languages/esql.md) provides a powerful way to filter, transform, and analyze data stored in {{es}}. Designed to be efficient to learn and use, it is a perfect fit for data scientists familiar with Pandas and other dataframe-based libraries. ES|QL queries produce tables with named columns, which is the definition of dataframes.
This page shows you an example of using ES|QL and Pandas together to work with dataframes.
## Import data [import-data]
Use the [`employees` sample data](https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/esql/qa/testFixtures/src/main/resources/employees.csv) and [mapping](https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/esql/qa/testFixtures/src/main/resources/mapping-default.json). The easiest way to load this dataset is to run [two Elasticsearch API requests](https://gist.github.com/pquentin/7cf29a5932cf52b293699dd994b1a276) in the Kibana Console.
::::{dropdown} Index mapping request
```console
PUT employees
{
"mappings": {
"properties": {
"avg_worked_seconds": {
"type": "long"
},
"birth_date": {
"type": "date"
},
"emp_no": {
"type": "integer"
},
"first_name": {
"type": "keyword"
},
"gender": {
"type": "keyword"
},
"height": {
"type": "double",
"fields": {
"float": {
"type": "float"
},
"half_float": {
"type": "half_float"
},
"scaled_float": {
"type": "scaled_float",
"scaling_factor": 100
}
}
},
"hire_date": {
"type": "date"
},
"is_rehired": {
"type": "boolean"
},
"job_positions": {
"type": "keyword"
},
"languages": {
"type": "integer",
"fields": {
"byte": {
"type": "byte"
},
"long": {
"type": "long"
},
"short": {
"type": "short"
}
}
},
"last_name": {
"type": "keyword"
},
"salary": {
"type": "integer"
},
"salary_change": {
"type": "double",
"fields": {
"int": {
"type": "integer"
},
"keyword": {
"type": "keyword"
},
"long": {
"type": "long"
}
}
},
"still_hired": {
"type": "boolean"
}
}
}
}
```
::::
::::{dropdown} Bulk request to ingest data
```console
PUT employees/_bulk
{ "index": {}}
{"birth_date":"1953-09-02T00:00:00Z","emp_no":"10001","first_name":"Georgi","gender":"M","hire_date":"1986-06-26T00:00:00Z","languages":"2","last_name":"Facello","salary":"57305","height":"2.03","still_hired":"true","avg_worked_seconds":"268728049","job_positions":["Senior Python Developer","Accountant"],"is_rehired":["false","true"],"salary_change":"1.19"}
{ "index": {}}
{"birth_date":"1964-06-02T00:00:00Z","emp_no":"10002","first_name":"Bezalel","gender":"F","hire_date":"1985-11-21T00:00:00Z","languages":"5","last_name":"Simmel","salary":"56371","height":"2.08","still_hired":"true","avg_worked_seconds":"328922887","job_positions":"Senior Team Lead","is_rehired":["false","false"],"salary_change":["-7.23","11.17"]}
{ "index": {}}
{"birth_date":"1959-12-03T00:00:00Z","emp_no":"10003","first_name":"Parto","gender":"M","hire_date":"1986-08-28T00:00:00Z","languages":"4","last_name":"Bamford","salary":"61805","height":"1.83","still_hired":"false","avg_worked_seconds":"200296405","salary_change":["14.68","12.82"]}
{ "index": {}}
{"birth_date":"1954-05-01T00:00:00Z","emp_no":"10004","first_name":"Chirstian","gender":"M","hire_date":"1986-12-01T00:00:00Z","languages":"5","last_name":"Koblick","salary":"36174","height":"1.78","still_hired":"true","avg_worked_seconds":"311267831","job_positions":["Reporting Analyst","Tech Lead","Head Human Resources","Support Engineer"],"is_rehired":"true","salary_change":["3.65","-0.35","1.13","13.48"]}
{ "index": {}}
{"birth_date":"1955-01-21T00:00:00Z","emp_no":"10005","first_name":"Kyoichi","gender":"M","hire_date":"1989-09-12T00:00:00Z","languages":"1","last_name":"Maliniak","salary":"63528","height":"2.05","still_hired":"true","avg_worked_seconds":"244294991","is_rehired":["false","false","false","true"],"salary_change":["-2.14","13.07"]}
{ "index": {}}
{"birth_date":"1953-04-20T00:00:00Z","emp_no":"10006","first_name":"Anneke","gender":"F","hire_date":"1989-06-02T00:00:00Z","languages":"3","last_name":"Preusig","salary":"60335","height":"1.56","still_hired":"false","avg_worked_seconds":"372957040","job_positions":["Tech Lead","Principal Support Engineer","Senior Team Lead"],"salary_change":"-3.90"}
{ "index": {}}
{"birth_date":"1957-05-23T00:00:00Z","emp_no":"10007","first_name":"Tzvetan","gender":"F","hire_date":"1989-02-10T00:00:00Z","languages":"4","last_name":"Zielinski","salary":"74572","height":"1.70","still_hired":"true","avg_worked_seconds":"393084805","is_rehired":["true","false","true","false"],"salary_change":["-7.06","1.99","0.57"]}
{ "index": {}}
{"birth_date":"1958-02-19T00:00:00Z","emp_no":"10008","first_name":"Saniya","gender":"M","hire_date":"1994-09-15T00:00:00Z","languages":"2","last_name":"Kalloufi","salary":"43906","height":"2.10","still_hired":"true","avg_worked_seconds":"283074758","job_positions":["Senior Python Developer","Junior Developer","Purchase Manager","Internship"],"is_rehired":["true","false"],"salary_change":["12.68","3.54","0.75","-2.92"]}
{ "index": {}}
{"birth_date":"1952-04-19T00:00:00Z","emp_no":"10009","first_name":"Sumant","gender":"F","hire_date":"1985-02-18T00:00:00Z","languages":"1","last_name":"Peac","salary":"66174","height":"1.85","still_hired":"false","avg_worked_seconds":"236805489","job_positions":["Senior Python Developer","Internship"]}
{ "index": {}}
{"birth_date":"1963-06-01T00:00:00Z","emp_no":"10010","first_name":"Duangkaew","hire_date":"1989-08-24T00:00:00Z","languages":"4","last_name":"Piveteau","salary":"45797","height":"1.70","still_hired":"false","avg_worked_seconds":"315236372","job_positions":["Architect","Reporting Analyst","Tech Lead","Purchase Manager"],"is_rehired":["true","true","false","false"],"salary_change":["5.05","-6.77","4.69","12.15"]}
{ "index": {}}
{"birth_date":"1953-11-07T00:00:00Z","emp_no":"10011","first_name":"Mary","hire_date":"1990-01-22T00:00:00Z","languages":"5","last_name":"Sluis","salary":"31120","height":"1.50","still_hired":"true","avg_worked_seconds":"239615525","job_positions":["Architect","Reporting Analyst","Tech Lead","Senior Team Lead"],"is_rehired":["true","true"],"salary_change":["10.35","-7.82","8.73","3.48"]}
{ "index": {}}
{"birth_date":"1960-10-04T00:00:00Z","emp_no":"10012","first_name":"Patricio","hire_date":"1992-12-18T00:00:00Z","languages":"5","last_name":"Bridgland","salary":"48942","height":"1.97","still_hired":"false","avg_worked_seconds":"365510850","job_positions":["Head Human Resources","Accountant"],"is_rehired":["false","true","true","false"],"salary_change":"0.04"}
{ "index": {}}
{"birth_date":"1963-06-07T00:00:00Z","emp_no":"10013","first_name":"Eberhardt","hire_date":"1985-10-20T00:00:00Z","languages":"1","last_name":"Terkki","salary":"48735","height":"1.94","still_hired":"true","avg_worked_seconds":"253864340","job_positions":"Reporting Analyst","is_rehired":["true","true"]}
{ "index": {}}
{"birth_date":"1956-02-12T00:00:00Z","emp_no":"10014","first_name":"Berni","hire_date":"1987-03-11T00:00:00Z","languages":"5","last_name":"Genin","salary":"37137","height":"1.99","still_hired":"false","avg_worked_seconds":"225049139","job_positions":["Reporting Analyst","Data Scientist","Head Human Resources"],"salary_change":["-1.89","9.07"]}
{ "index": {}}
{"birth_date":"1959-08-19T00:00:00Z","emp_no":"10015","first_name":"Guoxiang","hire_date":"1987-07-02T00:00:00Z","languages":"5","last_name":"Nooteboom","salary":"25324","height":"1.66","still_hired":"true","avg_worked_seconds":"390266432","job_positions":["Principal Support Engineer","Junior Developer","Head Human Resources","Support Engineer"],"is_rehired":["true","false","false","false"],"salary_change":["14.25","12.40"]}
{ "index": {}}
{"birth_date":"1961-05-02T00:00:00Z","emp_no":"10016","first_name":"Kazuhito","hire_date":"1995-01-27T00:00:00Z","languages":"2","last_name":"Cappelletti","salary":"61358","height":"1.54","still_hired":"false","avg_worked_seconds":"253029411","job_positions":["Reporting Analyst","Python Developer","Accountant","Purchase Manager"],"is_rehired":["false","false"],"salary_change":["-5.18","7.69"]}
{ "index": {}}
{"birth_date":"1958-07-06T00:00:00Z","emp_no":"10017","first_name":"Cristinel","hire_date":"1993-08-03T00:00:00Z","languages":"2","last_name":"Bouloucos","salary":"58715","height":"1.74","still_hired":"false","avg_worked_seconds":"236703986","job_positions":["Data Scientist","Head Human Resources","Purchase Manager"],"is_rehired":["true","false","true","true"],"salary_change":"-6.33"}
{ "index": {}}
{"birth_date":"1954-06-19T00:00:00Z","emp_no":"10018","first_name":"Kazuhide","hire_date":"1987-04-03T00:00:00Z","languages":"2","last_name":"Peha","salary":"56760","height":"1.97","still_hired":"false","avg_worked_seconds":"309604079","job_positions":"Junior Developer","is_rehired":["false","false","true","true"],"salary_change":["-1.64","11.51","-5.32"]}
{ "index": {}}
{"birth_date":"1953-01-23T00:00:00Z","emp_no":"10019","first_name":"Lillian","hire_date":"1999-04-30T00:00:00Z","languages":"1","last_name":"Haddadi","salary":"73717","height":"2.06","still_hired":"false","avg_worked_seconds":"342855721","job_positions":"Purchase Manager","is_rehired":["false","false"],"salary_change":["-6.84","8.42","-7.26"]}
{ "index": {}}
{"birth_date":"1952-12-24T00:00:00Z","emp_no":"10020","first_name":"Mayuko","gender":"M","hire_date":"1991-01-26T00:00:00Z","last_name":"Warwick","salary":"40031","height":"1.41","still_hired":"false","avg_worked_seconds":"373309605","job_positions":"Tech Lead","is_rehired":["true","true","false"],"salary_change":"-5.81"}
{ "index": {}}
{"birth_date":"1960-02-20T00:00:00Z","emp_no":"10021","first_name":"Ramzi","gender":"M","hire_date":"1988-02-10T00:00:00Z","last_name":"Erde","salary":"60408","height":"1.47","still_hired":"false","avg_worked_seconds":"287654610","job_positions":"Support Engineer","is_rehired":"true"}
{ "index": {}}
{"birth_date":"1952-07-08T00:00:00Z","emp_no":"10022","first_name":"Shahaf","gender":"M","hire_date":"1995-08-22T00:00:00Z","last_name":"Famili","salary":"48233","height":"1.82","still_hired":"false","avg_worked_seconds":"233521306","job_positions":["Reporting Analyst","Data Scientist","Python Developer","Internship"],"is_rehired":["true","false"],"salary_change":["12.09","2.85"]}
{ "index": {}}
{"birth_date":"1953-09-29T00:00:00Z","emp_no":"10023","first_name":"Bojan","gender":"F","hire_date":"1989-12-17T00:00:00Z","last_name":"Montemayor","salary":"47896","height":"1.75","still_hired":"true","avg_worked_seconds":"330870342","job_positions":["Accountant","Support Engineer","Purchase Manager"],"is_rehired":["true","true","false"],"salary_change":["14.63","0.80"]}
{ "index": {}}
{"birth_date":"1958-09-05T00:00:00Z","emp_no":"10024","first_name":"Suzette","gender":"F","hire_date":"1997-05-19T00:00:00Z","last_name":"Pettey","salary":"64675","height":"2.08","still_hired":"true","avg_worked_seconds":"367717671","job_positions":"Junior Developer","is_rehired":["true","true","true","true"]}
{ "index": {}}
{"birth_date":"1958-10-31T00:00:00Z","emp_no":"10025","first_name":"Prasadram","gender":"M","hire_date":"1987-08-17T00:00:00Z","last_name":"Heyers","salary":"47411","height":"1.87","still_hired":"false","avg_worked_seconds":"371270797","job_positions":"Accountant","is_rehired":["true","false"],"salary_change":["-4.33","-2.90","12.06","-3.46"]}
{ "index": {}}
{"birth_date":"1953-04-03T00:00:00Z","emp_no":"10026","first_name":"Yongqiao","gender":"M","hire_date":"1995-03-20T00:00:00Z","last_name":"Berztiss","salary":"28336","height":"2.10","still_hired":"true","avg_worked_seconds":"359208133","job_positions":"Reporting Analyst","is_rehired":["false","true"],"salary_change":["-7.37","10.62","11.20"]}
{ "index": {}}
{"birth_date":"1962-07-10T00:00:00Z","emp_no":"10027","first_name":"Divier","gender":"F","hire_date":"1989-07-07T00:00:00Z","last_name":"Reistad","salary":"73851","height":"1.53","still_hired":"false","avg_worked_seconds":"374037782","job_positions":"Senior Python Developer","is_rehired":"false"}
{ "index": {}}
{"birth_date":"1963-11-26T00:00:00Z","emp_no":"10028","first_name":"Domenick","gender":"M","hire_date":"1991-10-22T00:00:00Z","last_name":"Tempesti","salary":"39356","height":"2.07","still_hired":"true","avg_worked_seconds":"226435054","job_positions":["Tech Lead","Python Developer","Accountant","Internship"],"is_rehired":["true","false","false","true"]}
{ "index": {}}
{"birth_date":"1956-12-13T00:00:00Z","emp_no":"10029","first_name":"Otmar","gender":"M","hire_date":"1985-11-20T00:00:00Z","last_name":"Herbst","salary":"74999","height":"1.99","still_hired":"false","avg_worked_seconds":"257694181","job_positions":["Senior Python Developer","Data Scientist","Principal Support Engineer"],"is_rehired":"true","salary_change":["-0.32","-1.90","-8.19"]}
{ "index": {}}
{"birth_date":"1958-07-14T00:00:00Z","emp_no":"10030","gender":"M","hire_date":"1994-02-17T00:00:00Z","languages":"3","last_name":"Demeyer","salary":"67492","height":"1.92","still_hired":"false","avg_worked_seconds":"394597613","job_positions":["Tech Lead","Data Scientist","Senior Team Lead"],"is_rehired":["true","false","false"],"salary_change":"-0.40"}
{ "index": {}}
{"birth_date":"1959-01-27T00:00:00Z","emp_no":"10031","gender":"M","hire_date":"1991-09-01T00:00:00Z","languages":"4","last_name":"Joslin","salary":"37716","height":"1.68","still_hired":"false","avg_worked_seconds":"348545109","job_positions":["Architect","Senior Python Developer","Purchase Manager","Senior Team Lead"],"is_rehired":"false"}
{ "index": {}}
{"birth_date":"1960-08-09T00:00:00Z","emp_no":"10032","gender":"F","hire_date":"1990-06-20T00:00:00Z","languages":"3","last_name":"Reistad","salary":"62233","height":"2.10","still_hired":"false","avg_worked_seconds":"277622619","job_positions":["Architect","Senior Python Developer","Junior Developer","Purchase Manager"],"is_rehired":["false","false"],"salary_change":["9.32","-4.92"]}
{ "index": {}}
{"birth_date":"1956-11-14T00:00:00Z","emp_no":"10033","gender":"M","hire_date":"1987-03-18T00:00:00Z","languages":"1","last_name":"Merlo","salary":"70011","height":"1.63","still_hired":"false","avg_worked_seconds":"208374744","is_rehired":"true"}
{ "index": {}}
{"birth_date":"1962-12-29T00:00:00Z","emp_no":"10034","gender":"M","hire_date":"1988-09-21T00:00:00Z","languages":"1","last_name":"Swan","salary":"39878","height":"1.46","still_hired":"false","avg_worked_seconds":"214393176","job_positions":["Business Analyst","Data Scientist","Python Developer","Accountant"],"is_rehired":"false","salary_change":"-8.46"}
{ "index": {}}
{"birth_date":"1953-02-08T00:00:00Z","emp_no":"10035","gender":"M","hire_date":"1988-09-05T00:00:00Z","languages":"5","last_name":"Chappelet","salary":"25945","height":"1.81","still_hired":"false","avg_worked_seconds":"203838153","job_positions":["Senior Python Developer","Data Scientist"],"is_rehired":"false","salary_change":["-2.54","-6.58"]}
{ "index": {}}
{"birth_date":"1959-08-10T00:00:00Z","emp_no":"10036","gender":"M","hire_date":"1992-01-03T00:00:00Z","languages":"4","last_name":"Portugali","salary":"60781","height":"1.61","still_hired":"false","avg_worked_seconds":"305493131","job_positions":"Senior Python Developer","is_rehired":["true","false","false"]}
{ "index": {}}
{"birth_date":"1963-07-22T00:00:00Z","emp_no":"10037","gender":"M","hire_date":"1990-12-05T00:00:00Z","languages":"2","last_name":"Makrucki","salary":"37691","height":"2.00","still_hired":"true","avg_worked_seconds":"359217000","job_positions":["Senior Python Developer","Tech Lead","Accountant"],"is_rehired":"false","salary_change":"-7.08"}
{ "index": {}}
{"birth_date":"1960-07-20T00:00:00Z","emp_no":"10038","gender":"M","hire_date":"1989-09-20T00:00:00Z","languages":"4","last_name":"Lortz","salary":"35222","height":"1.53","still_hired":"true","avg_worked_seconds":"314036411","job_positions":["Senior Python Developer","Python Developer","Support Engineer"]}
{ "index": {}}
{"birth_date":"1959-10-01T00:00:00Z","emp_no":"10039","gender":"M","hire_date":"1988-01-19T00:00:00Z","languages":"2","last_name":"Brender","salary":"36051","height":"1.55","still_hired":"false","avg_worked_seconds":"243221262","job_positions":["Business Analyst","Python Developer","Principal Support Engineer"],"is_rehired":["true","true"],"salary_change":"-6.90"}
{ "index": {}}
{"emp_no":"10040","first_name":"Weiyi","gender":"F","hire_date":"1993-02-14T00:00:00Z","languages":"4","last_name":"Meriste","salary":"37112","height":"1.90","still_hired":"false","avg_worked_seconds":"244478622","job_positions":"Principal Support Engineer","is_rehired":["true","false","true","true"],"salary_change":["6.97","14.74","-8.94","1.92"]}
{ "index": {}}
{"emp_no":"10041","first_name":"Uri","gender":"F","hire_date":"1989-11-12T00:00:00Z","languages":"1","last_name":"Lenart","salary":"56415","height":"1.75","still_hired":"false","avg_worked_seconds":"287789442","job_positions":["Data Scientist","Head Human Resources","Internship","Senior Team Lead"],"salary_change":["9.21","0.05","7.29","-2.94"]}
{ "index": {}}
{"emp_no":"10042","first_name":"Magy","gender":"F","hire_date":"1993-03-21T00:00:00Z","languages":"3","last_name":"Stamatiou","salary":"30404","height":"1.44","still_hired":"true","avg_worked_seconds":"246355863","job_positions":["Architect","Business Analyst","Junior Developer","Internship"],"salary_change":["-9.28","9.42"]}
{ "index": {}}
{"emp_no":"10043","first_name":"Yishay","gender":"M","hire_date":"1990-10-20T00:00:00Z","languages":"1","last_name":"Tzvieli","salary":"34341","height":"1.52","still_hired":"true","avg_worked_seconds":"287222180","job_positions":["Data Scientist","Python Developer","Support Engineer"],"is_rehired":["false","true","true"],"salary_change":["-5.17","4.62","7.42"]}
{ "index": {}}
{"emp_no":"10044","first_name":"Mingsen","gender":"F","hire_date":"1994-05-21T00:00:00Z","languages":"1","last_name":"Casley","salary":"39728","height":"2.06","still_hired":"false","avg_worked_seconds":"387408356","job_positions":["Tech Lead","Principal Support Engineer","Accountant","Support Engineer"],"is_rehired":["true","true"],"salary_change":"8.09"}
{ "index": {}}
{"emp_no":"10045","first_name":"Moss","gender":"M","hire_date":"1989-09-02T00:00:00Z","languages":"3","last_name":"Shanbhogue","salary":"74970","height":"1.70","still_hired":"false","avg_worked_seconds":"371418933","job_positions":["Principal Support Engineer","Junior Developer","Accountant","Purchase Manager"],"is_rehired":["true","false"]}
{ "index": {}}
{"emp_no":"10046","first_name":"Lucien","gender":"M","hire_date":"1992-06-20T00:00:00Z","languages":"4","last_name":"Rosenbaum","salary":"50064","height":"1.52","still_hired":"true","avg_worked_seconds":"302353405","job_positions":["Principal Support Engineer","Junior Developer","Head Human Resources","Internship"],"is_rehired":["true","true","false","true"],"salary_change":"2.39"}
{ "index": {}}
{"emp_no":"10047","first_name":"Zvonko","gender":"M","hire_date":"1989-03-31T00:00:00Z","languages":"4","last_name":"Nyanchama","salary":"42716","height":"1.52","still_hired":"true","avg_worked_seconds":"306369346","job_positions":["Architect","Data Scientist","Principal Support Engineer","Senior Team Lead"],"is_rehired":"true","salary_change":["-6.36","12.12"]}
{ "index": {}}
{"emp_no":"10048","first_name":"Florian","gender":"M","hire_date":"1985-02-24T00:00:00Z","languages":"3","last_name":"Syrotiuk","salary":"26436","height":"2.00","still_hired":"false","avg_worked_seconds":"248451647","job_positions":"Internship","is_rehired":["true","true"]}
{ "index": {}}
{"emp_no":"10049","first_name":"Basil","gender":"F","hire_date":"1992-05-04T00:00:00Z","languages":"5","last_name":"Tramer","salary":"37853","height":"1.52","still_hired":"true","avg_worked_seconds":"320725709","job_positions":["Senior Python Developer","Business Analyst"],"salary_change":"-1.05"}
{ "index": {}}
{"birth_date":"1958-05-21T00:00:00Z","emp_no":"10050","first_name":"Yinghua","gender":"M","hire_date":"1990-12-25T00:00:00Z","languages":"2","last_name":"Dredge","salary":"43026","height":"1.96","still_hired":"true","avg_worked_seconds":"242731798","job_positions":["Reporting Analyst","Junior Developer","Accountant","Support Engineer"],"is_rehired":"true","salary_change":["8.70","10.94"]}
{ "index": {}}
{"birth_date":"1953-07-28T00:00:00Z","emp_no":"10051","first_name":"Hidefumi","gender":"M","hire_date":"1992-10-15T00:00:00Z","languages":"3","last_name":"Caine","salary":"58121","height":"1.89","still_hired":"true","avg_worked_seconds":"374753122","job_positions":["Business Analyst","Accountant","Purchase Manager"]}
{ "index": {}}
{"birth_date":"1961-02-26T00:00:00Z","emp_no":"10052","first_name":"Heping","gender":"M","hire_date":"1988-05-21T00:00:00Z","languages":"1","last_name":"Nitsch","salary":"55360","height":"1.79","still_hired":"true","avg_worked_seconds":"299654717","is_rehired":["true","true","false"],"salary_change":["-0.55","-1.89","-4.22","-6.03"]}
{ "index": {}}
{"birth_date":"1954-09-13T00:00:00Z","emp_no":"10053","first_name":"Sanjiv","gender":"F","hire_date":"1986-02-04T00:00:00Z","languages":"3","last_name":"Zschoche","salary":"54462","height":"1.58","still_hired":"false","avg_worked_seconds":"368103911","job_positions":"Support Engineer","is_rehired":["true","false","true","false"],"salary_change":["-7.67","-3.25"]}
{ "index": {}}
{"birth_date":"1957-04-04T00:00:00Z","emp_no":"10054","first_name":"Mayumi","gender":"M","hire_date":"1995-03-13T00:00:00Z","languages":"4","last_name":"Schueller","salary":"65367","height":"1.82","still_hired":"false","avg_worked_seconds":"297441693","job_positions":"Principal Support Engineer","is_rehired":["false","false"]}
{ "index": {}}
{"birth_date":"1956-06-06T00:00:00Z","emp_no":"10055","first_name":"Georgy","gender":"M","hire_date":"1992-04-27T00:00:00Z","languages":"5","last_name":"Dredge","salary":"49281","height":"2.04","still_hired":"false","avg_worked_seconds":"283157844","job_positions":["Senior Python Developer","Head Human Resources","Internship","Support Engineer"],"is_rehired":["false","false","true"],"salary_change":["7.34","12.99","3.17"]}
{ "index": {}}
{"birth_date":"1961-09-01T00:00:00Z","emp_no":"10056","first_name":"Brendon","gender":"F","hire_date":"1990-02-01T00:00:00Z","languages":"2","last_name":"Bernini","salary":"33370","height":"1.57","still_hired":"true","avg_worked_seconds":"349086555","job_positions":"Senior Team Lead","is_rehired":["true","false","false"],"salary_change":["10.99","-5.17"]}
{ "index": {}}
{"birth_date":"1954-05-30T00:00:00Z","emp_no":"10057","first_name":"Ebbe","gender":"F","hire_date":"1992-01-15T00:00:00Z","languages":"4","last_name":"Callaway","salary":"27215","height":"1.59","still_hired":"true","avg_worked_seconds":"324356269","job_positions":["Python Developer","Head Human Resources"],"salary_change":["-6.73","-2.43","-5.27","1.03"]}
{ "index": {}}
{"birth_date":"1954-10-01T00:00:00Z","emp_no":"10058","first_name":"Berhard","gender":"M","hire_date":"1987-04-13T00:00:00Z","languages":"3","last_name":"McFarlin","salary":"38376","height":"1.83","still_hired":"false","avg_worked_seconds":"268378108","job_positions":"Principal Support Engineer","salary_change":"-4.89"}
{ "index": {}}
{"birth_date":"1953-09-19T00:00:00Z","emp_no":"10059","first_name":"Alejandro","gender":"F","hire_date":"1991-06-26T00:00:00Z","languages":"2","last_name":"McAlpine","salary":"44307","height":"1.48","still_hired":"false","avg_worked_seconds":"237368465","job_positions":["Architect","Principal Support Engineer","Purchase Manager","Senior Team Lead"],"is_rehired":"false","salary_change":["5.53","13.38","-4.69","6.27"]}
{ "index": {}}
{"birth_date":"1961-10-15T00:00:00Z","emp_no":"10060","first_name":"Breannda","gender":"M","hire_date":"1987-11-02T00:00:00Z","languages":"2","last_name":"Billingsley","salary":"29175","height":"1.42","still_hired":"true","avg_worked_seconds":"341158890","job_positions":["Business Analyst","Data Scientist","Senior Team Lead"],"is_rehired":["false","false","true","false"],"salary_change":["-1.76","-0.85"]}
{ "index": {}}
{"birth_date":"1962-10-19T00:00:00Z","emp_no":"10061","first_name":"Tse","gender":"M","hire_date":"1985-09-17T00:00:00Z","languages":"1","last_name":"Herber","salary":"49095","height":"1.45","still_hired":"false","avg_worked_seconds":"327550310","job_positions":["Purchase Manager","Senior Team Lead"],"is_rehired":["false","true"],"salary_change":["14.39","-2.58","-0.95"]}
{ "index": {}}
{"birth_date":"1961-11-02T00:00:00Z","emp_no":"10062","first_name":"Anoosh","gender":"M","hire_date":"1991-08-30T00:00:00Z","languages":"3","last_name":"Peyn","salary":"65030","height":"1.70","still_hired":"false","avg_worked_seconds":"203989706","job_positions":["Python Developer","Senior Team Lead"],"is_rehired":["false","true","true"],"salary_change":"-1.17"}
{ "index": {}}
{"birth_date":"1952-08-06T00:00:00Z","emp_no":"10063","first_name":"Gino","gender":"F","hire_date":"1989-04-08T00:00:00Z","languages":"3","last_name":"Leonhardt","salary":"52121","height":"1.78","still_hired":"true","avg_worked_seconds":"214068302","is_rehired":"true"}
{ "index": {}}
{"birth_date":"1959-04-07T00:00:00Z","emp_no":"10064","first_name":"Udi","gender":"M","hire_date":"1985-11-20T00:00:00Z","languages":"5","last_name":"Jansch","salary":"33956","height":"1.93","still_hired":"false","avg_worked_seconds":"307364077","job_positions":"Purchase Manager","is_rehired":["false","false","true","false"],"salary_change":["-8.66","-2.52"]}
{ "index": {}}
{"birth_date":"1963-04-14T00:00:00Z","emp_no":"10065","first_name":"Satosi","gender":"M","hire_date":"1988-05-18T00:00:00Z","languages":"2","last_name":"Awdeh","salary":"50249","height":"1.59","still_hired":"false","avg_worked_seconds":"372660279","job_positions":["Business Analyst","Data Scientist","Principal Support Engineer"],"is_rehired":["false","true"],"salary_change":["-1.47","14.44","-9.81"]}
{ "index": {}}
{"birth_date":"1952-11-13T00:00:00Z","emp_no":"10066","first_name":"Kwee","gender":"M","hire_date":"1986-02-26T00:00:00Z","languages":"5","last_name":"Schusler","salary":"31897","height":"2.10","still_hired":"true","avg_worked_seconds":"360906451","job_positions":["Senior Python Developer","Data Scientist","Accountant","Internship"],"is_rehired":["true","true","true"],"salary_change":"5.94"}
{ "index": {}}
{"birth_date":"1953-01-07T00:00:00Z","emp_no":"10067","first_name":"Claudi","gender":"M","hire_date":"1987-03-04T00:00:00Z","languages":"2","last_name":"Stavenow","salary":"52044","height":"1.77","still_hired":"true","avg_worked_seconds":"347664141","job_positions":["Tech Lead","Principal Support Engineer"],"is_rehired":["false","false"],"salary_change":["8.72","4.44"]}
{ "index": {}}
{"birth_date":"1962-11-26T00:00:00Z","emp_no":"10068","first_name":"Charlene","gender":"M","hire_date":"1987-08-07T00:00:00Z","languages":"3","last_name":"Brattka","salary":"28941","height":"1.58","still_hired":"true","avg_worked_seconds":"233999584","job_positions":"Architect","is_rehired":"true","salary_change":["3.43","-5.61","-5.29"]}
{ "index": {}}
{"birth_date":"1960-09-06T00:00:00Z","emp_no":"10069","first_name":"Margareta","gender":"F","hire_date":"1989-11-05T00:00:00Z","languages":"5","last_name":"Bierman","salary":"41933","height":"1.77","still_hired":"true","avg_worked_seconds":"366512352","job_positions":["Business Analyst","Junior Developer","Purchase Manager","Support Engineer"],"is_rehired":"false","salary_change":["-3.34","-6.33","6.23","-0.31"]}
{ "index": {}}
{"birth_date":"1955-08-20T00:00:00Z","emp_no":"10070","first_name":"Reuven","gender":"M","hire_date":"1985-10-14T00:00:00Z","languages":"3","last_name":"Garigliano","salary":"54329","height":"1.77","still_hired":"true","avg_worked_seconds":"347188604","is_rehired":["true","true","true"],"salary_change":"-5.90"}
{ "index": {}}
{"birth_date":"1958-01-21T00:00:00Z","emp_no":"10071","first_name":"Hisao","gender":"M","hire_date":"1987-10-01T00:00:00Z","languages":"2","last_name":"Lipner","salary":"40612","height":"2.07","still_hired":"false","avg_worked_seconds":"306671693","job_positions":["Business Analyst","Reporting Analyst","Senior Team Lead"],"is_rehired":["false","false","false"],"salary_change":"-2.69"}
{ "index": {}}
{"birth_date":"1952-05-15T00:00:00Z","emp_no":"10072","first_name":"Hironoby","gender":"F","hire_date":"1988-07-21T00:00:00Z","languages":"5","last_name":"Sidou","salary":"54518","height":"1.82","still_hired":"true","avg_worked_seconds":"209506065","job_positions":["Architect","Tech Lead","Python Developer","Senior Team Lead"],"is_rehired":["false","false","true","false"],"salary_change":["11.21","-2.30","2.22","-5.44"]}
{ "index": {}}
{"birth_date":"1954-02-23T00:00:00Z","emp_no":"10073","first_name":"Shir","gender":"M","hire_date":"1991-12-01T00:00:00Z","languages":"4","last_name":"McClurg","salary":"32568","height":"1.66","still_hired":"false","avg_worked_seconds":"314930367","job_positions":["Principal Support Engineer","Python Developer","Junior Developer","Purchase Manager"],"is_rehired":["true","false"],"salary_change":"-5.67"}
{ "index": {}}
{"birth_date":"1955-08-28T00:00:00Z","emp_no":"10074","first_name":"Mokhtar","gender":"F","hire_date":"1990-08-13T00:00:00Z","languages":"5","last_name":"Bernatsky","salary":"38992","height":"1.64","still_hired":"true","avg_worked_seconds":"382397583","job_positions":["Senior Python Developer","Python Developer"],"is_rehired":["true","false","false","true"],"salary_change":["6.70","1.98","-5.64","2.96"]}
{ "index": {}}
{"birth_date":"1960-03-09T00:00:00Z","emp_no":"10075","first_name":"Gao","gender":"F","hire_date":"1987-03-19T00:00:00Z","languages":"5","last_name":"Dolinsky","salary":"51956","height":"1.94","still_hired":"false","avg_worked_seconds":"370238919","job_positions":"Purchase Manager","is_rehired":"true","salary_change":["9.63","-3.29","8.42"]}
{ "index": {}}
{"birth_date":"1952-06-13T00:00:00Z","emp_no":"10076","first_name":"Erez","gender":"F","hire_date":"1985-07-09T00:00:00Z","languages":"3","last_name":"Ritzmann","salary":"62405","height":"1.83","still_hired":"false","avg_worked_seconds":"376240317","job_positions":["Architect","Senior Python Developer"],"is_rehired":"false","salary_change":["-6.90","-1.30","8.75"]}
{ "index": {}}
{"birth_date":"1964-04-18T00:00:00Z","emp_no":"10077","first_name":"Mona","gender":"M","hire_date":"1990-03-02T00:00:00Z","languages":"5","last_name":"Azuma","salary":"46595","height":"1.68","still_hired":"false","avg_worked_seconds":"351960222","job_positions":"Internship","salary_change":"-0.01"}
{ "index": {}}
{"birth_date":"1959-12-25T00:00:00Z","emp_no":"10078","first_name":"Danel","gender":"F","hire_date":"1987-05-26T00:00:00Z","languages":"2","last_name":"Mondadori","salary":"69904","height":"1.81","still_hired":"true","avg_worked_seconds":"377116038","job_positions":["Architect","Principal Support Engineer","Internship"],"is_rehired":"true","salary_change":["-7.88","9.98","12.52"]}
{ "index": {}}
{"birth_date":"1961-10-05T00:00:00Z","emp_no":"10079","first_name":"Kshitij","gender":"F","hire_date":"1986-03-27T00:00:00Z","languages":"2","last_name":"Gils","salary":"32263","height":"1.59","still_hired":"false","avg_worked_seconds":"320953330","is_rehired":"false","salary_change":"7.58"}
{ "index": {}}
{"birth_date":"1957-12-03T00:00:00Z","emp_no":"10080","first_name":"Premal","gender":"M","hire_date":"1985-11-19T00:00:00Z","languages":"5","last_name":"Baek","salary":"52833","height":"1.80","still_hired":"false","avg_worked_seconds":"239266137","job_positions":"Senior Python Developer","salary_change":["-4.35","7.36","5.56"]}
{ "index": {}}
{"birth_date":"1960-12-17T00:00:00Z","emp_no":"10081","first_name":"Zhongwei","gender":"M","hire_date":"1986-10-30T00:00:00Z","languages":"2","last_name":"Rosen","salary":"50128","height":"1.44","still_hired":"true","avg_worked_seconds":"321375511","job_positions":["Accountant","Internship"],"is_rehired":["false","false","false"]}
{ "index": {}}
{"birth_date":"1963-09-09T00:00:00Z","emp_no":"10082","first_name":"Parviz","gender":"M","hire_date":"1990-01-03T00:00:00Z","languages":"4","last_name":"Lortz","salary":"49818","height":"1.61","still_hired":"false","avg_worked_seconds":"232522994","job_positions":"Principal Support Engineer","is_rehired":"false","salary_change":["1.19","-3.39"]}
{ "index": {}}
{"birth_date":"1959-07-23T00:00:00Z","emp_no":"10083","first_name":"Vishv","gender":"M","hire_date":"1987-03-31T00:00:00Z","languages":"1","last_name":"Zockler","salary":"39110","height":"1.42","still_hired":"false","avg_worked_seconds":"331236443","job_positions":"Head Human Resources"}
{ "index": {}}
{"birth_date":"1960-05-25T00:00:00Z","emp_no":"10084","first_name":"Tuval","gender":"M","hire_date":"1995-12-15T00:00:00Z","languages":"1","last_name":"Kalloufi","salary":"28035","height":"1.51","still_hired":"true","avg_worked_seconds":"359067056","job_positions":"Principal Support Engineer","is_rehired":"false"}
{ "index": {}}
{"birth_date":"1962-11-07T00:00:00Z","emp_no":"10085","first_name":"Kenroku","gender":"M","hire_date":"1994-04-09T00:00:00Z","languages":"5","last_name":"Malabarba","salary":"35742","height":"2.01","still_hired":"true","avg_worked_seconds":"353404008","job_positions":["Senior Python Developer","Business Analyst","Tech Lead","Accountant"],"salary_change":["11.67","6.75","8.40"]}
{ "index": {}}
{"birth_date":"1962-11-19T00:00:00Z","emp_no":"10086","first_name":"Somnath","gender":"M","hire_date":"1990-02-16T00:00:00Z","languages":"1","last_name":"Foote","salary":"68547","height":"1.74","still_hired":"true","avg_worked_seconds":"328580163","job_positions":"Senior Python Developer","is_rehired":["false","true"],"salary_change":"13.61"}
{ "index": {}}
{"birth_date":"1959-07-23T00:00:00Z","emp_no":"10087","first_name":"Xinglin","gender":"F","hire_date":"1986-09-08T00:00:00Z","languages":"5","last_name":"Eugenio","salary":"32272","height":"1.74","still_hired":"true","avg_worked_seconds":"305782871","job_positions":["Junior Developer","Internship"],"is_rehired":["false","false"],"salary_change":"-2.05"}
{ "index": {}}
{"birth_date":"1954-02-25T00:00:00Z","emp_no":"10088","first_name":"Jungsoon","gender":"F","hire_date":"1988-09-02T00:00:00Z","languages":"5","last_name":"Syrzycki","salary":"39638","height":"1.91","still_hired":"false","avg_worked_seconds":"330714423","job_positions":["Reporting Analyst","Business Analyst","Tech Lead"],"is_rehired":"true"}
{ "index": {}}
{"birth_date":"1963-03-21T00:00:00Z","emp_no":"10089","first_name":"Sudharsan","gender":"F","hire_date":"1986-08-12T00:00:00Z","languages":"4","last_name":"Flasterstein","salary":"43602","height":"1.57","still_hired":"true","avg_worked_seconds":"232951673","job_positions":["Junior Developer","Accountant"],"is_rehired":["true","false","false","false"]}
{ "index": {}}
{"birth_date":"1961-05-30T00:00:00Z","emp_no":"10090","first_name":"Kendra","gender":"M","hire_date":"1986-03-14T00:00:00Z","languages":"2","last_name":"Hofting","salary":"44956","height":"2.03","still_hired":"true","avg_worked_seconds":"212460105","is_rehired":["false","false","false","true"],"salary_change":["7.15","-1.85","3.60"]}
{ "index": {}}
{"birth_date":"1955-10-04T00:00:00Z","emp_no":"10091","first_name":"Amabile","gender":"M","hire_date":"1992-11-18T00:00:00Z","languages":"3","last_name":"Gomatam","salary":"38645","height":"2.09","still_hired":"true","avg_worked_seconds":"242582807","job_positions":["Reporting Analyst","Python Developer"],"is_rehired":["true","true","false","false"],"salary_change":["-9.23","7.50","5.85","5.19"]}
{ "index": {}}
{"birth_date":"1964-10-18T00:00:00Z","emp_no":"10092","first_name":"Valdiodio","gender":"F","hire_date":"1989-09-22T00:00:00Z","languages":"1","last_name":"Niizuma","salary":"25976","height":"1.75","still_hired":"false","avg_worked_seconds":"313407352","job_positions":["Junior Developer","Accountant"],"is_rehired":["false","false","true","true"],"salary_change":["8.78","0.39","-6.77","8.30"]}
{ "index": {}}
{"birth_date":"1964-06-11T00:00:00Z","emp_no":"10093","first_name":"Sailaja","gender":"M","hire_date":"1996-11-05T00:00:00Z","languages":"3","last_name":"Desikan","salary":"45656","height":"1.69","still_hired":"false","avg_worked_seconds":"315904921","job_positions":["Reporting Analyst","Tech Lead","Principal Support Engineer","Purchase Manager"],"salary_change":"-0.88"}
{ "index": {}}
{"birth_date":"1957-05-25T00:00:00Z","emp_no":"10094","first_name":"Arumugam","gender":"F","hire_date":"1987-04-18T00:00:00Z","languages":"5","last_name":"Ossenbruggen","salary":"66817","height":"2.10","still_hired":"false","avg_worked_seconds":"332920135","job_positions":["Senior Python Developer","Principal Support Engineer","Accountant"],"is_rehired":["true","false","true"],"salary_change":["2.22","7.92"]}
{ "index": {}}
{"birth_date":"1965-01-03T00:00:00Z","emp_no":"10095","first_name":"Hilari","gender":"M","hire_date":"1986-07-15T00:00:00Z","languages":"4","last_name":"Morton","salary":"37702","height":"1.55","still_hired":"false","avg_worked_seconds":"321850475","is_rehired":["true","true","false","false"],"salary_change":["-3.93","-6.66"]}
{ "index": {}}
{"birth_date":"1954-09-16T00:00:00Z","emp_no":"10096","first_name":"Jayson","gender":"M","hire_date":"1990-01-14T00:00:00Z","languages":"4","last_name":"Mandell","salary":"43889","height":"1.94","still_hired":"false","avg_worked_seconds":"204381503","job_positions":["Architect","Reporting Analyst"],"is_rehired":["false","false","false"]}
{ "index": {}}
{"birth_date":"1952-02-27T00:00:00Z","emp_no":"10097","first_name":"Remzi","gender":"M","hire_date":"1990-09-15T00:00:00Z","languages":"3","last_name":"Waschkowski","salary":"71165","height":"1.53","still_hired":"false","avg_worked_seconds":"206258084","job_positions":["Reporting Analyst","Tech Lead"],"is_rehired":["true","false"],"salary_change":"-1.12"}
{ "index": {}}
{"birth_date":"1961-09-23T00:00:00Z","emp_no":"10098","first_name":"Sreekrishna","gender":"F","hire_date":"1985-05-13T00:00:00Z","languages":"4","last_name":"Servieres","salary":"44817","height":"2.00","still_hired":"false","avg_worked_seconds":"272392146","job_positions":["Architect","Internship","Senior Team Lead"],"is_rehired":"false","salary_change":["-2.83","8.31","4.38"]}
{ "index": {}}
{"birth_date":"1956-05-25T00:00:00Z","emp_no":"10099","first_name":"Valter","gender":"F","hire_date":"1988-10-18T00:00:00Z","languages":"2","last_name":"Sullins","salary":"73578","height":"1.81","still_hired":"true","avg_worked_seconds":"377713748","is_rehired":["true","true"],"salary_change":["10.71","14.26","-8.78","-3.98"]}
{ "index": {}}
{"birth_date":"1953-04-21T00:00:00Z","emp_no":"10100","first_name":"Hironobu","gender":"F","hire_date":"1987-09-21T00:00:00Z","languages":"4","last_name":"Haraldson","salary":"68431","height":"1.77","still_hired":"true","avg_worked_seconds":"223910853","job_positions":"Purchase Manager","is_rehired":["false","true","true","false"],"salary_change":["13.97","-7.49"]}
```
::::
## Convert the dataset [convert-dataset-pandas-dataframe]
Use the ES|QL CSV import to convert the `employees` dataset to a Pandas dataframe object.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from io import StringIO
from elasticsearch import Elasticsearch
import pandas as pd
client = Elasticsearch(
"https://[host].elastic-cloud.com",
api_key="...",
)
response = client.esql.query(
query="FROM employees | LIMIT 500",
format="csv",
)
df = pd.read_csv(StringIO(response.body))
print(df)
```
:::
:::{tab-item} Async Python
:sync: async
```python
import asyncio
from io import StringIO
from elasticsearch import AsyncElasticsearch
import pandas as pd
client = AsyncElasticsearch(
"https://[host].elastic-cloud.com",
api_key="...",
)
async def main():
response = await client.esql.query(
query="FROM employees | LIMIT 500",
format="csv",
)
df = pd.read_csv(StringIO(response.body))
print(df)
asyncio.run(main())
:::
::::
Even though the dataset contains only 100 records, a LIMIT of 500 is specified to suppress ES|QL warnings about potentially missing records. This prints the following dataframe:
```python
avg_worked_seconds ... salary_change.long still_hired
0 268728049 ... 1 True
1 328922887 ... [-7, 11] True
2 200296405 ... [12, 14] False
3 311267831 ... [0, 1, 3, 13] True
4 244294991 ... [-2, 13] True
.. ... ... ... ...
95 204381503 ... NaN False
96 206258084 ... -1 False
97 272392146 ... [-2, 4, 8] False
98 377713748 ... [-8, -3, 10, 14] True
99 223910853 ... [-7, 13] True
```
You can now analyze the data with Pandas or you can also continue transforming the data using ES|QL.
## Analyze the data with Pandas [analyze-data]
In the next example, the [STATS … BY](elasticsearch://reference/query-languages/esql/commands/processing-commands.md#esql-stats-by) command is utilized to count how many employees are speaking a given language. The results are sorted with the `languages` column using [SORT](elasticsearch://reference/query-languages/esql/commands/processing-commands.md#esql-sort):
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = client.esql.query(
query="""
FROM employees
| STATS count = COUNT(emp_no) BY languages
| SORT languages
| LIMIT 500
""",
format="csv",
)
df = pd.read_csv(
StringIO(response.body),
dtype={"count": "Int64", "languages": "Int64"},
)
print(df)
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
response = await client.esql.query(
query="""
FROM employees
| STATS count = COUNT(emp_no) BY languages
| SORT languages
| LIMIT 500
""",
format="csv",
)
df = pd.read_csv(
StringIO(response.body),
dtype={"count": "Int64", "languages": "Int64"},
)
print(df)
```
:::
::::
The `dtype` parameter of `pd.read_csv()` is useful when the type inferred by Pandas is not enough. The code prints the following response:
```python
count languages
0 15 1
1 19 2
2 17 3
3 18 4
4 21 5
```
## Pass parameters to a query with ES|QL [passing-params]
Use the [built-in parameters support of the ES|QL REST API](docs-content://explore-analyze/query-filter/languages/esql-rest.md#esql-rest-params) to pass parameters to a query:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
response = client.esql.query(
query="""
FROM employees
| STATS count = COUNT(emp_no) BY languages
| WHERE languages >= (?)
| SORT languages
| LIMIT 500
""",
format="csv",
params=[3],
)
df = pd.read_csv(
StringIO(response.body),
dtype={"count": "Int64", "languages": "Int64"},
)
print(df)
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def example():
response = await client.esql.query(
query="""
FROM employees
| STATS count = COUNT(emp_no) BY languages
| WHERE languages >= (?)
| SORT languages
| LIMIT 500
""",
format="csv",
params=[3],
)
df = pd.read_csv(
StringIO(response.body),
dtype={"count": "Int64", "languages": "Int64"},
)
print(df)
```
:::
::::
The code above outputs the following:
```python
count languages
0 17 3
1 18 4
2 21 5
```
If you want to learn more about ES|QL, refer to the [ES|QL documentation](docs-content://explore-analyze/query-filter/languages/esql.md). You can also check out this other [Python example using Boston Celtics data](https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/Boston-Celtics-Demo/celtics-esql-demo.ipynb).
python-elasticsearch-9.4.0/docs/reference/esql-query-builder.md 0000664 0000000 0000000 00000022777 15176617013 0024646 0 ustar 00root root 0000000 0000000 # ES|QL query builder
::::{warning}
This functionality 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.
::::
The ES|QL query builder allows you to construct ES|QL queries using Python syntax. Consider the following example:
```python
>>> from elasticsearch.esql import ESQL
>>> query = (
ESQL.from_("employees")
.sort("emp_no")
.keep("first_name", "last_name", "height")
.eval(height_feet="height * 3.281", height_cm="height * 100")
.limit(3)
)
```
You can then see the assembled ES|QL query by printing the resulting query object:
```python
>>> print(query)
FROM employees
| SORT emp_no
| KEEP first_name, last_name, height
| EVAL height_feet = height * 3.281, height_cm = height * 100
| LIMIT 3
```
To execute this query, you can pass it to the `client.esql.query()` endpoint:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
from elasticsearch import Elasticsearch
client = Elasticsearch(hosts=[os.environ['ELASTICSEARCH_URL']])
response = client.esql.query(query=query)
```
:::
:::{tab-item} Async Python
:sync: async
```python
import asyncio
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch(hosts=[os.environ['ELASTICSEARCH_URL']])
async def main():
response = await client.esql.query(query=query)
asyncio.run(main())
```
:::
::::
The response body contains a `columns` attribute with the list of columns included in the results, and a `values` attribute with the list of results for the query, each given as a list of column values. Here is a possible response body returned by the example query given above:
```python
>>> from pprint import pprint
>>> pprint(response.body)
{'columns': [{'name': 'first_name', 'type': 'text'},
{'name': 'last_name', 'type': 'text'},
{'name': 'height', 'type': 'double'},
{'name': 'height_feet', 'type': 'double'},
{'name': 'height_cm', 'type': 'double'}],
'is_partial': False,
'took': 11,
'values': [['Adrian', 'Wells', 2.424, 7.953144, 242.4],
['Aaron', 'Gonzalez', 1.584, 5.1971, 158.4],
['Miranda', 'Kramer', 1.55, 5.08555, 155]]}
```
## Creating an ES|QL query
To construct an ES|QL query you start from one of the ES|QL source commands:
### `ESQL.from_`
The `FROM` command selects the indices, data streams or aliases to be queried.
Examples:
```python
from elasticsearch.esql import ESQL
# FROM employees
query1 = ESQL.from_("employees")
# FROM
query2 = ESQL.from_("")
# FROM employees-00001, other-employees-*
query3 = ESQL.from_("employees-00001", "other-employees-*")
# FROM cluster_one:employees-00001, cluster_two:other-employees-*
query4 = ESQL.from_("cluster_one:employees-00001", "cluster_two:other-employees-*")
# FROM employees METADATA _id
query5 = ESQL.from_("employees").metadata("_id")
```
Note how in the last example the optional `METADATA` clause of the `FROM` command is added as a chained method.
### `ESQL.row`
The `ROW` command produces a row with one or more columns, with the values that you specify.
Examples:
```python
from elasticsearch.esql import ESQL, functions
# ROW a = 1, b = "two", c = null
query1 = ESQL.row(a=1, b="two", c=None)
# ROW a = [1, 2]
query2 = ESQL.row(a=[1, 2])
# ROW a = ROUND(1.23, 0)
query3 = ESQL.row(a=functions.round(1.23, 0))
```
### `ESQL.show`
The `SHOW` command returns information about the deployment and its capabilities.
Example:
```python
from elasticsearch.esql import ESQL
# SHOW INFO
query = ESQL.show("INFO")
```
## Adding processing commands
Once you have a query object, you can add one or more processing commands to it. The following
example shows how to create a query that uses the `WHERE` and `LIMIT` commands to filter the
results:
```python
from elasticsearch.esql import ESQL
# FROM employees
# | WHERE still_hired == true
# | LIMIT 10
query = ESQL.from_("employees").where("still_hired == true").limit(10)
```
For a complete list of available commands, review the methods of the [`ESQLBase` class](https://elasticsearch-py.readthedocs.io/en/stable/esql.html) in the Elasticsearch Python API documentation.
## Creating ES|QL Expressions and Conditions
The ES|QL query builder for Python provides two ways to create expressions and conditions in ES|QL queries.
The simplest option is to provide all ES|QL expressions and conditionals as strings. The following example uses this approach to add two calculated columns to the results using the `EVAL` command:
```python
from elasticsearch.esql import ESQL
# FROM employees
# | SORT emp_no
# | KEEP first_name, last_name, height
# | EVAL height_feet = height * 3.281, height_cm = height * 100
query = (
ESQL.from_("employees")
.sort("emp_no")
.keep("first_name", "last_name", "height")
.eval(height_feet="height * 3.281", height_cm="height * 100")
)
```
A more advanced alternative is to replace the strings with Python expressions, which are automatically translated to ES|QL when the query object is rendered to a string. The following example is functionally equivalent to the one above:
```python
from elasticsearch.esql import ESQL, E
# FROM employees
# | SORT emp_no
# | KEEP first_name, last_name, height
# | EVAL height_feet = height * 3.281, height_cm = height * 100
query = (
ESQL.from_("employees")
.sort("emp_no")
.keep("first_name", "last_name", "height")
.eval(height_feet=E("height") * 3.281, height_cm=E("height") * 100)
)
```
Here the `E()` helper function is used as a wrapper to the column name that initiates an ES|QL expression. The `E()` function transforms the given column into an ES|QL expression that can be modified with Python operators.
Here is a second example, which uses a conditional expression in the `WHERE` command:
```python
from elasticsearch.esql import ESQL
# FROM employees
# | KEEP first_name, last_name, height
# | WHERE first_name == "Larry"
query = (
ESQL.from_("employees")
.keep("first_name", "last_name", "height")
.where('first_name == "Larry"')
)
```
Using Python syntax, the condition can be rewritten as follows:
```python
from elasticsearch.esql import ESQL, E
# FROM employees
# | KEEP first_name, last_name, height
# | WHERE first_name == "Larry"
query = (
ESQL.from_("employees")
.keep("first_name", "last_name", "height")
.where(E("first_name") == "Larry")
)
```
### Preventing injection attacks
ES|QL, like most query languages, is vulnerable to [code injection attacks](https://en.wikipedia.org/wiki/Code_injection) if untrusted data provided by users is added to a query. To eliminate this risk, ES|QL allows untrusted data to be given separately from the query as parameters.
Continuing with the example above, let's assume that the application needs a `find_employee_by_name()` function that searches for the name given as an argument. If this argument is received by the application from users, then it is considered untrusted and should not be added to the query directly. Here is how to code the function in a secure manner:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```python
def find_employee_by_name(name):
query = (
ESQL.from_("employees")
.keep("first_name", "last_name", "height")
.where(E("first_name") == E("?"))
)
return client.esql.query(query=query, params=[name])
```
:::
:::{tab-item} Async Python
:sync: async
```python
async def find_employee_by_name(name):
query = (
ESQL.from_("employees")
.keep("first_name", "last_name", "height")
.where(E("first_name") == E("?"))
)
return await client.esql.query(query=query, params=[name])
```
:::
::::
Here the part of the query in which the untrusted data needs to be inserted is replaced with a parameter, which in ES|QL is defined by the question mark. When using Python expressions, the parameter must be given as `E("?")` so that it is treated as an expression and not as a literal string.
The list of values given in the `params` argument to the query endpoint are assigned in order to the parameters defined in the query.
## Using ES|QL functions
The ES|QL language includes a rich set of functions that can be used in expressions and conditionals. These can be included in expressions given as strings, as shown in the example below:
```python
from elasticsearch.esql import ESQL
# FROM employees
# | KEEP first_name, last_name, height
# | WHERE LENGTH(first_name) < 4"
query = (
ESQL.from_("employees")
.keep("first_name", "last_name", "height")
.where("LENGTH(first_name) < 4")
)
```
All available ES|QL functions have Python wrappers in the `elasticsearch.esql.functions` module, which can be used when building expressions using Python syntax. Below is the example above coded using Python syntax:
```python
from elasticsearch.esql import ESQL, functions
# FROM employees
# | KEEP first_name, last_name, height
# | WHERE LENGTH(first_name) < 4"
query = (
ESQL.from_("employees")
.keep("first_name", "last_name", "height")
.where(functions.length(E("first_name")) < 4)
)
```
Arguments passed to functions are assumed to be literals. When passing field names, parameters or other ES|QL expressions, it is necessary to wrap them with the `E()` helper function so that they are interpreted correctly.
You can find the complete list of available functions in the Python client's [ES|QL API reference documentation](https://elasticsearch-py.readthedocs.io/en/stable/esql.html#module-elasticsearch.esql.functions).
python-elasticsearch-9.4.0/docs/reference/examples.md 0000664 0000000 0000000 00000026507 15176617013 0022724 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/examples.html
navigation_title: Examples
---
# {{es}} Python client examples [examples]
Below you can find examples of how to use the most frequently called APIs with the Python client.
* [Indexing a document](#ex-index)
* [Getting a document](#ex-get)
* [Refreshing an index](#ex-refresh)
* [Searching for a document](#ex-search)
* [Updating a document](#ex-update)
* [Deleting a document](#ex-delete)
## Indexing a document [ex-index]
To index a document, you need to specify three pieces of information: `index`, `id`, and a `document`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
from datetime import datetime
from elasticsearch import Elasticsearch
client = Elasticsearch('https://localhost:9200')
doc = {
'author': 'author_name',
'text': 'Interesting content...',
'timestamp': datetime.now(),
}
resp = client.index(index="test-index", id=1, document=doc)
print(resp['result'])
```
:::
:::{tab-item} Async Python
:sync: async
```py
import asyncio
from datetime import datetime
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch('https://localhost:9200')
doc = {
'author': 'author_name',
'text': 'Interesting content...',
'timestamp': datetime.now(),
}
async def main():
resp = await client.index(index="test-index", id=1, document=doc)
print(resp['result'])
asyncio.run(main())
```
:::
::::
## Getting a document [ex-get]
To get a document, you need to specify its `index` and `id`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
resp = client.get(index="test-index", id=1)
print(resp['_source'])
```
:::
:::{tab-item} Async Python
:sync: async
```py
resp = await client.get(index="test-index", id=1)
print(resp['_source'])
```
:::
::::
## Refreshing an index [ex-refresh]
You can perform the refresh operation on an index:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.indices.refresh(index="test-index")
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.indices.refresh(index="test-index")
```
:::
::::
## Searching for a document [ex-search]
The `search()` method returns results that are matching a query:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
resp = client.search(index="test-index", query={"match_all": {}})
print("Got %d Hits:" % resp['hits']['total']['value'])
for hit in resp['hits']['hits']:
print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])
```
:::
:::{tab-item} Async Python
:sync: async
```py
resp = await client.search(index="test-index", query={"match_all": {}})
print("Got %d Hits:" % resp['hits']['total']['value'])
for hit in resp['hits']['hits']:
print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])
```
:::
::::
## Updating a document [ex-update]
To update a document, you need to specify three pieces of information: `index`, `id`, and a `doc`:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
from datetime import datetime
from elasticsearch import Elasticsearch
client = Elasticsearch('https://localhost:9200')
doc = {
'author': 'author_name',
'text': 'Interesting modified content...',
'timestamp': datetime.now(),
}
resp = client.update(index="test-index", id=1, doc=doc)
print(resp['result'])
```
:::
:::{tab-item} Async Python
:sync: async
```py
import asyncio
from datetime import datetime
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch('https://localhost:9200')
async def main():
doc = {
'author': 'author_name',
'text': 'Interesting modified content...',
'timestamp': datetime.now(),
}
resp = await client.update(index="test-index", id=1, doc=doc)
print(resp['result'])
asyncio.run(main())
```
:::
::::
## Deleting a document [ex-delete]
You can delete a document by specifying its `index`, and `id` in the `delete()` method:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.delete(index="test-index", id=1)
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.delete(index="test-index", id=1)
```
:::
::::
## Interactive examples [ex-interactive]
The [elasticsearch-labs](https://github.com/elastic/elasticsearch-labs) repo contains interactive and executable [Python notebooks](https://github.com/elastic/elasticsearch-labs/tree/main/notebooks), sample apps, and resources for testing out Elasticsearch, using the Python client. These examples are mainly focused on vector search, hybrid search and generative AI use cases, but you’ll also find examples of basic operations like creating index mappings and performing lexical search.
### Search notebooks [_search_notebooks]
The [Search](https://github.com/elastic/elasticsearch-labs/tree/main/notebooks/search) folder is a good place to start if you’re new to Elasticsearch. This folder contains a number of notebooks that demonstrate the fundamentals of Elasticsearch, like indexing vectors, running lexical, semantic and *hybrid* searches, and more.
The following notebooks are available:
* [Quick start](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/00-quick-start.ipynb)
* [Keyword, querying, filtering](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/01-keyword-querying-filtering.ipynb)
* [Hybrid search](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/02-hybrid-search.ipynb)
* [Semantic search with ELSER](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/03-ELSER.ipynb)
* [Multilingual semantic search](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/04-multilingual.ipynb)
* [Query rules](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/05-query-rules.ipynb)
* [Synonyms API quick start](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/06-synonyms-api.ipynb)
Here’s a brief overview of what you’ll learn in each notebook.
#### Quick start [_quick_start]
In the [00-quick-start.ipynb](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/00-quick-start.ipynb) notebook you’ll learn how to:
* Use the Elasticsearch Python client for various operations.
* Create and define an index for a sample dataset with `dense_vector` fields.
* Transform book titles into embeddings using [Sentence Transformers](https://www.sbert.net) and index them into Elasticsearch.
* Perform k-nearest neighbors (knn) semantic searches.
* Integrate traditional text-based search with semantic search, for a hybrid search system.
* Use reciprocal rank fusion (RRF) to intelligently combine search results from different retrieval systems.
#### Keyword, querying, filtering [_keyword_querying_filtering]
In the [01-keyword-querying-filtering.ipynb](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/01-keyword-querying-filtering.ipynb) notebook, you’ll learn how to:
* Use [query and filter contexts](docs-content://explore-analyze/query-filter/languages/querydsl.md) to search and filter documents in Elasticsearch.
* Execute full-text searches with `match` and `multi-match` queries.
* Query and filter documents based on `text`, `number`, `date`, or `boolean` values.
* Run multi-field searches using the `multi-match` query.
* Prioritize specific fields in the `multi-match` query for tailored results.
#### Hybrid search [_hybrid_search]
In the [02-hybrid-search.ipynb](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/02-hybrid-search.ipynb) notebook, you’ll learn how to:
* Combine results of traditional text-based search with semantic search, for a hybrid search system.
* Transform fields in the sample dataset into embeddings using the Sentence Transformer model and index them into Elasticsearch.
* Use the [RRF API](elasticsearch://reference/elasticsearch/rest-apis/reciprocal-rank-fusion.md#rrf-api) to combine the results of a `match` query and a `kNN` semantic search.
* Walk through a super simple toy example that demonstrates, step by step, how RRF ranking works.
#### Semantic search with ELSER [_semantic_search_with_elser]
In the [03-ELSER.ipynb](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/03-ELSER.ipynb) notebook, you’ll learn how to:
* Use the Elastic Learned Sparse Encoder (ELSER) for text expansion-powered semantic search, out of the box — without training, fine-tuning, or embeddings generation.
* Download and deploy the ELSER model in your Elastic environment.
* Create an Elasticsearch index named search-movies with specific mappings and index a dataset of movie descriptions.
* Create an ingest pipeline containing an inference processor for ELSER model execution.
* Reindex the data from search-movies into another index, elser-movies, using the ELSER pipeline for text expansion.
* Observe the results of running the documents through the model by inspecting the additional terms it adds to documents, which enhance searchability.
* Perform simple keyword searches on the elser-movies index to assess the impact of ELSER’s text expansion.
* Execute ELSER-powered semantic searches using the `text_expansion` query.
#### Multilingual semantic search [_multilingual_semantic_search]
In the [04-multilingual.ipynb](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/04-multilingual.ipynb) notebook, you’ll learn how to:
* Use a multilingual embedding model for semantic search across languages.
* Transform fields in the sample dataset into embeddings using the Sentence Transformer model and index them into Elasticsearch.
* Use filtering with a `kNN` semantic search.
* Walk through a basic example that demonstrates, step by step, how multilingual search works across languages, and within non-English languages.
#### Query rules [_query_rules]
In the [05-query-rules.ipynb](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/05-query-rules.ipynb) notebook, you’ll learn how to:
* Use the query rules management APIs to create and edit promotional rules based on contextual queries.
* Apply these query rules by using the `rule_query` in Query DSL.
#### Synonyms API quick start [_synonyms_api_quick_start]
In the [06-synonyms-api.ipynb](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/search/06-synonyms-api.ipynb) notebook, you’ll learn how to:
* Use the synonyms management API to create a synonyms set to enhance your search recall.
* Configure an index to use search-time synonyms.
* Update synonyms in real time.
* Run queries that are enhanced by synonyms.
### Other notebooks [_other_notebooks]
* [Generative AI](https://github.com/elastic/elasticsearch-labs/tree/main/notebooks/generative-ai). Notebooks that demonstrate various use cases for Elasticsearch as the retrieval engine and vector store for LLM-powered applications.
* [Integrations](https://github.com/elastic/elasticsearch-labs/blob/main/notebooks/integrations). Notebooks that demonstrate how to integrate popular services and projects with Elasticsearch, including OpenAI, Hugging Face, and LlamaIndex
* [Langchain](https://github.com/elastic/elasticsearch-labs/tree/main/notebooks/langchain). Notebooks that demonstrate how to integrate Elastic with LangChain, a framework for developing applications powered by language models.
python-elasticsearch-9.4.0/docs/reference/getting-started.md 0000664 0000000 0000000 00000016111 15176617013 0024201 0 ustar 00root root 0000000 0000000 ---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/getting-started-python.html
- https://www.elastic.co/guide/en/serverless/current/elasticsearch-python-client-getting-started.html
---
# Getting started [getting-started-python]
This page guides you through the installation process of the Python client, shows you how to instantiate the client, and how to perform basic Elasticsearch operations with it.
### Requirements [_requirements]
* [Python](https://www.python.org/) 3.10 or later
* [`pip`](https://pip.pypa.io/en/stable/), installed by default alongside Python
### Installation [_installation]
To install the latest version of the client, run the following command:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```shell
python -m pip install elasticsearch
```
:::
:::{tab-item} Async Python
:sync: async
```shell
python -m pip install "elasticsearch[async]"
```
:::
::::
Refer to the [*Installation*](/reference/installation.md) page to learn more.
### Connecting [_connecting]
You can connect to the Elastic Cloud using an API key and the Elasticsearch endpoint.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
import os
from elasticsearch import Elasticsearch
client = Elasticsearch(
"https://...", # Elasticsearch endpoint
api_key=os.environ["ELASTIC_API_KEY"],
)
```
:::
:::{tab-item} Async Python
:sync: async
```py
import os
from elasticsearch import AsyncElasticsearch
client = AsyncElasticsearch(
"https://...", # Elasticsearch endpoint
api_key=os.environ["ELASTIC_API_KEY"],
)
```
:::
::::
Your Elasticsearch endpoint can be found on the **My deployment** page of your deployment:

You can generate an API key on the **Management** page under Security.

For other connection options, refer to the [*Connecting*](/reference/connecting.md) section.
### Operations [_operations]
Time to use Elasticsearch! This section walks you through the basic, and most important, operations of Elasticsearch. For more operations and more advanced examples, refer to the [*Examples*](/reference/examples.md) page.
#### Creating an index [_creating_an_index]
This is how you create the `my_index` index:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.indices.create(index="my_index")
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.indices.create(index="my_index")
```
:::
::::
Optionally, you can first define the expected types of your features with a custom mapping.
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
mappings = {
"properties": {
"foo": {"type": "text"},
"bar": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256,
}
},
},
}
}
client.indices.create(index="my_index", mappings=mappings)
```
:::
:::{tab-item} Async Python
:sync: async
```py
mappings = {
"properties": {
"foo": {"type": "text"},
"bar": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256,
}
},
},
}
}
await client.indices.create(index="my_index", mappings=mappings)
```
:::
::::
#### Indexing documents [_indexing_documents]
This indexes a document with the index API:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.index(
index="my_index",
id="my_document_id",
document={
"foo": "foo",
"bar": "bar",
}
)
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.index(
index="my_index",
id="my_document_id",
document={
"foo": "foo",
"bar": "bar",
}
)
```
:::
::::
You can also index multiple documents at once with the bulk helper function:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
from elasticsearch import helpers
def generate_docs():
for i in range(10):
yield {
"_index": "my_index",
"foo": f"foo {i}",
"bar": "bar",
}
helpers.bulk(client, generate_docs())
```
:::
:::{tab-item} Async Python
:sync: async
```py
from elasticsearch import helpers
async def generate_docs():
for i in range(10):
yield {
"_index": "my_index",
"foo": f"foo {i}",
"bar": "bar",
}
async def bulk_example():
await helpers.async_bulk(client, generate_docs())
```
:::
::::
These helpers are the recommended way to perform bulk ingestion. While it is also possible to perform bulk ingestion using `client.bulk` directly, the helpers handle retries, ingesting chunk by chunk and more. Refer to the [*Client helpers*](/reference/client-helpers.md) page for more details.
#### Getting documents [_getting_documents]
You can get documents by using the following code:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.get(index="my_index", id="my_document_id")
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.get(index="my_index", id="my_document_id")
```
:::
::::
#### Searching documents [_searching_documents]
This is how you can create a single match query with the Python client:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.search(index="my_index", query={
"match": {
"foo": "foo"
}
})
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.search(index="my_index", query={
"match": {
"foo": "foo"
}
})
```
:::
::::
#### Updating documents [_updating_documents]
This is how you can update a document, for example to add a new field:
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.update(
index="my_index",
id="my_document_id",
doc={
"foo": "bar",
"new_field": "new value",
}
)
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.update(
index="my_index",
id="my_document_id",
doc={
"foo": "bar",
"new_field": "new value",
}
)
```
:::
::::
#### Deleting documents [_deleting_documents]
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.delete(index="my_index", id="my_document_id")
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.delete(index="my_index", id="my_document_id")
```
:::
::::
#### Deleting an index [_deleting_an_index]
::::{tab-set}
:group: sync_or_async
:::{tab-item} Standard Python
:sync: sync
```py
client.indices.delete(index="my_index")
```
:::
:::{tab-item} Async Python
:sync: async
```py
await client.indices.delete(index="my_index")
```
:::
::::
## Further reading [_further_reading]
* Use [*Client helpers*](/reference/client-helpers.md) for a more comfortable experience with the APIs.
python-elasticsearch-9.4.0/docs/reference/images/ 0000775 0000000 0000000 00000000000 15176617013 0022017 5 ustar 00root root 0000000 0000000 python-elasticsearch-9.4.0/docs/reference/images/create-api-key.png 0000664 0000000 0000000 00000235274 15176617013 0025342 0 ustar 00root root 0000000 0000000 PNG
IHDR F Zef -zTXtRaw profile type exif xڥWv8E1ZooReWee*"Hfe룉r-6_?w
w?ob~}yK=ٚW넷W-}PZ|^}r!HׅB?,[-0: F?bnu~~p߬gxǗ;V$y}.4wqw\̩.~ S,I{뽂4902+?5(E%Fr!Ax}
ϕ !bd\ dͅ䲳$3ud1LnМR='ۆ32BܴIV)RC=SJ9TSK=s9,P%hJ*RK+kZk r+zgΕ;gw}FɌ<ʨ>)gyYg}*vRqwuv9O9߳J뷯Ț{eL5-Np3Mtd(Wlu1zeN93ɤ-Oǽ'͔)of(uy)kK44oƞ.TPmv.Ӯw=phe@ ʎ}6~C1gh>On|$ƯDݰy̽*ûS].=z͝Uwk!m҉xGõlBc1yt:sDJYj:q՞=̔,N^=[=&ЮFqz$THё:ŦxdV#@ˮ0;=Ҟf?MI`|ll
0ήiYgB>K]+ʕF9v2'%Xg|=t|#+ώEnR´S>#L۶;
(DdnfWYMFe']uSSpةyhrwO+f R)S<hڥZ6q
fVv+0w&